From 85fe26bd809aa623f139ae49e380341b5bf33386 Mon Sep 17 00:00:00 2001 From: zhenghuangkun Date: Wed, 9 Sep 2020 18:55:14 +0900 Subject: [PATCH] Modify NGAP Messages --- common/utils/ocp_itti/intertask_interface.h | 1 + executables/nr-softmodem.c | 29 +- openair2/COMMON/ngap_messages_def.h | 34 +- openair2/COMMON/ngap_messages_types.h | 446 +++---- openair2/GNB_APP/gnb_app.c | 38 +- openair2/GNB_APP/gnb_config.c | 251 ++-- openair2/GNB_APP/gnb_config.h | 2 +- openair2/GNB_APP/gnb_paramdef.h | 68 +- .../MESSAGES/ASN1/ASN1_files/ngap-15.8.0.asn1 | 101 +- openair3/NGAP/ngap_common.h | 4 +- openair3/NGAP/ngap_gNB.c | 285 ++--- openair3/NGAP/ngap_gNB.h | 6 +- .../ngap_gNB_context_management_procedures.c | 38 +- openair3/NGAP/ngap_gNB_decoder.c | 14 +- openair3/NGAP/ngap_gNB_defs.h | 172 ++- openair3/NGAP/ngap_gNB_encoder.c | 14 +- openair3/NGAP/ngap_gNB_handlers.c | 1035 ++++++++++------- openair3/NGAP/ngap_gNB_handlers.h | 2 +- .../NGAP/ngap_gNB_management_procedures.c | 76 +- .../NGAP/ngap_gNB_management_procedures.h | 6 +- openair3/NGAP/ngap_gNB_nas_procedures.c | 1018 ++++++++-------- openair3/NGAP/ngap_gNB_nas_procedures.h | 16 +- openair3/NGAP/ngap_gNB_nnsf.c | 290 ++--- openair3/NGAP/ngap_gNB_nnsf.h | 26 +- openair3/NGAP/ngap_gNB_overload.c | 24 +- openair3/NGAP/ngap_gNB_overload.h | 4 +- openair3/NGAP/ngap_gNB_trace.c | 18 +- openair3/NGAP/ngap_gNB_trace.h | 6 +- openair3/NGAP/ngap_gNB_ue_context.h | 16 +- 29 files changed, 2165 insertions(+), 1875 deletions(-) diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h index 026c8270d7..3b3b3fc118 100644 --- a/common/utils/ocp_itti/intertask_interface.h +++ b/common/utils/ocp_itti/intertask_interface.h @@ -312,6 +312,7 @@ void * rrc_enb_process_msg(void*); TASK_DEF(TASK_RRC_GNB, TASK_PRIORITY_MED, 200, NULL,NULL)\ TASK_DEF(TASK_RAL_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 200, NULL, NULL) \ + TASK_DEF(TASK_NGAP, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_X2AP, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_M2AP_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_M2AP_MCE, TASK_PRIORITY_MED, 200, NULL, NULL) \ diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index a3d0b325d6..ef6d469a91 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -387,30 +387,31 @@ int create_gNB_tasks(uint32_t gnb_nb) { return -1; }*/ if(itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0){ - LOG_E(SCTP, "Create task for SCTP failed\n"); - return -1; + LOG_E(SCTP, "Create task for SCTP failed\n"); + return -1; } if (is_x2ap_enabled()) { - if(itti_create_task(TASK_X2AP, x2ap_task, NULL) < 0){ - LOG_E(X2AP, "Create task for X2AP failed\n"); - } + if(itti_create_task(TASK_X2AP, x2ap_task, NULL) < 0){ + LOG_E(X2AP, "Create task for X2AP failed\n"); + } } else { - LOG_I(X2AP, "X2AP is disabled.\n"); + LOG_I(X2AP, "X2AP is disabled.\n"); } } if (EPC_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==0)) { if (gnb_nb > 0) { - /*if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) { + /* + if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) { LOG_E(SCTP, "Create task for SCTP failed\n"); return -1; } - - if (itti_create_task (TASK_S1AP, s1ap_eNB_task, NULL) < 0) { - LOG_E(S1AP, "Create task for S1AP failed\n"); + */ + 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){ @@ -430,9 +431,9 @@ int create_gNB_tasks(uint32_t gnb_nb) { if (gnb_nb > 0) { if (itti_create_task (TASK_GNB_APP, gNB_app_task, NULL) < 0) { - LOG_E(GNB_APP, "Create task for gNB APP failed\n"); - return -1; - } + LOG_E(GNB_APP, "Create task for gNB APP failed\n"); + return -1; + } LOG_I(NR_RRC,"Creating NR RRC gNB Task\n"); if (itti_create_task (TASK_RRC_GNB, rrc_gnb_task, NULL) < 0) { diff --git a/openair2/COMMON/ngap_messages_def.h b/openair2/COMMON/ngap_messages_def.h index 0bd9b7920e..9cdf2bc9e7 100644 --- a/openair2/COMMON/ngap_messages_def.h +++ b/openair2/COMMON/ngap_messages_def.h @@ -31,23 +31,23 @@ MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_REQ_LOG, MESSAGE_PRIORITY_MED, IttiMsgText MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMMAND_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_context_release_command_log) MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMPLETE_LOG, MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_context_release_complete_log) MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_ue_context_release_log) -MESSAGE_DEF(NGAP_E_RAB_SETUP_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_e_rab_setup_request_log) -MESSAGE_DEF(NGAP_E_RAB_SETUP_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_e_rab_setup_response_log) -MESSAGE_DEF(NGAP_E_RAB_MODIFY_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_e_rab_modify_request_log) -MESSAGE_DEF(NGAP_E_RAB_MODIFY_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_e_rab_modify_response_log) +MESSAGE_DEF(NGAP_PDUSESSION_SETUP_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_setup_request_log) +MESSAGE_DEF(NGAP_PDUSESSION_SETUP_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_setup_response_log) +MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_modify_request_log) +MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_modify_response_log) MESSAGE_DEF(NGAP_PAGING_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_paging_log) -MESSAGE_DEF(NGAP_E_RAB_RELEASE_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_e_rab_release_request_log) -MESSAGE_DEF(NGAP_E_RAB_RELEASE_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_e_rab_release_response_log) +MESSAGE_DEF(NGAP_PDUSESSION_RELEASE_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_release_request_log) +MESSAGE_DEF(NGAP_PDUSESSION_RELEASE_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_release_response_log) MESSAGE_DEF(NGAP_ERROR_INDICATION_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_error_indication_log) MESSAGE_DEF(NGAP_PATH_SWITCH_REQ_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_path_switch_req_log) MESSAGE_DEF(NGAP_PATH_SWITCH_REQ_ACK_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_path_switch_req_ack_log) /* gNB application layer -> NGAP messages */ -MESSAGE_DEF(NGAP_REGISTER_GNB_REQ , MESSAGE_PRIORITY_MED, ngap_register_enb_req_t , ngap_register_enb_req) +MESSAGE_DEF(NGAP_REGISTER_GNB_REQ , MESSAGE_PRIORITY_MED, ngap_register_gnb_req_t , ngap_register_gnb_req) /* NGAP -> gNB application layer messages */ -MESSAGE_DEF(NGAP_REGISTER_GNB_CNF , MESSAGE_PRIORITY_MED, ngap_register_enb_cnf_t , ngap_register_enb_cnf) -MESSAGE_DEF(NGAP_DEREGISTERED_GNB_IND , MESSAGE_PRIORITY_MED, ngap_deregistered_enb_ind_t , ngap_deregistered_enb_ind) +MESSAGE_DEF(NGAP_REGISTER_GNB_CNF , MESSAGE_PRIORITY_MED, ngap_register_gnb_cnf_t , ngap_register_gnb_cnf) +MESSAGE_DEF(NGAP_DEREGISTERED_GNB_IND , MESSAGE_PRIORITY_MED, ngap_deregistered_gnb_ind_t , ngap_deregistered_gnb_ind) /* RRC -> NGAP messages */ MESSAGE_DEF(NGAP_NAS_FIRST_REQ , MESSAGE_PRIORITY_MED, ngap_nas_first_req_t , ngap_nas_first_req) @@ -60,22 +60,22 @@ MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_RESP , MESSAGE_PRIORITY_MED, ngap_ue_relea MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMPLETE, MESSAGE_PRIORITY_MED, ngap_ue_release_complete_t , ngap_ue_release_complete) MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_RESP , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_resp_t , ngap_ue_ctxt_modification_resp) MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_FAIL , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_fail_t , ngap_ue_ctxt_modification_fail) -MESSAGE_DEF(NGAP_E_RAB_SETUP_RESP , MESSAGE_PRIORITY_MED, ngap_e_rab_setup_resp_t , ngap_e_rab_setup_resp) -MESSAGE_DEF(NGAP_E_RAB_SETUP_REQUEST_FAIL , MESSAGE_PRIORITY_MED, ngap_e_rab_setup_req_fail_t , ngap_e_rab_setup_request_fail) -MESSAGE_DEF(NGAP_E_RAB_MODIFY_RESP , MESSAGE_PRIORITY_MED, ngap_e_rab_modify_resp_t , ngap_e_rab_modify_resp) -MESSAGE_DEF(NGAP_E_RAB_RELEASE_RESPONSE , MESSAGE_PRIORITY_MED, ngap_e_rab_release_resp_t , ngap_e_rab_release_resp) +MESSAGE_DEF(NGAP_PDUSESSION_SETUP_RESP , MESSAGE_PRIORITY_MED, ngap_pdusession_setup_resp_t , ngap_pdusession_setup_resp) +MESSAGE_DEF(NGAP_PDUSESSION_SETUP_REQUEST_FAIL , MESSAGE_PRIORITY_MED, ngap_pdusession_setup_req_fail_t , ngap_pdusession_setup_request_fail) +MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_RESP , MESSAGE_PRIORITY_MED, ngap_pdusession_modify_resp_t , ngap_pdusession_modify_resp) +MESSAGE_DEF(NGAP_PDUSESSION_RELEASE_RESPONSE , MESSAGE_PRIORITY_MED, ngap_pdusession_release_resp_t , ngap_pdusession_release_resp) MESSAGE_DEF(NGAP_PATH_SWITCH_REQ , MESSAGE_PRIORITY_MED, ngap_path_switch_req_t , ngap_path_switch_req) MESSAGE_DEF(NGAP_PATH_SWITCH_REQ_ACK , MESSAGE_PRIORITY_MED, ngap_path_switch_req_ack_t , ngap_path_switch_req_ack) -MESSAGE_DEF(NGAP_E_RAB_MODIFICATION_IND , MESSAGE_PRIORITY_MED, ngap_e_rab_modification_ind_t , ngap_e_rab_modification_ind) +MESSAGE_DEF(NGAP_PDUSESSION_MODIFICATION_IND , MESSAGE_PRIORITY_MED, ngap_pdusession_modification_ind_t , ngap_pdusession_modification_ind) /* NGAP -> RRC messages */ MESSAGE_DEF(NGAP_DOWNLINK_NAS , MESSAGE_PRIORITY_MED, ngap_downlink_nas_t , ngap_downlink_nas ) MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, ngap_initial_context_setup_req_t , ngap_initial_context_setup_req ) MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_REQ , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_req_t , ngap_ue_ctxt_modification_req) MESSAGE_DEF(NGAP_PAGING_IND , MESSAGE_PRIORITY_MED, ngap_paging_ind_t , ngap_paging_ind ) -MESSAGE_DEF(NGAP_E_RAB_SETUP_REQ , MESSAGE_PRIORITY_MED, ngap_e_rab_setup_req_t , ngap_e_rab_setup_req ) -MESSAGE_DEF(NGAP_E_RAB_MODIFY_REQ , MESSAGE_PRIORITY_MED, ngap_e_rab_modify_req_t , ngap_e_rab_modify_req ) -MESSAGE_DEF(NGAP_E_RAB_RELEASE_COMMAND , MESSAGE_PRIORITY_MED, ngap_e_rab_release_command_t , ngap_e_rab_release_command) +MESSAGE_DEF(NGAP_PDUSESSION_SETUP_REQ , MESSAGE_PRIORITY_MED, ngap_pdusession_setup_req_t , ngap_pdusession_setup_req ) +MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_REQ , MESSAGE_PRIORITY_MED, ngap_pdusession_modify_req_t , ngap_pdusession_modify_req ) +MESSAGE_DEF(NGAP_PDUSESSION_RELEASE_COMMAND , MESSAGE_PRIORITY_MED, ngap_pdusession_release_command_t , ngap_pdusession_release_command) MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMMAND, MESSAGE_PRIORITY_MED, ngap_ue_release_command_t , ngap_ue_release_command) /* NGAP <-> RRC messages (can be initiated either by MME or gNB) */ diff --git a/openair2/COMMON/ngap_messages_types.h b/openair2/COMMON/ngap_messages_types.h index 64397c9a52..1e067ba4ef 100644 --- a/openair2/COMMON/ngap_messages_types.h +++ b/openair2/COMMON/ngap_messages_types.h @@ -26,10 +26,10 @@ //-------------------------------------------------------------------------------------------// // Defines to access message fields. -#define NGAP_REGISTER_GNB_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_register_enb_req +#define NGAP_REGISTER_GNB_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_register_gnb_req -#define NGAP_REGISTER_GNB_CNF(mSGpTR) (mSGpTR)->ittiMsg.ngap_register_enb_cnf -#define NGAP_DEREGISTERED_GNB_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_deregistered_enb_ind +#define NGAP_REGISTER_GNB_CNF(mSGpTR) (mSGpTR)->ittiMsg.ngap_register_gnb_cnf +#define NGAP_DEREGISTERED_GNB_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_deregistered_gnb_ind #define NGAP_NAS_FIRST_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_nas_first_req #define NGAP_UPLINK_NAS(mSGpTR) (mSGpTR)->ittiMsg.ngap_uplink_nas @@ -40,48 +40,50 @@ #define NGAP_NAS_NON_DELIVERY_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_nas_non_delivery_ind #define NGAP_UE_CTXT_MODIFICATION_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_ctxt_modification_resp #define NGAP_UE_CTXT_MODIFICATION_FAIL(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_ctxt_modification_fail -#define NGAP_E_RAB_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_e_rab_setup_resp -#define NGAP_E_RAB_SETUP_FAIL(mSGpTR) (mSGpTR)->ittiMsg.ngap_e_rab_setup_req_fail -#define NGAP_E_RAB_MODIFY_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_e_rab_modify_resp +#define NGAP_PDUSESSION_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_setup_resp +#define NGAP_PDUSESSION_SETUP_FAIL(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_setup_req_fail +#define NGAP_PDUSESSION_MODIFY_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_modify_resp #define NGAP_PATH_SWITCH_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_path_switch_req #define NGAP_PATH_SWITCH_REQ_ACK(mSGpTR) (mSGpTR)->ittiMsg.ngap_path_switch_req_ack -#define NGAP_E_RAB_MODIFICATION_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_e_rab_modification_ind +#define NGAP_PDUSESSION_MODIFICATION_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_modification_ind #define NGAP_DOWNLINK_NAS(mSGpTR) (mSGpTR)->ittiMsg.ngap_downlink_nas #define NGAP_INITIAL_CONTEXT_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_initial_context_setup_req #define NGAP_UE_CTXT_MODIFICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_ctxt_modification_req #define NGAP_UE_CONTEXT_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_command #define NGAP_UE_CONTEXT_RELEASE_COMPLETE(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_complete -#define NGAP_E_RAB_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_e_rab_setup_req -#define NGAP_E_RAB_MODIFY_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_e_rab_modify_req +#define NGAP_PDUSESSION_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_setup_req +#define NGAP_PDUSESSION_MODIFY_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_modify_req #define NGAP_PAGING_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_paging_ind #define NGAP_UE_CONTEXT_RELEASE_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_req -#define NGAP_E_RAB_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.ngap_e_rab_release_command -#define NGAP_E_RAB_RELEASE_RESPONSE(mSGpTR) (mSGpTR)->ittiMsg.ngap_e_rab_release_resp +#define NGAP_PDUSESSION_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_release_command +#define NGAP_PDUSESSION_RELEASE_RESPONSE(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_release_resp //-------------------------------------------------------------------------------------------// /* Maximum number of e-rabs to be setup/deleted in a single message. * Even if only one bearer will be modified by message. */ -#define NGAP_MAX_E_RAB (LTE_maxDRB + 3) +#define NGAP_MAX_PDUSESSION (LTE_maxDRB + 3) /* Length of the transport layer address string * 160 bits / 8 bits by char. */ #define NGAP_TRANSPORT_LAYER_ADDRESS_SIZE (160 / 8) -#define NGAP_MAX_NB_MME_IP_ADDRESS 10 +#define NGAP_MAX_NB_AMF_IP_ADDRESS 10 #define NGAP_IMSI_LENGTH 16 +#define QOSFLOW_MAX_VALUE 64; + /* Security key length used within gNB * Even if only 16 bytes will be effectively used, * the key length is 32 bytes (256 bits) */ #define SECURITY_KEY_LENGTH 32 typedef enum cell_type_e { - CELL_MACRO_GNB, - CELL_HOME_GNB, + CELL_MACRO_ENB, + CELL_HOME_ENB, CELL_MACRO_GNB } cell_type_t; @@ -150,14 +152,16 @@ typedef struct allocation_retention_priority_s { pre_emp_vulnerability_t pre_emp_vulnerability; } allocation_retention_priority_t; -typedef struct security_capabilities_s { - uint16_t encryption_algorithms; - uint16_t integrity_algorithms; -} security_capabilities_t; +typedef struct nr_security_capabilities_s { + uint16_t nRencryption_algorithms; + uint16_t nRintegrity_algorithms; + uint16_t eUTRAencryption_algorithms; + uint16_t eUTRAintegrity_algorithms; +} nr_security_capabilities_t; /* Provides the establishment cause for the RRC connection request as provided * by the upper layers. W.r.t. the cause value names: highPriorityAccess - * concerns AC11..AC15, ‘mt’ stands for ‘Mobile Terminating’ and ‘mo’ for + * concerns AC11..AC15, ‘mt Estands for ‘Mobile Terminating Eand ‘mo Efor * 'Mobile Originating'. Defined in TS 36.331. */ typedef enum rrc_establishment_cause_e { @@ -172,13 +176,21 @@ typedef enum rrc_establishment_cause_e { RRC_CAUSE_LAST } rrc_establishment_cause_t; -typedef struct ngap_gummei_s { +typedef struct ngap_guami_s { uint16_t mcc; uint16_t mnc; uint8_t mnc_len; - uint8_t mme_code; - uint16_t mme_group_id; -} ngap_gummei_t; + uint8_t amf_region_id; + uint16_t amf_set_id; + uint8_t amf_pointer; +} ngap_guami_t; + +typedef struct ngap_allowed_NSSAI_s{ + uint8_t sST; + uint8_t sD_flag; + uint8_t sD[3]; +}ngap_allowed_NSSAI_t; + typedef struct ngap_imsi_s { uint8_t buffer[NGAP_IMSI_LENGTH]; @@ -186,7 +198,7 @@ typedef struct ngap_imsi_s { } ngap_imsi_t; typedef struct s_tmsi_s { - uint8_t mme_code; + uint8_t amf_code; uint32_t m_tmsi; } s_tmsi_t; @@ -207,14 +219,14 @@ typedef struct ue_paging_identity_s { typedef enum ue_identities_presenceMask_e { UE_IDENTITIES_NONE = 0, UE_IDENTITIES_s_tmsi = 1 << 1, - UE_IDENTITIES_gummei = 1 << 2, + UE_IDENTITIES_guami = 1 << 2, } ue_identities_presenceMask_t; -typedef struct ue_identity_s { +typedef struct nrue_identity_s { ue_identities_presenceMask_t presenceMask; s_tmsi_t s_tmsi; - ngap_gummei_t gummei; -} ue_identity_t; + ngap_guami_t guami; +} nrue_identity_t; typedef struct nas_pdu_s { /* Octet string data */ @@ -223,12 +235,21 @@ typedef struct nas_pdu_s { uint32_t length; } nas_pdu_t, ue_radio_cap_t; +typedef enum pdu_session_type_e { + PDUSessionType_ipv4 = 0, + PDUSessionType_ipv6 = 1, + PDUSessionType_ipv4v6 = 2, + PDUSessionType_ethernet = 3, + PDUSessionType_unstructured = 4 +}pdu_session_type_t; + typedef struct transport_layer_addr_s { /* Length of the transport layer address buffer in bits. NGAP layer received a * bit string<1..160> containing one of the following addresses: ipv4, * ipv6, or ipv4 and ipv6. The layer doesn't interpret the buffer but - * silently forward it to S1-U. + * silently forward it to NG-U. */ + uint8_t pdu_session_type; uint8_t length; uint8_t buffer[20]; // in network byte order } transport_layer_addr_t; @@ -240,53 +261,55 @@ typedef struct transport_layer_addr_s { dEST.length = sOURCE.length; \ } while (0) -typedef struct e_rab_level_qos_parameter_s { +typedef struct pdusession_level_qos_parameter_s { uint8_t qci; allocation_retention_priority_t allocation_retention_priority; -} e_rab_level_qos_parameter_t; +} pdusession_level_qos_parameter_t; -typedef struct e_rab_s { - /* Unique e_rab_id for the UE. */ - uint8_t e_rab_id; - /* Quality of service for this e_rab */ - e_rab_level_qos_parameter_t qos; +typedef struct pdusession_s { + /* Unique pdusession_id for the UE. */ + uint8_t pdusession_id; + + uint8_t nb_qos; + /* Quality of service for this pdusession */ + pdusession_level_qos_parameter_t qos[QOSFLOW_MAX_VALUE]; /* The NAS PDU should be forwarded by the RRC layer to the NAS layer */ nas_pdu_t nas_pdu; /* The transport layer address for the IP packets */ - transport_layer_addr_t sgw_addr; + transport_layer_addr_t upf_addr; /* S-GW Tunnel endpoint identifier */ uint32_t gtp_teid; -} e_rab_t; +} pdusession_t; -typedef struct e_rab_setup_s { - /* Unique e_rab_id for the UE. */ - uint8_t e_rab_id; +typedef struct pdusession_setup_s { + /* Unique pdusession_id for the UE. */ + uint8_t pdusession_id; /* The transport layer address for the IP packets */ transport_layer_addr_t gNB_addr; /* S-GW Tunnel endpoint identifier */ uint32_t gtp_teid; -} e_rab_setup_t; +} pdusession_setup_t; -typedef struct e_rab_tobe_added_s { - /* Unique e_rab_id for the UE. */ - uint8_t e_rab_id; +typedef struct pdusession_tobe_added_s { + /* Unique pdusession_id for the UE. */ + uint8_t pdusession_id; /* Unique drb_ID for the UE. */ uint8_t drb_ID; /* The transport layer address for the IP packets */ - transport_layer_addr_t sgw_addr; + transport_layer_addr_t upf_addr; /* S-GW Tunnel endpoint identifier */ uint32_t gtp_teid; -} e_rab_tobe_added_t; +} pdusession_tobe_added_t; -typedef struct e_rab_admitted_tobe_added_s { - /* Unique e_rab_id for the UE. */ - uint8_t e_rab_id; +typedef struct pdusession_admitted_tobe_added_s { + /* Unique pdusession_id for the UE. */ + uint8_t pdusession_id; /* Unique drb_ID for the UE. */ uint8_t drb_ID; @@ -296,25 +319,25 @@ typedef struct e_rab_admitted_tobe_added_s { /* S-GW Tunnel endpoint identifier */ uint32_t gtp_teid; -} e_rab_admitted_tobe_added_t; +} pdusession_admitted_tobe_added_t; -typedef struct e_rab_tobeswitched_s { - /* Unique e_rab_id for the UE. */ - uint8_t e_rab_id; +typedef struct pdusession_tobeswitched_s { + /* Unique pdusession_id for the UE. */ + uint8_t pdusession_id; /* The transport layer address for the IP packets */ - transport_layer_addr_t sgw_addr; + transport_layer_addr_t upf_addr; /* S-GW Tunnel endpoint identifier */ uint32_t gtp_teid; -} e_rab_tobeswitched_t; +} pdusession_tobeswitched_t; -typedef struct e_rab_modify_s { - /* Unique e_rab_id for the UE. */ - uint8_t e_rab_id; -} e_rab_modify_t; +typedef struct pdusession_modify_s { + /* Unique pdusession_id for the UE. */ + uint8_t pdusession_id; +} pdusession_modify_t; typedef enum S1ap_Cause_e { NGAP_CAUSE_NOTHING, /* No components present */ @@ -327,14 +350,14 @@ typedef enum S1ap_Cause_e { } ngap_Cause_t; -typedef struct e_rab_failed_s { - /* Unique e_rab_id for the UE. */ - uint8_t e_rab_id; +typedef struct pdusession_failed_s { + /* Unique pdusession_id for the UE. */ + uint8_t pdusession_id; /* Cause of the failure */ // cause_t cause; ngap_Cause_t cause; uint8_t cause_value; -} e_rab_failed_t; +} pdusession_failed_t; typedef enum ngap_ue_ctxt_modification_present_s { NGAP_UE_CONTEXT_MODIFICATION_SECURITY_KEY = (1 << 0), @@ -349,7 +372,7 @@ typedef enum ngap_paging_ind_present_s { //-------------------------------------------------------------------------------------------// // gNB application layer -> NGAP messages -typedef struct ngap_register_enb_req_s { +typedef struct ngap_register_gnb_req_s { /* Unique gNB_id to identify the gNB within EPC. * For macro gNB ids this field should be 20 bits long. * For home gNB ids this field should be 28 bits long. @@ -380,38 +403,38 @@ typedef struct ngap_register_enb_req_s { paging_drx_t default_drx; /* The gNB IP address to bind */ - net_ip_address_t enb_ip_address; + net_ip_address_t gnb_ip_address; - /* Nb of MME to connect to */ - uint8_t nb_mme; - /* List of MME to connect to */ - net_ip_address_t mme_ip_address[NGAP_MAX_NB_MME_IP_ADDRESS]; - uint8_t broadcast_plmn_num[NGAP_MAX_NB_MME_IP_ADDRESS]; - uint8_t broadcast_plmn_index[NGAP_MAX_NB_MME_IP_ADDRESS][PLMN_LIST_MAX_SIZE]; + /* Nb of AMF to connect to */ + uint8_t nb_amf; + /* List of AMF to connect to */ + net_ip_address_t amf_ip_address[NGAP_MAX_NB_AMF_IP_ADDRESS]; + uint8_t broadcast_plmn_num[NGAP_MAX_NB_AMF_IP_ADDRESS]; + uint8_t broadcast_plmn_index[NGAP_MAX_NB_AMF_IP_ADDRESS][PLMN_LIST_MAX_SIZE]; - /* Number of SCTP streams used for a mme association */ + /* Number of SCTP streams used for a amf association */ uint16_t sctp_in_streams; uint16_t sctp_out_streams; -} ngap_register_enb_req_t; +} ngap_register_gnb_req_t; //-------------------------------------------------------------------------------------------// // NGAP -> gNB application layer messages -typedef struct ngap_register_enb_cnf_s { - /* Nb of MME connected */ - uint8_t nb_mme; -} ngap_register_enb_cnf_t; +typedef struct ngap_register_gnb_cnf_s { + /* Nb of AMF connected */ + uint8_t nb_amf; +} ngap_register_gnb_cnf_t; -typedef struct ngap_deregistered_enb_ind_s { - /* Nb of MME connected */ - uint8_t nb_mme; -} ngap_deregistered_enb_ind_t; +typedef struct ngap_deregistered_gnb_ind_s { + /* Nb of AMF connected */ + uint8_t nb_amf; +} ngap_deregistered_gnb_ind_t; //-------------------------------------------------------------------------------------------// // RRC -> NGAP messages /* The NAS First Req is the first message exchanged between RRC and NGAP * for an UE. - * The rnti uniquely identifies an UE within a cell. Later the enb_ue_ngap_id + * The rnti uniquely identifies an UE within a cell. Later the gnb_ue_ngap_id * will be the unique identifier used between RRC and NGAP. */ typedef struct ngap_nas_first_req_s { @@ -428,53 +451,53 @@ typedef struct ngap_nas_first_req_s { /* NAS PDU */ nas_pdu_t nas_pdu; - /* If this flag is set NGAP layer is expecting the GUMMEI. If = 0, + /* If this flag is set NGAP layer is expecting the GUAMI. If = 0, * the temporary s-tmsi is used. */ - ue_identity_t ue_identity; + nrue_identity_t ue_identity; } ngap_nas_first_req_t; typedef struct ngap_uplink_nas_s { /* Unique UE identifier within an gNB */ - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; /* NAS pdu */ nas_pdu_t nas_pdu; } ngap_uplink_nas_t; typedef struct ngap_ue_cap_info_ind_s { - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; ue_radio_cap_t ue_radio_cap; } ngap_ue_cap_info_ind_t; typedef struct ngap_initial_context_setup_resp_s { - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; - /* Number of e_rab setup-ed in the list */ - uint8_t nb_of_e_rabs; - /* list of e_rab setup-ed by RRC layers */ - e_rab_setup_t e_rabs[NGAP_MAX_E_RAB]; + /* Number of pdusession setup-ed in the list */ + uint8_t nb_of_pdusessions; + /* list of pdusession setup-ed by RRC layers */ + pdusession_setup_t pdusessions[NGAP_MAX_PDUSESSION]; - /* Number of e_rab failed to be setup in list */ - uint8_t nb_of_e_rabs_failed; - /* list of e_rabs that failed to be setup */ - e_rab_failed_t e_rabs_failed[NGAP_MAX_E_RAB]; + /* Number of pdusession failed to be setup in list */ + uint8_t nb_of_pdusessions_failed; + /* list of pdusessions that failed to be setup */ + pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION]; } ngap_initial_context_setup_resp_t; typedef struct ngap_initial_context_setup_fail_s { - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; /* TODO add cause */ -} ngap_initial_context_setup_fail_t, ngap_ue_ctxt_modification_fail_t, ngap_e_rab_setup_req_fail_t; +} ngap_initial_context_setup_fail_t, ngap_ue_ctxt_modification_fail_t, ngap_pdusession_setup_req_fail_t; typedef struct ngap_nas_non_delivery_ind_s { - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; nas_pdu_t nas_pdu; /* TODO: add cause */ } ngap_nas_non_delivery_ind_t; typedef struct ngap_ue_ctxt_modification_req_s { - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; /* Bit-mask of possible present parameters */ ngap_ue_ctxt_modification_present_t present; @@ -487,17 +510,17 @@ typedef struct ngap_ue_ctxt_modification_req_s { /* UE aggregate maximum bitrate */ ambr_t ue_ambr; - /* Security capabilities */ - security_capabilities_t security_capabilities; + /* NR Security capabilities */ + nr_security_capabilities_t security_capabilities; } ngap_ue_ctxt_modification_req_t; typedef struct ngap_ue_ctxt_modification_resp_s { - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; } ngap_ue_ctxt_modification_resp_t; typedef struct ngap_ue_release_complete_s { - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; } ngap_ue_release_complete_t; @@ -508,7 +531,7 @@ typedef struct ngap_downlink_nas_s { uint16_t ue_initial_id; /* Unique UE identifier within an gNB */ - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; /* NAS pdu */ nas_pdu_t nas_pdu; @@ -520,23 +543,30 @@ typedef struct ngap_initial_context_setup_req_s { uint16_t ue_initial_id; /* gNB ue ngap id as initialized by NGAP layer */ - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; - uint32_t mme_ue_ngap_id; + unsigned long long amf_ue_ngap_id:40; /* UE aggregate maximum bitrate */ ambr_t ue_ambr; + /* guami */ + ngap_guami_t guami; + + /* allowed nssai */ + uint8_t nb_allowed_nssais; + ngap_allowed_NSSAI_t allowed_nssai[8]; + /* Security algorithms */ - security_capabilities_t security_capabilities; + nr_security_capabilities_t security_capabilities; /* Security key */ uint8_t security_key[SECURITY_KEY_LENGTH]; - /* Number of e_rab to be setup in the list */ - uint8_t nb_of_e_rabs; - /* list of e_rab to be setup by RRC layers */ - e_rab_t e_rab_param[NGAP_MAX_E_RAB]; + /* Number of pdusession to be setup in the list */ + uint8_t nb_of_pdusessions; + /* list of pdusession to be setup by RRC layers */ + pdusession_t pdusession_param[NGAP_MAX_PDUSESSION]; } ngap_initial_context_setup_req_t; typedef struct tai_plmn_identity_s { @@ -572,57 +602,57 @@ typedef struct ngap_paging_ind_s { paging_priority_t paging_priority; } ngap_paging_ind_t; -typedef struct ngap_e_rab_setup_req_s { +typedef struct ngap_pdusession_setup_req_s { /* UE id for initial connection to NGAP */ uint16_t ue_initial_id; - /* MME UE id */ - uint32_t mme_ue_ngap_id; + /* AMF UE id */ + unsigned long long amf_ue_ngap_id:40; /* gNB ue ngap id as initialized by NGAP layer */ - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; - /* Number of e_rab to be setup in the list */ - uint8_t nb_e_rabs_tosetup; + /* Number of pdusession to be setup in the list */ + uint8_t nb_pdusessions_tosetup; /* E RAB setup request */ - e_rab_t e_rab_setup_params[NGAP_MAX_E_RAB]; + pdusession_t pdusession_setup_params[NGAP_MAX_PDUSESSION]; -} ngap_e_rab_setup_req_t; +} ngap_pdusession_setup_req_t; -typedef struct ngap_e_rab_setup_resp_s { +typedef struct ngap_pdusession_setup_resp_s { unsigned gNB_ue_ngap_id:24; - /* Number of e_rab setup-ed in the list */ - uint8_t nb_of_e_rabs; - /* list of e_rab setup-ed by RRC layers */ - e_rab_setup_t e_rabs[NGAP_MAX_E_RAB]; + /* Number of pdusession setup-ed in the list */ + uint8_t nb_of_pdusessions; + /* list of pdusession setup-ed by RRC layers */ + pdusession_setup_t pdusessions[NGAP_MAX_PDUSESSION]; - /* Number of e_rab failed to be setup in list */ - uint8_t nb_of_e_rabs_failed; - /* list of e_rabs that failed to be setup */ - e_rab_failed_t e_rabs_failed[NGAP_MAX_E_RAB]; -} ngap_e_rab_setup_resp_t; + /* Number of pdusession failed to be setup in list */ + uint8_t nb_of_pdusessions_failed; + /* list of pdusessions that failed to be setup */ + pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION]; +} ngap_pdusession_setup_resp_t; typedef struct ngap_path_switch_req_s { - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; - /* Number of e_rab setup-ed in the list */ - uint8_t nb_of_e_rabs; + /* Number of pdusession setup-ed in the list */ + uint8_t nb_of_pdusessions; - /* list of e_rab setup-ed by RRC layers */ - e_rab_setup_t e_rabs_tobeswitched[NGAP_MAX_E_RAB]; + /* list of pdusession setup-ed by RRC layers */ + pdusession_setup_t pdusessions_tobeswitched[NGAP_MAX_PDUSESSION]; - /* MME UE id */ - uint32_t mme_ue_ngap_id; + /* AMF UE id */ + unsigned long long amf_ue_ngap_id:40; - ngap_gummei_t ue_gummei; + ngap_guami_t ue_guami; uint16_t ue_initial_id; /* Security algorithms */ - security_capabilities_t security_capabilities; + nr_security_capabilities_t security_capabilities; } ngap_path_switch_req_t; @@ -631,25 +661,25 @@ typedef struct ngap_path_switch_req_ack_s { /* UE id for initial connection to NGAP */ uint16_t ue_initial_id; - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; - /* MME UE id */ - uint32_t mme_ue_ngap_id; + /* AMF UE id */ + unsigned long long amf_ue_ngap_id:40; /* UE aggregate maximum bitrate */ ambr_t ue_ambr; - /* Number of e_rab setup-ed in the list */ - uint8_t nb_e_rabs_tobeswitched; + /* Number of pdusession setup-ed in the list */ + uint8_t nb_pdusessions_tobeswitched; - /* list of e_rab to be switched by RRC layers */ - e_rab_tobeswitched_t e_rabs_tobeswitched[NGAP_MAX_E_RAB]; + /* list of pdusession to be switched by RRC layers */ + pdusession_tobeswitched_t pdusessions_tobeswitched[NGAP_MAX_PDUSESSION]; - /* Number of e_rabs to be released by RRC */ - uint8_t nb_e_rabs_tobereleased; + /* Number of pdusessions to be released by RRC */ + uint8_t nb_pdusessions_tobereleased; - /* list of e_rabs to be released */ - e_rab_failed_t e_rabs_tobereleased[NGAP_MAX_E_RAB]; + /* list of pdusessions to be released */ + pdusession_failed_t pdusessions_tobereleased[NGAP_MAX_PDUSESSION]; /* Security key */ int next_hop_chain_count; @@ -657,31 +687,31 @@ typedef struct ngap_path_switch_req_ack_s { } ngap_path_switch_req_ack_t; -typedef struct ngap_e_rab_modification_ind_s { +typedef struct ngap_pdusession_modification_ind_s { - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; - /* MME UE id */ - uint32_t mme_ue_ngap_id; + /* AMF UE id */ + unsigned long long amf_ue_ngap_id:40; - /* Number of e_rab setup-ed in the list */ - uint8_t nb_of_e_rabs_tobemodified; + /* Number of pdusession setup-ed in the list */ + uint8_t nb_of_pdusessions_tobemodified; - uint8_t nb_of_e_rabs_nottobemodified; + uint8_t nb_of_pdusessions_nottobemodified; - /* list of e_rab setup-ed by RRC layers */ - e_rab_setup_t e_rabs_tobemodified[NGAP_MAX_E_RAB]; + /* list of pdusession setup-ed by RRC layers */ + pdusession_setup_t pdusessions_tobemodified[NGAP_MAX_PDUSESSION]; - e_rab_setup_t e_rabs_nottobemodified[NGAP_MAX_E_RAB]; + pdusession_setup_t pdusessions_nottobemodified[NGAP_MAX_PDUSESSION]; uint16_t ue_initial_id; -} ngap_e_rab_modification_ind_t; +} ngap_pdusession_modification_ind_t; // NGAP --> RRC messages typedef struct ngap_ue_release_command_s { - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; } ngap_ue_release_command_t; @@ -689,83 +719,83 @@ typedef struct ngap_ue_release_command_s { //-------------------------------------------------------------------------------------------// // NGAP <-- RRC messages typedef struct ngap_ue_release_req_s { - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; ngap_Cause_t cause; long cause_value; } ngap_ue_release_req_t, ngap_ue_release_resp_t; -typedef struct ngap_e_rab_modify_req_s { +typedef struct ngap_pdusession_modify_req_s { /* UE id for initial connection to NGAP */ uint16_t ue_initial_id; - /* MME UE id */ - uint32_t mme_ue_ngap_id; + /* AMF UE id */ + unsigned long long amf_ue_ngap_id:40; /* gNB ue ngap id as initialized by NGAP layer */ - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; - /* Number of e_rab to be modify in the list */ - uint8_t nb_e_rabs_tomodify; + /* Number of pdusession to be modify in the list */ + uint8_t nb_pdusessions_tomodify; /* E RAB modify request */ - e_rab_t e_rab_modify_params[NGAP_MAX_E_RAB]; -} ngap_e_rab_modify_req_t; + pdusession_t pdusession_modify_params[NGAP_MAX_PDUSESSION]; +} ngap_pdusession_modify_req_t; -typedef struct ngap_e_rab_modify_resp_s { - unsigned gNB_ue_ngap_id:24; +typedef struct ngap_pdusession_modify_resp_s { + uint32_t gNB_ue_ngap_id; - /* Number of e_rab modify-ed in the list */ - uint8_t nb_of_e_rabs; - /* list of e_rab modify-ed by RRC layers */ - e_rab_modify_t e_rabs[NGAP_MAX_E_RAB]; + /* Number of pdusession modify-ed in the list */ + uint8_t nb_of_pdusessions; + /* list of pdusession modify-ed by RRC layers */ + pdusession_modify_t pdusessions[NGAP_MAX_PDUSESSION]; - /* Number of e_rab failed to be modify in list */ - uint8_t nb_of_e_rabs_failed; - /* list of e_rabs that failed to be modify */ - e_rab_failed_t e_rabs_failed[NGAP_MAX_E_RAB]; -} ngap_e_rab_modify_resp_t; + /* Number of pdusession failed to be modify in list */ + uint8_t nb_of_pdusessions_failed; + /* list of pdusessions that failed to be modify */ + pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION]; +} ngap_pdusession_modify_resp_t; -typedef struct e_rab_release_s { - /* Unique e_rab_id for the UE. */ - uint8_t e_rab_id; -} e_rab_release_t; +typedef struct pdusession_release_s { + /* Unique pdusession_id for the UE. */ + uint8_t pdusession_id; +} pdusession_release_t; -typedef struct ngap_e_rab_release_command_s { - /* MME UE id */ - uint32_t mme_ue_ngap_id; +typedef struct ngap_pdusession_release_command_s { + /* AMF UE id */ + unsigned long long amf_ue_ngap_id:40; /* gNB ue ngap id as initialized by NGAP layer */ - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; /* The NAS PDU should be forwarded by the RRC layer to the NAS layer */ nas_pdu_t nas_pdu; - /* Number of e_rab to be released in the list */ - uint8_t nb_e_rabs_torelease; + /* Number of pdusession to be released in the list */ + uint8_t nb_pdusessions_torelease; /* E RAB release command */ - e_rab_release_t e_rab_release_params[NGAP_MAX_E_RAB]; + pdusession_release_t pdusession_release_params[NGAP_MAX_PDUSESSION]; -} ngap_e_rab_release_command_t; +} ngap_pdusession_release_command_t; -typedef struct ngap_e_rab_release_resp_s { - /* MME UE id */ - uint32_t mme_ue_ngap_id; +typedef struct ngap_pdusession_release_resp_s { + /* AMF UE id */ + unsigned long long amf_ue_ngap_id:40; /* gNB ue ngap id as initialized by NGAP layer */ - unsigned gNB_ue_ngap_id:24; + uint32_t gNB_ue_ngap_id; - /* Number of e_rab released in the list */ - uint8_t nb_of_e_rabs_released; + /* Number of pdusession released in the list */ + uint8_t nb_of_pdusessions_released; - /* list of e_rabs released */ - e_rab_release_t e_rab_release[NGAP_MAX_E_RAB]; + /* list of pdusessions released */ + pdusession_release_t pdusession_release[NGAP_MAX_PDUSESSION]; - /* Number of e_rab failed to be released in list */ - uint8_t nb_of_e_rabs_failed; - /* list of e_rabs that failed to be released */ - e_rab_failed_t e_rabs_failed[NGAP_MAX_E_RAB]; + /* Number of pdusession failed to be released in list */ + uint8_t nb_of_pdusessions_failed; + /* list of pdusessions that failed to be released */ + pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION]; -} ngap_e_rab_release_resp_t; +} ngap_pdusession_release_resp_t; #endif /* NGAP_MESSAGES_TYPES_H_ */ diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 9bdd709262..8bb585f3ee 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -75,26 +75,26 @@ static void configure_nr_rrc(uint32_t gnb_id) static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, const Enb_properties_array_t *enb_properties) { uint32_t gnb_id; - //MessageDef *msg_p; + MessageDef *msg_p; uint32_t register_gnb_pending = 0; for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) { { - //s1ap_register_enb_req_t *s1ap_register_gNB; //Type Temporarily reuse + ngap_register_gnb_req_t *ngap_register_gNB; //Type Temporarily reuse // note: there is an implicit relationship between the data structure and the message name - /*msg_p = itti_alloc_new_message (TASK_GNB_APP, S1AP_REGISTER_ENB_REQ); //Message Temporarily reuse + *msg_p = itti_alloc_new_message (TASK_GNB_APP, NGAP_REGISTER_GNB_REQ); //Message Temporarily reuse - RCconfig_NR_S1(msg_p, gnb_id);*/ + RCconfig_NR_NG(msg_p, gnb_id); if (gnb_id == 0) RCconfig_nr_gtpu(); - /*s1ap_register_gNB = &S1AP_REGISTER_ENB_REQ(msg_p); //Message Temporarily reuse - LOG_I(GNB_APP,"default drx %d\n",s1ap_register_gNB->default_drx);*/ + ngap_register_gNB = &NGAP_REGISTER_GNB_REQ(msg_p); //Message Temporarily reuse + LOG_I(GNB_APP,"default drx %d\n",ngap_register_gNB->default_drx);*/ LOG_I(GNB_APP,"[gNB %d] gNB_app_register for instance %d\n", gnb_id, GNB_MODULE_ID_TO_INSTANCE(gnb_id)); - //itti_send_msg_to_task (TASK_S1AP, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); + itti_send_msg_to_task (TASK_NGAP, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); register_gnb_pending++; } @@ -201,16 +201,16 @@ void *gNB_app_task(void *args_p) break; -/* - case S1AP_REGISTER_ENB_CNF: - LOG_I(GNB_APP, "[gNB %d] Received %s: associated MME %d\n", instance, msg_name, - S1AP_REGISTER_ENB_CNF(msg_p).nb_mme); + case NGAP_REGISTER_GNB_CNF: + LOG_I(GNB_APP, "[gNB %d] Received %s: associated AMF %d\n", instance, msg_name, + NGAP_REGISTER_GNB_CNF(msg_p).nb_amf); +/* DevAssert(register_gnb_pending > 0); register_gnb_pending--; - // Check if at least gNB is registered with one MME - if (S1AP_REGISTER_ENB_CNF(msg_p).nb_mme > 0) { + // Check if at least gNB is registered with one AMF + if (NGAP_REGISTER_GNB_CNF(msg_p).nb_amf > 0) { registered_gnb++; } @@ -226,7 +226,7 @@ void *gNB_app_task(void *args_p) } else { uint32_t not_associated = gnb_nb - registered_gnb; - LOG_W(GNB_APP, " %d gNB %s not associated with a MME, retrying registration in %d seconds ...\n", + LOG_W(GNB_APP, " %d gNB %s not associated with a AMF, retrying registration in %d seconds ...\n", not_associated, not_associated > 1 ? "are" : "is", GNB_REGISTER_RETRY_DELAY); // Restart the gNB registration process in GNB_REGISTER_RETRY_DELAY seconds @@ -241,12 +241,12 @@ void *gNB_app_task(void *args_p) } } } - - break; */ - case S1AP_DEREGISTERED_ENB_IND: - LOG_W(GNB_APP, "[gNB %d] Received %s: associated MME %d\n", instance, msg_name, - S1AP_DEREGISTERED_ENB_IND(msg_p).nb_mme); + break; + + case NGAP_DEREGISTERED_GNB_IND: + LOG_W(GNB_APP, "[gNB %d] Received %s: associated AMF %d\n", instance, msg_name, + NGAP_DEREGISTERED_GNB_IND(msg_p).nb_amf); /* TODO handle recovering of registration */ break; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 61aa10e47b..4d9b76301a 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -37,7 +37,7 @@ #include "UTIL/OTG/otg.h" #include "UTIL/OTG/otg_externs.h" #include "intertask_interface.h" -#include "s1ap_eNB.h" +#include "ngap_gNB.h" #include "sctp_eNB_task.h" #include "sctp_default_values.h" // #include "SystemInformationBlockType2.h" @@ -342,7 +342,7 @@ void RCconfig_nr_flexran() if (!GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr) { // Calculate a default gNB ID if (EPC_MODE_ENABLED) - gnb_id = i + (s1ap_generate_eNB_id () & 0xFFFF8); + gnb_id = i + (ngap_generate_gNB_id () & 0xFFFF8); else gnb_id = i; } else { @@ -569,7 +569,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { // Calculate a default gNB ID if (EPC_MODE_ENABLED) { uint32_t hash; - hash = s1ap_generate_eNB_id (); + hash = ngap_generate_gNB_id (); gnb_id = i + (hash & 0xFFFF8); } else { gnb_id = i; @@ -683,9 +683,9 @@ int RCconfig_nr_gtpu(void ) { - char* gnb_interface_name_for_S1U = NULL; - char* gnb_ipv4_address_for_S1U = NULL; - uint32_t gnb_port_for_S1U = 0; + char* gnb_interface_name_for_NGU = NULL; + char* gnb_ipv4_address_for_NGU = NULL; + uint32_t gnb_port_for_NGU = 0; char *address = NULL; char *cidr = NULL; char gtpupath[MAX_OPTNAME_SIZE*2 + 8]; @@ -708,28 +708,28 @@ int RCconfig_nr_gtpu(void ) { - cidr = gnb_ipv4_address_for_S1U; + cidr = gnb_ipv4_address_for_NGU; address = strtok(cidr, "/"); if (address) { MessageDef *message; AssertFatal((message = itti_alloc_new_message(TASK_GNB_APP, GTPV1U_ENB_S1_REQ))!=NULL,""); - // IPV4_STR_ADDR_TO_INT_NWBO ( address, RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); + // IPV4_STR_ADDR_TO_INT_NWBO ( address, RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB NG_U !\n" ); // LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up); - IPV4_STR_ADDR_TO_INT_NWBO ( address, GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); + IPV4_STR_ADDR_TO_INT_NWBO ( address, GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB NG_U !\n" ); LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up); - GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = gnb_port_for_S1U; + GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = gnb_port_for_NGU; itti_send_msg_to_task (TASK_GTPV1_U, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) } else - LOG_E(GTPU,"invalid address for S1U\n"); + LOG_E(GTPU,"invalid address for NGU\n"); return 0; } -int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) { +int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) { int j,k = 0; int gnb_id; @@ -779,29 +779,26 @@ int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) { config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); - - - if (GNBParamList.numelt > 0) { for (k = 0; k < GNBParamList.numelt; k++) { - if (GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr == NULL) { - // Calculate a default gNB ID - if (EPC_MODE_ENABLED) { - uint32_t hash; - - hash = s1ap_generate_eNB_id (); - gnb_id = k + (hash & 0xFFFF8); - } else { - gnb_id = k; - } - } else { + if (GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr == NULL) { + // Calculate a default gNB ID + if (EPC_MODE_ENABLED) { + uint32_t hash; + + hash = ngap_generate_gNB_id (); + gnb_id = k + (hash & 0xFFFF8); + } else { + gnb_id = k; + } + } else { gnb_id = *(GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr); } - // search if in active list - for (j=0; j < GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; j++) { - if (strcmp(GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[j], *(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr)) == 0) { + // search if in active list + for (j=0; j < GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; j++) { + if (strcmp(GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[j], *(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr)) == 0) { paramdef_t PLMNParams[] = GNBPLMNPARAMS_DESC; paramlist_def_t PLMNParamList = {GNB_CONFIG_STRING_PLMN_LIST, NULL, 0}; /* map parameter checking array instances to parameter definition array instances */ @@ -810,27 +807,27 @@ int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) { for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I) PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]); - paramdef_t S1Params[] = GNBS1PARAMS_DESC; - paramlist_def_t S1ParamList = {GNB_CONFIG_STRING_MME_IP_ADDRESS,NULL,0}; - - paramdef_t SCTPParams[] = GNBSCTPPARAMS_DESC; - paramdef_t NETParams[] = GNBNETPARAMS_DESC; - char aprefix[MAX_OPTNAME_SIZE*2 + 8]; - - S1AP_REGISTER_ENB_REQ (msg_p).eNB_id = gnb_id; - - if (strcmp(*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr), "CELL_MACRO_GNB") == 0) { - S1AP_REGISTER_ENB_REQ (msg_p).cell_type = CELL_MACRO_ENB; - } else if (strcmp(*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr), "CELL_HOME_GNB") == 0) { - S1AP_REGISTER_ENB_REQ (msg_p).cell_type = CELL_HOME_ENB; - } else { - AssertFatal (0, - "Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for cell_type choice: CELL_MACRO_GNB or CELL_HOME_GNB !\n", - RC.config_file_name, i, *(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr)); - } - - S1AP_REGISTER_ENB_REQ (msg_p).eNB_name = strdup(*(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr)); - S1AP_REGISTER_ENB_REQ (msg_p).tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr; + paramdef_t NGParams[] = GNBNGPARAMS_DESC; + paramlist_def_t NGParamList = {GNB_CONFIG_STRING_AMF_IP_ADDRESS,NULL,0}; + + paramdef_t SCTPParams[] = GNBSCTPPARAMS_DESC; + paramdef_t NETParams[] = GNBNETPARAMS_DESC; + char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + + NGAP_REGISTER_GNB_REQ (msg_p).gNB_id = gnb_id; + + if (strcmp(*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr), "CELL_MACRO_GNB") == 0) { + NGAP_REGISTER_GNB_REQ (msg_p).cell_type = CELL_MACRO_GNB; + } else if (strcmp(*(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr), "CELL_HOME_GNB") == 0) { + NGAP_REGISTER_GNB_REQ (msg_p).cell_type = CELL_HOME_ENB; + } else { + AssertFatal (0, + "Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for cell_type choice: CELL_MACRO_GNB or CELL_HOME_GNB !\n", + RC.config_file_name, i, *(GNBParamList.paramarray[k][GNB_CELL_TYPE_IDX].strptr)); + } + + NGAP_REGISTER_GNB_REQ (msg_p).gNB_name = strdup(*(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr)); + NGAP_REGISTER_GNB_REQ (msg_p).tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr; AssertFatal(!GNBParamList.paramarray[k][GNB_MOBILE_COUNTRY_CODE_IDX_OLD].strptr && !GNBParamList.paramarray[k][GNB_MOBILE_NETWORK_CODE_IDX_OLD].strptr, "It seems that you use an old configuration file. Please change the existing\n" @@ -846,100 +843,100 @@ int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) { AssertFatal(0, "The number of PLMN IDs must be in [1,6], but is %d\n", PLMNParamList.numelt); - S1AP_REGISTER_ENB_REQ(msg_p).num_plmn = PLMNParamList.numelt; + NGAP_REGISTER_GNB_REQ(msg_p).num_plmn = PLMNParamList.numelt; for (int l = 0; l < PLMNParamList.numelt; ++l) { - - S1AP_REGISTER_ENB_REQ (msg_p).mcc[l] = *PLMNParamList.paramarray[l][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; - S1AP_REGISTER_ENB_REQ (msg_p).mnc[l] = *PLMNParamList.paramarray[l][GNB_MOBILE_NETWORK_CODE_IDX].uptr; - S1AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length[l] = *PLMNParamList.paramarray[l][GNB_MNC_DIGIT_LENGTH].u8ptr; - S1AP_REGISTER_ENB_REQ (msg_p).default_drx = 0; - AssertFatal((S1AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length[l] == 2) || - (S1AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length[l] == 3), - "BAD MNC DIGIT LENGTH %d", - S1AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length[l]); - } - sprintf(aprefix,"%s.[%i]",GNB_CONFIG_STRING_GNB_LIST,k); - config_getlist( &S1ParamList,S1Params,sizeof(S1Params)/sizeof(paramdef_t),aprefix); - - S1AP_REGISTER_ENB_REQ (msg_p).nb_mme = 0; - - for (int l = 0; l < S1ParamList.numelt; l++) { - - S1AP_REGISTER_ENB_REQ (msg_p).nb_mme += 1; - - strcpy(S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv4_address,*(S1ParamList.paramarray[l][GNB_MME_IPV4_ADDRESS_IDX].strptr)); - strcpy(S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv6_address,*(S1ParamList.paramarray[l][GNB_MME_IPV6_ADDRESS_IDX].strptr)); - if (strcmp(*(S1ParamList.paramarray[l][GNB_MME_IP_ADDRESS_ACTIVE_IDX].strptr), "yes") == 0) { - } - if (strcmp(*(S1ParamList.paramarray[l][GNB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv4") == 0) { - S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv4 = 1; - } else if (strcmp(*(S1ParamList.paramarray[l][GNB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv6") == 0) { - S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv6 = 1; - } else if (strcmp(*(S1ParamList.paramarray[l][GNB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "no") == 0) { - S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv4 = 1; - S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv6 = 1; - } + NGAP_REGISTER_GNB_REQ (msg_p).mcc[l] = *PLMNParamList.paramarray[l][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; + NGAP_REGISTER_GNB_REQ (msg_p).mnc[l] = *PLMNParamList.paramarray[l][GNB_MOBILE_NETWORK_CODE_IDX].uptr; + NGAP_REGISTER_GNB_REQ (msg_p).mnc_digit_length[l] = *PLMNParamList.paramarray[l][GNB_MNC_DIGIT_LENGTH].u8ptr; + NGAP_REGISTER_GNB_REQ (msg_p).default_drx = 0; + AssertFatal((NGAP_REGISTER_GNB_REQ (msg_p).mnc_digit_length[l] == 2) || + (NGAP_REGISTER_GNB_REQ (msg_p).mnc_digit_length[l] == 3), + "BAD MNC DIGIT LENGTH %d", + NGAP_REGISTER_GNB_REQ (msg_p).mnc_digit_length[l]); + } + sprintf(aprefix,"%s.[%i]",GNB_CONFIG_STRING_GNB_LIST,k); + config_getlist( &NGParamList,NGParams,sizeof(NGParams)/sizeof(paramdef_t),aprefix); + + NGAP_REGISTER_GNB_REQ (msg_p).nb_amf = 0; + + for (int l = 0; l < NGParamList.numelt; l++) { + + NGAP_REGISTER_GNB_REQ (msg_p).nb_amf += 1; + + strcpy(NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[l].ipv4_address,*(NGParamList.paramarray[l][GNB_AMF_IPV4_ADDRESS_IDX].strptr)); + strcpy(NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[l].ipv6_address,*(NGParamList.paramarray[l][GNB_AMF_IPV6_ADDRESS_IDX].strptr)); - if (S1ParamList.paramarray[l][GNB_MME_BROADCAST_PLMN_INDEX].iptr) - S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] = S1ParamList.paramarray[l][GNB_MME_BROADCAST_PLMN_INDEX].numelt; + if (strcmp(*(NGParamList.paramarray[l][GNB_AMF_IP_ADDRESS_ACTIVE_IDX].strptr), "yes") == 0) { + } + if (strcmp(*(NGParamList.paramarray[l][GNB_AMF_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv4") == 0) { + NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv4 = 1; + } else if (strcmp(*(NGParamList.paramarray[l][GNB_AMF_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv6") == 0) { + NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv6 = 1; + } else if (strcmp(*(NGParamList.paramarray[l][GNB_AMF_IP_ADDRESS_PREFERENCE_IDX].strptr), "no") == 0) { + NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv4 = 1; + NGAP_REGISTER_GNB_REQ (msg_p).amf_ip_address[j].ipv6 = 1; + } + + if (NGParamList.paramarray[l][GNB_AMF_BROADCAST_PLMN_INDEX].iptr) + NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] = NGParamList.paramarray[l][GNB_AMF_BROADCAST_PLMN_INDEX].numelt; else - S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] = 0; + NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] = 0; - AssertFatal(S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] <= S1AP_REGISTER_ENB_REQ(msg_p).num_plmn, - "List of broadcast PLMN to be sent to MME can not be longer than actual " + AssertFatal(NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] <= NGAP_REGISTER_GNB_REQ(msg_p).num_plmn, + "List of broadcast PLMN to be sent to AMF can not be longer than actual " "PLMN list (max %d, but is %d)\n", - S1AP_REGISTER_ENB_REQ(msg_p).num_plmn, - S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l]); + NGAP_REGISTER_GNB_REQ(msg_p).num_plmn, + NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l]); - for (int el = 0; el < S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l]; ++el) { + for (int el = 0; el < NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l]; ++el) { /* UINTARRAY gets mapped to int, see config_libconfig.c:223 */ - S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] = S1ParamList.paramarray[l][GNB_MME_BROADCAST_PLMN_INDEX].iptr[el]; - AssertFatal(S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] >= 0 - && S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] < S1AP_REGISTER_ENB_REQ(msg_p).num_plmn, - "index for MME's MCC/MNC (%d) is an invalid index for the registered PLMN IDs (%d)\n", - S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el], - S1AP_REGISTER_ENB_REQ(msg_p).num_plmn); + NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el] = NGParamList.paramarray[l][GNB_AMF_BROADCAST_PLMN_INDEX].iptr[el]; + AssertFatal(NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el] >= 0 + && NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el] < NGAP_REGISTER_GNB_REQ(msg_p).num_plmn, + "index for AMF's MCC/MNC (%d) is an invalid index for the registered PLMN IDs (%d)\n", + NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el], + NGAP_REGISTER_GNB_REQ(msg_p).num_plmn); } /* if no broadcasst_plmn array is defined, fill default values */ - if (S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] == 0) { - S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_num[l] = S1AP_REGISTER_ENB_REQ(msg_p).num_plmn; + if (NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] == 0) { + NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_num[l] = NGAP_REGISTER_GNB_REQ(msg_p).num_plmn; - for (int el = 0; el < S1AP_REGISTER_ENB_REQ(msg_p).num_plmn; ++el) - S1AP_REGISTER_ENB_REQ(msg_p).broadcast_plmn_index[l][el] = el; + for (int el = 0; el < NGAP_REGISTER_GNB_REQ(msg_p).num_plmn; ++el) + NGAP_REGISTER_GNB_REQ(msg_p).broadcast_plmn_index[l][el] = el; } - - } + + } - - // SCTP SETTING - S1AP_REGISTER_ENB_REQ (msg_p).sctp_out_streams = SCTP_OUT_STREAMS; - S1AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = SCTP_IN_STREAMS; - if (EPC_MODE_ENABLED) { - sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_SCTP_CONFIG); - config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix); - S1AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr); - S1AP_REGISTER_ENB_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr); - } + + // SCTP SETTING + NGAP_REGISTER_GNB_REQ (msg_p).sctp_out_streams = SCTP_OUT_STREAMS; + NGAP_REGISTER_GNB_REQ (msg_p).sctp_in_streams = SCTP_IN_STREAMS; + if (EPC_MODE_ENABLED) { + sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_SCTP_CONFIG); + config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix); + NGAP_REGISTER_GNB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr); + NGAP_REGISTER_GNB_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr); + } sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG); - // NETWORK_INTERFACES + // NETWORK_INTERFACES config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix); - - // S1AP_REGISTER_ENB_REQ (msg_p).enb_interface_name_for_S1U = strdup(enb_interface_name_for_S1U); - cidr = *(NETParams[GNB_IPV4_ADDRESS_FOR_S1_MME_IDX].strptr); - address = strtok(cidr, "/"); - - S1AP_REGISTER_ENB_REQ (msg_p).enb_ip_address.ipv6 = 0; - S1AP_REGISTER_ENB_REQ (msg_p).enb_ip_address.ipv4 = 1; - - strcpy(S1AP_REGISTER_ENB_REQ (msg_p).enb_ip_address.ipv4_address, address); - - break; - } - } + + // NGAP_REGISTER_GNB_REQ (msg_p).enb_interface_name_for_NGU = strdup(enb_interface_name_for_NGU); + cidr = *(NETParams[GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX].strptr); + address = strtok(cidr, "/"); + + NGAP_REGISTER_GNB_REQ (msg_p).gnb_ip_address.ipv6 = 0; + NGAP_REGISTER_GNB_REQ (msg_p).gnb_ip_address.ipv4 = 1; + + strcpy(NGAP_REGISTER_GNB_REQ (msg_p).gnb_ip_address.ipv4_address, address); + + break; + } + } } } } @@ -1038,7 +1035,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { // Calculate a default eNB ID if (EPC_MODE_ENABLED) { uint32_t hash; - hash = s1ap_generate_eNB_id (); + hash = ngap_generate_gNB_id (); gnb_id = k + (hash & 0xFFFF8); } else { gnb_id = k; diff --git a/openair2/GNB_APP/gnb_config.h b/openair2/GNB_APP/gnb_config.h index e2588d9e4d..b2e03deeb0 100644 --- a/openair2/GNB_APP/gnb_config.h +++ b/openair2/GNB_APP/gnb_config.h @@ -102,7 +102,7 @@ extern void NRRCConfig(void); //void ru_config_display(void); void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc); -int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i); +int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i); int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i); #endif /* GNB_CONFIG_H_ */ diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index 84045fc622..7c311e2881 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -226,34 +226,34 @@ typedef struct ccparams_nr_x2 { /* MME configuration parameters section name */ -#define GNB_CONFIG_STRING_MME_IP_ADDRESS "mme_ip_address" +#define GNB_CONFIG_STRING_AMF_IP_ADDRESS "amf_ip_address" /* SRB1 configuration parameters names */ -#define GNB_CONFIG_STRING_MME_IPV4_ADDRESS "ipv4" -#define GNB_CONFIG_STRING_MME_IPV6_ADDRESS "ipv6" -#define GNB_CONFIG_STRING_MME_IP_ADDRESS_ACTIVE "active" -#define GNB_CONFIG_STRING_MME_IP_ADDRESS_PREFERENCE "preference" -#define GNB_CONFIG_STRING_MME_BROADCAST_PLMN_INDEX "broadcast_plmn_index" +#define GNB_CONFIG_STRING_AMF_IPV4_ADDRESS "ipv4" +#define GNB_CONFIG_STRING_AMF_IPV6_ADDRESS "ipv6" +#define GNB_CONFIG_STRING_AMF_IP_ADDRESS_ACTIVE "active" +#define GNB_CONFIG_STRING_AMF_IP_ADDRESS_PREFERENCE "preference" +#define GNB_CONFIG_STRING_AMF_BROADCAST_PLMN_INDEX "broadcast_plmn_index" /*-------------------------------------------------------------------------------------------------------------------------------------*/ /* MME configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*-------------------------------------------------------------------------------------------------------------------------------------*/ -#define GNBS1PARAMS_DESC { \ -{GNB_CONFIG_STRING_MME_IPV4_ADDRESS, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_MME_IPV6_ADDRESS, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_MME_IP_ADDRESS_ACTIVE, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_MME_IP_ADDRESS_PREFERENCE, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ +#define GNBNGPARAMS_DESC { \ +{GNB_CONFIG_STRING_AMF_IPV4_ADDRESS, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_AMF_IPV6_ADDRESS, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_AMF_IP_ADDRESS_ACTIVE, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_AMF_IP_ADDRESS_PREFERENCE, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ } -#define GNB_MME_IPV4_ADDRESS_IDX 0 -#define GNB_MME_IPV6_ADDRESS_IDX 1 -#define GNB_MME_IP_ADDRESS_ACTIVE_IDX 2 -#define GNB_MME_IP_ADDRESS_PREFERENCE_IDX 3 -#define GNB_MME_BROADCAST_PLMN_INDEX 4 +#define GNB_AMF_IPV4_ADDRESS_IDX 0 +#define GNB_AMF_IPV6_ADDRESS_IDX 1 +#define GNB_AMF_IP_ADDRESS_ACTIVE_IDX 2 +#define GNB_AMF_IP_ADDRESS_PREFERENCE_IDX 3 +#define GNB_AMF_BROADCAST_PLMN_INDEX 4 /*---------------------------------------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------------------------------------*/ /* SCTP configuration parameters section name */ @@ -281,20 +281,20 @@ typedef struct ccparams_nr_x2 { /* S1 interface configuration parameters section name */ #define GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG "NETWORK_INTERFACES" -#define GNB_INTERFACE_NAME_FOR_S1_MME_IDX 0 -#define GNB_IPV4_ADDRESS_FOR_S1_MME_IDX 1 -#define GNB_INTERFACE_NAME_FOR_S1U_IDX 2 -#define GNB_IPV4_ADDR_FOR_S1U_IDX 3 -#define GNB_PORT_FOR_S1U_IDX 4 +#define GNB_INTERFACE_NAME_FOR_NG_AMF_IDX 0 +#define GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX 1 +#define GNB_INTERFACE_NAME_FOR_NGU_IDX 2 +#define GNB_IPV4_ADDR_FOR_NGU_IDX 3 +#define GNB_PORT_FOR_NGU_IDX 4 #define GNB_IPV4_ADDR_FOR_X2C_IDX 5 #define GNB_PORT_FOR_X2C_IDX 6 /* S1 interface configuration parameters names */ -#define GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1_MME "GNB_INTERFACE_NAME_FOR_S1_MME" -#define GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_S1_MME "GNB_IPV4_ADDRESS_FOR_S1_MME" -#define GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1U "GNB_INTERFACE_NAME_FOR_S1U" -#define GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_S1U "GNB_IPV4_ADDRESS_FOR_S1U" -#define GNB_CONFIG_STRING_GNB_PORT_FOR_S1U "GNB_PORT_FOR_S1U" +#define GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NG_AMF "GNB_INTERFACE_NAME_FOR_NG_AMF" +#define GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_NG_AMF "GNB_IPV4_ADDRESS_FOR_NG_AMF" +#define GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NGU "GNB_INTERFACE_NAME_FOR_NGU" +#define GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_NGU "GNB_IPV4_ADDRESS_FOR_NGU" +#define GNB_CONFIG_STRING_GNB_PORT_FOR_NGU "GNB_PORT_FOR_NGU" /* X2 interface configuration parameters names */ #define GNB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_X2C "GNB_IPV4_ADDRESS_FOR_X2C" @@ -305,11 +305,11 @@ typedef struct ccparams_nr_x2 { /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*--------------------------------------------------------------------------------------------------------------------------------------------------*/ #define GNBNETPARAMS_DESC { \ -{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1_MME, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_S1_MME, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1U, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_S1U, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_PORT_FOR_S1U, NULL, 0, uptr:NULL, defintval:2152L, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NG_AMF, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_NG_AMF, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NGU, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_NGU, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_GNB_PORT_FOR_NGU, NULL, 0, uptr:NULL, defintval:2152L, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_X2C, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ {GNB_CONFIG_STRING_ENB_PORT_FOR_X2C, NULL, 0, uptr:NULL, defintval:0L, TYPE_UINT, 0} \ } @@ -321,9 +321,9 @@ typedef struct ccparams_nr_x2 { /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define GNBGTPUPARAMS_DESC { \ -{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1U, NULL, 0, strptr:&gnb_interface_name_for_S1U, defstrval:"lo", TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_S1U, NULL, 0, strptr:&gnb_ipv4_address_for_S1U, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_PORT_FOR_S1U, NULL, 0, uptr:&gnb_port_for_S1U, defintval:2152, TYPE_UINT, 0} \ +{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NGU, NULL, 0, strptr:&gnb_interface_name_for_NGU, defstrval:"lo", TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_NGU, NULL, 0, strptr:&gnb_ipv4_address_for_NGU, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_GNB_PORT_FOR_NGU, NULL, 0, uptr:&gnb_port_for_NGU, defintval:2152, TYPE_UINT, 0} \ } /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ diff --git a/openair3/NGAP/MESSAGES/ASN1/ASN1_files/ngap-15.8.0.asn1 b/openair3/NGAP/MESSAGES/ASN1/ASN1_files/ngap-15.8.0.asn1 index b808ed3ada..65a13ecbf6 100644 --- a/openair3/NGAP/MESSAGES/ASN1/ASN1_files/ngap-15.8.0.asn1 +++ b/openair3/NGAP/MESSAGES/ASN1/ASN1_files/ngap-15.8.0.asn1 @@ -2945,10 +2945,10 @@ AMFName ::= PrintableString (SIZE(1..150, ...)) AMFPagingTarget ::= CHOICE { globalRANNodeID GlobalRANNodeID, tAI TAI, - choice-Extensions ProtocolIE-SingleContainer { {AMFPagingTarget-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {AMFPagingTarget-ExtIEs} } } -AMFPagingTarget-ExtIEs NGAP-PROTOCOL-IES ::= { +AMFPagingTarget-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -3121,10 +3121,10 @@ BroadcastCancelledAreaList ::= CHOICE { cellIDCancelledNR CellIDCancelledNR, tAICancelledNR TAICancelledNR, emergencyAreaIDCancelledNR EmergencyAreaIDCancelledNR, - choice-Extensions ProtocolIE-SingleContainer { {BroadcastCancelledAreaList-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {BroadcastCancelledAreaList-ExtIEs} } } -BroadcastCancelledAreaList-ExtIEs NGAP-PROTOCOL-IES ::= { +BroadcastCancelledAreaList-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -3135,10 +3135,10 @@ BroadcastCompletedAreaList ::= CHOICE { cellIDBroadcastNR CellIDBroadcastNR, tAIBroadcastNR TAIBroadcastNR, emergencyAreaIDBroadcastNR EmergencyAreaIDBroadcastNR, - choice-Extensions ProtocolIE-SingleContainer { {BroadcastCompletedAreaList-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {BroadcastCompletedAreaList-ExtIEs} } } -BroadcastCompletedAreaList-ExtIEs NGAP-PROTOCOL-IES ::= { +BroadcastCompletedAreaList-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -3220,10 +3220,10 @@ Cause ::= CHOICE { nas CauseNas, protocol CauseProtocol, misc CauseMisc, - choice-Extensions ProtocolIE-SingleContainer { {Cause-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {Cause-ExtIEs} } } -Cause-ExtIEs NGAP-PROTOCOL-IES ::= { +Cause-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -3367,10 +3367,10 @@ CellIDCancelledNR-Item-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { CellIDListForRestart ::= CHOICE { eUTRA-CGIListforRestart EUTRA-CGIList, nR-CGIListforRestart NR-CGIList, - choice-Extensions ProtocolIE-SingleContainer { {CellIDListForRestart-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {CellIDListForRestart-ExtIEs} } } -CellIDListForRestart-ExtIEs NGAP-PROTOCOL-IES ::= { +CellIDListForRestart-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -3530,6 +3530,7 @@ CPTransportLayerInformation-ExtIEs NGAP-PROTOCOL-IES ::= { ... } + CriticalityDiagnostics ::= SEQUENCE { procedureCode ProcedureCode OPTIONAL, triggeringMessage TriggeringMessage OPTIONAL, @@ -3626,10 +3627,10 @@ DRBsSubjectToStatusTransferItem-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { DRBStatusDL ::= CHOICE { dRBStatusDL12 DRBStatusDL12, dRBStatusDL18 DRBStatusDL18, - choice-Extensions ProtocolIE-SingleContainer { {DRBStatusDL-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {DRBStatusDL-ExtIEs} } } -DRBStatusDL-ExtIEs NGAP-PROTOCOL-IES ::= { +DRBStatusDL-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -3656,10 +3657,10 @@ DRBStatusDL18-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { DRBStatusUL ::= CHOICE { dRBStatusUL12 DRBStatusUL12, dRBStatusUL18 DRBStatusUL18, - choice-Extensions ProtocolIE-SingleContainer { {DRBStatusUL-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {DRBStatusUL-ExtIEs} } } -DRBStatusUL-ExtIEs NGAP-PROTOCOL-IES ::= { +DRBStatusUL-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -4011,19 +4012,19 @@ GlobalRANNodeID ::= CHOICE { globalGNB-ID GlobalGNB-ID, globalNgENB-ID GlobalNgENB-ID, globalN3IWF-ID GlobalN3IWF-ID, - choice-Extensions ProtocolIE-SingleContainer { {GlobalRANNodeID-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {GlobalRANNodeID-ExtIEs} } } -GlobalRANNodeID-ExtIEs NGAP-PROTOCOL-IES ::= { +GlobalRANNodeID-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } GNB-ID ::= CHOICE { gNB-ID BIT STRING (SIZE(22..32)), - choice-Extensions ProtocolIE-SingleContainer { {GNB-ID-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {GNB-ID-ExtIEs} } } -GNB-ID-ExtIEs NGAP-PROTOCOL-IES ::= { +GNB-ID-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -4180,10 +4181,10 @@ LastVisitedCellInformation ::= CHOICE { eUTRANCell LastVisitedEUTRANCellInformation, uTRANCell LastVisitedUTRANCellInformation, gERANCell LastVisitedGERANCellInformation, - choice-Extensions ProtocolIE-SingleContainer { {LastVisitedCellInformation-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {LastVisitedCellInformation-ExtIEs} } } -LastVisitedCellInformation-ExtIEs NGAP-PROTOCOL-IES ::= { +LastVisitedCellInformation-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -4280,10 +4281,10 @@ MobilityRestrictionList-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { N3IWF-ID ::= CHOICE { n3IWF-ID BIT STRING (SIZE(16)), - choice-Extensions ProtocolIE-SingleContainer { {N3IWF-ID-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {N3IWF-ID-ExtIEs} } } -N3IWF-ID-ExtIEs NGAP-PROTOCOL-IES ::= { +N3IWF-ID-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -4310,20 +4311,20 @@ NgENB-ID ::= CHOICE { macroNgENB-ID BIT STRING (SIZE(20)), shortMacroNgENB-ID BIT STRING (SIZE(18)), longMacroNgENB-ID BIT STRING (SIZE(21)), - choice-Extensions ProtocolIE-SingleContainer { {NgENB-ID-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {NgENB-ID-ExtIEs} } } -NgENB-ID-ExtIEs NGAP-PROTOCOL-IES ::= { +NgENB-ID-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } NGRAN-CGI ::= CHOICE { nR-CGI NR-CGI, eUTRA-CGI EUTRA-CGI, - choice-Extensions ProtocolIE-SingleContainer { {NGRAN-CGI-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {NGRAN-CGI-ExtIEs} } } -NGRAN-CGI-ExtIEs NGAP-PROTOCOL-IES ::= { +NGRAN-CGI-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -4406,10 +4407,10 @@ OverloadAction ::= ENUMERATED { OverloadResponse ::= CHOICE { overloadAction OverloadAction, - choice-Extensions ProtocolIE-SingleContainer { {OverloadResponse-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {OverloadResponse-ExtIEs} } } -OverloadResponse-ExtIEs NGAP-PROTOCOL-IES ::= { +OverloadResponse-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -5185,10 +5186,10 @@ PriorityLevelQos ::= INTEGER (1..127, ...) PWSFailedCellIDList ::= CHOICE { eUTRA-CGI-PWSFailedList EUTRA-CGIList, nR-CGI-PWSFailedList NR-CGIList, - choice-Extensions ProtocolIE-SingleContainer { {PWSFailedCellIDList-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {PWSFailedCellIDList-ExtIEs} } } -PWSFailedCellIDList-ExtIEs NGAP-PROTOCOL-IES ::= { +PWSFailedCellIDList-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -5197,10 +5198,10 @@ PWSFailedCellIDList-ExtIEs NGAP-PROTOCOL-IES ::= { QosCharacteristics ::= CHOICE { nonDynamic5QI NonDynamic5QIDescriptor, dynamic5QI Dynamic5QIDescriptor, - choice-Extensions ProtocolIE-SingleContainer { {QosCharacteristics-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {QosCharacteristics-ExtIEs} } } -QosCharacteristics-ExtIEs NGAP-PROTOCOL-IES ::= { +QosCharacteristics-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -5506,10 +5507,10 @@ ResetAll ::= ENUMERATED { ResetType ::= CHOICE { nG-Interface ResetAll, partOfNG-Interface UE-associatedLogicalNG-connectionList, - choice-Extensions ProtocolIE-SingleContainer { {ResetType-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {ResetType-ExtIEs} } } -ResetType-ExtIEs NGAP-PROTOCOL-IES ::= { +ResetType-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -5692,10 +5693,10 @@ SONConfigurationTransfer-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { SONInformation ::= CHOICE { sONInformationRequest SONInformationRequest, sONInformationReply SONInformationReply, - choice-Extensions ProtocolIE-SingleContainer { {SONInformation-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {SONInformation-ExtIEs} } } -SONInformation-ExtIEs NGAP-PROTOCOL-IES ::= { +SONInformation-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -5896,10 +5897,10 @@ TargeteNB-ID-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { TargetID ::= CHOICE { targetRANNodeID TargetRANNodeID, targeteNB-ID TargeteNB-ID, - choice-Extensions ProtocolIE-SingleContainer { {TargetID-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {TargetID-ExtIEs} } } -TargetID-ExtIEs NGAP-PROTOCOL-IES ::= { +TargetID-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -6027,20 +6028,20 @@ UEHistoryInformation ::= SEQUENCE (SIZE(1..maxnoofCellsinUEHistoryInfo)) OF Last UEIdentityIndexValue ::= CHOICE { indexLength10 BIT STRING (SIZE(10)), - choice-Extensions ProtocolIE-SingleContainer { {UEIdentityIndexValue-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {UEIdentityIndexValue-ExtIEs} } } -UEIdentityIndexValue-ExtIEs NGAP-PROTOCOL-IES ::= { +UEIdentityIndexValue-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } UE-NGAP-IDs ::= CHOICE { uE-NGAP-ID-pair UE-NGAP-ID-pair, aMF-UE-NGAP-ID AMF-UE-NGAP-ID, - choice-Extensions ProtocolIE-SingleContainer { {UE-NGAP-IDs-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {UE-NGAP-IDs-ExtIEs} } } -UE-NGAP-IDs-ExtIEs NGAP-PROTOCOL-IES ::= { +UE-NGAP-IDs-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -6057,10 +6058,10 @@ UE-NGAP-ID-pair-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { UEPagingIdentity ::= CHOICE { fiveG-S-TMSI FiveG-S-TMSI, - choice-Extensions ProtocolIE-SingleContainer { {UEPagingIdentity-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {UEPagingIdentity-ExtIEs} } } -UEPagingIdentity-ExtIEs NGAP-PROTOCOL-IES ::= { +UEPagingIdentity-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -6149,10 +6150,10 @@ ULForwarding ::= ENUMERATED { UPTransportLayerInformation ::= CHOICE { gTPTunnel GTPTunnel, - choice-Extensions ProtocolIE-SingleContainer { {UPTransportLayerInformation-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {UPTransportLayerInformation-ExtIEs} } } -UPTransportLayerInformation-ExtIEs NGAP-PROTOCOL-IES ::= { +UPTransportLayerInformation-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -6186,10 +6187,10 @@ UserLocationInformation ::= CHOICE { userLocationInformationEUTRA UserLocationInformationEUTRA, userLocationInformationNR UserLocationInformationNR, userLocationInformationN3IWF UserLocationInformationN3IWF, - choice-Extensions ProtocolIE-SingleContainer { {UserLocationInformation-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {UserLocationInformation-ExtIEs} } } -UserLocationInformation-ExtIEs NGAP-PROTOCOL-IES ::= { +UserLocationInformation-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } @@ -6267,10 +6268,10 @@ WarningAreaList ::= CHOICE { nR-CGIListForWarning NR-CGIListForWarning, tAIListForWarning TAIListForWarning, emergencyAreaIDList EmergencyAreaIDList, - choice-Extensions ProtocolIE-SingleContainer { {WarningAreaList-ExtIEs} } + choice-Extensions ProtocolExtensionContainer { {WarningAreaList-ExtIEs} } } -WarningAreaList-ExtIEs NGAP-PROTOCOL-IES ::= { +WarningAreaList-ExtIEs NGAP-PROTOCOL-EXTENSION ::= { ... } diff --git a/openair3/NGAP/ngap_common.h b/openair3/NGAP/ngap_common.h index 6e85b0b682..1f2ed2b7b8 100644 --- a/openair3/NGAP/ngap_common.h +++ b/openair3/NGAP/ngap_common.h @@ -54,7 +54,7 @@ #include "NGAP_ProtocolExtensionContainer.h" #include "NGAP_asn_constant.h" #include "NGAP_SupportedTAs-Item.h" -#include "NGAP_ServedGUMMEIsItem.h" +#include "NGAP_ServedGUAMIsItem.h" /* Checking version of ASN1C compiler */ #if (ASN1C_ENVIRONMENT_VERSION < ASN1C_MINIMUM_VERSION) @@ -82,7 +82,7 @@ extern int asn1_xer_print; # define NGAP_INFO(x, args...) LOG_I(NGAP, x, ##args) # define NGAP_DEBUG(x, args...) LOG_I(NGAP, x, ##args) #else -# include "mme_default_values.h" +# include "amf_default_values.h" # define NGAP_ERROR(x, args...) do { fprintf(stdout, "[NGAP][E]"x, ##args); } while(0) # define NGAP_WARN(x, args...) do { fprintf(stdout, "[NGAP][W]"x, ##args); } while(0) # define NGAP_TRAF(x, args...) do { fprintf(stdout, "[NGAP][T]"x, ##args); } while(0) diff --git a/openair3/NGAP/ngap_gNB.c b/openair3/NGAP/ngap_gNB.c index 5883045f2b..aa4b7713f9 100644 --- a/openair3/NGAP/ngap_gNB.c +++ b/openair3/NGAP/ngap_gNB.c @@ -60,16 +60,16 @@ #include "assertions.h" #include "conversions.h" -#if defined(TEST_S1C_MME) - #include "oaisim_mme_test_s1c.h" +#if defined(TEST_S1C_AMF) + #include "oaisim_amf_test_s1c.h" #endif ngap_gNB_config_t ngap_config; -static int ngap_gNB_generate_s1_setup_request( - ngap_gNB_instance_t *instance_p, ngap_gNB_mme_data_t *ngap_mme_data_p); +static int ngap_gNB_generate_ng_setup_request( + ngap_gNB_instance_t *instance_p, ngap_gNB_amf_data_t *ngap_amf_data_p); -void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_enb_req_t *ngap_register_gNB); +void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_gnb_req_t *ngap_register_gNB); void ngap_gNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); @@ -87,8 +87,8 @@ uint32_t ngap_generate_gNB_id(void) { return gNB_id; } -static void ngap_gNB_register_mme(ngap_gNB_instance_t *instance_p, - net_ip_address_t *mme_ip_address, +static void ngap_gNB_register_amf(ngap_gNB_instance_t *instance_p, + net_ip_address_t *amf_ip_address, net_ip_address_t *local_ip_addr, uint16_t in_streams, uint16_t out_streams, @@ -96,10 +96,10 @@ static void ngap_gNB_register_mme(ngap_gNB_instance_t *instance_p, uint8_t broadcast_plmn_index[PLMN_LIST_MAX_SIZE]) { MessageDef *message_p = NULL; sctp_new_association_req_t *sctp_new_association_req_p = NULL; - ngap_gNB_mme_data_t *ngap_mme_data_p = NULL; - struct ngap_gNB_mme_data_s *mme = NULL; + ngap_gNB_amf_data_t *ngap_amf_data_p = NULL; + struct ngap_gNB_amf_data_s *amf = NULL; DevAssert(instance_p != NULL); - DevAssert(mme_ip_address != NULL); + DevAssert(amf_ip_address != NULL); message_p = itti_alloc_new_message(TASK_NGAP, SCTP_NEW_ASSOCIATION_REQ); sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; sctp_new_association_req_p->port = NGAP_PORT_NUMBER; @@ -107,62 +107,62 @@ static void ngap_gNB_register_mme(ngap_gNB_instance_t *instance_p, sctp_new_association_req_p->in_streams = in_streams; sctp_new_association_req_p->out_streams = out_streams; memcpy(&sctp_new_association_req_p->remote_address, - mme_ip_address, - sizeof(*mme_ip_address)); + amf_ip_address, + sizeof(*amf_ip_address)); memcpy(&sctp_new_association_req_p->local_address, local_ip_addr, sizeof(*local_ip_addr)); - NGAP_INFO("[gNB %d] check the mme registration state\n",instance_p->instance); - mme = NULL; + NGAP_INFO("[gNB %d] check the amf registration state\n",instance_p->instance); + amf = NULL; - if ( mme == NULL ) { - /* Create new MME descriptor */ - ngap_mme_data_p = calloc(1, sizeof(*ngap_mme_data_p)); - DevAssert(ngap_mme_data_p != NULL); - ngap_mme_data_p->cnx_id = ngap_gNB_fetch_add_global_cnx_id(); - sctp_new_association_req_p->ulp_cnx_id = ngap_mme_data_p->cnx_id; - ngap_mme_data_p->assoc_id = -1; - ngap_mme_data_p->broadcast_plmn_num = broadcast_plmn_num; - memcpy(&ngap_mme_data_p->mme_s1_ip, - mme_ip_address, - sizeof(*mme_ip_address)); + if ( amf == NULL ) { + /* Create new AMF descriptor */ + ngap_amf_data_p = calloc(1, sizeof(*ngap_amf_data_p)); + DevAssert(ngap_amf_data_p != NULL); + ngap_amf_data_p->cnx_id = ngap_gNB_fetch_add_global_cnx_id(); + sctp_new_association_req_p->ulp_cnx_id = ngap_amf_data_p->cnx_id; + ngap_amf_data_p->assoc_id = -1; + ngap_amf_data_p->broadcast_plmn_num = broadcast_plmn_num; + memcpy(&ngap_amf_data_p->amf_s1_ip, + amf_ip_address, + sizeof(*amf_ip_address)); for (int i = 0; i < broadcast_plmn_num; ++i) - ngap_mme_data_p->broadcast_plmn_index[i] = broadcast_plmn_index[i]; + ngap_amf_data_p->broadcast_plmn_index[i] = broadcast_plmn_index[i]; - ngap_mme_data_p->ngap_gNB_instance = instance_p; - STAILQ_INIT(&ngap_mme_data_p->served_gummei); - /* Insert the new descriptor in list of known MME + ngap_amf_data_p->ngap_gNB_instance = instance_p; + STAILQ_INIT(&ngap_amf_data_p->served_guami); + /* Insert the new descriptor in list of known AMF * but not yet associated. */ - RB_INSERT(ngap_mme_map, &instance_p->ngap_mme_head, ngap_mme_data_p); - ngap_mme_data_p->state = NGAP_GNB_STATE_WAITING; - instance_p->ngap_mme_nb ++; - instance_p->ngap_mme_pending_nb ++; - } else if (mme->state == NGAP_GNB_STATE_WAITING) { - instance_p->ngap_mme_pending_nb ++; - sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id; - NGAP_INFO("[gNB %d] MME already registered, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", + RB_INSERT(ngap_amf_map, &instance_p->ngap_amf_head, ngap_amf_data_p); + ngap_amf_data_p->state = NGAP_GNB_STATE_WAITING; + instance_p->ngap_amf_nb ++; + instance_p->ngap_amf_pending_nb ++; + } else if (amf->state == NGAP_GNB_STATE_WAITING) { + instance_p->ngap_amf_pending_nb ++; + sctp_new_association_req_p->ulp_cnx_id = amf->cnx_id; + NGAP_INFO("[gNB %d] AMF already registered, retrive the data (state %d, cnx %d, amf_nb %d, amf_pending_nb %d)\n", instance_p->instance, - mme->state, mme->cnx_id, - instance_p->ngap_mme_nb, instance_p->ngap_mme_pending_nb); - /*ngap_mme_data_p->cnx_id = mme->cnx_id; - sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id; + amf->state, amf->cnx_id, + instance_p->ngap_amf_nb, instance_p->ngap_amf_pending_nb); + /*ngap_amf_data_p->cnx_id = amf->cnx_id; + sctp_new_association_req_p->ulp_cnx_id = amf->cnx_id; - ngap_mme_data_p->assoc_id = -1; - ngap_mme_data_p->ngap_gNB_instance = instance_p; + ngap_amf_data_p->assoc_id = -1; + ngap_amf_data_p->ngap_gNB_instance = instance_p; */ } else { - NGAP_WARN("[gNB %d] MME already registered but not in the waiting state, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", + NGAP_WARN("[gNB %d] AMF already registered but not in the waiting state, retrive the data (state %d, cnx %d, amf_nb %d, amf_pending_nb %d)\n", instance_p->instance, - mme->state, mme->cnx_id, - instance_p->ngap_mme_nb, instance_p->ngap_mme_pending_nb); + amf->state, amf->cnx_id, + instance_p->ngap_amf_nb, instance_p->ngap_amf_pending_nb); } itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); } -void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_enb_req_t *ngap_register_gNB) { +void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_gnb_req_t *ngap_register_gNB) { ngap_gNB_instance_t *new_instance; uint8_t index; DevAssert(ngap_register_gNB != NULL); @@ -187,7 +187,7 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_enb_req_t * new_instance = calloc(1, sizeof(ngap_gNB_instance_t)); DevAssert(new_instance != NULL); RB_INIT(&new_instance->ngap_ue_head); - RB_INIT(&new_instance->ngap_mme_head); + RB_INIT(&new_instance->ngap_amf_head); /* Copy usefull parameters */ new_instance->instance = instance; new_instance->gNB_name = ngap_register_gNB->gNB_name; @@ -196,8 +196,8 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_enb_req_t * new_instance->tac = ngap_register_gNB->tac; memcpy(&new_instance->gNB_s1_ip, - &ngap_register_gNB->enb_ip_address, - sizeof(ngap_register_gNB->enb_ip_address)); + &ngap_register_gNB->gnb_ip_address, + sizeof(ngap_register_gNB->gnb_ip_address)); for (int i = 0; i < ngap_register_gNB->num_plmn; i++) { new_instance->mcc[i] = ngap_register_gNB->mcc[i]; @@ -215,27 +215,27 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_enb_req_t * ngap_register_gNB->gNB_id); } - DevCheck(ngap_register_gNB->nb_mme <= NGAP_MAX_NB_MME_IP_ADDRESS, - NGAP_MAX_NB_MME_IP_ADDRESS, ngap_register_gNB->nb_mme, 0); + DevCheck(ngap_register_gNB->nb_amf <= NGAP_MAX_NB_AMF_IP_ADDRESS, + NGAP_MAX_NB_AMF_IP_ADDRESS, ngap_register_gNB->nb_amf, 0); - /* Trying to connect to provided list of MME ip address */ - for (index = 0; index < ngap_register_gNB->nb_mme; index++) { - net_ip_address_t *mme_ip = &ngap_register_gNB->mme_ip_address[index]; - struct ngap_gNB_mme_data_s *mme = NULL; - RB_FOREACH(mme, ngap_mme_map, &new_instance->ngap_mme_head) { + /* Trying to connect to provided list of AMF ip address */ + for (index = 0; index < ngap_register_gNB->nb_amf; index++) { + net_ip_address_t *amf_ip = &ngap_register_gNB->amf_ip_address[index]; + struct ngap_gNB_amf_data_s *amf = NULL; + RB_FOREACH(amf, ngap_amf_map, &new_instance->ngap_amf_head) { /* Compare whether IPv4 and IPv6 information is already present, in which * wase we do not register again */ - if (mme->mme_s1_ip.ipv4 == mme_ip->ipv4 && (!mme_ip->ipv4 - || strncmp(mme->mme_s1_ip.ipv4_address, mme_ip->ipv4_address, 16) == 0) - && mme->mme_s1_ip.ipv6 == mme_ip->ipv6 && (!mme_ip->ipv6 - || strncmp(mme->mme_s1_ip.ipv6_address, mme_ip->ipv6_address, 46) == 0)) + if (amf->amf_s1_ip.ipv4 == amf_ip->ipv4 && (!amf_ip->ipv4 + || strncmp(amf->amf_s1_ip.ipv4_address, amf_ip->ipv4_address, 16) == 0) + && amf->amf_s1_ip.ipv6 == amf_ip->ipv6 && (!amf_ip->ipv6 + || strncmp(amf->amf_s1_ip.ipv6_address, amf_ip->ipv6_address, 46) == 0)) break; } - if (mme) + if (amf) continue; - ngap_gNB_register_mme(new_instance, - mme_ip, - &ngap_register_gNB->enb_ip_address, + ngap_gNB_register_amf(new_instance, + amf_ip, + &ngap_register_gNB->gnb_ip_address, ngap_register_gNB->sctp_in_streams, ngap_register_gNB->sctp_out_streams, ngap_register_gNB->broadcast_plmn_num[index], @@ -245,37 +245,37 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_enb_req_t * void ngap_gNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { ngap_gNB_instance_t *instance_p; - ngap_gNB_mme_data_t *ngap_mme_data_p; + ngap_gNB_amf_data_t *ngap_amf_data_p; DevAssert(sctp_new_association_resp != NULL); instance_p = ngap_gNB_get_instance(instance); DevAssert(instance_p != NULL); - ngap_mme_data_p = ngap_gNB_get_MME(instance_p, -1, + ngap_amf_data_p = ngap_gNB_get_AMF(instance_p, -1, sctp_new_association_resp->ulp_cnx_id); - DevAssert(ngap_mme_data_p != NULL); + DevAssert(ngap_amf_data_p != NULL); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { NGAP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", sctp_new_association_resp->sctp_state, instance, sctp_new_association_resp->ulp_cnx_id); - ngap_handle_s1_setup_message(ngap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); + ngap_handle_ng_setup_message(ngap_amf_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); return; } /* Update parameters */ - ngap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id; - ngap_mme_data_p->in_streams = sctp_new_association_resp->in_streams; - ngap_mme_data_p->out_streams = sctp_new_association_resp->out_streams; - /* Prepare new S1 Setup Request */ - ngap_gNB_generate_s1_setup_request(instance_p, ngap_mme_data_p); + ngap_amf_data_p->assoc_id = sctp_new_association_resp->assoc_id; + ngap_amf_data_p->in_streams = sctp_new_association_resp->in_streams; + ngap_amf_data_p->out_streams = sctp_new_association_resp->out_streams; + /* Prepare new NG Setup Request */ + ngap_gNB_generate_ng_setup_request(instance_p, ngap_amf_data_p); } static void ngap_gNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { int result; DevAssert(sctp_data_ind != NULL); -#if defined(TEST_S1C_MME) - mme_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream, +#if defined(TEST_S1C_AMF) + amf_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream, sctp_data_ind->buffer, sctp_data_ind->buffer_length); #else ngap_gNB_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream, @@ -349,15 +349,15 @@ void *ngap_gNB_process_itti_msg(void *notUsed) { } break; - case NGAP_E_RAB_SETUP_RESP: { - ngap_gNB_e_rab_setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &NGAP_E_RAB_SETUP_RESP(received_msg)); + case NGAP_PDUSESSION_SETUP_RESP: { + ngap_gNB_pdusession_setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &NGAP_PDUSESSION_SETUP_RESP(received_msg)); } break; - case NGAP_E_RAB_MODIFY_RESP: { - ngap_gNB_e_rab_modify_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &NGAP_E_RAB_MODIFY_RESP(received_msg)); + case NGAP_PDUSESSION_MODIFY_RESP: { + ngap_gNB_pdusession_modify_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &NGAP_PDUSESSION_MODIFY_RESP(received_msg)); } break; @@ -373,9 +373,9 @@ void *ngap_gNB_process_itti_msg(void *notUsed) { } break; - case NGAP_E_RAB_MODIFICATION_IND: { - ngap_gNB_generate_E_RAB_Modification_Indication(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &NGAP_E_RAB_MODIFICATION_IND(received_msg)); + case NGAP_PDUSESSION_MODIFICATION_IND: { + ngap_gNB_generate_PDUSESSION_Modification_Indication(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &NGAP_PDUSESSION_MODIFICATION_IND(received_msg)); } break; @@ -402,9 +402,9 @@ void *ngap_gNB_process_itti_msg(void *notUsed) { } break; - case NGAP_E_RAB_RELEASE_RESPONSE: { - ngap_gNB_e_rab_release_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &NGAP_E_RAB_RELEASE_RESPONSE(received_msg)); + case NGAP_PDUSESSION_RELEASE_RESPONSE: { + ngap_gNB_pdusession_release_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &NGAP_PDUSESSION_RELEASE_RESPONSE(received_msg)); } break; @@ -433,97 +433,118 @@ void *ngap_gNB_task(void *arg) { //----------------------------------------------------------------------------- /* -* gNB generate a S1 setup request towards MME +* gNB generate a NG setup request towards AMF */ -static int ngap_gNB_generate_s1_setup_request( +static int ngap_gNB_generate_ng_setup_request( ngap_gNB_instance_t *instance_p, - ngap_gNB_mme_data_t *ngap_mme_data_p) + ngap_gNB_amf_data_t *ngap_amf_data_p) //----------------------------------------------------------------------------- { NGAP_NGAP_PDU_t pdu; - NGAP_S1SetupRequest_t *out = NULL; - NGAP_S1SetupRequestIEs_t *ie = NULL; - NGAP_SupportedTAs_Item_t *ta = NULL; - NGAP_PLMNidentity_t *plmn = NULL; + NGAP_NGSetupRequest_t *out = NULL; + NGAP_NGSetupRequestIEs_t *ie = NULL; + NGAP_SupportedTAItem_t *ta = NULL; + NGAP_BroadcastPLMNItem_t *plmn = NULL; + NGAP_SliceSupportItem_t *ssi = NULL; uint8_t *buffer = NULL; uint32_t len = 0; int ret = 0; DevAssert(instance_p != NULL); - DevAssert(ngap_mme_data_p != NULL); - ngap_mme_data_p->state = NGAP_GNB_STATE_WAITING; + DevAssert(ngap_amf_data_p != NULL); + ngap_amf_data_p->state = NGAP_GNB_STATE_WAITING; /* 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_S1Setup; + pdu.choice.initiatingMessage.procedureCode = NGAP_ProcedureCode_id_NGSetup; pdu.choice.initiatingMessage.criticality = NGAP_Criticality_reject; - pdu.choice.initiatingMessage.value.present = NGAP_InitiatingMessage__value_PR_S1SetupRequest; - out = &pdu.choice.initiatingMessage.value.choice.S1SetupRequest; + pdu.choice.initiatingMessage.value.present = NGAP_InitiatingMessage__value_PR_NGSetupRequest; + out = &pdu.choice.initiatingMessage.value.choice.NGSetupRequest; /* mandatory */ - ie = (NGAP_S1SetupRequestIEs_t *)calloc(1, sizeof(NGAP_S1SetupRequestIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_Global_GNB_ID; + ie = (NGAP_NGSetupRequestIEs_t *)calloc(1, sizeof(NGAP_NGSetupRequestIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_GlobalRANNodeID; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_S1SetupRequestIEs__value_PR_Global_GNB_ID; - MCC_MNC_TO_PLMNID(instance_p->mcc[ngap_mme_data_p->broadcast_plmn_index[0]], - instance_p->mnc[ngap_mme_data_p->broadcast_plmn_index[0]], - instance_p->mnc_digit_length[ngap_mme_data_p->broadcast_plmn_index[0]], - &ie->value.choice.Global_GNB_ID.pLMNidentity); - ie->value.choice.Global_GNB_ID.gNB_ID.present = NGAP_GNB_ID_PR_macroGNB_ID; + ie->value.present = NGAP_NGSetupRequestIEs__value_PR_GlobalRANNodeID; + ie->value.choice.GlobalRANNodeID.present = NGAP_GlobalRANNodeID_PR_globalGNB_ID; + MCC_MNC_TO_PLMNID(instance_p->mcc[ngap_amf_data_p->broadcast_plmn_index[0]], + instance_p->mnc[ngap_amf_data_p->broadcast_plmn_index[0]], + instance_p->mnc_digit_length[ngap_amf_data_p->broadcast_plmn_index[0]], + &ie->value.choice.GlobalRANNodeID.choice.globalGNB_ID.pLMNIdentity); + ie->value.choice.GlobalRANNodeID.choice.globalGNB_ID.gNB_ID.present = NGAP_GNB_ID_PR_gNB_ID; MACRO_GNB_ID_TO_BIT_STRING(instance_p->gNB_id, - &ie->value.choice.Global_GNB_ID.gNB_ID.choice.macroGNB_ID); + &ie->value.choice.GlobalRANNodeID.choice.globalGNB_ID.gNB_ID.choice.gNB_ID); NGAP_INFO("%d -> %02x%02x%02x\n", instance_p->gNB_id, - ie->value.choice.Global_GNB_ID.gNB_ID.choice.macroGNB_ID.buf[0], - ie->value.choice.Global_GNB_ID.gNB_ID.choice.macroGNB_ID.buf[1], - ie->value.choice.Global_GNB_ID.gNB_ID.choice.macroGNB_ID.buf[2]); + ie->value.choice.GlobalRANNodeID.choice.globalGNB_ID.gNB_ID.choice.gNB_ID.buf[0], + ie->value.choice.GlobalRANNodeID.choice.globalGNB_ID.gNB_ID.choice.gNB_ID.buf[1], + ie->value.choice.GlobalRANNodeID.choice.globalGNB_ID.gNB_ID.choice.gNB_ID.buf[2]); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional */ if (instance_p->gNB_name) { - ie = (NGAP_S1SetupRequestIEs_t *)calloc(1, sizeof(NGAP_S1SetupRequestIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_gNBname; + ie = (NGAP_NGSetupRequestIEs_t *)calloc(1, sizeof(NGAP_NGSetupRequestIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_RANNodeName; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_S1SetupRequestIEs__value_PR_GNBname; - OCTET_STRING_fromBuf(&ie->value.choice.GNBname, instance_p->gNB_name, + ie->value.present = NGAP_NGSetupRequestIEs__value_PR_RANNodeName; + OCTET_STRING_fromBuf(&ie->value.choice.RANNodeName, instance_p->gNB_name, strlen(instance_p->gNB_name)); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* mandatory */ - ie = (NGAP_S1SetupRequestIEs_t *)calloc(1, sizeof(NGAP_S1SetupRequestIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_SupportedTAs; + ie = (NGAP_NGSetupRequestIEs_t *)calloc(1, sizeof(NGAP_NGSetupRequestIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_SupportedTAList; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_S1SetupRequestIEs__value_PR_SupportedTAs; + ie->value.present = NGAP_NGSetupRequestIEs__value_PR_SupportedTAList; { - ta = (NGAP_SupportedTAs_Item_t *)calloc(1, sizeof(NGAP_SupportedTAs_Item_t)); + ta = (NGAP_SupportedTAItem_t *)calloc(1, sizeof(NGAP_SupportedTAItem_t)); INT16_TO_OCTET_STRING(instance_p->tac, &ta->tAC); { - for (int i = 0; i < ngap_mme_data_p->broadcast_plmn_num; ++i) { - plmn = (NGAP_PLMNidentity_t *)calloc(1, sizeof(NGAP_PLMNidentity_t)); - MCC_MNC_TO_TBCD(instance_p->mcc[ngap_mme_data_p->broadcast_plmn_index[i]], - instance_p->mnc[ngap_mme_data_p->broadcast_plmn_index[i]], - instance_p->mnc_digit_length[ngap_mme_data_p->broadcast_plmn_index[i]], - plmn); - ASN_SEQUENCE_ADD(&ta->broadcastPLMNs.list, plmn); + for (int i = 0; i < ngap_amf_data_p->broadcast_plmn_num; ++i) { + plmn = (NGAP_BroadcastPLMNItem_t *)calloc(1, sizeof(NGAP_BroadcastPLMNItem_t)); + 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); + + 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) { + 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; + ssi->s_NSSAI.sD->buf[0] = instance_p->s_nssai[i][si].sD[0]; + ssi->s_NSSAI.sD->buf[1] = instance_p->s_nssai[i][si].sD[1]; + ssi->s_NSSAI.sD->buf[2] = instance_p->s_nssai[i][si].sD[2]; + } + + + ASN_SEQUENCE_ADD(&plmn->tAISliceSupportList.list, ssi); + } + + ASN_SEQUENCE_ADD(&ta->broadcastPLMNList.list, plmn); } } - ASN_SEQUENCE_ADD(&ie->value.choice.SupportedTAs.list, ta); + ASN_SEQUENCE_ADD(&ie->value.choice.SupportedTAList.list, ta); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ - ie = (NGAP_S1SetupRequestIEs_t *)calloc(1, sizeof(NGAP_S1SetupRequestIEs_t)); + ie = (NGAP_NGSetupRequestIEs_t *)calloc(1, sizeof(NGAP_NGSetupRequestIEs_t)); ie->id = NGAP_ProtocolIE_ID_id_DefaultPagingDRX; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_S1SetupRequestIEs__value_PR_PagingDRX; + ie->value.present = NGAP_NGSetupRequestIEs__value_PR_PagingDRX; ie->value.choice.PagingDRX = instance_p->default_drx; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); if (ngap_gNB_encode_pdu(&pdu, &buffer, &len) < 0) { - NGAP_ERROR("Failed to encode S1 setup request\n"); + NGAP_ERROR("Failed to encode NG setup request\n"); return -1; } /* Non UE-Associated signalling -> stream = 0 */ - ngap_gNB_itti_send_sctp_data_req(instance_p->instance, ngap_mme_data_p->assoc_id, buffer, len, 0); + ngap_gNB_itti_send_sctp_data_req(instance_p->instance, ngap_amf_data_p->assoc_id, buffer, len, 0); return ret; } diff --git a/openair3/NGAP/ngap_gNB.h b/openair3/NGAP/ngap_gNB.h index 0e8a184109..79ee2e0eee 100644 --- a/openair3/NGAP/ngap_gNB.h +++ b/openair3/NGAP/ngap_gNB.h @@ -31,13 +31,13 @@ #define NGAP_GNB_H_ typedef struct ngap_gNB_config_s { - // MME related params - unsigned char mme_enabled; ///< MME enabled ? + // AMF related params + unsigned char amf_enabled; ///< AMF enabled ? } ngap_gNB_config_t; extern ngap_gNB_config_t ngap_config; -#define EPC_MODE_ENABLED ngap_config.mme_enabled +#define EPC_MODE_ENABLED ngap_config.amf_enabled void *ngap_gNB_process_itti_msg(void*); void ngap_gNB_init(void); diff --git a/openair3/NGAP/ngap_gNB_context_management_procedures.c b/openair3/NGAP/ngap_gNB_context_management_procedures.c index a98dabaf95..f210845ede 100644 --- a/openair3/NGAP/ngap_gNB_context_management_procedures.c +++ b/openair3/NGAP/ngap_gNB_context_management_procedures.c @@ -68,8 +68,8 @@ int ngap_ue_context_release_complete(instance_t instance, DevAssert(ngap_gNB_instance_p != NULL); /*RB_FOREACH(ue_context_p, ngap_ue_map, &ngap_gNB_instance_p->ngap_ue_head) { - NGAP_WARN("in ngap_ue_map: UE context gNB_ue_ngap_id %u mme_ue_ngap_id %u state %u\n", - ue_context_p->gNB_ue_ngap_id, ue_context_p->mme_ue_ngap_id, + NGAP_WARN("in ngap_ue_map: UE context gNB_ue_ngap_id %u amf_ue_ngap_id %u state %u\n", + ue_context_p->gNB_ue_ngap_id, ue_context_p->amf_ue_ngap_id, ue_context_p->ue_state); }*/ if ((ue_context_p = ngap_gNB_get_ue_context(ngap_gNB_instance_p, @@ -90,10 +90,10 @@ int ngap_ue_context_release_complete(instance_t instance, /* mandatory */ ie = (NGAP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(NGAP_UEContextReleaseComplete_IEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID; + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_UEContextReleaseComplete_IEs__value_PR_MME_UE_NGAP_ID; - ie->value.choice.MME_UE_NGAP_ID = ue_context_p->mme_ue_ngap_id; + ie->value.present = NGAP_UEContextReleaseComplete_IEs__value_PR_AMF_UE_NGAP_ID; + ie->value.choice.AMF_UE_NGAP_ID = ue_context_p->amf_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -113,21 +113,21 @@ int ngap_ue_context_release_complete(instance_t instance, MSC_LOG_TX_MESSAGE( MSC_NGAP_GNB, - MSC_NGAP_MME, + MSC_NGAP_AMF, buffer, length, - MSC_AS_TIME_FMT" UEContextRelease successfulOutcome gNB_ue_ngap_id %u mme_ue_ngap_id %u", + MSC_AS_TIME_FMT" UEContextRelease successfulOutcome gNB_ue_ngap_id %u amf_ue_ngap_id %u", 0,0, //MSC_AS_TIME_ARGS(ctxt_pP), ue_release_complete_p->gNB_ue_ngap_id, - ue_context_p->mme_ue_ngap_id); + ue_context_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, - ue_context_p->mme_ref->assoc_id, buffer, + ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); //LG ngap_gNB_itti_send_sctp_close_association(ngap_gNB_instance_p->instance, - // ue_context_p->mme_ref->assoc_id); + // ue_context_p->amf_ref->assoc_id); // release UE context struct ngap_gNB_ue_context_s *ue_context2_p = NULL; @@ -141,8 +141,8 @@ int ngap_ue_context_release_complete(instance_t instance, ue_context_p->gNB_ue_ngap_id); } /*RB_FOREACH(ue_context_p, ngap_ue_map, &ngap_gNB_instance_p->ngap_ue_head) { - NGAP_WARN("in ngap_ue_map: UE context gNB_ue_ngap_id %u mme_ue_ngap_id %u state %u\n", - ue_context_p->gNB_ue_ngap_id, ue_context_p->mme_ue_ngap_id, + NGAP_WARN("in ngap_ue_map: UE context gNB_ue_ngap_id %u amf_ue_ngap_id %u state %u\n", + ue_context_p->gNB_ue_ngap_id, ue_context_p->amf_ue_ngap_id, ue_context_p->ue_state); }*/ @@ -184,10 +184,10 @@ int ngap_ue_context_release_req(instance_t instance, /* mandatory */ ie = (NGAP_UEContextReleaseRequest_IEs_t *)calloc(1, sizeof(NGAP_UEContextReleaseRequest_IEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID; + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_UEContextReleaseRequest_IEs__value_PR_MME_UE_NGAP_ID; - ie->value.choice.MME_UE_NGAP_ID = ue_context_p->mme_ue_ngap_id; + ie->value.present = NGAP_UEContextReleaseRequest_IEs__value_PR_AMF_UE_NGAP_ID; + ie->value.choice.AMF_UE_NGAP_ID = ue_context_p->amf_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -248,17 +248,17 @@ int ngap_ue_context_release_req(instance_t instance, MSC_LOG_TX_MESSAGE( MSC_NGAP_GNB, - MSC_NGAP_MME, + MSC_NGAP_AMF, buffer, length, - MSC_AS_TIME_FMT" UEContextReleaseRequest initiatingMessage gNB_ue_ngap_id %u mme_ue_ngap_id %u", + MSC_AS_TIME_FMT" UEContextReleaseRequest initiatingMessage gNB_ue_ngap_id %u amf_ue_ngap_id %u", 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_release_req_p->gNB_ue_ngap_id, - ue_context_p->mme_ue_ngap_id); + ue_context_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, - ue_context_p->mme_ref->assoc_id, buffer, + ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); return 0; diff --git a/openair3/NGAP/ngap_gNB_decoder.c b/openair3/NGAP/ngap_gNB_decoder.c index 680fdc01fa..d25246a323 100644 --- a/openair3/NGAP/ngap_gNB_decoder.c +++ b/openair3/NGAP/ngap_gNB_decoder.c @@ -62,22 +62,22 @@ static int ngap_gNB_decode_initiating_message(NGAP_NGAP_PDU_t *pdu) { free(res.buffer); break; - case NGAP_ProcedureCode_id_E_RABSetup: + case NGAP_ProcedureCode_id_PDUSESSIONSetup: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); - NGAP_INFO("E_RABSetup initiating message\n"); + NGAP_INFO("PDUSESSIONSetup initiating message\n"); break; - case NGAP_ProcedureCode_id_E_RABModify: + case NGAP_ProcedureCode_id_PDUSESSIONModify: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); - NGAP_INFO("E_RABModify initiating message\n"); + NGAP_INFO("PDUSESSIONModify initiating message\n"); break; - case NGAP_ProcedureCode_id_E_RABRelease: + case NGAP_ProcedureCode_id_PDUSESSIONRelease: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); - NGAP_INFO("TODO E_RABRelease initiating message\n"); + NGAP_INFO("TODO PDUSESSIONRelease initiating message\n"); break; case NGAP_ProcedureCode_id_ErrorIndication: @@ -112,7 +112,7 @@ static int ngap_gNB_decode_successful_outcome(NGAP_NGAP_PDU_t *pdu) { free(res.buffer); break; - case NGAP_ProcedureCode_id_E_RABModificationIndication: + case NGAP_ProcedureCode_id_PDUSESSIONModificationIndication: 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 5f1bf2d904..fdac9efd65 100644 --- a/openair3/NGAP/ngap_gNB_defs.h +++ b/openair3/NGAP/ngap_gNB_defs.h @@ -34,13 +34,13 @@ typedef enum { /* Disconnected state: initial state for any association. */ NGAP_GNB_STATE_DISCONNECTED = 0x0, - /* State waiting for S1 Setup response message if gNB is MME accepted or - * S1 Setup failure if MME rejects the gNB. + /* State waiting for S1 Setup response message if gNB is AMF accepted or + * S1 Setup failure if AMF rejects the gNB. */ NGAP_GNB_STATE_WAITING = 0x1, - /* The gNB is successfully connected to MME, UE contexts can be created. */ + /* The gNB is successfully connected to AMF, UE contexts can be created. */ NGAP_GNB_STATE_CONNECTED = 0x2, - /* The MME has sent an overload start message. Once the MME disables the + /* The AMF has sent an overload start message. Once the AMF disables the * OVERLOAD marker, the state of the association will be * NGAP_GNB_STATE_CONNECTED. */ @@ -51,18 +51,17 @@ typedef enum { /* If the Overload Action IE in the OVERLOAD START message is set to * - “reject all RRC connection establishments for non-emergency mobile - * originated data transfer “ (i.e. reject traffic corresponding to RRC cause - * “mo-data “ (TS 36.331 [16])), or - * - “reject all RRC connection establishments for signalling “ (i.e. reject - * traffic corresponding to RRC cause “modata” and “mo-signalling” - * (TS 36.331 [16])),or + * originated data transfer  E(i.e. reject traffic corresponding to RRC cause + * “mo-data  E(TS 36.331 [16])), or + * - “reject all RRC connection establishments for signalling  E(i.e. reject + * traffic corresponding to RRC cause “modata Eand “mo-signalling E * (TS 36.331 [16])),or * - “only permit RRC connection establishments for emergency sessions and - * mobile terminated services” (i.e. only permit traffic corresponding to RRC - * cause “emergency” and “mt-Access” (TS 36.331 [16])). + * mobile terminated services E(i.e. only permit traffic corresponding to RRC + * cause “emergency Eand “mt-Access E(TS 36.331 [16])). * * NOTE: When the Overload Action IE is set to “only permit RRC connection - * establishments for emergency sessions and mobile terminated services”, - * emergency calls with RRC cause “highPriorityAcess” from high priority users + * establishments for emergency sessions and mobile terminated services E + * emergency calls with RRC cause “highPriorityAcess Efrom high priority users * are rejected (TS 24.301 [24]). */ typedef enum { @@ -81,67 +80,106 @@ struct plmn_identity_s { STAILQ_ENTRY(plmn_identity_s) next; }; -/* Served group id element */ -struct served_group_id_s { - uint16_t mme_group_id; - STAILQ_ENTRY(served_group_id_s) next; +/* Served amf region id for a particular AMF */ +struct served_region_id_s { + uint8_t amf_region_id; + STAILQ_ENTRY(served_region_id_s) next; }; -/* Served mme code for a particular MME */ -struct mme_code_s { - uint8_t mme_code; - STAILQ_ENTRY(mme_code_s) next; +/* Served amf set id for a particular AMF */ +struct amf_set_id_s { + uint16_t amf_set_id; + STAILQ_ENTRY(amf_set_id_s) next; }; -/* Served gummei element */ -struct served_gummei_s { - /* Number of MME served PLMNs */ +/* Served amf pointer for a particular AMF */ +struct amf_pointer_s { + uint8_t amf_pointer; + STAILQ_ENTRY(amf_pointer_s) next; +}; + + +/* Served guami element */ +struct served_guami_s { + /* Number of AMF served PLMNs */ uint8_t nb_served_plmns; - /* List of served PLMNs by MME */ + /* List of served PLMNs by AMF */ STAILQ_HEAD(served_plmns_s, plmn_identity_s) served_plmns; - /* Number of group id in list */ - uint8_t nb_group_id; + /* Number of region id in list */ + uint8_t nb_region_id; /* Served group id list */ - STAILQ_HEAD(served_group_ids_s, served_group_id_s) served_group_ids; + STAILQ_HEAD(served_region_ids_s, served_region_id_s) served_region_ids; - /* Number of MME code */ - uint8_t nb_mme_code; - /* MME Code to uniquely identify an MME within an MME pool area */ - STAILQ_HEAD(mme_codes_s, mme_code_s) mme_codes; + /* Number of AMF set id */ + uint8_t nb_amf_set_id; + /* AMF Set id to uniquely identify an AMF within an AMF pool area */ + STAILQ_HEAD(amf_set_ids_s, amf_set_id_s) amf_set_ids; - /* Next GUMMEI element */ - STAILQ_ENTRY(served_gummei_s) next; + /* Number of AMF pointer */ + uint8_t nb_amf_pointer; + /* AMF pointer to uniquely identify an AMF within an AMF pool area */ + STAILQ_HEAD(amf_pointers_s, amf_pointer_s) amf_pointers; + + /* Next GUAMI element */ + STAILQ_ENTRY(served_guami_s) next; }; +/* slice support element */ +struct slice_support_s { + uint8_t sST; + uint8_t sD_flag; + uint8_t sD[3]; +}; + +/* plmn support element */ +struct plmn_support_s { + plmn_identity_s plmn_identity; + + /* Number of slice support in list */ + uint8_t nb_slice_s; + /* Served group id list */ + STAILQ_HEAD(slice_supports_s, slice_support_s) slice_supports; + + /* Next plmn support element */ + STAILQ_ENTRY(plmn_support_s) next; +}; + + struct ngap_gNB_instance_s; -/* This structure describes association of a gNB to a MME */ -typedef struct ngap_gNB_mme_data_s { - /* MME descriptors tree, ordered by sctp assoc id */ - RB_ENTRY(ngap_gNB_mme_data_s) entry; +/* This structure describes association of a gNB to a AMF */ +typedef struct ngap_gNB_amf_data_s { + /* AMF descriptors tree, ordered by sctp assoc id */ + RB_ENTRY(ngap_gNB_amf_data_s) entry; - /* This is the optional name provided by the MME */ - char *mme_name; + /* This is the optional name provided by the AMF */ + char *amf_name; - /* MME NGAP IP address */ - net_ip_address_t mme_s1_ip; + /* AMF NGAP IP address */ + net_ip_address_t amf_s1_ip; - /* List of served GUMMEI per MME. There is one GUMMEI per RAT with a max + /* List of served GUAMI per AMF. There is one GUAMI per RAT with a max * number of 8 RATs but in our case only one is used. The LTE related pool * configuration is included on the first place in the list. */ - STAILQ_HEAD(served_gummeis_s, served_gummei_s) served_gummei; + STAILQ_HEAD(served_guamis_s, served_guami_s) served_guami; - /* Relative processing capacity of an MME with respect to the other MMEs - * in the pool in order to load-balance MMEs within a pool as defined + /* Relative processing capacity of an AMF with respect to the other AMFs + * in the pool in order to load-balance AMFs within a pool as defined * in TS 23.401. */ - uint8_t relative_mme_capacity; + uint8_t relative_amf_capacity; - /* Current MME overload information (if any). */ + /* + * List of PLMN Support per AMF. + * + */ + STAILQ_HEAD(plmn_supports_s, plmn_support_s) plmn_supports; + + /* Current AMF overload information (if any). */ ngap_overload_state_t overload_state; - /* Current gNB->MME NGAP association state */ + /* Current gNB->AMF NGAP association state */ ngap_gNB_state_t state; /* Next usable stream for UE signalling */ @@ -157,14 +195,21 @@ typedef struct ngap_gNB_mme_data_s { /* SCTP association id */ int32_t assoc_id; - /* This is served PLMN IDs communicated to the MME via an index over the + /* This is served PLMN IDs communicated to the AMF via an index over the * MCC/MNC array in ngap_gNB_instance */ uint8_t broadcast_plmn_num; uint8_t broadcast_plmn_index[PLMN_LIST_MAX_SIZE]; + /* Only meaningfull in virtual mode */ struct ngap_gNB_instance_s *ngap_gNB_instance; -} ngap_gNB_mme_data_t; +} ngap_gNB_amf_data_t; + +typedef struct ngap_gNB_NSSAI_s{ + uint8_t sST; + uint8_t sD_flag; + uint8_t sD[3]; +}ngap_gNB_NSSAI_t; typedef struct ngap_gNB_instance_s { /* Next ngap gNB association. @@ -172,16 +217,16 @@ typedef struct ngap_gNB_instance_s { */ STAILQ_ENTRY(ngap_gNB_instance_s) ngap_gNB_entries; - /* Number of MME requested by gNB (tree size) */ - uint32_t ngap_mme_nb; - /* Number of MME for which association is pending */ - uint32_t ngap_mme_pending_nb; - /* Number of MME successfully associated to gNB */ - uint32_t ngap_mme_associated_nb; - /* Tree of NGAP MME associations ordered by association ID */ - RB_HEAD(ngap_mme_map, ngap_gNB_mme_data_s) ngap_mme_head; + /* Number of AMF requested by gNB (tree size) */ + uint32_t ngap_amf_nb; + /* Number of AMF for which association is pending */ + uint32_t ngap_amf_pending_nb; + /* Number of AMF successfully associated to gNB */ + uint32_t ngap_amf_associated_nb; + /* Tree of NGAP AMF associations ordered by association ID */ + RB_HEAD(ngap_amf_map, ngap_gNB_amf_data_s) ngap_amf_head; - /* TODO: add a map ordered by relative MME capacity */ + /* TODO: add a map ordered by relative AMF capacity */ /* Tree of UE ordered by gNB_ue_ngap_id's */ RB_HEAD(ngap_ue_map, ngap_gNB_ue_context_s) ngap_ue_head; @@ -214,6 +259,9 @@ typedef struct ngap_gNB_instance_s { uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE]; uint8_t num_plmn; + uint16_t num_nssai[PLMN_LIST_MAX_SIZE]; + ngap_gNB_NSSAI_t s_nssai[PLMN_LIST_MAX_SIZE][1024]; + /* Default Paging DRX of the gNB as defined in TS 36.304 */ paging_drx_t default_drx; } ngap_gNB_instance_t; @@ -231,10 +279,10 @@ typedef struct { } ngap_gNB_internal_data_t; int ngap_gNB_compare_assoc_id( - struct ngap_gNB_mme_data_s *p1, struct ngap_gNB_mme_data_s *p2); + struct ngap_gNB_amf_data_s *p1, struct ngap_gNB_amf_data_s *p2); /* Generate the tree management functions */ -RB_PROTOTYPE(ngap_mme_map, ngap_gNB_mme_data_s, entry, +RB_PROTOTYPE(ngap_amf_map, ngap_gNB_amf_data_s, entry, ngap_gNB_compare_assoc_id); #endif /* NGAP_GNB_DEFS_H_ */ diff --git a/openair3/NGAP/ngap_gNB_encoder.c b/openair3/NGAP/ngap_gNB_encoder.c index bc07ca9c1a..f9016972bc 100644 --- a/openair3/NGAP/ngap_gNB_encoder.c +++ b/openair3/NGAP/ngap_gNB_encoder.c @@ -118,7 +118,7 @@ int ngap_gNB_encode_initiating(NGAP_NGAP_PDU_t *pdu, free(res.buffer); break; - case NGAP_ProcedureCode_id_E_RABModificationIndication: + case NGAP_ProcedureCode_id_PDUSESSIONModificationIndication: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); break; @@ -157,22 +157,22 @@ int ngap_gNB_encode_successfull_outcome(NGAP_NGAP_PDU_t *pdu, free(res.buffer); break; - case NGAP_ProcedureCode_id_E_RABSetup: + case NGAP_ProcedureCode_id_PDUSESSIONSetup: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); - NGAP_INFO("E_RABSetup successful message\n"); + NGAP_INFO("PDUSESSIONSetup successful message\n"); break; - case NGAP_ProcedureCode_id_E_RABModify: + case NGAP_ProcedureCode_id_PDUSESSIONModify: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); - NGAP_INFO("E_RABModify successful message\n"); + NGAP_INFO("PDUSESSIONModify successful message\n"); break; - case NGAP_ProcedureCode_id_E_RABRelease: + case NGAP_ProcedureCode_id_PDUSESSIONRelease: res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_NGAP_NGAP_PDU, pdu); free(res.buffer); - NGAP_INFO("E_RAB Release successful message\n"); + NGAP_INFO("PDUSESSION Release successful message\n"); break; default: diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c index 64fe3ec22d..2df0bb337e 100644 --- a/openair3/NGAP/ngap_gNB_handlers.c +++ b/openair3/NGAP/ngap_gNB_handlers.c @@ -51,11 +51,11 @@ #include "msc.h" static -int ngap_gNB_handle_s1_setup_response(uint32_t assoc_id, +int ngap_gNB_handle_ng_setup_response(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); static -int ngap_gNB_handle_s1_setup_failure(uint32_t assoc_id, +int ngap_gNB_handle_ng_setup_failure(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); @@ -75,7 +75,7 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, NGAP_NGAP_PDU_t *pdu); static -int ngap_gNB_handle_e_rab_setup_request(uint32_t assoc_id, +int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); @@ -85,83 +85,86 @@ int ngap_gNB_handle_paging(uint32_t assoc_id, NGAP_NGAP_PDU_t *pdu); static -int ngap_gNB_handle_e_rab_modify_request(uint32_t assoc_id, +int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); static -int ngap_gNB_handle_e_rab_release_command(uint32_t assoc_id, +int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); static -int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, +int ngap_gNB_handle_ng_path_switch_request_ack(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); static -int ngap_gNB_handle_s1_path_switch_request_failure(uint32_t assoc_id, +int ngap_gNB_handle_ng_path_switch_request_failure(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); static -int ngap_gNB_handle_s1_ENDC_e_rab_modification_confirm(uint32_t assoc_id, +int ngap_gNB_handle_ng_ENDC_pdusession_modification_confirm(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); /* Handlers matrix. Only gNB related procedure present here */ ngap_message_decoded_callback messages_callback[][3] = { + { 0, 0, 0 }, /* AMFConfigurationUpdate */ + { 0, 0, 0 }, /* AMFStatusIndication */ + { 0, 0, 0 }, /* CellTrafficTrace */ + { ngap_gNB_handle_deactivate_trace, 0, 0 }, /* DeactivateTrace */ + { ngap_gNB_handle_nas_downlink, 0, 0 }, /* DownlinkNASTransport */ + { 0, 0, 0 }, /* DownlinkNonUEAssociatedNRPPaTransport */ + { 0, 0, 0 }, /* DownlinkRANConfigurationTransfer */ + { 0, 0, 0 }, /* DownlinkRANStatusTransfer */ + { 0, 0, 0 }, /* DownlinkUEAssociatedNRPPaTransport */ + { ngap_gNB_handle_error_indication, 0, 0 }, /* ErrorIndication */ + { 0, 0, 0 }, /* HandoverCancel */ + { 0, 0, 0 }, /* HandoverNotification */ { 0, 0, 0 }, /* HandoverPreparation */ { 0, 0, 0 }, /* HandoverResourceAllocation */ - { 0, 0, 0 }, /* HandoverNotification */ - { 0, ngap_gNB_handle_s1_path_switch_request_ack, ngap_gNB_handle_s1_path_switch_request_failure }, /* PathSwitchRequest */ - { 0, 0, 0 }, /* HandoverCancel */ - { ngap_gNB_handle_e_rab_setup_request, 0, 0 }, /* E_RABSetup */ - { ngap_gNB_handle_e_rab_modify_request, 0, 0 }, /* E_RABModify */ - { ngap_gNB_handle_e_rab_release_command, 0, 0 }, /* E_RABRelease */ - { 0, 0, 0 }, /* E_RABReleaseIndication */ { ngap_gNB_handle_initial_context_request, 0, 0 }, /* InitialContextSetup */ - { ngap_gNB_handle_paging, 0, 0 }, /* Paging */ - { ngap_gNB_handle_nas_downlink, 0, 0 }, /* downlinkNASTransport */ - { 0, 0, 0 }, /* initialUEMessage */ - { 0, 0, 0 }, /* uplinkNASTransport */ - { 0, 0, 0 }, /* Reset */ - { ngap_gNB_handle_error_indication, 0, 0 }, /* ErrorIndication */ - { 0, 0, 0 }, /* NASNonDeliveryIndication */ - { 0, ngap_gNB_handle_s1_setup_response, ngap_gNB_handle_s1_setup_failure }, /* S1Setup */ - { 0, 0, 0 }, /* UEContextReleaseRequest */ - { 0, 0, 0 }, /* DownlinkS1cdma2000tunneling */ - { 0, 0, 0 }, /* UplinkS1cdma2000tunneling */ - { 0, 0, 0 }, /* UEContextModification */ - { 0, 0, 0 }, /* UECapabilityInfoIndication */ - { ngap_gNB_handle_ue_context_release_command, 0, 0 }, /* UEContextRelease */ - { 0, 0, 0 }, /* gNBStatusTransfer */ - { 0, 0, 0 }, /* MMEStatusTransfer */ - { ngap_gNB_handle_deactivate_trace, 0, 0 }, /* DeactivateTrace */ - { ngap_gNB_handle_trace_start, 0, 0 }, /* TraceStart */ - { 0, 0, 0 }, /* TraceFailureIndication */ - { 0, 0, 0 }, /* GNBConfigurationUpdate */ - { 0, 0, 0 }, /* MMEConfigurationUpdate */ + { 0, 0, 0 }, /* InitialUEMessage */ { 0, 0, 0 }, /* LocationReportingControl */ { 0, 0, 0 }, /* LocationReportingFailureIndication */ { 0, 0, 0 }, /* LocationReport */ + { 0, 0, 0 }, /* NASNonDeliveryIndication */ + { 0, 0, 0 }, /* NGReset */ + { 0, ngap_gNB_handle_ng_setup_response, ngap_gNB_handle_ng_setup_failure }, /* NGSetup */ { 0, 0, 0 }, /* OverloadStart */ { 0, 0, 0 }, /* OverloadStop */ - { 0, 0, 0 }, /* WriteReplaceWarning */ - { 0, 0, 0 }, /* gNBDirectInformationTransfer */ - { 0, 0, 0 }, /* MMEDirectInformationTransfer */ + { ngap_gNB_handle_paging, 0, 0 }, /* Paging */ + { 0, ngap_gNB_handle_ng_path_switch_request_ack, ngap_gNB_handle_ng_path_switch_request_failure }, /* PathSwitchRequest */ + { ngap_gNB_handle_pdusession_modify_request, 0, 0 }, /* PDUSessionResourceModify */ + { 0, ngap_gNB_handle_ng_ENDC_pdusession_modification_confirm, 0 }, /* PDUSessionResourceModifyIndication */ + { ngap_gNB_handle_pdusession_release_command, 0, 0 }, /* PDUSessionResourceRelease */ + { ngap_gNB_handle_pdusession_setup_request, 0, 0 }, /* PDUSessionResourceSetup */ + { 0, 0, 0 }, /* PDUSessionResourceNotify */ { 0, 0, 0 }, /* PrivateMessage */ - { 0, 0, 0 }, /* gNBConfigurationTransfer */ - { 0, 0, 0 }, /* MMEConfigurationTransfer */ - { 0, 0, 0 }, /* CellTrafficTrace */ - { 0, 0, 0 }, /* Kill */ - { 0, 0, 0 }, /* DownlinkUEAssociatedLPPaTransport */ - { 0, 0, 0 }, /* UplinkUEAssociatedLPPaTransport */ - { 0, 0, 0 }, /* DownlinkNonUEAssociatedLPPaTransport */ - { 0, 0, 0 }, /* UplinkNonUEAssociatedLPPaTransport */ - { 0, 0, 0 }, /* UERadioCapabilityMatch */ + { 0, 0, 0 }, /* PWSCancel */ + { 0, 0, 0 }, /* PWSFailureIndication */ { 0, 0, 0 }, /* PWSRestartIndication */ - { 0, ngap_gNB_handle_s1_ENDC_e_rab_modification_confirm, 0 }, /* E_RABModificationIndication */ + { 0, 0, 0 }, /* RANConfigurationUpdate */ + { 0, 0, 0 }, /* RerouteNASRequest */ + { 0, 0, 0 }, /* RRCInactiveTransitionReport */ + { 0, 0, 0 }, /* TraceFailureIndication */ + { ngap_gNB_handle_trace_start, 0, 0 }, /* TraceStart */ + { 0, 0, 0 }, /* UEContextModification */ + { ngap_gNB_handle_ue_context_release_command, 0, 0 }, /* UEContextRelease */ + { 0, 0, 0 }, /* UEContextReleaseRequest */ + { 0, 0, 0 }, /* UERadioCapabilityCheck */ + { 0, 0, 0 }, /* UERadioCapabilityInfoIndication */ + { 0, 0, 0 }, /* UETNLABindingRelease */ + { 0, 0, 0 }, /* UplinkNASTransport */ + { 0, 0, 0 }, /* UplinkNonUEAssociatedNRPPaTransport */ + { 0, 0, 0 }, /* UplinkRANConfigurationTransfer */ + { 0, 0, 0 }, /* UplinkRANStatusTransfer */ + { 0, 0, 0 }, /* UplinkUEAssociatedNRPPaTransport */ + { 0, 0, 0 }, /* WriteReplaceWarning */ + { 0, 0, 0 }, /* SecondaryRATDataUsageReport */ + }; char *ngap_direction2String(int ngap_dir) { static char *ngap_direction_String[] = { @@ -172,43 +175,43 @@ char *ngap_direction2String(int ngap_dir) { }; return(ngap_direction_String[ngap_dir]); } -void ngap_handle_s1_setup_message(ngap_gNB_mme_data_t *mme_desc_p, int sctp_shutdown) { +void ngap_handle_ng_setup_message(ngap_gNB_amf_data_t *amf_desc_p, int sctp_shutdown) { if (sctp_shutdown) { - /* A previously connected MME has been shutdown */ + /* A previously connected AMF has been shutdown */ - /* TODO check if it was used by some gNB and send a message to inform these gNB if there is no more associated MME */ - if (mme_desc_p->state == NGAP_GNB_STATE_CONNECTED) { - mme_desc_p->state = NGAP_GNB_STATE_DISCONNECTED; + /* TODO check if it was used by some gNB and send a message to inform these gNB if there is no more associated AMF */ + if (amf_desc_p->state == NGAP_GNB_STATE_CONNECTED) { + amf_desc_p->state = NGAP_GNB_STATE_DISCONNECTED; - if (mme_desc_p->ngap_gNB_instance->ngap_mme_associated_nb > 0) { - /* Decrease associated MME number */ - mme_desc_p->ngap_gNB_instance->ngap_mme_associated_nb --; + if (amf_desc_p->ngap_gNB_instance->ngap_amf_associated_nb > 0) { + /* Decrease associated AMF number */ + amf_desc_p->ngap_gNB_instance->ngap_amf_associated_nb --; } - /* If there are no more associated MME, inform gNB app */ - if (mme_desc_p->ngap_gNB_instance->ngap_mme_associated_nb == 0) { + /* If there are no more associated AMF, inform gNB app */ + if (amf_desc_p->ngap_gNB_instance->ngap_amf_associated_nb == 0) { MessageDef *message_p; message_p = itti_alloc_new_message(TASK_NGAP, NGAP_DEREGISTERED_GNB_IND); - NGAP_DEREGISTERED_GNB_IND(message_p).nb_mme = 0; - itti_send_msg_to_task(TASK_GNB_APP, mme_desc_p->ngap_gNB_instance->instance, message_p); + NGAP_DEREGISTERED_GNB_IND(message_p).nb_amf = 0; + itti_send_msg_to_task(TASK_GNB_APP, amf_desc_p->ngap_gNB_instance->instance, message_p); } } } else { /* Check that at least one setup message is pending */ - DevCheck(mme_desc_p->ngap_gNB_instance->ngap_mme_pending_nb > 0, mme_desc_p->ngap_gNB_instance->instance, - mme_desc_p->ngap_gNB_instance->ngap_mme_pending_nb, 0); + DevCheck(amf_desc_p->ngap_gNB_instance->ngap_amf_pending_nb > 0, amf_desc_p->ngap_gNB_instance->instance, + amf_desc_p->ngap_gNB_instance->ngap_amf_pending_nb, 0); - if (mme_desc_p->ngap_gNB_instance->ngap_mme_pending_nb > 0) { + if (amf_desc_p->ngap_gNB_instance->ngap_amf_pending_nb > 0) { /* Decrease pending messages number */ - mme_desc_p->ngap_gNB_instance->ngap_mme_pending_nb --; + amf_desc_p->ngap_gNB_instance->ngap_amf_pending_nb --; } /* If there are no more pending messages, inform gNB app */ - if (mme_desc_p->ngap_gNB_instance->ngap_mme_pending_nb == 0) { + if (amf_desc_p->ngap_gNB_instance->ngap_amf_pending_nb == 0) { MessageDef *message_p; message_p = itti_alloc_new_message(TASK_NGAP, NGAP_REGISTER_GNB_CNF); - NGAP_REGISTER_GNB_CNF(message_p).nb_mme = mme_desc_p->ngap_gNB_instance->ngap_mme_associated_nb; - itti_send_msg_to_task(TASK_GNB_APP, mme_desc_p->ngap_gNB_instance->instance, message_p); + NGAP_REGISTER_GNB_CNF(message_p).nb_amf = amf_desc_p->ngap_gNB_instance->ngap_amf_associated_nb; + itti_send_msg_to_task(TASK_GNB_APP, amf_desc_p->ngap_gNB_instance->instance, message_p); } } } @@ -254,14 +257,14 @@ int ngap_gNB_handle_message(uint32_t assoc_id, int32_t stream, } static -int ngap_gNB_handle_s1_setup_failure(uint32_t assoc_id, +int ngap_gNB_handle_ng_setup_failure(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { - NGAP_S1SetupFailure_t *container; - NGAP_S1SetupFailureIEs_t *ie; - ngap_gNB_mme_data_t *mme_desc_p; + NGAP_NGSetupFailure_t *container; + NGAP_NGSetupFailureIEs_t *ie; + ngap_gNB_amf_data_t *amf_desc_p; DevAssert(pdu != NULL); - container = &pdu->choice.unsuccessfulOutcome.value.choice.S1SetupFailure; + container = &pdu->choice.unsuccessfulOutcome.value.choice.NGSetupFailure; /* S1 Setup Failure == Non UE-related procedure -> stream 0 */ if (stream != 0) { @@ -269,130 +272,180 @@ int ngap_gNB_handle_s1_setup_failure(uint32_t assoc_id, assoc_id, stream); } - if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { + if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) { NGAP_ERROR("[SCTP %d] Received S1 setup response for non existing " - "MME context\n", assoc_id); + "AMF context\n", assoc_id); return -1; } - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_S1SetupFailureIEs_t, ie, container, + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_NGSetupFailureIEs_t, ie, container, NGAP_ProtocolIE_ID_id_Cause,true); if ((ie->value.choice.Cause.present == NGAP_Cause_PR_misc) && (ie->value.choice.Cause.choice.misc == NGAP_CauseMisc_unspecified)) { - NGAP_WARN("Received s1 setup failure for MME... MME is not ready\n"); + NGAP_WARN("Received NG setup failure for AMF... AMF is not ready\n"); } else { - NGAP_ERROR("Received s1 setup failure for MME... please check your parameters\n"); + NGAP_ERROR("Received NG setup failure for AMF... please check your parameters\n"); } - mme_desc_p->state = NGAP_GNB_STATE_WAITING; - ngap_handle_s1_setup_message(mme_desc_p, 0); + amf_desc_p->state = NGAP_GNB_STATE_WAITING; + ngap_handle_ng_setup_message(amf_desc_p, 0); return 0; } static -int ngap_gNB_handle_s1_setup_response(uint32_t assoc_id, +int ngap_gNB_handle_ng_setup_response(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { - NGAP_S1SetupResponse_t *container; - NGAP_S1SetupResponseIEs_t *ie; - ngap_gNB_mme_data_t *mme_desc_p; + NGAP_NGSetupResponse_t *container; + NGAP_NGSetupResponseIEs_t *ie; + ngap_gNB_amf_data_t *amf_desc_p; int i; DevAssert(pdu != NULL); - container = &pdu->choice.successfulOutcome.value.choice.S1SetupResponse; + container = &pdu->choice.successfulOutcome.value.choice.NGSetupResponse; - /* S1 Setup Response == Non UE-related procedure -> stream 0 */ + /* NG Setup Response == Non UE-related procedure -> stream 0 */ if (stream != 0) { - NGAP_ERROR("[SCTP %d] Received s1 setup response on stream != 0 (%d)\n", + NGAP_ERROR("[SCTP %d] Received ng setup response on stream != 0 (%d)\n", assoc_id, stream); return -1; } - if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { - NGAP_ERROR("[SCTP %d] Received S1 setup response for non existing " - "MME context\n", assoc_id); + if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) { + NGAP_ERROR("[SCTP %d] Received NG setup response for non existing " + "AMF context\n", assoc_id); return -1; } - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_S1SetupResponseIEs_t, ie, container, - NGAP_ProtocolIE_ID_id_ServedGUMMEIs, true); + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_NGSetupResponseIEs_t, ie, container, + NGAP_ProtocolIE_ID_id_ServedGUAMIList, true); - /* The list of served gummei can contain at most 8 elements. - * LTE related gummei is the first element in the list, i.e with an id of 0. + /* The list of served guami can contain at most 256 elements. + * NR related guami is the first element in the list, i.e with an id of 0. */ - NGAP_DEBUG("servedGUMMEIs.list.count %d\n", ie->value.choice.ServedGUMMEIs.list.count); - DevAssert(ie->value.choice.ServedGUMMEIs.list.count > 0); - DevAssert(ie->value.choice.ServedGUMMEIs.list.count <= NGAP_maxnoofRATs); + NGAP_DEBUG("servedGUAMIs.list.count %d\n", ie->value.choice.ServedGUAMIList.list.count); + DevAssert(ie->value.choice.ServedGUAMIList.list.count > 0); + DevAssert(ie->value.choice.ServedGUAMIList.list.count <= NGAP_maxnoofServedGUAMIs); - for (i = 0; i < ie->value.choice.ServedGUMMEIs.list.count; i++) { - NGAP_ServedGUMMEIsItem_t *gummei_item_p; - struct served_gummei_s *new_gummei_p; + for (i = 0; i < ie->value.choice.ServedGUAMIList.list.count; i++) { + NGAP_ServedGUAMIItem_t *guami_item_p; + struct served_guami_s *new_guami_p; int j; - gummei_item_p = ie->value.choice.ServedGUMMEIs.list.array[i]; - new_gummei_p = calloc(1, sizeof(struct served_gummei_s)); - STAILQ_INIT(&new_gummei_p->served_plmns); - STAILQ_INIT(&new_gummei_p->served_group_ids); - STAILQ_INIT(&new_gummei_p->mme_codes); - NGAP_DEBUG("servedPLMNs.list.count %d\n", gummei_item_p->servedPLMNs.list.count); + guami_item_p = ie->value.choice.ServedGUAMIList.list.array[i]; + new_guami_p = calloc(1, sizeof(struct served_guami_s)); + STAILQ_INIT(&new_guami_p->served_plmns); + STAILQ_INIT(&new_guami_p->served_region_ids); + STAILQ_INIT(&new_guami_p->amf_set_ids); + STAILQ_INIT(&new_guami_p->amf_pointers); + + NGAP_PLMNIdentity_t *plmn_identity_p; + struct plmn_identity_s *new_plmn_identity_p; + plmn_identity_p = &guami_item_p->gUAMI.pLMNIdentity; + new_plmn_identity_p = calloc(1, sizeof(struct plmn_identity_s)); + TBCD_TO_MCC_MNC(plmn_identity_p, new_plmn_identity_p->mcc, + new_plmn_identity_p->mnc, new_plmn_identity_p->mnc_digit_length); + STAILQ_INSERT_TAIL(&new_guami_p->served_plmns, new_plmn_identity_p, next); + new_guami_p->nb_served_plmns++; + + NGAP_AMFRegionID_t *amf_region_id_p; + struct served_region_id_s *new_region_id_p; + amf_region_id_p = &guami_item_p->gUAMI.aMFRegionID; + new_region_id_p = calloc(1, sizeof(struct served_region_id_s)); + OCTET_STRING_TO_INT8(amf_region_id_p, new_region_id_p->amf_region_id); + STAILQ_INSERT_TAIL(&new_guami_p->served_region_ids, new_region_id_p, next); + new_guami_p->nb_region_id++; - for (j = 0; j < gummei_item_p->servedPLMNs.list.count; j++) { - NGAP_PLMNidentity_t *plmn_identity_p; - struct plmn_identity_s *new_plmn_identity_p; - plmn_identity_p = gummei_item_p->servedPLMNs.list.array[j]; - new_plmn_identity_p = calloc(1, sizeof(struct plmn_identity_s)); - TBCD_TO_MCC_MNC(plmn_identity_p, new_plmn_identity_p->mcc, - new_plmn_identity_p->mnc, new_plmn_identity_p->mnc_digit_length); - STAILQ_INSERT_TAIL(&new_gummei_p->served_plmns, new_plmn_identity_p, next); - new_gummei_p->nb_served_plmns++; - } + NGAP_AMFSetID_t *amf_set_id_p; + struct amf_set_id_s *new_amf_set_id_p; + amf_set_id_p = &guami_item_p->gUAMI.aMFSetID; + new_amf_set_id_p = calloc(1, sizeof(struct amf_set_id_s)); + OCTET_STRING_TO_INT16(amf_set_id_p, new_amf_set_id_p->amf_set_id); + STAILQ_INSERT_TAIL(&new_guami_p->amf_set_ids, new_amf_set_id_p, next); + new_guami_p->nb_amf_set_id++; - for (j = 0; j < gummei_item_p->servedGroupIDs.list.count; j++) { - NGAP_MME_Group_ID_t *mme_group_id_p; - struct served_group_id_s *new_group_id_p; - mme_group_id_p = gummei_item_p->servedGroupIDs.list.array[j]; - new_group_id_p = calloc(1, sizeof(struct served_group_id_s)); - OCTET_STRING_TO_INT16(mme_group_id_p, new_group_id_p->mme_group_id); - STAILQ_INSERT_TAIL(&new_gummei_p->served_group_ids, new_group_id_p, next); - new_gummei_p->nb_group_id++; - } + NGAP_AMFPointer_t *amf_pointer_p; + struct amf_pointer_s *new_amf_pointer_p; + amf_pointer_p = &guami_item_p->gUAMI.aMFPointer; + new_amf_pointer_p = calloc(1, sizeof(struct amf_pointer_s)); + OCTET_STRING_TO_INT8(amf_pointer_p, new_amf_pointer_p->amf_pointer); + STAILQ_INSERT_TAIL(&new_guami_p->amf_pointers, new_amf_pointer_p, next); + new_guami_p->nb_amf_pointer++; - for (j = 0; j < gummei_item_p->servedMMECs.list.count; j++) { - NGAP_MME_Code_t *mme_code_p; - struct mme_code_s *new_mme_code_p; - mme_code_p = gummei_item_p->servedMMECs.list.array[j]; - new_mme_code_p = calloc(1, sizeof(struct mme_code_s)); - OCTET_STRING_TO_INT8(mme_code_p, new_mme_code_p->mme_code); - STAILQ_INSERT_TAIL(&new_gummei_p->mme_codes, new_mme_code_p, next); - new_gummei_p->nb_mme_code++; - } - - STAILQ_INSERT_TAIL(&mme_desc_p->served_gummei, new_gummei_p, next); + STAILQ_INSERT_TAIL(&amf_desc_p->served_guami, new_guami_p, next); } - /* Set the capacity of this MME */ - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_S1SetupResponseIEs_t, ie, container, - NGAP_ProtocolIE_ID_id_RelativeMMECapacity, true); + /* Set the capacity of this AMF */ + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_NGSetupResponseIEs_t, ie, container, + NGAP_ProtocolIE_ID_id_RelativeAMFCapacity, true); - mme_desc_p->relative_mme_capacity = ie->value.choice.RelativeMMECapacity; + amf_desc_p->relative_amf_capacity = ie->value.choice.RelativeAMFCapacity; - /* Optionaly set the mme name */ - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_S1SetupResponseIEs_t, ie, container, - NGAP_ProtocolIE_ID_id_MMEname, false); + /* mandatory set the amf name */ + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_NGSetupResponseIEs_t, ie, container, + NGAP_ProtocolIE_ID_id_AMFName, true); if (ie) { - mme_desc_p->mme_name = calloc(ie->value.choice.MMEname.size + 1, sizeof(char)); - memcpy(mme_desc_p->mme_name, ie->value.choice.MMEname.buf, - ie->value.choice.MMEname.size); - /* Convert the mme name to a printable string */ - mme_desc_p->mme_name[ie->value.choice.MMEname.size] = '\0'; + 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); + /* Convert the amf name to a printable string */ + amf_desc_p->amf_name[ie->value.choice.AMFname.size] = '\0'; } - /* The association is now ready as gNB and MME know parameters of each other. + + /* mandatory set the plmn supports */ + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_NGSetupResponseIEs_t, ie, container, + NGAP_ProtocolIE_ID_id_PLMNSupportList, true); + + NGAP_DEBUG("PLMNSupportList.list.count %d\n", ie->value.choice.PLMNSupportList.list.count); + DevAssert(ie->value.choice.PLMNSupportList.list.count > 0); + DevAssert(ie->value.choice.PLMNSupportList.list.count <= NGAP_maxnoofPLMNs); + + STAILQ_INIT(&amf_desc_p->plmn_supports); + + for (i = 0; i < ie->value.choice.ServedGUAMIList.list.count; i++) { + NGAP_PLMNSupportItem_t *plmn_support_item_p; + struct plmn_support_s *new_plmn_support_p; + NGAP_SliceSupportItem_t *slice_support_item_p; + struct slice_support_s *new_slice_support_p; + + plmn_support_item_p = ie->value.choice.PLMNSupportList.list.array[i]; + + new_plmn_support_p = calloc(1, sizeof(struct plmn_support_s)); + + TBCD_TO_MCC_MNC(&plmn_support_item_p->pLMNIdentity, new_plmn_support_p->plmn_identity.mcc, + new_plmn_support_p->plmn_identity.mnc, new_plmn_support_p->plmn_identity.mnc_digit_length); + + NGAP_DEBUG("PLMNSupportList.list.count %d\n", plmn_support_item_p->sliceSupportList.list.count); + DevAssert(plmn_support_item_p->sliceSupportList.list.count > 0); + DevAssert(plmn_support_item_p->sliceSupportList.list.count <= NGAP_maxnoofSliceItems); + + STAILQ_INIT(&new_plmn_support_p->slice_supports); + for(int j=0; jsliceSupportList.list.count; j++) { + slice_support_item_p = plmn_support_item_p->sliceSupportList.list.array[j]; + + new_slice_support_p = calloc(1, sizeof(struct slice_support_s)); + + OCTET_STRING_TO_INT8(&slice_support_item_p->s_NSSAI.sST, new_slice_support_p->sST); + + if(slice_support_item_p->s_NSSAI.sD != NULL) { + new_slice_support_p->sD_flag = 1; + OCTET_STRING_TO_INT8(&slice_support_item_p->s_NSSAI.sD[0], new_slice_support_p->sD[0]); + OCTET_STRING_TO_INT8(&slice_support_item_p->s_NSSAI.sD[1], new_slice_support_p->sD[1]); + OCTET_STRING_TO_INT8(&slice_support_item_p->s_NSSAI.sD[2], new_slice_support_p->sD[2]); + } + STAILQ_INSERT_TAIL(&new_plmn_support_p->slice_supports, new_slice_support_p, next); + } + + STAILQ_INSERT_TAIL(&amf_desc_p->plmn_supports, new_plmn_support_p, next); + } + + /* The association is now ready as gNB and AMF know parameters of each other. * Mark the association as UP to enable UE contexts creation. */ - mme_desc_p->state = NGAP_GNB_STATE_CONNECTED; - mme_desc_p->ngap_gNB_instance->ngap_mme_associated_nb ++; - ngap_handle_s1_setup_message(mme_desc_p, 0); + 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); return 0; } @@ -403,7 +456,7 @@ int ngap_gNB_handle_error_indication(uint32_t assoc_id, NGAP_NGAP_PDU_t *pdu) { NGAP_ErrorIndication_t *container; NGAP_ErrorIndicationIEs_t *ie; - ngap_gNB_mme_data_t *mme_desc_p; + ngap_gNB_amf_data_t *amf_desc_p; DevAssert(pdu != NULL); container = &pdu->choice.initiatingMessage.value.choice.ErrorIndication; @@ -413,18 +466,18 @@ int ngap_gNB_handle_error_indication(uint32_t assoc_id, assoc_id, stream); } - if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { + if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) { NGAP_ERROR("[SCTP %d] Received S1 Error indication for non existing " - "MME context\n", assoc_id); + "AMF context\n", assoc_id); return -1; } NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_ErrorIndicationIEs_t, ie, container, - NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID, false); + NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, false); /* optional */ if (ie != NULL) { - NGAP_WARN("Received S1 Error indication MME UE NGAP ID 0x%lx\n", ie->value.choice.MME_UE_NGAP_ID); + NGAP_WARN("Received S1 Error indication AMF UE NGAP ID 0x%lx\n", ie->value.choice.AMF_UE_NGAP_ID); } NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_ErrorIndicationIEs_t, ie, container, @@ -499,8 +552,8 @@ int ngap_gNB_handle_error_indication(uint32_t assoc_id, NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_no_radio_resources_available_in_target_cell\n"); break; - case NGAP_CauseRadioNetwork_unknown_mme_ue_ngap_id: - NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_unknown_mme_ue_ngap_id\n"); + case NGAP_CauseRadioNetwork_unknown_amf_ue_ngap_id: + NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_unknown_amf_ue_ngap_id\n"); break; case NGAP_CauseRadioNetwork_unknown_enb_ue_ngap_id: @@ -567,24 +620,24 @@ int ngap_gNB_handle_error_indication(uint32_t assoc_id, NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_interaction_with_other_procedure\n"); break; - case NGAP_CauseRadioNetwork_unknown_E_RAB_ID: - NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_unknown_E_RAB_ID\n"); + case NGAP_CauseRadioNetwork_unknown_PDUSESSION_ID: + NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_unknown_PDUSESSION_ID\n"); break; - case NGAP_CauseRadioNetwork_multiple_E_RAB_ID_instances: - NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_multiple_E_RAB_ID_instances\n"); + case NGAP_CauseRadioNetwork_multiple_PDUSESSION_ID_instances: + NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_multiple_PDUSESSION_ID_instances\n"); break; case NGAP_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported: NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported\n"); break; - case NGAP_CauseRadioNetwork_s1_intra_system_handover_triggered: - NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_s1_intra_system_handover_triggered\n"); + case NGAP_CauseRadioNetwork_ng_intra_system_handover_triggered: + NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_ng_intra_system_handover_triggered\n"); break; - case NGAP_CauseRadioNetwork_s1_inter_system_handover_triggered: - NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_s1_inter_system_handover_triggered\n"); + case NGAP_CauseRadioNetwork_ng_inter_system_handover_triggered: + NGAP_WARN("Received S1 Error indication NGAP_CauseRadioNetwork_ng_inter_system_handover_triggered\n"); break; case NGAP_CauseRadioNetwork_x2_handover_triggered: @@ -738,44 +791,44 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { int i; - ngap_gNB_mme_data_t *mme_desc_p = NULL; + ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL; MessageDef *message_p = NULL; NGAP_InitialContextSetupRequest_t *container; NGAP_InitialContextSetupRequestIEs_t *ie; - NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id; - NGAP_MME_UE_NGAP_ID_t mme_ue_ngap_id; + NGAP_RAN_UE_NGAP_ID_t ran_ue_ngap_id; + NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id; DevAssert(pdu != NULL); container = &pdu->choice.initiatingMessage.value.choice.InitialContextSetupRequest; - if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { + if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) { NGAP_ERROR("[SCTP %d] Received initial context setup request for non " - "existing MME context\n", assoc_id); + "existing AMF context\n", assoc_id); return -1; } - /* id-MME-UE-NGAP-ID */ + /* id-AMF-UE-NGAP-ID */ NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, - NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID, true); + NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, true); if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - mme_ue_ngap_id = ie->value.choice.MME_UE_NGAP_ID; + amf_ue_ngap_id = ie->value.choice.AMF_UE_NGAP_ID; } else { return -1; } - /* id-gNB-UE-NGAP-ID */ + /* id-RAN-UE-NGAP-ID */ NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, - NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID, true); + NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID, true); if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - enb_ue_ngap_id = ie->value.choice.GNB_UE_NGAP_ID; + ran_ue_ngap_id = ie->value.choice.RAN_UE_NGAP_ID; - if ((ue_desc_p = ngap_gNB_get_ue_context(mme_desc_p->ngap_gNB_instance, - enb_ue_ngap_id)) == NULL) { + if ((ue_desc_p = ngap_gNB_get_ue_context(amf_desc_p->ngap_gNB_instance, + ran_ue_ngap_id)) == NULL) { NGAP_ERROR("[SCTP %d] Received initial context setup request for non " "existing UE context 0x%06lx\n", assoc_id, - enb_ue_ngap_id); + ran_ue_ngap_id); return -1; } } else { @@ -790,67 +843,201 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, } ue_desc_p->rx_stream = stream; - ue_desc_p->mme_ue_ngap_id = mme_ue_ngap_id; + ue_desc_p->amf_ue_ngap_id = amf_ue_ngap_id; message_p = itti_alloc_new_message(TASK_NGAP, NGAP_INITIAL_CONTEXT_SETUP_REQ); NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; ue_desc_p->ue_initial_id = 0; NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).gNB_ue_ngap_id = ue_desc_p->gNB_ue_ngap_id; - NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).mme_ue_ngap_id = ue_desc_p->mme_ue_ngap_id; - /* id-uEaggregateMaximumBitrate */ + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).amf_ue_ngap_id = ue_desc_p->amf_ue_ngap_id; + /* id-UEAggregateMaximumBitRate */ NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, - NGAP_ProtocolIE_ID_id_uEaggregateMaximumBitrate, true); + NGAP_ProtocolIE_ID_id_UEAggregateMaximumBitRate, false); if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - asn_INTEGER2ulong(&(ie->value.choice.UEAggregateMaximumBitrate.uEaggregateMaximumBitRateUL), + asn_INTEGER2ulong(&(ie->value.choice.UEAggregateMaximumBitRate.uEAggregateMaximumBitRateUL), &(NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_ul)); - asn_INTEGER2ulong(&(ie->value.choice.UEAggregateMaximumBitrate.uEaggregateMaximumBitRateDL), + asn_INTEGER2ulong(&(ie->value.choice.UEAggregateMaximumBitRate.uEAggregateMaximumBitRateDL), &(NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_dl)); - /* id-E-RABToBeSetupListCtxtSUReq */ } else { + NGAP_ERROR("could not found NGAP_ProtocolIE_ID_id_UEAggregateMaximumBitRate\n"); + } + + + /* id-GUAMI */ + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, + NGAP_ProtocolIE_ID_id_GUAMI, true); + + if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ + ie->value.choice.GUAMI.pLMNIdentity + ie->value.choice.GUAMI.aMFRegionID + ie->value.choice.GUAMI.aMFSetID + ie->value.choice.GUAMI.aMFPointer + TBCD_TO_MCC_MNC(&ie->value.choice.GUAMI.pLMNIdentity, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).guami.mcc, + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).guami.mnc, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).guami.mnc_len); + + OCTET_STRING_TO_INT8(&ie->value.choice.GUAMI.aMFRegionID, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).guami.amf_region_id); + OCTET_STRING_TO_INT16(&ie->value.choice.GUAMI.aMFSetID, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).guami.amf_set_id); + OCTET_STRING_TO_INT8(&ie->value.choice.GUAMI.aMFPointer, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).guami.amf_pointer); + } else {/* ie != NULL */ return -1; } NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, - NGAP_ProtocolIE_ID_id_E_RABToBeSetupListCtxtSUReq, true); + NGAP_ProtocolIE_ID_id_PDUSessionResourceSetupListCxtReq, false); if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_of_e_rabs = - ie->value.choice.E_RABToBeSetupListCtxtSUReq.list.count; + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_of_pdusessions = + ie->value.choice.PDUSessionResourceSetupListCxtReq.list.count; - for (i = 0; i < ie->value.choice.E_RABToBeSetupListCtxtSUReq.list.count; i++) { - NGAP_E_RABToBeSetupItemCtxtSUReq_t *item_p; - item_p = &(((NGAP_E_RABToBeSetupItemCtxtSUReqIEs_t *)ie->value.choice.E_RABToBeSetupListCtxtSUReq.list.array[i])->value.choice.E_RABToBeSetupItemCtxtSUReq); - NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].e_rab_id = item_p->e_RAB_ID; + for (i = 0; i < ie->value.choice.PDUSessionResourceSetupListCxtReq.list.count; i++) { + NGAP_PDUSessionResourceSetupItemCxtReq_t *item_p; + asn_dec_rval_t dec_rval; + NGAP_PDUSessionResourceSetupRequestTransfer_t *pdusessionTransfer_p = NULL; + NGAP_PDUSessionResourceSetupRequestTransferIEs_t *pdusessionTransfer_ies = NULL; + + item_p = (NGAP_PDUSessionResourceSetupItemCxtReq_t *)ie->value.choice.PDUSessionResourceSetupListCxtReq.list.array[i]; + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].pdusession_id = item_p->pDUSessionID; if (item_p->nAS_PDU != NULL) { /* Only copy NAS pdu if present */ - NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.length = item_p->nAS_PDU->size; - NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer = + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].nas_pdu.length = item_p->nAS_PDU->size; + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU->size); - memcpy(NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer, + memcpy(NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].nas_pdu.buffer, item_p->nAS_PDU->buf, item_p->nAS_PDU->size); - NGAP_DEBUG("Received NAS message with the E_RAB setup procedure\n"); + NGAP_DEBUG("Received NAS message with the PDUSESSION setup procedure\n"); } else { - NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.length = 0; - NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer = NULL; + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].nas_pdu.length = 0; + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].nas_pdu.buffer = NULL; + } + + + dec_rval = uper_decode(NULL, + &asn_DEF_NGAP_PDUSessionResourceSetupRequestTransfer, + (void **)&pdusessionTransfer_p, + item_p->pDUSessionResourceSetupRequestTransfer.buf, + item_p->pDUSessionResourceSetupRequestTransfer.size, 0, 0); + + if(dec_rval.code != RC_OK) { + NGAP_ERROR("could not decode PDUSessionResourceSetupRequestTransfer\n"); + return -1; + } + + for(int j=0; j< pdusessionTransfer_p->protocolIEs.list.count; j++) { + pdusessionTransfer_ies = pdusessionTransfer_p->protocolIEs.list.array[j]; + switch(pdusessionTransfer_ies->id) { + /* optional PDUSessionAggregateMaximumBitRate */ + case NGAP_ProtocolIE_ID_id_PDUSessionAggregateMaximumBitRate: + break; + + /* mandatory UL-NGU-UP-TNLInformation */ + case NGAP_ProtocolIE_ID_id_UL_NGU_UP_TNLInformation: + { + NGAP_GTPTunnel_t *gTPTunnel_p; + gTPTunnel_p = &pdusessionTransfer_ies->value.choice.UPTransportLayerInformation.choice.gTPTunnel; + + /* Set the transport layer address */ + memcpy(NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].upf_addr.buffer, + gTPTunnel_p->transportLayerAddress.buf, gTPTunnel_p->transportLayerAddress.size); + + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].upf_addr.length = + gTPTunnel_p->transportLayerAddress.size * 8 - gTPTunnel_p->transportLayerAddress.bits_unused; + + /* GTP tunnel endpoint ID */ + OCTET_STRING_TO_INT32(&gTPTunnel_p->gTP_TEID, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].gtp_teid); + } + + break; + + /* optional AdditionalUL-NGU-UP-TNLInformation */ + case NGAP_ProtocolIE_ID_id_AdditionalUL_NGU_UP_TNLInformation: + break; + + /* optional DataForwardingNotPossible */ + case NGAP_ProtocolIE_ID_id_DataForwardingNotPossible: + break; + + /* mandatory PDUSessionType */ + case NGAP_ProtocolIE_ID_id_PDUSessionType: + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].upf_addr.pdu_session_type = (uint8_t)pdusessionTransfer_ies->value.choice.PDUSessionType; + break; + + /* optional SecurityIndication */ + case NGAP_ProtocolIE_ID_id_SecurityIndication: + break; + + /* optional NetworkInstance */ + case NGAP_ProtocolIE_ID_id_NetworkInstance: + break; + + /* mandatory QosFlowSetupRequestList */ + case NGAP_ProtocolIE_ID_id_QosFlowSetupRequestList: + { + NGAP_QosFlowSetupRequestItem_t *qosFlowItem_p; + + NGAP_DEBUG("servedGUAMIs.list.count %d\n", pdusessionTransfer_ies->value.choice.QosFlowSetupRequestList.list.count); + DevAssert(pdusessionTransfer_ies->value.choice.QosFlowSetupRequestList.list.count > 0); + DevAssert(pdusessionTransfer_ies->value.choice.QosFlowSetupRequestList.list.count <= NGAP_maxnoofQosFlows); + + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].nb_qos = pdusessionTransfer_ies->value.choice.QosFlowSetupRequestList.list.count; + + for(int qosIdx = 0; qosIdx < pdusessionTransfer_ies->value.choice.QosFlowSetupRequestList.list.count; qosIdx++) { + qosFlowItem_p = pdusessionTransfer_ies->value.choice.QosFlowSetupRequestList.list.array[qosIdx]; + + /* Set the QOS informations */ + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].qos[qosIdx].qci = (uint8_t)qosFlowItem_p->qosFlowIdentifier; + + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].qos[qosIdx].allocation_retention_priority.priority_level = + qosFlowItem_p->qosFlowLevelQosParameters.allocationAndRetentionPriority.priorityLevelARP; + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].qos[qosIdx].allocation_retention_priority.pre_emp_capability = + qosFlowItem_p->qosFlowLevelQosParameters.allocationAndRetentionPriority.pre_emptionCapability; + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).pdusession_param[i].qos[qosIdx].allocation_retention_priority.pre_emp_vulnerability = + qosFlowItem_p->qosFlowLevelQosParameters.allocationAndRetentionPriority.pre_emptionVulnerability; + } + } + + break; + + /* optional CommonNetworkInstance */ + case NGAP_ProtocolIE_ID_id_CommonNetworkInstance: + break; + + default: + NGAP_ERROR("could not found protocolIEs id %d\n", pdusessionTransfer_ies->id); + return -1; + } } - /* Set the transport layer address */ - memcpy(NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].sgw_addr.buffer, - item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size); - NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].sgw_addr.length = - item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused; - /* GTP tunnel endpoint ID */ - OCTET_STRING_TO_INT32(&item_p->gTP_TEID, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].gtp_teid); - /* Set the QOS informations */ - NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI; - NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.priority_level = - item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel; - NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.pre_emp_capability = - item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionCapability; - NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.pre_emp_vulnerability = - item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability; } /* for i... */ + } else {/* ie != NULL */ + NGAP_ERROR("could not found NGAP_ProtocolIE_ID_id_PDUSessionResourceSetupListCxtReq\n"); + } + + /* id-AllowedNSSAI */ + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, + NGAP_ProtocolIE_ID_id_AllowedNSSAI, true); + + if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ + NGAP_AllowedNSSAI_Item_t *allow_nssai_item_p = NULL; + + NGAP_DEBUG("AllowedNSSAI.list.count %d\n", ie->value.choice.AllowedNSSAI.list.count); + DevAssert(ie->value.choice.AllowedNSSAI.list.count > 0); + DevAssert(ie->value.choice.AllowedNSSAI.list.count <= NGAP_maxnoofAllowedS_NSSAIs); + + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_allowed_nssais = ie->value.choice.AllowedNSSAI.list.count; + + for(i = 0; i < ie->value.choice.AllowedNSSAI.list.count; i++) { + allow_nssai_item_p = ie->value.choice.AllowedNSSAI.list.array[i]; + + OCTET_STRING_TO_INT8(&allow_nssai_item_p->s_NSSAI.sST, NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[i].sST); + + if(allow_nssai_item_p->s_NSSAI.sD != NULL) { + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[i].sD_flag = 1; + OCTET_STRING_TO_INT8(&allow_nssai_item_p->s_NSSAI.sD[0], NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[i].sD[0]); + OCTET_STRING_TO_INT8(&allow_nssai_item_p->s_NSSAI.sD[1], NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[i].sD[1]); + OCTET_STRING_TO_INT8(&allow_nssai_item_p->s_NSSAI.sD[2], NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).allowed_nssai[i].sD[2]); + } + } } else {/* ie != NULL */ return -1; } @@ -860,10 +1047,14 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, NGAP_ProtocolIE_ID_id_UESecurityCapabilities, true); if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.encryption_algorithms = - BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.encryptionAlgorithms); - NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.integrity_algorithms = - BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.integrityProtectionAlgorithms); + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.nRencryption_algorithms = + BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.nRencryptionAlgorithms); + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.nRintegrity_algorithms = + BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.nRintegrityProtectionAlgorithms); + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.eUTRAencryption_algorithms = + BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.eUTRAencryptionAlgorithms); + NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.eUTRAintegrity_algorithms = + BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.eUTRAintegrityProtectionAlgorithms); /* id-SecurityKey : Copy the security key */ } else {/* ie != NULL */ return -1; @@ -888,19 +1079,19 @@ static int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { - ngap_gNB_mme_data_t *mme_desc_p = NULL; + ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL; MessageDef *message_p = NULL; - NGAP_MME_UE_NGAP_ID_t mme_ue_ngap_id; + NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id; NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id; NGAP_UEContextReleaseCommand_t *container; NGAP_UEContextReleaseCommand_IEs_t *ie; DevAssert(pdu != NULL); container = &pdu->choice.initiatingMessage.value.choice.UEContextReleaseCommand; - if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { + if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) { NGAP_ERROR("[SCTP %d] Received UE context release command for non " - "existing MME context\n", assoc_id); + "existing AMF context\n", assoc_id); return -1; } @@ -911,17 +1102,17 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, switch (ie->value.choice.UE_NGAP_IDs.present) { case NGAP_UE_NGAP_IDs_PR_uE_NGAP_ID_pair: enb_ue_ngap_id = ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair.gNB_UE_NGAP_ID; - mme_ue_ngap_id = ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair.mME_UE_NGAP_ID; + amf_ue_ngap_id = ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair.mME_UE_NGAP_ID; MSC_LOG_RX_MESSAGE( MSC_NGAP_GNB, - MSC_NGAP_MME, + MSC_NGAP_AMF, NULL,0, - "0 UEContextRelease/%s gNB_ue_ngap_id "NGAP_UE_ID_FMT" mme_ue_ngap_id "NGAP_UE_ID_FMT" len %u", + "0 UEContextRelease/%s gNB_ue_ngap_id "NGAP_UE_ID_FMT" amf_ue_ngap_id "NGAP_UE_ID_FMT" len %u", ngap_direction2String(pdu->present - 1), enb_ue_ngap_id, - mme_ue_ngap_id); + amf_ue_ngap_id); - if ((ue_desc_p = ngap_gNB_get_ue_context(mme_desc_p->ngap_gNB_instance, + if ((ue_desc_p = ngap_gNB_get_ue_context(amf_desc_p->ngap_gNB_instance, enb_ue_ngap_id)) == NULL) { NGAP_ERROR("[SCTP %d] Received UE context release command for non " "existing UE context 0x%06lx\n", @@ -937,8 +1128,8 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, enb_ue_ngap_id); message_p = itti_alloc_new_message(TASK_NGAP, NGAP_UE_CONTEXT_RELEASE_COMMAND); - if (ue_desc_p->mme_ue_ngap_id == 0) { // case of Detach Request and switch off from RRC_IDLE mode - ue_desc_p->mme_ue_ngap_id = mme_ue_ngap_id; + if (ue_desc_p->amf_ue_ngap_id == 0) { // case of Detach Request and switch off from RRC_IDLE mode + ue_desc_p->amf_ue_ngap_id = amf_ue_ngap_id; } NGAP_UE_CONTEXT_RELEASE_COMMAND(message_p).gNB_ue_ngap_id = enb_ue_ngap_id; @@ -948,12 +1139,12 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, break; - //#warning "TODO mapping mme_ue_ngap_id enb_ue_ngap_id?" + //#warning "TODO mapping amf_ue_ngap_id enb_ue_ngap_id?" case NGAP_UE_NGAP_IDs_PR_mME_UE_NGAP_ID: - mme_ue_ngap_id = ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair.mME_UE_NGAP_ID; - NGAP_ERROR("TO DO mapping mme_ue_ngap_id enb_ue_ngap_id"); - (void)mme_ue_ngap_id; /* TODO: remove - it's to remove gcc warning about unused var */ + amf_ue_ngap_id = ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair.mME_UE_NGAP_ID; + NGAP_ERROR("TO DO mapping amf_ue_ngap_id enb_ue_ngap_id"); + (void)amf_ue_ngap_id; /* TODO: remove - it's to remove gcc warning about unused var */ case NGAP_UE_NGAP_IDs_PR_NOTHING: default: @@ -970,38 +1161,38 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, } static -int ngap_gNB_handle_e_rab_setup_request(uint32_t assoc_id, +int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { int i; - NGAP_MME_UE_NGAP_ID_t mme_ue_ngap_id; + NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id; NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id; - ngap_gNB_mme_data_t *mme_desc_p = NULL; + ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL; MessageDef *message_p = NULL; - NGAP_E_RABSetupRequest_t *container; - NGAP_E_RABSetupRequestIEs_t *ie; + NGAP_PDUSESSIONSetupRequest_t *container; + NGAP_PDUSESSIONSetupRequestIEs_t *ie; DevAssert(pdu != NULL); - container = &pdu->choice.initiatingMessage.value.choice.E_RABSetupRequest; + container = &pdu->choice.initiatingMessage.value.choice.PDUSESSIONSetupRequest; - if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { + if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) { NGAP_ERROR("[SCTP %d] Received initial context setup request for non " - "existing MME context\n", assoc_id); + "existing AMF context\n", assoc_id); return -1; } - /* id-MME-UE-NGAP-ID */ - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABSetupRequestIEs_t, ie, container, - NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID, true); + /* id-AMF-UE-NGAP-ID */ + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONSetupRequestIEs_t, ie, container, + NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, true); if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - mme_ue_ngap_id = ie->value.choice.MME_UE_NGAP_ID; + amf_ue_ngap_id = ie->value.choice.AMF_UE_NGAP_ID; } else { return -1; } /* id-gNB-UE-NGAP-ID */ - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABSetupRequestIEs_t, ie, container, + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONSetupRequestIEs_t, ie, container, NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID, true); if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ @@ -1010,7 +1201,7 @@ int ngap_gNB_handle_e_rab_setup_request(uint32_t assoc_id, return -1; } - if ((ue_desc_p = ngap_gNB_get_ue_context(mme_desc_p->ngap_gNB_instance, + if ((ue_desc_p = ngap_gNB_get_ue_context(amf_desc_p->ngap_gNB_instance, enb_ue_ngap_id)) == NULL) { NGAP_ERROR("[SCTP %d] Received initial context setup request for non " "existing UE context 0x%06lx\n", assoc_id, @@ -1027,59 +1218,59 @@ int ngap_gNB_handle_e_rab_setup_request(uint32_t assoc_id, ue_desc_p->rx_stream = stream; - if ( ue_desc_p->mme_ue_ngap_id != mme_ue_ngap_id) { - NGAP_WARN("UE context mme_ue_ngap_id is different form that of the message (%d != %ld)", - ue_desc_p->mme_ue_ngap_id, mme_ue_ngap_id); + if ( ue_desc_p->amf_ue_ngap_id != amf_ue_ngap_id) { + NGAP_WARN("UE context amf_ue_ngap_id is different form that of the message (%d != %ld)", + ue_desc_p->amf_ue_ngap_id, amf_ue_ngap_id); } - message_p = itti_alloc_new_message(TASK_NGAP, NGAP_E_RAB_SETUP_REQ); - NGAP_E_RAB_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; - NGAP_E_RAB_SETUP_REQ(message_p).mme_ue_ngap_id = mme_ue_ngap_id; - NGAP_E_RAB_SETUP_REQ(message_p).gNB_ue_ngap_id = enb_ue_ngap_id; - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABSetupRequestIEs_t, ie, container, - NGAP_ProtocolIE_ID_id_E_RABToBeSetupListBearerSUReq, true); + message_p = itti_alloc_new_message(TASK_NGAP, NGAP_PDUSESSION_SETUP_REQ); + NGAP_PDUSESSION_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; + NGAP_PDUSESSION_SETUP_REQ(message_p).amf_ue_ngap_id = amf_ue_ngap_id; + NGAP_PDUSESSION_SETUP_REQ(message_p).gNB_ue_ngap_id = enb_ue_ngap_id; + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONSetupRequestIEs_t, ie, container, + NGAP_ProtocolIE_ID_id_PDUSESSIONToBeSetupListBearerSUReq, true); if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - NGAP_E_RAB_SETUP_REQ(message_p).nb_e_rabs_tosetup = - ie->value.choice.E_RABToBeSetupListBearerSUReq.list.count; + NGAP_PDUSESSION_SETUP_REQ(message_p).nb_pdusessions_tosetup = + ie->value.choice.PDUSESSIONToBeSetupListBearerSUReq.list.count; - for (i = 0; i < ie->value.choice.E_RABToBeSetupListBearerSUReq.list.count; i++) { - NGAP_E_RABToBeSetupItemBearerSUReq_t *item_p; - item_p = &(((NGAP_E_RABToBeSetupItemBearerSUReqIEs_t *)ie->value.choice.E_RABToBeSetupListBearerSUReq.list.array[i])->value.choice.E_RABToBeSetupItemBearerSUReq); - NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].e_rab_id = item_p->e_RAB_ID; + for (i = 0; i < ie->value.choice.PDUSESSIONToBeSetupListBearerSUReq.list.count; i++) { + NGAP_PDUSESSIONToBeSetupItemBearerSUReq_t *item_p; + item_p = &(((NGAP_PDUSESSIONToBeSetupItemBearerSUReqIEs_t *)ie->value.choice.PDUSESSIONToBeSetupListBearerSUReq.list.array[i])->value.choice.PDUSESSIONToBeSetupItemBearerSUReq); + NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].pdusession_id = item_p->e_RAB_ID; // check for the NAS PDU if (item_p->nAS_PDU.size > 0 ) { - NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length = item_p->nAS_PDU.size; - NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size); - memcpy(NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer, + NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].nas_pdu.length = item_p->nAS_PDU.size; + NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size); + memcpy(NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].nas_pdu.buffer, item_p->nAS_PDU.buf, item_p->nAS_PDU.size); - // NGAP_INFO("received a NAS PDU with size %d (%02x.%02x)\n",NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length, item_p->nAS_PDU.buf[0], item_p->nAS_PDU.buf[1]); + // NGAP_INFO("received a NAS PDU with size %d (%02x.%02x)\n",NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].nas_pdu.length, item_p->nAS_PDU.buf[0], item_p->nAS_PDU.buf[1]); } else { - NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length = 0; - NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer = NULL; - NGAP_WARN("NAS PDU is not provided, generate a E_RAB_SETUP Failure (TBD) back to MME \n"); + NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].nas_pdu.length = 0; + NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].nas_pdu.buffer = NULL; + NGAP_WARN("NAS PDU is not provided, generate a PDUSESSION_SETUP Failure (TBD) back to AMF \n"); } /* Set the transport layer address */ - memcpy(NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.buffer, + memcpy(NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].sgw_addr.buffer, item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size); - NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length = + NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].sgw_addr.length = item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused; /* NGAP_INFO("sgw addr %s len: %d (size %d, index %d)\n", - NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.buffer, - NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length, + NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].sgw_addr.buffer, + NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].sgw_addr.length, item_p->transportLayerAddress.size, i); */ /* GTP tunnel endpoint ID */ - OCTET_STRING_TO_INT32(&item_p->gTP_TEID, NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].gtp_teid); + OCTET_STRING_TO_INT32(&item_p->gTP_TEID, NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].gtp_teid); /* Set the QOS informations */ - NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI; - NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.priority_level = + NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI; + NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].qos.allocation_retention_priority.priority_level = item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel; - NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.pre_emp_capability = + NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].qos.allocation_retention_priority.pre_emp_capability = item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionCapability; - NGAP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.pre_emp_vulnerability = + NGAP_PDUSESSION_SETUP_REQ(message_p).pdusession_setup_params[i].qos.allocation_retention_priority.pre_emp_vulnerability = item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability; } /* for i... */ @@ -1095,15 +1286,15 @@ static int ngap_gNB_handle_paging(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { - ngap_gNB_mme_data_t *mme_desc_p = NULL; + ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_instance_t *ngap_gNB_instance = NULL; MessageDef *message_p = NULL; NGAP_Paging_t *container; NGAP_PagingIEs_t *ie; DevAssert(pdu != NULL); container = &pdu->choice.initiatingMessage.value.choice.Paging; - // received Paging Message from MME - NGAP_DEBUG("[SCTP %d] Received Paging Message From MME\n",assoc_id); + // received Paging Message from AMF + NGAP_DEBUG("[SCTP %d] Received Paging Message From AMF\n",assoc_id); /* Paging procedure -> stream != 0 */ if (stream == 0) { @@ -1112,16 +1303,16 @@ int ngap_gNB_handle_paging(uint32_t assoc_id, return -1; } - if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { + if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) { NGAP_ERROR("[SCTP %d] Received Paging for non " - "existing MME context\n", assoc_id); + "existing AMF context\n", assoc_id); return -1; } - ngap_gNB_instance = mme_desc_p->ngap_gNB_instance; + ngap_gNB_instance = amf_desc_p->ngap_gNB_instance; if (ngap_gNB_instance == NULL) { - NGAP_ERROR("[SCTP %d] Received Paging for non existing MME context : ngap_gNB_instance is NULL\n", + NGAP_ERROR("[SCTP %d] Received Paging for non existing AMF context : ngap_gNB_instance is NULL\n", assoc_id); return -1; } @@ -1136,7 +1327,7 @@ int ngap_gNB_handle_paging(uint32_t assoc_id, NGAP_PAGING_IND(message_p).ue_index_value = BIT_STRING_to_uint32(&ie->value.choice.UEIdentityIndexValue); NGAP_DEBUG("[SCTP %d] Received Paging ue_index_value (%d)\n", assoc_id,(uint32_t)NGAP_PAGING_IND(message_p).ue_index_value); - NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code = 0; + NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.amf_code = 0; NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi = 0; } else { return -1; @@ -1150,7 +1341,7 @@ int ngap_gNB_handle_paging(uint32_t assoc_id, /* convert UE Paging Identity */ if (ie->value.choice.UEPagingID.present == NGAP_UEPagingID_PR_s_TMSI) { NGAP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_s_tmsi; - OCTET_STRING_TO_INT8(&ie->value.choice.UEPagingID.choice.s_TMSI.mMEC, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code); + OCTET_STRING_TO_INT8(&ie->value.choice.UEPagingID.choice.s_TMSI.mMEC, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.amf_code); OCTET_STRING_TO_INT32(&ie->value.choice.UEPagingID.choice.s_TMSI.m_TMSI, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi); } else if (ie->value.choice.UEPagingID.present == NGAP_UEPagingID_PR_iMSI) { NGAP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_imsi; @@ -1250,9 +1441,9 @@ int ngap_gNB_handle_paging(uint32_t assoc_id, NGAP_DEBUG("[SCTP %d] Received Paging parameters: ue_index_value %d cn_domain %d paging_drx %d paging_priority %d\n",assoc_id, NGAP_PAGING_IND(message_p).ue_index_value, NGAP_PAGING_IND(message_p).cn_domain, NGAP_PAGING_IND(message_p).paging_drx, NGAP_PAGING_IND(message_p).paging_priority); - NGAP_DEBUG("[SCTP %d] Received Paging parameters(ue): presenceMask %d s_tmsi.m_tmsi %d s_tmsi.mme_code %d IMSI length %d (0-5) %d%d%d%d%d%d\n",assoc_id, + NGAP_DEBUG("[SCTP %d] Received Paging parameters(ue): presenceMask %d s_tmsi.m_tmsi %d s_tmsi.amf_code %d IMSI length %d (0-5) %d%d%d%d%d%d\n",assoc_id, NGAP_PAGING_IND(message_p).ue_paging_identity.presenceMask, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi, - NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length, + NGAP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.amf_code, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length, NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[0], NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[1], NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2], NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[3], NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[4], NGAP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[5]); @@ -1262,38 +1453,38 @@ int ngap_gNB_handle_paging(uint32_t assoc_id, } static -int ngap_gNB_handle_e_rab_modify_request(uint32_t assoc_id, +int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { - int i, nb_of_e_rabs_failed; - ngap_gNB_mme_data_t *mme_desc_p = NULL; + int i, nb_of_pdusessions_failed; + ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL; MessageDef *message_p = NULL; - NGAP_E_RABModifyRequest_t *container; - NGAP_E_RABModifyRequestIEs_t *ie; + NGAP_PDUSESSIONModifyRequest_t *container; + NGAP_PDUSESSIONModifyRequestIEs_t *ie; NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id; - NGAP_MME_UE_NGAP_ID_t mme_ue_ngap_id; + NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id; DevAssert(pdu != NULL); - container = &pdu->choice.initiatingMessage.value.choice.E_RABModifyRequest; + container = &pdu->choice.initiatingMessage.value.choice.PDUSESSIONModifyRequest; - if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { + if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) { NGAP_ERROR("[SCTP %d] Received E-RAB modify request for non " - "existing MME context\n", assoc_id); + "existing AMF context\n", assoc_id); return -1; } - /* id-MME-UE-NGAP-ID */ - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABModifyRequestIEs_t, ie, container, - NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID, true); + /* id-AMF-UE-NGAP-ID */ + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONModifyRequestIEs_t, ie, container, + NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, true); if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - mme_ue_ngap_id = ie->value.choice.MME_UE_NGAP_ID; + amf_ue_ngap_id = ie->value.choice.AMF_UE_NGAP_ID; } else { return -1; } /* id-gNB-UE-NGAP-ID */ - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABModifyRequestIEs_t, ie, container, + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONModifyRequestIEs_t, ie, container, NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID, true); if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ @@ -1302,7 +1493,7 @@ int ngap_gNB_handle_e_rab_modify_request(uint32_t assoc_id, return -1; } - if ((ue_desc_p = ngap_gNB_get_ue_context(mme_desc_p->ngap_gNB_instance, + if ((ue_desc_p = ngap_gNB_get_ue_context(amf_desc_p->ngap_gNB_instance, enb_ue_ngap_id)) == NULL) { NGAP_ERROR("[SCTP %d] Received E-RAB modify request for non " "existing UE context 0x%06lx\n", assoc_id, @@ -1319,71 +1510,71 @@ int ngap_gNB_handle_e_rab_modify_request(uint32_t assoc_id, ue_desc_p->rx_stream = stream; - if (ue_desc_p->mme_ue_ngap_id != mme_ue_ngap_id) { - NGAP_WARN("UE context mme_ue_ngap_id is different form that of the message (%d != %ld)", - ue_desc_p->mme_ue_ngap_id, mme_ue_ngap_id); - message_p = itti_alloc_new_message (TASK_RRC_GNB, NGAP_E_RAB_MODIFY_RESP); - NGAP_E_RAB_MODIFY_RESP (message_p).gNB_ue_ngap_id = enb_ue_ngap_id; - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABModifyRequestIEs_t, ie, container, - NGAP_ProtocolIE_ID_id_E_RABToBeModifiedListBearerModReq, true); + if (ue_desc_p->amf_ue_ngap_id != amf_ue_ngap_id) { + NGAP_WARN("UE context amf_ue_ngap_id is different form that of the message (%d != %ld)", + ue_desc_p->amf_ue_ngap_id, amf_ue_ngap_id); + message_p = itti_alloc_new_message (TASK_RRC_GNB, NGAP_PDUSESSION_MODIFY_RESP); + NGAP_PDUSESSION_MODIFY_RESP (message_p).gNB_ue_ngap_id = enb_ue_ngap_id; + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONModifyRequestIEs_t, ie, container, + NGAP_ProtocolIE_ID_id_PDUSESSIONToBeModifiedListBearerModReq, true); if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - for(nb_of_e_rabs_failed = 0; nb_of_e_rabs_failed < ie->value.choice.E_RABToBeModifiedListBearerModReq.list.count; nb_of_e_rabs_failed++) { - NGAP_E_RABToBeModifiedItemBearerModReq_t *item_p; - item_p = &(((NGAP_E_RABToBeModifiedItemBearerModReqIEs_t *) - ie->value.choice.E_RABToBeModifiedListBearerModReq.list.array[nb_of_e_rabs_failed])->value.choice.E_RABToBeModifiedItemBearerModReq); - NGAP_E_RAB_MODIFY_RESP(message_p).e_rabs_failed[nb_of_e_rabs_failed].e_rab_id = item_p->e_RAB_ID; - NGAP_E_RAB_MODIFY_RESP(message_p).e_rabs_failed[nb_of_e_rabs_failed].cause = NGAP_Cause_PR_radioNetwork; - NGAP_E_RAB_MODIFY_RESP(message_p).e_rabs_failed[nb_of_e_rabs_failed].cause_value = NGAP_CauseRadioNetwork_unknown_mme_ue_ngap_id; + for(nb_of_pdusessions_failed = 0; nb_of_pdusessions_failed < ie->value.choice.PDUSESSIONToBeModifiedListBearerModReq.list.count; nb_of_pdusessions_failed++) { + NGAP_PDUSESSIONToBeModifiedItemBearerModReq_t *item_p; + item_p = &(((NGAP_PDUSESSIONToBeModifiedItemBearerModReqIEs_t *) + ie->value.choice.PDUSESSIONToBeModifiedListBearerModReq.list.array[nb_of_pdusessions_failed])->value.choice.PDUSESSIONToBeModifiedItemBearerModReq); + NGAP_PDUSESSION_MODIFY_RESP(message_p).pdusessions_failed[nb_of_pdusessions_failed].pdusession_id = item_p->e_RAB_ID; + NGAP_PDUSESSION_MODIFY_RESP(message_p).pdusessions_failed[nb_of_pdusessions_failed].cause = NGAP_Cause_PR_radioNetwork; + NGAP_PDUSESSION_MODIFY_RESP(message_p).pdusessions_failed[nb_of_pdusessions_failed].cause_value = NGAP_CauseRadioNetwork_unknown_amf_ue_ngap_id; } } else { return -1; } - NGAP_E_RAB_MODIFY_RESP(message_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed; - ngap_gNB_e_rab_modify_resp(mme_desc_p->ngap_gNB_instance->instance, - &NGAP_E_RAB_MODIFY_RESP(message_p)); + NGAP_PDUSESSION_MODIFY_RESP(message_p).nb_of_pdusessions_failed = nb_of_pdusessions_failed; + ngap_gNB_pdusession_modify_resp(amf_desc_p->ngap_gNB_instance->instance, + &NGAP_PDUSESSION_MODIFY_RESP(message_p)); itti_free(TASK_RRC_GNB,message_p); message_p = NULL; return -1; } - message_p = itti_alloc_new_message(TASK_NGAP, NGAP_E_RAB_MODIFY_REQ); - NGAP_E_RAB_MODIFY_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; - NGAP_E_RAB_MODIFY_REQ(message_p).mme_ue_ngap_id = mme_ue_ngap_id; - NGAP_E_RAB_MODIFY_REQ(message_p).gNB_ue_ngap_id = enb_ue_ngap_id; + message_p = itti_alloc_new_message(TASK_NGAP, NGAP_PDUSESSION_MODIFY_REQ); + NGAP_PDUSESSION_MODIFY_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; + NGAP_PDUSESSION_MODIFY_REQ(message_p).amf_ue_ngap_id = amf_ue_ngap_id; + NGAP_PDUSESSION_MODIFY_REQ(message_p).gNB_ue_ngap_id = enb_ue_ngap_id; /* id-E-RABToBeModifiedListBearerModReq */ - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABModifyRequestIEs_t, ie, container, - NGAP_ProtocolIE_ID_id_E_RABToBeModifiedListBearerModReq, true); + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONModifyRequestIEs_t, ie, container, + NGAP_ProtocolIE_ID_id_PDUSESSIONToBeModifiedListBearerModReq, true); if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - NGAP_E_RAB_MODIFY_REQ(message_p).nb_e_rabs_tomodify = - ie->value.choice.E_RABToBeModifiedListBearerModReq.list.count; + NGAP_PDUSESSION_MODIFY_REQ(message_p).nb_pdusessions_tomodify = + ie->value.choice.PDUSESSIONToBeModifiedListBearerModReq.list.count; - for (i = 0; i < ie->value.choice.E_RABToBeModifiedListBearerModReq.list.count; i++) { - NGAP_E_RABToBeModifiedItemBearerModReq_t *item_p; - item_p = &(((NGAP_E_RABToBeModifiedItemBearerModReqIEs_t *)ie->value.choice.E_RABToBeModifiedListBearerModReq.list.array[i])->value.choice.E_RABToBeModifiedItemBearerModReq); - NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].e_rab_id = item_p->e_RAB_ID; + for (i = 0; i < ie->value.choice.PDUSESSIONToBeModifiedListBearerModReq.list.count; i++) { + NGAP_PDUSESSIONToBeModifiedItemBearerModReq_t *item_p; + item_p = &(((NGAP_PDUSESSIONToBeModifiedItemBearerModReqIEs_t *)ie->value.choice.PDUSESSIONToBeModifiedListBearerModReq.list.array[i])->value.choice.PDUSESSIONToBeModifiedItemBearerModReq); + NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].pdusession_id = item_p->e_RAB_ID; // check for the NAS PDU if (item_p->nAS_PDU.size > 0 ) { - NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.length = item_p->nAS_PDU.size; - NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size); - memcpy(NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer, + NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].nas_pdu.length = item_p->nAS_PDU.size; + NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size); + memcpy(NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].nas_pdu.buffer, item_p->nAS_PDU.buf, item_p->nAS_PDU.size); } else { - NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.length = 0; - NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer = NULL; + NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].nas_pdu.length = 0; + NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].nas_pdu.buffer = NULL; continue; } /* Set the QOS informations */ - NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.qci = item_p->e_RABLevelQoSParameters.qCI; - NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.priority_level = + NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].qos.qci = item_p->e_RABLevelQoSParameters.qCI; + NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].qos.allocation_retention_priority.priority_level = item_p->e_RABLevelQoSParameters.allocationRetentionPriority.priorityLevel; - NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.pre_emp_capability = + NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].qos.allocation_retention_priority.pre_emp_capability = item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionCapability; - NGAP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.pre_emp_vulnerability = + NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].qos.allocation_retention_priority.pre_emp_vulnerability = item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability; } @@ -1396,38 +1587,38 @@ int ngap_gNB_handle_e_rab_modify_request(uint32_t assoc_id, } // handle e-rab release command and send it to rrc_end static -int ngap_gNB_handle_e_rab_release_command(uint32_t assoc_id, +int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { int i; - ngap_gNB_mme_data_t *mme_desc_p = NULL; + ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL; MessageDef *message_p = NULL; - NGAP_E_RABReleaseCommand_t *container; - NGAP_E_RABReleaseCommandIEs_t *ie; + NGAP_PDUSESSIONReleaseCommand_t *container; + NGAP_PDUSESSIONReleaseCommandIEs_t *ie; NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id; - NGAP_MME_UE_NGAP_ID_t mme_ue_ngap_id; + NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id; DevAssert(pdu != NULL); - container = &pdu->choice.initiatingMessage.value.choice.E_RABReleaseCommand; + container = &pdu->choice.initiatingMessage.value.choice.PDUSESSIONReleaseCommand; - if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { - NGAP_ERROR("[SCTP %d] Received E-RAB release command for non existing MME context\n", assoc_id); + if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) { + NGAP_ERROR("[SCTP %d] Received E-RAB release command for non existing AMF context\n", assoc_id); return -1; } - /* id-MME-UE-NGAP-ID */ - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABReleaseCommandIEs_t, ie, container, - NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID, true); + /* id-AMF-UE-NGAP-ID */ + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONReleaseCommandIEs_t, ie, container, + NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, true); if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - mme_ue_ngap_id = ie->value.choice.MME_UE_NGAP_ID; + amf_ue_ngap_id = ie->value.choice.AMF_UE_NGAP_ID; } else { return -1; } /* id-gNB-UE-NGAP-ID */ - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABReleaseCommandIEs_t, ie, container, + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONReleaseCommandIEs_t, ie, container, NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID, true); if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ @@ -1436,7 +1627,7 @@ int ngap_gNB_handle_e_rab_release_command(uint32_t assoc_id, return -1; } - if ((ue_desc_p = ngap_gNB_get_ue_context(mme_desc_p->ngap_gNB_instance, + if ((ue_desc_p = ngap_gNB_get_ue_context(amf_desc_p->ngap_gNB_instance, enb_ue_ngap_id)) == NULL) { NGAP_ERROR("[SCTP %d] Received E-RAB release command for non existing UE context 0x%06lx\n", assoc_id, ie->value.choice.GNB_UE_NGAP_ID); @@ -1452,43 +1643,43 @@ int ngap_gNB_handle_e_rab_release_command(uint32_t assoc_id, ue_desc_p->rx_stream = stream; - if (ue_desc_p->mme_ue_ngap_id != mme_ue_ngap_id) { - NGAP_WARN("UE context mme_ue_ngap_id is different form that of the message (%d != %ld)", - ue_desc_p->mme_ue_ngap_id, mme_ue_ngap_id); + if (ue_desc_p->amf_ue_ngap_id != amf_ue_ngap_id) { + NGAP_WARN("UE context amf_ue_ngap_id is different form that of the message (%d != %ld)", + ue_desc_p->amf_ue_ngap_id, amf_ue_ngap_id); } - NGAP_DEBUG("[SCTP %d] Received E-RAB release command for gNB_UE_NGAP_ID %ld mme_ue_ngap_id %ld\n", - assoc_id, enb_ue_ngap_id, mme_ue_ngap_id); - message_p = itti_alloc_new_message(TASK_NGAP, NGAP_E_RAB_RELEASE_COMMAND); - NGAP_E_RAB_RELEASE_COMMAND(message_p).gNB_ue_ngap_id = enb_ue_ngap_id; - NGAP_E_RAB_RELEASE_COMMAND(message_p).mme_ue_ngap_id = mme_ue_ngap_id; + NGAP_DEBUG("[SCTP %d] Received E-RAB release command for gNB_UE_NGAP_ID %ld amf_ue_ngap_id %ld\n", + assoc_id, enb_ue_ngap_id, amf_ue_ngap_id); + message_p = itti_alloc_new_message(TASK_NGAP, NGAP_PDUSESSION_RELEASE_COMMAND); + NGAP_PDUSESSION_RELEASE_COMMAND(message_p).gNB_ue_ngap_id = enb_ue_ngap_id; + NGAP_PDUSESSION_RELEASE_COMMAND(message_p).amf_ue_ngap_id = amf_ue_ngap_id; /* id-NAS-PDU */ - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABReleaseCommandIEs_t, ie, container, + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONReleaseCommandIEs_t, ie, container, NGAP_ProtocolIE_ID_id_NAS_PDU, false); if(ie && ie->value.choice.NAS_PDU.size > 0) { - NGAP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = ie->value.choice.NAS_PDU.size; - NGAP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer = + NGAP_PDUSESSION_RELEASE_COMMAND(message_p).nas_pdu.length = ie->value.choice.NAS_PDU.size; + NGAP_PDUSESSION_RELEASE_COMMAND(message_p).nas_pdu.buffer = malloc(sizeof(uint8_t) * ie->value.choice.NAS_PDU.size); - memcpy(NGAP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer, + memcpy(NGAP_PDUSESSION_RELEASE_COMMAND(message_p).nas_pdu.buffer, ie->value.choice.NAS_PDU.buf, ie->value.choice.NAS_PDU.size); } else { - NGAP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = 0; - NGAP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer = NULL; + NGAP_PDUSESSION_RELEASE_COMMAND(message_p).nas_pdu.length = 0; + NGAP_PDUSESSION_RELEASE_COMMAND(message_p).nas_pdu.buffer = NULL; } /* id-E-RABToBeReleasedList */ - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_E_RABReleaseCommandIEs_t, ie, container, - NGAP_ProtocolIE_ID_id_E_RABToBeReleasedList, true); + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSESSIONReleaseCommandIEs_t, ie, container, + NGAP_ProtocolIE_ID_id_PDUSESSIONToBeReleasedList, true); if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ - NGAP_E_RAB_RELEASE_COMMAND(message_p).nb_e_rabs_torelease = ie->value.choice.E_RABList.list.count; + NGAP_PDUSESSION_RELEASE_COMMAND(message_p).nb_pdusessions_torelease = ie->value.choice.PDUSESSIONList.list.count; - for (i = 0; i < ie->value.choice.E_RABList.list.count; i++) { - NGAP_E_RABItem_t *item_p; - item_p = &(((NGAP_E_RABItemIEs_t *)ie->value.choice.E_RABList.list.array[i])->value.choice.E_RABItem); - NGAP_E_RAB_RELEASE_COMMAND(message_p).e_rab_release_params[i].e_rab_id = item_p->e_RAB_ID; + for (i = 0; i < ie->value.choice.PDUSESSIONList.list.count; i++) { + NGAP_PDUSESSIONItem_t *item_p; + item_p = &(((NGAP_PDUSESSIONItemIEs_t *)ie->value.choice.PDUSESSIONList.list.array[i])->value.choice.PDUSESSIONItem); + NGAP_PDUSESSION_RELEASE_COMMAND(message_p).pdusession_release_params[i].pdusession_id = item_p->e_RAB_ID; NGAP_DEBUG("[SCTP] Received E-RAB release command for e-rab id %ld\n", item_p->e_RAB_ID); } } else { @@ -1500,18 +1691,18 @@ int ngap_gNB_handle_e_rab_release_command(uint32_t assoc_id, } static -int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, +int ngap_gNB_handle_ng_path_switch_request_ack(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { - ngap_gNB_mme_data_t *mme_desc_p = NULL; + ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_ue_context_t *ue_desc_p = NULL; MessageDef *message_p = NULL; NGAP_PathSwitchRequestAcknowledge_t *pathSwitchRequestAcknowledge; NGAP_PathSwitchRequestAcknowledgeIEs_t *ie; - NGAP_E_RABToBeSwitchedULItemIEs_t *ngap_E_RABToBeSwitchedULItemIEs; - NGAP_E_RABToBeSwitchedULItem_t *ngap_E_RABToBeSwitchedULItem; - NGAP_E_RABItemIEs_t *e_RABItemIEs; - NGAP_E_RABItem_t *e_RABItem; + NGAP_PDUSESSIONToBeSwitchedULItemIEs_t *ngap_PDUSESSIONToBeSwitchedULItemIEs; + NGAP_PDUSESSIONToBeSwitchedULItem_t *ngap_PDUSESSIONToBeSwitchedULItem; + NGAP_PDUSESSIONItemIEs_t *e_RABItemIEs; + NGAP_PDUSESSIONItem_t *e_RABItem; DevAssert(pdu != NULL); pathSwitchRequestAcknowledge = &pdu->choice.successfulOutcome.value.choice.PathSwitchRequestAcknowledge; @@ -1522,9 +1713,9 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, //return -1; } - if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { + if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) { NGAP_ERROR("[SCTP %d] Received S1 path switch request ack for non existing " - "MME context\n", assoc_id); + "AMF context\n", assoc_id); return -1; } @@ -1541,7 +1732,7 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, NGAP_PATH_SWITCH_REQ_ACK(message_p).gNB_ue_ngap_id = ie->value.choice.GNB_UE_NGAP_ID; - if ((ue_desc_p = ngap_gNB_get_ue_context(mme_desc_p->ngap_gNB_instance, + if ((ue_desc_p = ngap_gNB_get_ue_context(amf_desc_p->ngap_gNB_instance, ie->value.choice.GNB_UE_NGAP_ID)) == NULL) { NGAP_ERROR("[SCTP %d] Received path switch request ack for non " "existing UE context 0x%06lx\n", assoc_id, @@ -1553,7 +1744,7 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, NGAP_PATH_SWITCH_REQ_ACK(message_p).ue_initial_id = ue_desc_p->ue_initial_id; /* mandatory */ NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PathSwitchRequestAcknowledgeIEs_t, ie, pathSwitchRequestAcknowledge, - NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID, true); + NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, true); if (ie == NULL) { NGAP_ERROR("[SCTP %d] Received path switch request ack for non " @@ -1561,11 +1752,11 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, return -1; } - NGAP_PATH_SWITCH_REQ_ACK(message_p).mme_ue_ngap_id = ie->value.choice.MME_UE_NGAP_ID; + NGAP_PATH_SWITCH_REQ_ACK(message_p).amf_ue_ngap_id = ie->value.choice.AMF_UE_NGAP_ID; - if ( ue_desc_p->mme_ue_ngap_id != ie->value.choice.MME_UE_NGAP_ID) { - NGAP_WARN("UE context mme_ue_ngap_id is different form that of the message (%d != %ld)", - ue_desc_p->mme_ue_ngap_id, ie->value.choice.MME_UE_NGAP_ID); + if ( ue_desc_p->amf_ue_ngap_id != ie->value.choice.AMF_UE_NGAP_ID) { + NGAP_WARN("UE context amf_ue_ngap_id is different form that of the message (%d != %ld)", + ue_desc_p->amf_ue_ngap_id, ie->value.choice.AMF_UE_NGAP_ID); } /* mandatory */ @@ -1604,42 +1795,42 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, /* optional */ NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PathSwitchRequestAcknowledgeIEs_t, ie, pathSwitchRequestAcknowledge, - NGAP_ProtocolIE_ID_id_E_RABToBeSwitchedULList, false); + NGAP_ProtocolIE_ID_id_PDUSESSIONToBeSwitchedULList, false); if (ie) { - NGAP_PATH_SWITCH_REQ_ACK(message_p).nb_e_rabs_tobeswitched = ie->value.choice.E_RABToBeSwitchedULList.list.count; + NGAP_PATH_SWITCH_REQ_ACK(message_p).nb_pdusessions_tobeswitched = ie->value.choice.PDUSESSIONToBeSwitchedULList.list.count; - for (int i = 0; i < ie->value.choice.E_RABToBeSwitchedULList.list.count; i++) { - ngap_E_RABToBeSwitchedULItemIEs = (NGAP_E_RABToBeSwitchedULItemIEs_t *)ie->value.choice.E_RABToBeSwitchedULList.list.array[i]; - ngap_E_RABToBeSwitchedULItem = &ngap_E_RABToBeSwitchedULItemIEs->value.choice.E_RABToBeSwitchedULItem; - NGAP_PATH_SWITCH_REQ_ACK (message_p).e_rabs_tobeswitched[i].e_rab_id = ngap_E_RABToBeSwitchedULItem->e_RAB_ID; - memcpy(NGAP_PATH_SWITCH_REQ_ACK (message_p).e_rabs_tobeswitched[i].sgw_addr.buffer, - ngap_E_RABToBeSwitchedULItem->transportLayerAddress.buf, ngap_E_RABToBeSwitchedULItem->transportLayerAddress.size); - NGAP_PATH_SWITCH_REQ_ACK (message_p).e_rabs_tobeswitched[i].sgw_addr.length = - ngap_E_RABToBeSwitchedULItem->transportLayerAddress.size * 8 - ngap_E_RABToBeSwitchedULItem->transportLayerAddress.bits_unused; - OCTET_STRING_TO_INT32(&ngap_E_RABToBeSwitchedULItem->gTP_TEID, - NGAP_PATH_SWITCH_REQ_ACK (message_p).e_rabs_tobeswitched[i].gtp_teid); + for (int i = 0; i < ie->value.choice.PDUSESSIONToBeSwitchedULList.list.count; i++) { + ngap_PDUSESSIONToBeSwitchedULItemIEs = (NGAP_PDUSESSIONToBeSwitchedULItemIEs_t *)ie->value.choice.PDUSESSIONToBeSwitchedULList.list.array[i]; + ngap_PDUSESSIONToBeSwitchedULItem = &ngap_PDUSESSIONToBeSwitchedULItemIEs->value.choice.PDUSESSIONToBeSwitchedULItem; + NGAP_PATH_SWITCH_REQ_ACK (message_p).pdusessions_tobeswitched[i].pdusession_id = ngap_PDUSESSIONToBeSwitchedULItem->e_RAB_ID; + memcpy(NGAP_PATH_SWITCH_REQ_ACK (message_p).pdusessions_tobeswitched[i].sgw_addr.buffer, + ngap_PDUSESSIONToBeSwitchedULItem->transportLayerAddress.buf, ngap_PDUSESSIONToBeSwitchedULItem->transportLayerAddress.size); + NGAP_PATH_SWITCH_REQ_ACK (message_p).pdusessions_tobeswitched[i].sgw_addr.length = + ngap_PDUSESSIONToBeSwitchedULItem->transportLayerAddress.size * 8 - ngap_PDUSESSIONToBeSwitchedULItem->transportLayerAddress.bits_unused; + OCTET_STRING_TO_INT32(&ngap_PDUSESSIONToBeSwitchedULItem->gTP_TEID, + NGAP_PATH_SWITCH_REQ_ACK (message_p).pdusessions_tobeswitched[i].gtp_teid); } } else { - NGAP_WARN("E_RABToBeSwitchedULList not supported\n"); - NGAP_PATH_SWITCH_REQ_ACK(message_p).nb_e_rabs_tobeswitched = 0; + NGAP_WARN("PDUSESSIONToBeSwitchedULList not supported\n"); + NGAP_PATH_SWITCH_REQ_ACK(message_p).nb_pdusessions_tobeswitched = 0; } /* optional */ NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PathSwitchRequestAcknowledgeIEs_t, ie, pathSwitchRequestAcknowledge, - NGAP_ProtocolIE_ID_id_E_RABToBeReleasedList, false); + NGAP_ProtocolIE_ID_id_PDUSESSIONToBeReleasedList, false); if (ie) { - NGAP_PATH_SWITCH_REQ_ACK(message_p).nb_e_rabs_tobereleased = ie->value.choice.E_RABList.list.count; + NGAP_PATH_SWITCH_REQ_ACK(message_p).nb_pdusessions_tobereleased = ie->value.choice.PDUSESSIONList.list.count; - for (int i = 0; i < ie->value.choice.E_RABList.list.count; i++) { - e_RABItemIEs = (NGAP_E_RABItemIEs_t *)ie->value.choice.E_RABList.list.array[i]; - e_RABItem = &e_RABItemIEs->value.choice.E_RABItem; - NGAP_PATH_SWITCH_REQ_ACK (message_p).e_rabs_tobereleased[i].e_rab_id = e_RABItem->e_RAB_ID; + for (int i = 0; i < ie->value.choice.PDUSESSIONList.list.count; i++) { + e_RABItemIEs = (NGAP_PDUSESSIONItemIEs_t *)ie->value.choice.PDUSESSIONList.list.array[i]; + e_RABItem = &e_RABItemIEs->value.choice.PDUSESSIONItem; + NGAP_PATH_SWITCH_REQ_ACK (message_p).pdusessions_tobereleased[i].pdusession_id = e_RABItem->e_RAB_ID; } } else { - NGAP_WARN("E_RABToBeReleasedList not supported\n"); - NGAP_PATH_SWITCH_REQ_ACK(message_p).nb_e_rabs_tobereleased = 0; + NGAP_WARN("PDUSESSIONToBeReleasedList not supported\n"); + NGAP_PATH_SWITCH_REQ_ACK(message_p).nb_pdusessions_tobereleased = 0; } /* optional */ @@ -1652,10 +1843,10 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, /* optional */ NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PathSwitchRequestAcknowledgeIEs_t, ie, pathSwitchRequestAcknowledge, - NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID_2, false); + NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID_2, false); if(!ie) { - NGAP_WARN("MME_UE_NGAP_ID_2 flag not supported\n"); + NGAP_WARN("AMF_UE_NGAP_ID_2 flag not supported\n"); } // TODO continue @@ -1664,10 +1855,10 @@ int ngap_gNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, } static -int ngap_gNB_handle_s1_path_switch_request_failure(uint32_t assoc_id, +int ngap_gNB_handle_ng_path_switch_request_failure(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { - ngap_gNB_mme_data_t *mme_desc_p = NULL; + ngap_gNB_amf_data_t *amf_desc_p = NULL; NGAP_PathSwitchRequestFailure_t *pathSwitchRequestFailure; NGAP_PathSwitchRequestFailureIEs_t *ie; DevAssert(pdu != NULL); @@ -1679,9 +1870,9 @@ int ngap_gNB_handle_s1_path_switch_request_failure(uint32_t assoc_ return -1; } - if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { + if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) { NGAP_ERROR("[SCTP %d] Received S1 path switch request failure for non existing " - "MME context\n", assoc_id); + "AMF context\n", assoc_id); return -1; } @@ -1732,7 +1923,7 @@ int ngap_gNB_handle_s1_path_switch_request_failure(uint32_t assoc_ } static -int ngap_gNB_handle_s1_ENDC_e_rab_modification_confirm(uint32_t assoc_id, +int ngap_gNB_handle_ng_ENDC_pdusession_modification_confirm(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu){ diff --git a/openair3/NGAP/ngap_gNB_handlers.h b/openair3/NGAP/ngap_gNB_handlers.h index 0c7fac1227..f490cd769a 100644 --- a/openair3/NGAP/ngap_gNB_handlers.h +++ b/openair3/NGAP/ngap_gNB_handlers.h @@ -22,7 +22,7 @@ #ifndef NGAP_GNB_HANDLERS_H_ #define NGAP_GNB_HANDLERS_H_ -void ngap_handle_s1_setup_message(ngap_gNB_mme_data_t *mme_desc_p, int sctp_shutdown); +void ngap_handle_ng_setup_message(ngap_gNB_amf_data_t *amf_desc_p, int sctp_shutdown); int ngap_gNB_handle_message(uint32_t assoc_id, int32_t stream, const uint8_t * const data, const uint32_t data_length); diff --git a/openair3/NGAP/ngap_gNB_management_procedures.c b/openair3/NGAP/ngap_gNB_management_procedures.c index 14031014f5..9f929d7ea1 100644 --- a/openair3/NGAP/ngap_gNB_management_procedures.c +++ b/openair3/NGAP/ngap_gNB_management_procedures.c @@ -43,10 +43,10 @@ ngap_gNB_internal_data_t ngap_gNB_internal_data; -RB_GENERATE(ngap_mme_map, ngap_gNB_mme_data_s, entry, ngap_gNB_compare_assoc_id); +RB_GENERATE(ngap_amf_map, ngap_gNB_amf_data_s, entry, ngap_gNB_compare_assoc_id); int ngap_gNB_compare_assoc_id( - struct ngap_gNB_mme_data_s *p1, struct ngap_gNB_mme_data_s *p2) + struct ngap_gNB_amf_data_s *p1, struct ngap_gNB_amf_data_s *p2) { if (p1->assoc_id == -1) { if (p1->cnx_id < p2->cnx_id) { @@ -89,14 +89,14 @@ void ngap_gNB_insert_new_instance(ngap_gNB_instance_t *new_instance_p) new_instance_p, ngap_gNB_entries); } -struct ngap_gNB_mme_data_s *ngap_gNB_get_MME( +struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF( ngap_gNB_instance_t *instance_p, int32_t assoc_id, uint16_t cnx_id) { - struct ngap_gNB_mme_data_s temp; - struct ngap_gNB_mme_data_s *found; + struct ngap_gNB_amf_data_s temp; + struct ngap_gNB_amf_data_s *found; - memset(&temp, 0, sizeof(struct ngap_gNB_mme_data_s)); + memset(&temp, 0, sizeof(struct ngap_gNB_amf_data_s)); temp.assoc_id = assoc_id; temp.cnx_id = cnx_id; @@ -104,30 +104,30 @@ struct ngap_gNB_mme_data_s *ngap_gNB_get_MME( if (instance_p == NULL) { STAILQ_FOREACH(instance_p, &ngap_gNB_internal_data.ngap_gNB_instances_head, ngap_gNB_entries) { - found = RB_FIND(ngap_mme_map, &instance_p->ngap_mme_head, &temp); + found = RB_FIND(ngap_amf_map, &instance_p->ngap_amf_head, &temp); if (found != NULL) { return found; } } } else { - return RB_FIND(ngap_mme_map, &instance_p->ngap_mme_head, &temp); + return RB_FIND(ngap_amf_map, &instance_p->ngap_amf_head, &temp); } return NULL; } -struct ngap_gNB_mme_data_s *ngap_gNB_get_MME_from_instance( +struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF_from_instance( ngap_gNB_instance_t *instance_p) { - struct ngap_gNB_mme_data_s *mme = NULL; - struct ngap_gNB_mme_data_s *mme_next = NULL; + struct ngap_gNB_amf_data_s *amf = NULL; + struct ngap_gNB_amf_data_s *amf_next = NULL; - for (mme = RB_MIN(ngap_mme_map, &instance_p->ngap_mme_head); mme!=NULL ; mme = mme_next) { - mme_next = RB_NEXT(ngap_mme_map, &instance_p->ngap_mme_head, mme); - if (mme->ngap_gNB_instance == instance_p) { - return mme; + for (amf = RB_MIN(ngap_amf_map, &instance_p->ngap_amf_head); amf!=NULL ; amf = amf_next) { + amf_next = RB_NEXT(ngap_amf_map, &instance_p->ngap_amf_head, amf); + if (amf->ngap_gNB_instance == instance_p) { + return amf; } } @@ -149,40 +149,40 @@ ngap_gNB_instance_t *ngap_gNB_get_instance(instance_t instance) return NULL; } -void ngap_gNB_remove_mme_desc(ngap_gNB_instance_t * instance) +void ngap_gNB_remove_amf_desc(ngap_gNB_instance_t * instance) { - struct ngap_gNB_mme_data_s *mme = NULL; - struct ngap_gNB_mme_data_s *mmeNext = NULL; + struct ngap_gNB_amf_data_s *amf = NULL; + struct ngap_gNB_amf_data_s *amfNext = NULL; struct plmn_identity_s* plmnInfo; struct served_group_id_s* groupInfo; - struct served_gummei_s* gummeiInfo; - struct mme_code_s* mmeCode; + struct served_guami_s* guamInfo; + struct amf_code_s* amfCode; - for (mme = RB_MIN(ngap_mme_map, &instance->ngap_mme_head); mme; mme = mmeNext) { - mmeNext = RB_NEXT(ngap_mme_map, &instance->ngap_mme_head, mme); - RB_REMOVE(ngap_mme_map, &instance->ngap_mme_head, mme); - while (!STAILQ_EMPTY(&mme->served_gummei)) { - gummeiInfo = STAILQ_FIRST(&mme->served_gummei); - STAILQ_REMOVE_HEAD(&mme->served_gummei, next); + for (amf = RB_MIN(ngap_amf_map, &instance->ngap_amf_head); amf; amf = amfNext) { + amfNext = RB_NEXT(ngap_amf_map, &instance->ngap_amf_head, amf); + RB_REMOVE(ngap_amf_map, &instance->ngap_amf_head, amf); + while (!STAILQ_EMPTY(&amf->served_guami)) { + guamInfo = STAILQ_FIRST(&amf->served_guami); + STAILQ_REMOVE_HEAD(&amf->served_guami, next); - while (!STAILQ_EMPTY(&gummeiInfo->served_plmns)) { - plmnInfo = STAILQ_FIRST(&gummeiInfo->served_plmns); - STAILQ_REMOVE_HEAD(&gummeiInfo->served_plmns, next); + while (!STAILQ_EMPTY(&guamInfo->served_plmns)) { + plmnInfo = STAILQ_FIRST(&guamInfo->served_plmns); + STAILQ_REMOVE_HEAD(&guamInfo->served_plmns, next); free(plmnInfo); } - while (!STAILQ_EMPTY(&gummeiInfo->served_group_ids)) { - groupInfo = STAILQ_FIRST(&gummeiInfo->served_group_ids); - STAILQ_REMOVE_HEAD(&gummeiInfo->served_group_ids, next); + while (!STAILQ_EMPTY(&guamInfo->served_group_ids)) { + groupInfo = STAILQ_FIRST(&guamInfo->served_group_ids); + STAILQ_REMOVE_HEAD(&guamInfo->served_group_ids, next); free(groupInfo); } - while (!STAILQ_EMPTY(&gummeiInfo->mme_codes)) { - mmeCode = STAILQ_FIRST(&gummeiInfo->mme_codes); - STAILQ_REMOVE_HEAD(&gummeiInfo->mme_codes, next); - free(mmeCode); + while (!STAILQ_EMPTY(&guamInfo->amf_codes)) { + amfCode = STAILQ_FIRST(&guamInfo->amf_codes); + STAILQ_REMOVE_HEAD(&guamInfo->amf_codes, next); + free(amfCode); } - free(gummeiInfo); + free(guamInfo); } - free(mme); + free(amf); } } diff --git a/openair3/NGAP/ngap_gNB_management_procedures.h b/openair3/NGAP/ngap_gNB_management_procedures.h index fdafb73db7..4400478e59 100644 --- a/openair3/NGAP/ngap_gNB_management_procedures.h +++ b/openair3/NGAP/ngap_gNB_management_procedures.h @@ -22,13 +22,13 @@ #ifndef NGAP_GNB_MANAGEMENT_PROCEDURES_H_ #define NGAP_GNB_MANAGEMENT_PROCEDURES_H_ -struct ngap_gNB_mme_data_s *ngap_gNB_get_MME( +struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF( ngap_gNB_instance_t *instance_p, int32_t assoc_id, uint16_t cnx_id); -struct ngap_gNB_mme_data_s *ngap_gNB_get_MME_from_instance(ngap_gNB_instance_t *instance_p); +struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF_from_instance(ngap_gNB_instance_t *instance_p); -void ngap_gNB_remove_mme_desc(ngap_gNB_instance_t * instance); +void ngap_gNB_remove_amf_desc(ngap_gNB_instance_t * instance); void ngap_gNB_insert_new_instance(ngap_gNB_instance_t *new_instance_p); diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.c b/openair3/NGAP/ngap_gNB_nas_procedures.c index 9731a6f18d..389f4a4cde 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.c +++ b/openair3/NGAP/ngap_gNB_nas_procedures.c @@ -54,7 +54,7 @@ int ngap_gNB_handle_nas_first_req( //------------------------------------------------------------------------------ { ngap_gNB_instance_t *instance_p = NULL; - struct ngap_gNB_mme_data_s *mme_desc_p = NULL; + struct ngap_gNB_amf_data_s *amf_desc_p = NULL; struct ngap_gNB_ue_context_s *ue_desc_p = NULL; NGAP_NGAP_PDU_t pdu; NGAP_InitialUEMessage_t *out; @@ -72,40 +72,40 @@ int ngap_gNB_handle_nas_first_req( pdu.choice.initiatingMessage.value.present = NGAP_InitiatingMessage__value_PR_InitialUEMessage; out = &pdu.choice.initiatingMessage.value.choice.InitialUEMessage; - /* Select the MME corresponding to the provided GUMMEI. */ - if (ngap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_gummei) { - mme_desc_p = ngap_gNB_nnsf_select_mme_by_gummei( + /* Select the AMF corresponding to the provided GUAMI. */ + if (ngap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_guami) { + amf_desc_p = ngap_gNB_nnsf_select_amf_by_guami( instance_p, ngap_nas_first_req_p->establishment_cause, - ngap_nas_first_req_p->ue_identity.gummei); + ngap_nas_first_req_p->ue_identity.guami); - if (mme_desc_p) { - NGAP_INFO("[gNB %d] Chose MME '%s' (assoc_id %d) through GUMMEI MCC %d MNC %d MMEGI %d MMEC %d\n", + if (amf_desc_p) { + NGAP_INFO("[gNB %d] Chose AMF '%s' (assoc_id %d) through GUAMI MCC %d MNC %d AMFGI %d AMFC %d\n", instance, - mme_desc_p->mme_name, - mme_desc_p->assoc_id, - ngap_nas_first_req_p->ue_identity.gummei.mcc, - ngap_nas_first_req_p->ue_identity.gummei.mnc, - ngap_nas_first_req_p->ue_identity.gummei.mme_group_id, - ngap_nas_first_req_p->ue_identity.gummei.mme_code); + amf_desc_p->amf_name, + amf_desc_p->assoc_id, + ngap_nas_first_req_p->ue_identity.guami.mcc, + ngap_nas_first_req_p->ue_identity.guami.mnc, + ngap_nas_first_req_p->ue_identity.guami.amf_group_id, + ngap_nas_first_req_p->ue_identity.guami.amf_code); } } - if (mme_desc_p == NULL) { - /* Select the MME corresponding to the provided s-TMSI. */ + if (amf_desc_p == NULL) { + /* Select the AMF corresponding to the provided s-TMSI. */ if (ngap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_s_tmsi) { - mme_desc_p = ngap_gNB_nnsf_select_mme_by_mme_code( + amf_desc_p = ngap_gNB_nnsf_select_amf_by_amf_code( instance_p, ngap_nas_first_req_p->establishment_cause, ngap_nas_first_req_p->selected_plmn_identity, - ngap_nas_first_req_p->ue_identity.s_tmsi.mme_code); + ngap_nas_first_req_p->ue_identity.s_tmsi.amf_code); - if (mme_desc_p) { - NGAP_INFO("[gNB %d] Chose MME '%s' (assoc_id %d) through S-TMSI MMEC %d and selected PLMN Identity index %d MCC %d MNC %d\n", + if (amf_desc_p) { + NGAP_INFO("[gNB %d] Chose AMF '%s' (assoc_id %d) through S-TMSI AMFC %d and selected PLMN Identity index %d MCC %d MNC %d\n", instance, - mme_desc_p->mme_name, - mme_desc_p->assoc_id, - ngap_nas_first_req_p->ue_identity.s_tmsi.mme_code, + amf_desc_p->amf_name, + amf_desc_p->assoc_id, + ngap_nas_first_req_p->ue_identity.s_tmsi.amf_code, ngap_nas_first_req_p->selected_plmn_identity, instance_p->mcc[ngap_nas_first_req_p->selected_plmn_identity], instance_p->mnc[ngap_nas_first_req_p->selected_plmn_identity]); @@ -113,48 +113,48 @@ int ngap_gNB_handle_nas_first_req( } } - if (mme_desc_p == NULL) { - /* Select MME based on the selected PLMN identity, received through RRC + if (amf_desc_p == NULL) { + /* Select AMF based on the selected PLMN identity, received through RRC * Connection Setup Complete */ - mme_desc_p = ngap_gNB_nnsf_select_mme_by_plmn_id( + amf_desc_p = ngap_gNB_nnsf_select_amf_by_plmn_id( instance_p, ngap_nas_first_req_p->establishment_cause, ngap_nas_first_req_p->selected_plmn_identity); - if (mme_desc_p) { - NGAP_INFO("[gNB %d] Chose MME '%s' (assoc_id %d) through selected PLMN Identity index %d MCC %d MNC %d\n", + if (amf_desc_p) { + NGAP_INFO("[gNB %d] Chose AMF '%s' (assoc_id %d) through selected PLMN Identity index %d MCC %d MNC %d\n", instance, - mme_desc_p->mme_name, - mme_desc_p->assoc_id, + amf_desc_p->amf_name, + amf_desc_p->assoc_id, ngap_nas_first_req_p->selected_plmn_identity, instance_p->mcc[ngap_nas_first_req_p->selected_plmn_identity], instance_p->mnc[ngap_nas_first_req_p->selected_plmn_identity]); } } - if (mme_desc_p == NULL) { + if (amf_desc_p == NULL) { /* - * If no MME corresponds to the GUMMEI, the s-TMSI, or the selected PLMN - * identity, selects the MME with the highest capacity. + * If no AMF corresponds to the GUAMI, the s-TMSI, or the selected PLMN + * identity, selects the AMF with the highest capacity. */ - mme_desc_p = ngap_gNB_nnsf_select_mme( + amf_desc_p = ngap_gNB_nnsf_select_amf( instance_p, ngap_nas_first_req_p->establishment_cause); - if (mme_desc_p) { - NGAP_INFO("[gNB %d] Chose MME '%s' (assoc_id %d) through highest relative capacity\n", + if (amf_desc_p) { + NGAP_INFO("[gNB %d] Chose AMF '%s' (assoc_id %d) through highest relative capacity\n", instance, - mme_desc_p->mme_name, - mme_desc_p->assoc_id); + amf_desc_p->amf_name, + amf_desc_p->assoc_id); } } - if (mme_desc_p == NULL) { + if (amf_desc_p == NULL) { /* - * In case gNB has no MME associated, the gNB should inform RRC and discard + * In case gNB has no AMF associated, the gNB should inform RRC and discard * this request. */ - NGAP_WARN("No MME is associated to the gNB\n"); + NGAP_WARN("No AMF is associated to the gNB\n"); // TODO: Inform RRC return -1; } @@ -164,8 +164,8 @@ int ngap_gNB_handle_nas_first_req( */ ue_desc_p = ngap_gNB_allocate_new_UE_context(); DevAssert(ue_desc_p != NULL); - /* Keep a reference to the selected MME */ - ue_desc_p->mme_ref = mme_desc_p; + /* Keep a reference to the selected AMF */ + ue_desc_p->amf_ref = amf_desc_p; ue_desc_p->ue_initial_id = ngap_nas_first_req_p->ue_initial_id; ue_desc_p->gNB_instance = instance_p; ue_desc_p->selected_plmn_identity = ngap_nas_first_req_p->selected_plmn_identity; @@ -255,7 +255,7 @@ int ngap_gNB_handle_nas_first_req( ie->id = NGAP_ProtocolIE_ID_id_S_TMSI; ie->criticality = NGAP_Criticality_reject; ie->value.present = NGAP_InitialUEMessage_IEs__value_PR_S_TMSI; - MME_CODE_TO_OCTET_STRING(ngap_nas_first_req_p->ue_identity.s_tmsi.mme_code, + AMF_CODE_TO_OCTET_STRING(ngap_nas_first_req_p->ue_identity.s_tmsi.amf_code, &ie->value.choice.S_TMSI.mMEC); M_TMSI_TO_OCTET_STRING(ngap_nas_first_req_p->ue_identity.s_tmsi.m_tmsi, &ie->value.choice.S_TMSI.m_TMSI); @@ -264,21 +264,21 @@ int ngap_gNB_handle_nas_first_req( /* optional */ - if (ngap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_gummei) { - NGAP_DEBUG("GUMMEI_ID_PRESENT\n"); + if (ngap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_guami) { + NGAP_DEBUG("GUAMI_ID_PRESENT\n"); ie = (NGAP_InitialUEMessage_IEs_t *)calloc(1, sizeof(NGAP_InitialUEMessage_IEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_GUMMEI_ID; + ie->id = NGAP_ProtocolIE_ID_id_GUAMI_ID; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_InitialUEMessage_IEs__value_PR_GUMMEI; + ie->value.present = NGAP_InitialUEMessage_IEs__value_PR_GUAMI; MCC_MNC_TO_PLMNID( - ngap_nas_first_req_p->ue_identity.gummei.mcc, - ngap_nas_first_req_p->ue_identity.gummei.mnc, - ngap_nas_first_req_p->ue_identity.gummei.mnc_len, - &ie->value.choice.GUMMEI.pLMN_Identity); - MME_GID_TO_OCTET_STRING(ngap_nas_first_req_p->ue_identity.gummei.mme_group_id, - &ie->value.choice.GUMMEI.mME_Group_ID); - MME_CODE_TO_OCTET_STRING(ngap_nas_first_req_p->ue_identity.gummei.mme_code, - &ie->value.choice.GUMMEI.mME_Code); + ngap_nas_first_req_p->ue_identity.guami.mcc, + ngap_nas_first_req_p->ue_identity.guami.mnc, + ngap_nas_first_req_p->ue_identity.guami.mnc_len, + &ie->value.choice.GUAMI.pLMN_Identity); + AMF_GID_TO_OCTET_STRING(ngap_nas_first_req_p->ue_identity.guami.amf_group_id, + &ie->value.choice.GUAMI.mME_Group_ID); + AMF_CODE_TO_OCTET_STRING(ngap_nas_first_req_p->ue_identity.guami.amf_code, + &ie->value.choice.GUAMI.mME_Code); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } @@ -293,7 +293,7 @@ int ngap_gNB_handle_nas_first_req( ue_desc_p->ue_state = NGAP_UE_WAITING_CSR; /* Assign a stream for this UE : * From 3GPP 36.412 7)Transport layers: - * Within the SCTP association established between one MME and gNB pair: + * Within the SCTP association established between one AMF and gNB pair: * - a single pair of stream identifiers shall be reserved for the sole use * of NGAP elementary procedures that utilize non UE-associated signalling. * - At least one pair of stream identifiers shall be reserved for the sole use @@ -303,23 +303,23 @@ int ngap_gNB_handle_nas_first_req( * the stream should not be changed during the communication of the * UE-associated signalling. */ - mme_desc_p->nextstream = (mme_desc_p->nextstream + 1) % mme_desc_p->out_streams; + amf_desc_p->nextstream = (amf_desc_p->nextstream + 1) % amf_desc_p->out_streams; - if ((mme_desc_p->nextstream == 0) && (mme_desc_p->out_streams > 1)) { - mme_desc_p->nextstream += 1; + if ((amf_desc_p->nextstream == 0) && (amf_desc_p->out_streams > 1)) { + amf_desc_p->nextstream += 1; } - ue_desc_p->tx_stream = mme_desc_p->nextstream; + ue_desc_p->tx_stream = amf_desc_p->nextstream; MSC_LOG_TX_MESSAGE( MSC_NGAP_GNB, - MSC_NGAP_MME, + MSC_NGAP_AMF, (const char *)NULL, 0, MSC_AS_TIME_FMT" initialUEMessage initiatingMessage gNB_ue_ngap_id %u", 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_desc_p->gNB_ue_ngap_id); /* Send encoded message over sctp */ - ngap_gNB_itti_send_sctp_data_req(instance_p->instance, mme_desc_p->assoc_id, + ngap_gNB_itti_send_sctp_data_req(instance_p->instance, amf_desc_p->assoc_id, buffer, length, ue_desc_p->tx_stream); return 0; } @@ -330,13 +330,13 @@ int ngap_gNB_handle_nas_downlink(uint32_t assoc_id, NGAP_NGAP_PDU_t *pdu) //------------------------------------------------------------------------------ { - ngap_gNB_mme_data_t *mme_desc_p = NULL; + 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; NGAP_DownlinkNASTransport_t *container; NGAP_DownlinkNASTransport_IEs_t *ie; NGAP_GNB_UE_NGAP_ID_t enb_ue_ngap_id; - NGAP_MME_UE_NGAP_ID_t mme_ue_ngap_id; + NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id; DevAssert(pdu != NULL); /* UE-related procedure -> stream != 0 */ @@ -346,19 +346,19 @@ int ngap_gNB_handle_nas_downlink(uint32_t assoc_id, return -1; } - if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { + if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) { NGAP_ERROR( - "[SCTP %d] Received NAS downlink message for non existing MME context\n", + "[SCTP %d] Received NAS downlink message for non existing AMF context\n", assoc_id); return -1; } - ngap_gNB_instance = mme_desc_p->ngap_gNB_instance; + ngap_gNB_instance = amf_desc_p->ngap_gNB_instance; /* Prepare the NGAP message to encode */ container = &pdu->choice.initiatingMessage.value.choice.DownlinkNASTransport; NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_DownlinkNASTransport_IEs_t, ie, container, - NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID, true); - mme_ue_ngap_id = ie->value.choice.MME_UE_NGAP_ID; + NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID, true); + amf_ue_ngap_id = ie->value.choice.AMF_UE_NGAP_ID; NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_DownlinkNASTransport_IEs_t, ie, container, NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID, true); @@ -368,12 +368,12 @@ int ngap_gNB_handle_nas_downlink(uint32_t assoc_id, enb_ue_ngap_id)) == NULL) { MSC_LOG_RX_DISCARDED_MESSAGE( MSC_NGAP_GNB, - MSC_NGAP_MME, + MSC_NGAP_AMF, NULL, 0, - MSC_AS_TIME_FMT" downlinkNASTransport gNB_ue_ngap_id %u mme_ue_ngap_id %u", + MSC_AS_TIME_FMT" downlinkNASTransport gNB_ue_ngap_id %u amf_ue_ngap_id %u", enb_ue_ngap_id, - mme_ue_ngap_id); + amf_ue_ngap_id); NGAP_ERROR("[SCTP %d] Received NAS downlink message for non existing UE context gNB_UE_NGAP_ID: 0x%lx\n", assoc_id, enb_ue_ngap_id); @@ -388,18 +388,18 @@ int ngap_gNB_handle_nas_downlink(uint32_t assoc_id, return -1; } - /* Is it the first outcome of the MME for this UE ? If so store the mme + /* Is it the first outcome of the AMF for this UE ? If so store the amf * UE ngap id. */ - if (ue_desc_p->mme_ue_ngap_id == 0) { - ue_desc_p->mme_ue_ngap_id = mme_ue_ngap_id; + if (ue_desc_p->amf_ue_ngap_id == 0) { + ue_desc_p->amf_ue_ngap_id = amf_ue_ngap_id; } else { - /* We already have a mme ue ngap id check the received is the same */ - if (ue_desc_p->mme_ue_ngap_id != mme_ue_ngap_id) { - NGAP_ERROR("[SCTP %d] Mismatch in MME UE NGAP ID (0x%lx != 0x%"PRIx32"\n", + /* We already have a amf ue ngap id check the received is the same */ + if (ue_desc_p->amf_ue_ngap_id != amf_ue_ngap_id) { + NGAP_ERROR("[SCTP %d] Mismatch in AMF UE NGAP ID (0x%lx != 0x%"PRIx32"\n", assoc_id, - mme_ue_ngap_id, - ue_desc_p->mme_ue_ngap_id + amf_ue_ngap_id, + ue_desc_p->amf_ue_ngap_id ); return -1; } @@ -407,12 +407,12 @@ int ngap_gNB_handle_nas_downlink(uint32_t assoc_id, MSC_LOG_RX_MESSAGE( MSC_NGAP_GNB, - MSC_NGAP_MME, + MSC_NGAP_AMF, NULL, 0, - MSC_AS_TIME_FMT" downlinkNASTransport gNB_ue_ngap_id %u mme_ue_ngap_id %u", + MSC_AS_TIME_FMT" downlinkNASTransport gNB_ue_ngap_id %u amf_ue_ngap_id %u", assoc_id, - mme_ue_ngap_id); + amf_ue_ngap_id); NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_DownlinkNASTransport_IEs_t, ie, container, NGAP_ProtocolIE_ID_id_NAS_PDU, true); @@ -468,10 +468,10 @@ int ngap_gNB_nas_uplink(instance_t instance, ngap_uplink_nas_t *ngap_uplink_nas_ out = &pdu.choice.initiatingMessage.value.choice.UplinkNASTransport; /* mandatory */ ie = (NGAP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(NGAP_UplinkNASTransport_IEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID; + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_UplinkNASTransport_IEs__value_PR_MME_UE_NGAP_ID; - ie->value.choice.MME_UE_NGAP_ID = ue_context_p->mme_ue_ngap_id; + ie->value.present = NGAP_UplinkNASTransport_IEs__value_PR_AMF_UE_NGAP_ID; + ie->value.choice.AMF_UE_NGAP_ID = ue_context_p->amf_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ ie = (NGAP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(NGAP_UplinkNASTransport_IEs_t)); @@ -526,16 +526,16 @@ int ngap_gNB_nas_uplink(instance_t instance, ngap_uplink_nas_t *ngap_uplink_nas_ MSC_LOG_TX_MESSAGE( MSC_NGAP_GNB, - MSC_NGAP_MME, + MSC_NGAP_AMF, (const char *)NULL, 0, - MSC_AS_TIME_FMT" uplinkNASTransport initiatingMessage gNB_ue_ngap_id %u mme_ue_ngap_id %u", + MSC_AS_TIME_FMT" uplinkNASTransport initiatingMessage gNB_ue_ngap_id %u amf_ue_ngap_id %u", 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_context_p->gNB_ue_ngap_id, - ue_context_p->mme_ue_ngap_id); + ue_context_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, - ue_context_p->mme_ref->assoc_id, buffer, + ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); return 0; } @@ -564,7 +564,7 @@ int ngap_gNB_nas_non_delivery_ind(instance_t instance, ngap_nas_non_delivery_ind->gNB_ue_ngap_id); MSC_LOG_EVENT( MSC_NGAP_GNB, - MSC_AS_TIME_FMT" Sent of NAS_NON_DELIVERY_IND to MME failed, no context for gNB_ue_ngap_id %06x", + MSC_AS_TIME_FMT" Sent of NAS_NON_DELIVERY_IND to AMF failed, no context for gNB_ue_ngap_id %06x", ngap_nas_non_delivery_ind->gNB_ue_ngap_id); return -1; } @@ -578,10 +578,10 @@ int ngap_gNB_nas_non_delivery_ind(instance_t instance, out = &pdu.choice.initiatingMessage.value.choice.NASNonDeliveryIndication; /* mandatory */ ie = (NGAP_NASNonDeliveryIndication_IEs_t *)calloc(1, sizeof(NGAP_NASNonDeliveryIndication_IEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID; + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_NASNonDeliveryIndication_IEs__value_PR_MME_UE_NGAP_ID; - ie->value.choice.MME_UE_NGAP_ID = ue_context_p->mme_ue_ngap_id; + ie->value.present = NGAP_NASNonDeliveryIndication_IEs__value_PR_AMF_UE_NGAP_ID; + ie->value.choice.AMF_UE_NGAP_ID = ue_context_p->amf_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ ie = (NGAP_NASNonDeliveryIndication_IEs_t *)calloc(1, sizeof(NGAP_NASNonDeliveryIndication_IEs_t)); @@ -613,22 +613,22 @@ int ngap_gNB_nas_non_delivery_ind(instance_t instance, /* Encode procedure has failed... */ MSC_LOG_EVENT( MSC_NGAP_GNB, - MSC_AS_TIME_FMT" Sent of NAS_NON_DELIVERY_IND to MME failed (encoding)"); + MSC_AS_TIME_FMT" Sent of NAS_NON_DELIVERY_IND to AMF failed (encoding)"); return -1; } MSC_LOG_TX_MESSAGE( MSC_NGAP_GNB, - MSC_NGAP_MME, + MSC_NGAP_AMF, (const char *)buffer, length, - MSC_AS_TIME_FMT" NASNonDeliveryIndication initiatingMessage gNB_ue_ngap_id %u mme_ue_ngap_id %u", + MSC_AS_TIME_FMT" NASNonDeliveryIndication initiatingMessage gNB_ue_ngap_id %u amf_ue_ngap_id %u", 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_context_p->gNB_ue_ngap_id, - ue_context_p->mme_ue_ngap_id); + ue_context_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, - ue_context_p->mme_ref->assoc_id, buffer, + ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); return 0; } @@ -679,10 +679,10 @@ int ngap_gNB_initial_ctxt_resp( out = &pdu.choice.successfulOutcome.value.choice.InitialContextSetupResponse; /* mandatory */ ie = (NGAP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(NGAP_InitialContextSetupResponseIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID; + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_InitialContextSetupResponseIEs__value_PR_MME_UE_NGAP_ID; - ie->value.choice.MME_UE_NGAP_ID = ue_context_p->mme_ue_ngap_id; + ie->value.present = NGAP_InitialContextSetupResponseIEs__value_PR_AMF_UE_NGAP_ID; + ie->value.choice.AMF_UE_NGAP_ID = ue_context_p->amf_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ ie = (NGAP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(NGAP_InitialContextSetupResponseIEs_t)); @@ -693,73 +693,73 @@ int ngap_gNB_initial_ctxt_resp( ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ ie = (NGAP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(NGAP_InitialContextSetupResponseIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_E_RABSetupListCtxtSURes; + ie->id = NGAP_ProtocolIE_ID_id_PDUSESSIONSetupListCtxtSURes; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_InitialContextSetupResponseIEs__value_PR_E_RABSetupListCtxtSURes; + ie->value.present = NGAP_InitialContextSetupResponseIEs__value_PR_PDUSESSIONSetupListCtxtSURes; - for (i = 0; i < initial_ctxt_resp_p->nb_of_e_rabs; i++) { - NGAP_E_RABSetupItemCtxtSUResIEs_t *item; + for (i = 0; i < initial_ctxt_resp_p->nb_of_pdusessions; i++) { + NGAP_PDUSESSIONSetupItemCtxtSUResIEs_t *item; /* mandatory */ - item = (NGAP_E_RABSetupItemCtxtSUResIEs_t *)calloc(1, sizeof(NGAP_E_RABSetupItemCtxtSUResIEs_t)); - item->id = NGAP_ProtocolIE_ID_id_E_RABSetupItemCtxtSURes; + item = (NGAP_PDUSESSIONSetupItemCtxtSUResIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONSetupItemCtxtSUResIEs_t)); + item->id = NGAP_ProtocolIE_ID_id_PDUSESSIONSetupItemCtxtSURes; item->criticality = NGAP_Criticality_ignore; - item->value.present = NGAP_E_RABSetupItemCtxtSUResIEs__value_PR_E_RABSetupItemCtxtSURes; - item->value.choice.E_RABSetupItemCtxtSURes.e_RAB_ID = initial_ctxt_resp_p->e_rabs[i].e_rab_id; - GTP_TEID_TO_ASN1(initial_ctxt_resp_p->e_rabs[i].gtp_teid, &item->value.choice.E_RABSetupItemCtxtSURes.gTP_TEID); - item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf = malloc(initial_ctxt_resp_p->e_rabs[i].gNB_addr.length); - memcpy(item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf, - initial_ctxt_resp_p->e_rabs[i].gNB_addr.buffer, - initial_ctxt_resp_p->e_rabs[i].gNB_addr.length); - item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.size = initial_ctxt_resp_p->e_rabs[i].gNB_addr.length; - item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.bits_unused = 0; - NGAP_DEBUG("initial_ctxt_resp_p: e_rab ID %ld, enb_addr %d.%d.%d.%d, SIZE %ld \n", - item->value.choice.E_RABSetupItemCtxtSURes.e_RAB_ID, - item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf[0], - item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf[1], - item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf[2], - item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf[3], - item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.size); - ASN_SEQUENCE_ADD(&ie->value.choice.E_RABSetupListCtxtSURes.list, item); + item->value.present = NGAP_PDUSESSIONSetupItemCtxtSUResIEs__value_PR_PDUSESSIONSetupItemCtxtSURes; + item->value.choice.PDUSESSIONSetupItemCtxtSURes.e_RAB_ID = initial_ctxt_resp_p->pdusessions[i].pdusession_id; + GTP_TEID_TO_ASN1(initial_ctxt_resp_p->pdusessions[i].gtp_teid, &item->value.choice.PDUSESSIONSetupItemCtxtSURes.gTP_TEID); + item->value.choice.PDUSESSIONSetupItemCtxtSURes.transportLayerAddress.buf = malloc(initial_ctxt_resp_p->pdusessions[i].gNB_addr.length); + memcpy(item->value.choice.PDUSESSIONSetupItemCtxtSURes.transportLayerAddress.buf, + initial_ctxt_resp_p->pdusessions[i].gNB_addr.buffer, + initial_ctxt_resp_p->pdusessions[i].gNB_addr.length); + item->value.choice.PDUSESSIONSetupItemCtxtSURes.transportLayerAddress.size = initial_ctxt_resp_p->pdusessions[i].gNB_addr.length; + item->value.choice.PDUSESSIONSetupItemCtxtSURes.transportLayerAddress.bits_unused = 0; + NGAP_DEBUG("initial_ctxt_resp_p: pdusession ID %ld, enb_addr %d.%d.%d.%d, SIZE %ld \n", + item->value.choice.PDUSESSIONSetupItemCtxtSURes.e_RAB_ID, + item->value.choice.PDUSESSIONSetupItemCtxtSURes.transportLayerAddress.buf[0], + item->value.choice.PDUSESSIONSetupItemCtxtSURes.transportLayerAddress.buf[1], + item->value.choice.PDUSESSIONSetupItemCtxtSURes.transportLayerAddress.buf[2], + item->value.choice.PDUSESSIONSetupItemCtxtSURes.transportLayerAddress.buf[3], + item->value.choice.PDUSESSIONSetupItemCtxtSURes.transportLayerAddress.size); + ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONSetupListCtxtSURes.list, item); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional */ - if (initial_ctxt_resp_p->nb_of_e_rabs_failed) { + if (initial_ctxt_resp_p->nb_of_pdusessions_failed) { ie = (NGAP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(NGAP_InitialContextSetupResponseIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_E_RABFailedToSetupListCtxtSURes; + ie->id = NGAP_ProtocolIE_ID_id_PDUSESSIONFailedToSetupListCtxtSURes; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_InitialContextSetupResponseIEs__value_PR_E_RABList; + ie->value.present = NGAP_InitialContextSetupResponseIEs__value_PR_PDUSESSIONList; - for (i = 0; i < initial_ctxt_resp_p->nb_of_e_rabs_failed; i++) { - NGAP_E_RABItemIEs_t *item; + for (i = 0; i < initial_ctxt_resp_p->nb_of_pdusessions_failed; i++) { + NGAP_PDUSESSIONItemIEs_t *item; /* mandatory */ - item = (NGAP_E_RABItemIEs_t *)calloc(1, sizeof(NGAP_E_RABItemIEs_t)); - item->id = NGAP_ProtocolIE_ID_id_E_RABItem; + item = (NGAP_PDUSESSIONItemIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONItemIEs_t)); + item->id = NGAP_ProtocolIE_ID_id_PDUSESSIONItem; item->criticality = NGAP_Criticality_ignore; - item->value.present = NGAP_E_RABItemIEs__value_PR_E_RABItem; - item->value.choice.E_RABItem.e_RAB_ID = initial_ctxt_resp_p->e_rabs_failed[i].e_rab_id; - item->value.choice.E_RABItem.cause.present = initial_ctxt_resp_p->e_rabs_failed[i].cause; + item->value.present = NGAP_PDUSESSIONItemIEs__value_PR_PDUSESSIONItem; + item->value.choice.PDUSESSIONItem.e_RAB_ID = initial_ctxt_resp_p->pdusessions_failed[i].pdusession_id; + item->value.choice.PDUSESSIONItem.cause.present = initial_ctxt_resp_p->pdusessions_failed[i].cause; - switch(item->value.choice.E_RABItem.cause.present) { + switch(item->value.choice.PDUSESSIONItem.cause.present) { case NGAP_Cause_PR_radioNetwork: - item->value.choice.E_RABItem.cause.choice.radioNetwork = initial_ctxt_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.radioNetwork = initial_ctxt_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_transport: - item->value.choice.E_RABItem.cause.choice.transport = initial_ctxt_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.transport = initial_ctxt_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_nas: - item->value.choice.E_RABItem.cause.choice.nas = initial_ctxt_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.nas = initial_ctxt_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_protocol: - item->value.choice.E_RABItem.cause.choice.protocol = initial_ctxt_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.protocol = initial_ctxt_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_misc: - item->value.choice.E_RABItem.cause.choice.misc = initial_ctxt_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.misc = initial_ctxt_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_NOTHING: @@ -767,8 +767,8 @@ int ngap_gNB_initial_ctxt_resp( break; } - NGAP_DEBUG("initial context setup response: failed e_rab ID %ld\n", item->value.choice.E_RABItem.e_RAB_ID); - ASN_SEQUENCE_ADD(&ie->value.choice.E_RABList.list, item); + NGAP_DEBUG("initial context setup response: failed pdusession ID %ld\n", item->value.choice.PDUSESSIONItem.e_RAB_ID); + ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONList.list, item); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); @@ -792,16 +792,16 @@ int ngap_gNB_initial_ctxt_resp( MSC_LOG_TX_MESSAGE( MSC_NGAP_GNB, - MSC_NGAP_MME, + MSC_NGAP_AMF, (const char *)buffer, length, - MSC_AS_TIME_FMT" InitialContextSetup successfulOutcome gNB_ue_ngap_id %u mme_ue_ngap_id %u", + MSC_AS_TIME_FMT" InitialContextSetup successfulOutcome gNB_ue_ngap_id %u amf_ue_ngap_id %u", 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), initial_ctxt_resp_p->gNB_ue_ngap_id, - ue_context_p->mme_ue_ngap_id); + ue_context_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, - ue_context_p->mme_ref->assoc_id, buffer, + ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); return 0; } @@ -851,10 +851,10 @@ int ngap_gNB_ue_capabilities(instance_t instance, out = &pdu.choice.initiatingMessage.value.choice.UECapabilityInfoIndication; /* mandatory */ ie = (NGAP_UECapabilityInfoIndicationIEs_t *)calloc(1, sizeof(NGAP_UECapabilityInfoIndicationIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID; + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_UECapabilityInfoIndicationIEs__value_PR_MME_UE_NGAP_ID; - ie->value.choice.MME_UE_NGAP_ID = ue_context_p->mme_ue_ngap_id; + ie->value.present = NGAP_UECapabilityInfoIndicationIEs__value_PR_AMF_UE_NGAP_ID; + ie->value.choice.AMF_UE_NGAP_ID = ue_context_p->amf_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ ie = (NGAP_UECapabilityInfoIndicationIEs_t *)calloc(1, sizeof(NGAP_UECapabilityInfoIndicationIEs_t)); @@ -881,43 +881,43 @@ int ngap_gNB_ue_capabilities(instance_t instance, MSC_LOG_TX_MESSAGE( MSC_NGAP_GNB, - MSC_NGAP_MME, + MSC_NGAP_AMF, (const char *)buffer, length, - MSC_AS_TIME_FMT" UECapabilityInfoIndication initiatingMessage gNB_ue_ngap_id %u mme_ue_ngap_id %u", + MSC_AS_TIME_FMT" UECapabilityInfoIndication initiatingMessage gNB_ue_ngap_id %u amf_ue_ngap_id %u", 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_cap_info_ind_p->gNB_ue_ngap_id, - ue_context_p->mme_ue_ngap_id); + ue_context_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, - ue_context_p->mme_ref->assoc_id, buffer, + ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); return 0; } //------------------------------------------------------------------------------ -int ngap_gNB_e_rab_setup_resp(instance_t instance, - ngap_e_rab_setup_resp_t *e_rab_setup_resp_p) +int ngap_gNB_pdusession_setup_resp(instance_t instance, + ngap_pdusession_setup_resp_t *pdusession_setup_resp_p) //------------------------------------------------------------------------------ { ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; struct ngap_gNB_ue_context_s *ue_context_p = NULL; NGAP_NGAP_PDU_t pdu; - NGAP_E_RABSetupResponse_t *out; - NGAP_E_RABSetupResponseIEs_t *ie; + NGAP_PDUSESSIONSetupResponse_t *out; + NGAP_PDUSESSIONSetupResponseIEs_t *ie; uint8_t *buffer = NULL; uint32_t length; int i; /* Retrieve the NGAP gNB instance associated with Mod_id */ ngap_gNB_instance_p = ngap_gNB_get_instance(instance); - DevAssert(e_rab_setup_resp_p != NULL); + DevAssert(pdusession_setup_resp_p != NULL); DevAssert(ngap_gNB_instance_p != NULL); if ((ue_context_p = ngap_gNB_get_ue_context(ngap_gNB_instance_p, - e_rab_setup_resp_p->gNB_ue_ngap_id)) == NULL) { + pdusession_setup_resp_p->gNB_ue_ngap_id)) == NULL) { /* The context for this gNB ue ngap id doesn't exist in the map of gNB UEs */ NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: 0x%06x\n", - e_rab_setup_resp_p->gNB_ue_ngap_id); + pdusession_setup_resp_p->gNB_ue_ngap_id); return -1; } @@ -928,103 +928,103 @@ int ngap_gNB_e_rab_setup_resp(instance_t instance, ue_context_p->ue_state == NGAP_UE_WAITING_CSR)) { NGAP_WARN("You are attempting to send NAS data over non-connected " "gNB ue ngap id: %06x, current state: %d\n", - e_rab_setup_resp_p->gNB_ue_ngap_id, ue_context_p->ue_state); + pdusession_setup_resp_p->gNB_ue_ngap_id, ue_context_p->ue_state); return -1; } /* Prepare the NGAP message to encode */ memset(&pdu, 0, sizeof(pdu)); pdu.present = NGAP_NGAP_PDU_PR_successfulOutcome; - pdu.choice.successfulOutcome.procedureCode = NGAP_ProcedureCode_id_E_RABModify; + pdu.choice.successfulOutcome.procedureCode = NGAP_ProcedureCode_id_PDUSESSIONModify; pdu.choice.successfulOutcome.criticality = NGAP_Criticality_reject; - pdu.choice.successfulOutcome.value.present = NGAP_SuccessfulOutcome__value_PR_E_RABSetupResponse; - out = &pdu.choice.successfulOutcome.value.choice.E_RABSetupResponse; + pdu.choice.successfulOutcome.value.present = NGAP_SuccessfulOutcome__value_PR_PDUSESSIONSetupResponse; + out = &pdu.choice.successfulOutcome.value.choice.PDUSESSIONSetupResponse; /* mandatory */ - ie = (NGAP_E_RABSetupResponseIEs_t *)calloc(1, sizeof(NGAP_E_RABSetupResponseIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID; + ie = (NGAP_PDUSESSIONSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONSetupResponseIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_E_RABSetupResponseIEs__value_PR_MME_UE_NGAP_ID; - ie->value.choice.MME_UE_NGAP_ID = ue_context_p->mme_ue_ngap_id; + ie->value.present = NGAP_PDUSESSIONSetupResponseIEs__value_PR_AMF_UE_NGAP_ID; + ie->value.choice.AMF_UE_NGAP_ID = ue_context_p->amf_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ - ie = (NGAP_E_RABSetupResponseIEs_t *)calloc(1, sizeof(NGAP_E_RABSetupResponseIEs_t)); + ie = (NGAP_PDUSESSIONSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONSetupResponseIEs_t)); ie->id = NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_E_RABSetupResponseIEs__value_PR_GNB_UE_NGAP_ID; - ie->value.choice.GNB_UE_NGAP_ID = e_rab_setup_resp_p->gNB_ue_ngap_id; + ie->value.present = NGAP_PDUSESSIONSetupResponseIEs__value_PR_GNB_UE_NGAP_ID; + ie->value.choice.GNB_UE_NGAP_ID = pdusession_setup_resp_p->gNB_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional */ - if (e_rab_setup_resp_p->nb_of_e_rabs > 0) { - ie = (NGAP_E_RABSetupResponseIEs_t *)calloc(1, sizeof(NGAP_E_RABSetupResponseIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_E_RABSetupListBearerSURes; + if (pdusession_setup_resp_p->nb_of_pdusessions > 0) { + ie = (NGAP_PDUSESSIONSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONSetupResponseIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_PDUSESSIONSetupListBearerSURes; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_E_RABSetupResponseIEs__value_PR_E_RABSetupListBearerSURes; + ie->value.present = NGAP_PDUSESSIONSetupResponseIEs__value_PR_PDUSESSIONSetupListBearerSURes; - for (i = 0; i < e_rab_setup_resp_p->nb_of_e_rabs; i++) { - NGAP_E_RABSetupItemBearerSUResIEs_t *item; + for (i = 0; i < pdusession_setup_resp_p->nb_of_pdusessions; i++) { + NGAP_PDUSESSIONSetupItemBearerSUResIEs_t *item; /* mandatory */ - item = (NGAP_E_RABSetupItemBearerSUResIEs_t *)calloc(1, sizeof(NGAP_E_RABSetupItemBearerSUResIEs_t)); - item->id = NGAP_ProtocolIE_ID_id_E_RABSetupItemBearerSURes; + item = (NGAP_PDUSESSIONSetupItemBearerSUResIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONSetupItemBearerSUResIEs_t)); + item->id = NGAP_ProtocolIE_ID_id_PDUSESSIONSetupItemBearerSURes; item->criticality = NGAP_Criticality_ignore; - item->value.present = NGAP_E_RABSetupItemBearerSUResIEs__value_PR_E_RABSetupItemBearerSURes; - item->value.choice.E_RABSetupItemBearerSURes.e_RAB_ID = e_rab_setup_resp_p->e_rabs[i].e_rab_id; - GTP_TEID_TO_ASN1(e_rab_setup_resp_p->e_rabs[i].gtp_teid, &item->value.choice.E_RABSetupItemBearerSURes.gTP_TEID); - item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.buf = malloc(e_rab_setup_resp_p->e_rabs[i].gNB_addr.length); - memcpy(item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.buf, - e_rab_setup_resp_p->e_rabs[i].gNB_addr.buffer, - e_rab_setup_resp_p->e_rabs[i].gNB_addr.length); - item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.size = e_rab_setup_resp_p->e_rabs[i].gNB_addr.length; - item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.bits_unused = 0; - NGAP_DEBUG("e_rab_setup_resp: e_rab ID %ld, teid %u, enb_addr %d.%d.%d.%d, SIZE %ld\n", - item->value.choice.E_RABSetupItemBearerSURes.e_RAB_ID, - e_rab_setup_resp_p->e_rabs[i].gtp_teid, - item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.buf[0], - item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.buf[1], - item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.buf[2], - item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.buf[3], - item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.size); - ASN_SEQUENCE_ADD(&ie->value.choice.E_RABSetupListBearerSURes.list, item); + item->value.present = NGAP_PDUSESSIONSetupItemBearerSUResIEs__value_PR_PDUSESSIONSetupItemBearerSURes; + item->value.choice.PDUSESSIONSetupItemBearerSURes.e_RAB_ID = pdusession_setup_resp_p->pdusessions[i].pdusession_id; + GTP_TEID_TO_ASN1(pdusession_setup_resp_p->pdusessions[i].gtp_teid, &item->value.choice.PDUSESSIONSetupItemBearerSURes.gTP_TEID); + item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf = malloc(pdusession_setup_resp_p->pdusessions[i].gNB_addr.length); + memcpy(item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf, + pdusession_setup_resp_p->pdusessions[i].gNB_addr.buffer, + pdusession_setup_resp_p->pdusessions[i].gNB_addr.length); + item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.size = pdusession_setup_resp_p->pdusessions[i].gNB_addr.length; + item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.bits_unused = 0; + NGAP_DEBUG("pdusession_setup_resp: pdusession ID %ld, teid %u, enb_addr %d.%d.%d.%d, SIZE %ld\n", + item->value.choice.PDUSESSIONSetupItemBearerSURes.e_RAB_ID, + pdusession_setup_resp_p->pdusessions[i].gtp_teid, + item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf[0], + item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf[1], + item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf[2], + item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.buf[3], + item->value.choice.PDUSESSIONSetupItemBearerSURes.transportLayerAddress.size); + ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONSetupListBearerSURes.list, item); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* optional */ - if (e_rab_setup_resp_p->nb_of_e_rabs_failed > 0) { - ie = (NGAP_E_RABSetupResponseIEs_t *)calloc(1, sizeof(NGAP_E_RABSetupResponseIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_E_RABFailedToSetupListBearerSURes; + if (pdusession_setup_resp_p->nb_of_pdusessions_failed > 0) { + ie = (NGAP_PDUSESSIONSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONSetupResponseIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_PDUSESSIONFailedToSetupListBearerSURes; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_E_RABSetupResponseIEs__value_PR_E_RABList; + ie->value.present = NGAP_PDUSESSIONSetupResponseIEs__value_PR_PDUSESSIONList; - for (i = 0; i < e_rab_setup_resp_p->nb_of_e_rabs_failed; i++) { - NGAP_E_RABItemIEs_t *item; - item = (NGAP_E_RABItemIEs_t *)calloc(1, sizeof(NGAP_E_RABItemIEs_t)); - item->id = NGAP_ProtocolIE_ID_id_E_RABItem; + for (i = 0; i < pdusession_setup_resp_p->nb_of_pdusessions_failed; i++) { + NGAP_PDUSESSIONItemIEs_t *item; + item = (NGAP_PDUSESSIONItemIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONItemIEs_t)); + item->id = NGAP_ProtocolIE_ID_id_PDUSESSIONItem; item->criticality = NGAP_Criticality_ignore; - item->value.present = NGAP_E_RABItemIEs__value_PR_E_RABItem; - item->value.choice.E_RABItem.e_RAB_ID = e_rab_setup_resp_p->e_rabs_failed[i].e_rab_id; - item->value.choice.E_RABItem.cause.present = e_rab_setup_resp_p->e_rabs_failed[i].cause; + item->value.present = NGAP_PDUSESSIONItemIEs__value_PR_PDUSESSIONItem; + item->value.choice.PDUSESSIONItem.e_RAB_ID = pdusession_setup_resp_p->pdusessions_failed[i].pdusession_id; + item->value.choice.PDUSESSIONItem.cause.present = pdusession_setup_resp_p->pdusessions_failed[i].cause; - switch(item->value.choice.E_RABItem.cause.present) { + switch(item->value.choice.PDUSESSIONItem.cause.present) { case NGAP_Cause_PR_radioNetwork: - item->value.choice.E_RABItem.cause.choice.radioNetwork = e_rab_setup_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.radioNetwork = pdusession_setup_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_transport: - item->value.choice.E_RABItem.cause.choice.transport = e_rab_setup_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.transport = pdusession_setup_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_nas: - item->value.choice.E_RABItem.cause.choice.nas = e_rab_setup_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.nas = pdusession_setup_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_protocol: - item->value.choice.E_RABItem.cause.choice.protocol = e_rab_setup_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.protocol = pdusession_setup_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_misc: - item->value.choice.E_RABItem.cause.choice.misc = e_rab_setup_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.misc = pdusession_setup_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_NOTHING: @@ -1032,8 +1032,8 @@ int ngap_gNB_e_rab_setup_resp(instance_t instance, break; } - NGAP_DEBUG("e_rab_modify_resp: failed e_rab ID %ld\n", item->value.choice.E_RABItem.e_RAB_ID); - ASN_SEQUENCE_ADD(&ie->value.choice.E_RABList.list, item); + NGAP_DEBUG("pdusession_modify_resp: failed pdusession ID %ld\n", item->value.choice.PDUSESSIONItem.e_RAB_ID); + ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONList.list, item); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); @@ -1041,19 +1041,19 @@ int ngap_gNB_e_rab_setup_resp(instance_t instance, /* optional */ if (0) { - ie = (NGAP_E_RABSetupResponseIEs_t *)calloc(1, sizeof(NGAP_E_RABSetupResponseIEs_t)); + ie = (NGAP_PDUSESSIONSetupResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONSetupResponseIEs_t)); ie->id = NGAP_ProtocolIE_ID_id_CriticalityDiagnostics; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_E_RABSetupResponseIEs__value_PR_CriticalityDiagnostics; + ie->value.present = NGAP_PDUSESSIONSetupResponseIEs__value_PR_CriticalityDiagnostics; // ie->value.choice.CriticalityDiagnostics = ; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } - /* NGAP_E_RABSetupListBearerSURes_t e_RABSetupListBearerSURes; - memset(&e_RABSetupListBearerSURes, 0, sizeof(NGAP_E_RABSetupListBearerSURes_t)); - if (ngap_encode_ngap_e_rabsetuplistbearersures(&e_RABSetupListBearerSURes, &initial_ies_p->e_RABSetupListBearerSURes.ngap_E_RABSetupItemBearerSURes) < 0 ) + /* NGAP_PDUSESSIONSetupListBearerSURes_t e_RABSetupListBearerSURes; + memset(&e_RABSetupListBearerSURes, 0, sizeof(NGAP_PDUSESSIONSetupListBearerSURes_t)); + if (ngap_encode_ngap_pdusessionsetuplistbearersures(&e_RABSetupListBearerSURes, &initial_ies_p->e_RABSetupListBearerSURes.ngap_PDUSESSIONSetupItemBearerSURes) < 0 ) return -1; - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_E_RABSetupListBearerSURes, &e_RABSetupListBearerSURes); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_PDUSESSIONSetupListBearerSURes, &e_RABSetupListBearerSURes); */ fprintf(stderr, "start encode\n"); @@ -1065,43 +1065,43 @@ int ngap_gNB_e_rab_setup_resp(instance_t instance, MSC_LOG_TX_MESSAGE( MSC_NGAP_GNB, - MSC_NGAP_MME, + MSC_NGAP_AMF, (const char *)buffer, length, - MSC_AS_TIME_FMT" E_RAN Setup successfulOutcome gNB_ue_ngap_id %u mme_ue_ngap_id %u", + MSC_AS_TIME_FMT" E_RAN Setup successfulOutcome gNB_ue_ngap_id %u amf_ue_ngap_id %u", 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - e_rab_setup_resp_p->gNB_ue_ngap_id, - ue_context_p->mme_ue_ngap_id); + pdusession_setup_resp_p->gNB_ue_ngap_id, + ue_context_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, - ue_context_p->mme_ref->assoc_id, buffer, + ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); return 0; } //------------------------------------------------------------------------------ -int ngap_gNB_e_rab_modify_resp(instance_t instance, - ngap_e_rab_modify_resp_t *e_rab_modify_resp_p) +int ngap_gNB_pdusession_modify_resp(instance_t instance, + ngap_pdusession_modify_resp_t *pdusession_modify_resp_p) //------------------------------------------------------------------------------ { ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; struct ngap_gNB_ue_context_s *ue_context_p = NULL; NGAP_NGAP_PDU_t pdu; - NGAP_E_RABModifyResponse_t *out; - NGAP_E_RABModifyResponseIEs_t *ie; + NGAP_PDUSESSIONModifyResponse_t *out; + NGAP_PDUSESSIONModifyResponseIEs_t *ie; uint8_t *buffer = NULL; uint32_t length; int i; /* Retrieve the NGAP gNB instance associated with Mod_id */ ngap_gNB_instance_p = ngap_gNB_get_instance(instance); - DevAssert(e_rab_modify_resp_p != NULL); + DevAssert(pdusession_modify_resp_p != NULL); DevAssert(ngap_gNB_instance_p != NULL); if ((ue_context_p = ngap_gNB_get_ue_context(ngap_gNB_instance_p, - e_rab_modify_resp_p->gNB_ue_ngap_id)) == NULL) { + pdusession_modify_resp_p->gNB_ue_ngap_id)) == NULL) { /* The context for this gNB ue ngap id doesn't exist in the map of gNB UEs */ NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: 0x%06x\n", - e_rab_modify_resp_p->gNB_ue_ngap_id); + pdusession_modify_resp_p->gNB_ue_ngap_id); return -1; } @@ -1112,88 +1112,88 @@ int ngap_gNB_e_rab_modify_resp(instance_t instance, ue_context_p->ue_state == NGAP_UE_WAITING_CSR)) { NGAP_WARN("You are attempting to send NAS data over non-connected " "gNB ue ngap id: %06x, current state: %d\n", - e_rab_modify_resp_p->gNB_ue_ngap_id, ue_context_p->ue_state); + pdusession_modify_resp_p->gNB_ue_ngap_id, ue_context_p->ue_state); return -1; } /* Prepare the NGAP message to encode */ memset(&pdu, 0, sizeof(pdu)); pdu.present = NGAP_NGAP_PDU_PR_successfulOutcome; - pdu.choice.successfulOutcome.procedureCode = NGAP_ProcedureCode_id_E_RABModify; + pdu.choice.successfulOutcome.procedureCode = NGAP_ProcedureCode_id_PDUSESSIONModify; pdu.choice.successfulOutcome.criticality = NGAP_Criticality_reject; - pdu.choice.successfulOutcome.value.present = NGAP_SuccessfulOutcome__value_PR_E_RABModifyResponse; - out = &pdu.choice.successfulOutcome.value.choice.E_RABModifyResponse; + pdu.choice.successfulOutcome.value.present = NGAP_SuccessfulOutcome__value_PR_PDUSESSIONModifyResponse; + out = &pdu.choice.successfulOutcome.value.choice.PDUSESSIONModifyResponse; /* mandatory */ - ie = (NGAP_E_RABModifyResponseIEs_t *)calloc(1, sizeof(NGAP_E_RABModifyResponseIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID; + ie = (NGAP_PDUSESSIONModifyResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONModifyResponseIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_E_RABModifyResponseIEs__value_PR_MME_UE_NGAP_ID; - ie->value.choice.MME_UE_NGAP_ID = ue_context_p->mme_ue_ngap_id; + ie->value.present = NGAP_PDUSESSIONModifyResponseIEs__value_PR_AMF_UE_NGAP_ID; + ie->value.choice.AMF_UE_NGAP_ID = ue_context_p->amf_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ - ie = (NGAP_E_RABModifyResponseIEs_t *)calloc(1, sizeof(NGAP_E_RABModifyResponseIEs_t)); + ie = (NGAP_PDUSESSIONModifyResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONModifyResponseIEs_t)); ie->id = NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_E_RABModifyResponseIEs__value_PR_GNB_UE_NGAP_ID; - ie->value.choice.GNB_UE_NGAP_ID = e_rab_modify_resp_p->gNB_ue_ngap_id; + ie->value.present = NGAP_PDUSESSIONModifyResponseIEs__value_PR_GNB_UE_NGAP_ID; + ie->value.choice.GNB_UE_NGAP_ID = pdusession_modify_resp_p->gNB_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional */ - if (e_rab_modify_resp_p->nb_of_e_rabs > 0) { - ie = (NGAP_E_RABModifyResponseIEs_t *)calloc(1, sizeof(NGAP_E_RABModifyResponseIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_E_RABModifyListBearerModRes; + if (pdusession_modify_resp_p->nb_of_pdusessions > 0) { + ie = (NGAP_PDUSESSIONModifyResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONModifyResponseIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_PDUSESSIONModifyListBearerModRes; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_E_RABModifyResponseIEs__value_PR_E_RABModifyListBearerModRes; + ie->value.present = NGAP_PDUSESSIONModifyResponseIEs__value_PR_PDUSESSIONModifyListBearerModRes; - for (i = 0; i < e_rab_modify_resp_p->nb_of_e_rabs; i++) { - NGAP_E_RABModifyItemBearerModResIEs_t *item; - item = (NGAP_E_RABModifyItemBearerModResIEs_t *)calloc(1, sizeof(NGAP_E_RABModifyItemBearerModResIEs_t)); - item->id = NGAP_ProtocolIE_ID_id_E_RABModifyItemBearerModRes; + for (i = 0; i < pdusession_modify_resp_p->nb_of_pdusessions; i++) { + NGAP_PDUSESSIONModifyItemBearerModResIEs_t *item; + item = (NGAP_PDUSESSIONModifyItemBearerModResIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONModifyItemBearerModResIEs_t)); + item->id = NGAP_ProtocolIE_ID_id_PDUSESSIONModifyItemBearerModRes; item->criticality = NGAP_Criticality_ignore; - item->value.present = NGAP_E_RABModifyItemBearerModResIEs__value_PR_E_RABModifyItemBearerModRes; - item->value.choice.E_RABModifyItemBearerModRes.e_RAB_ID = e_rab_modify_resp_p->e_rabs[i].e_rab_id; - NGAP_DEBUG("e_rab_modify_resp: modified e_rab ID %ld\n", item->value.choice.E_RABModifyItemBearerModRes.e_RAB_ID); - ASN_SEQUENCE_ADD(&ie->value.choice.E_RABModifyListBearerModRes.list, item); + item->value.present = NGAP_PDUSESSIONModifyItemBearerModResIEs__value_PR_PDUSESSIONModifyItemBearerModRes; + item->value.choice.PDUSESSIONModifyItemBearerModRes.e_RAB_ID = pdusession_modify_resp_p->pdusessions[i].pdusession_id; + NGAP_DEBUG("pdusession_modify_resp: modified pdusession ID %ld\n", item->value.choice.PDUSESSIONModifyItemBearerModRes.e_RAB_ID); + ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONModifyListBearerModRes.list, item); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* optional */ - if (e_rab_modify_resp_p->nb_of_e_rabs_failed > 0) { - ie = (NGAP_E_RABModifyResponseIEs_t *)calloc(1, sizeof(NGAP_E_RABModifyResponseIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_E_RABFailedToModifyList; + if (pdusession_modify_resp_p->nb_of_pdusessions_failed > 0) { + ie = (NGAP_PDUSESSIONModifyResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONModifyResponseIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_PDUSESSIONFailedToModifyList; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_E_RABModifyResponseIEs__value_PR_E_RABList; + ie->value.present = NGAP_PDUSESSIONModifyResponseIEs__value_PR_PDUSESSIONList; - for (i = 0; i < e_rab_modify_resp_p->nb_of_e_rabs_failed; i++) { - NGAP_E_RABItemIEs_t *item; - item = (NGAP_E_RABItemIEs_t *)calloc(1, sizeof(NGAP_E_RABItemIEs_t)); - item->id = NGAP_ProtocolIE_ID_id_E_RABItem; + for (i = 0; i < pdusession_modify_resp_p->nb_of_pdusessions_failed; i++) { + NGAP_PDUSESSIONItemIEs_t *item; + item = (NGAP_PDUSESSIONItemIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONItemIEs_t)); + item->id = NGAP_ProtocolIE_ID_id_PDUSESSIONItem; item->criticality = NGAP_Criticality_ignore; - item->value.present = NGAP_E_RABItemIEs__value_PR_E_RABItem; - item->value.choice.E_RABItem.e_RAB_ID = e_rab_modify_resp_p->e_rabs_failed[i].e_rab_id; - item->value.choice.E_RABItem.cause.present = e_rab_modify_resp_p->e_rabs_failed[i].cause; + item->value.present = NGAP_PDUSESSIONItemIEs__value_PR_PDUSESSIONItem; + item->value.choice.PDUSESSIONItem.e_RAB_ID = pdusession_modify_resp_p->pdusessions_failed[i].pdusession_id; + item->value.choice.PDUSESSIONItem.cause.present = pdusession_modify_resp_p->pdusessions_failed[i].cause; - switch(item->value.choice.E_RABItem.cause.present) { + switch(item->value.choice.PDUSESSIONItem.cause.present) { case NGAP_Cause_PR_radioNetwork: - item->value.choice.E_RABItem.cause.choice.radioNetwork = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.radioNetwork = pdusession_modify_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_transport: - item->value.choice.E_RABItem.cause.choice.transport = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.transport = pdusession_modify_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_nas: - item->value.choice.E_RABItem.cause.choice.nas = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.nas = pdusession_modify_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_protocol: - item->value.choice.E_RABItem.cause.choice.protocol = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.protocol = pdusession_modify_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_misc: - item->value.choice.E_RABItem.cause.choice.misc = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.misc = pdusession_modify_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_NOTHING: @@ -1201,8 +1201,8 @@ int ngap_gNB_e_rab_modify_resp(instance_t instance, break; } - NGAP_DEBUG("e_rab_modify_resp: failed e_rab ID %ld\n", item->value.choice.E_RABItem.e_RAB_ID); - ASN_SEQUENCE_ADD(&ie->value.choice.E_RABList.list, item); + NGAP_DEBUG("pdusession_modify_resp: failed pdusession ID %ld\n", item->value.choice.PDUSESSIONItem.e_RAB_ID); + ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONList.list, item); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); @@ -1210,10 +1210,10 @@ int ngap_gNB_e_rab_modify_resp(instance_t instance, /* optional */ if (0) { - ie = (NGAP_E_RABModifyResponseIEs_t *)calloc(1, sizeof(NGAP_E_RABModifyResponseIEs_t)); + ie = (NGAP_PDUSESSIONModifyResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONModifyResponseIEs_t)); ie->id = NGAP_ProtocolIE_ID_id_CriticalityDiagnostics; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_E_RABModifyResponseIEs__value_PR_CriticalityDiagnostics; + ie->value.present = NGAP_PDUSESSIONModifyResponseIEs__value_PR_CriticalityDiagnostics; // ie->value.choice.CriticalityDiagnostics = ; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } @@ -1228,123 +1228,123 @@ int ngap_gNB_e_rab_modify_resp(instance_t instance, MSC_LOG_TX_MESSAGE( MSC_NGAP_GNB, - MSC_NGAP_MME, + MSC_NGAP_AMF, (const char *)buffer, length, - MSC_AS_TIME_FMT" E_RAN Modify successful Outcome gNB_ue_ngap_id %u mme_ue_ngap_id %u", + MSC_AS_TIME_FMT" E_RAN Modify successful Outcome gNB_ue_ngap_id %u amf_ue_ngap_id %u", 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - e_rab_modify_resp_p->gNB_ue_ngap_id, - ue_context_p->mme_ue_ngap_id); + pdusession_modify_resp_p->gNB_ue_ngap_id, + ue_context_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, - ue_context_p->mme_ref->assoc_id, buffer, + ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); return 0; } //------------------------------------------------------------------------------ -int ngap_gNB_e_rab_release_resp(instance_t instance, - ngap_e_rab_release_resp_t *e_rab_release_resp_p) +int ngap_gNB_pdusession_release_resp(instance_t instance, + ngap_pdusession_release_resp_t *pdusession_release_resp_p) //------------------------------------------------------------------------------ { ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; struct ngap_gNB_ue_context_s *ue_context_p = NULL; NGAP_NGAP_PDU_t pdu; - NGAP_E_RABReleaseResponse_t *out; - NGAP_E_RABReleaseResponseIEs_t *ie; + NGAP_PDUSESSIONReleaseResponse_t *out; + NGAP_PDUSESSIONReleaseResponseIEs_t *ie; uint8_t *buffer = NULL; uint32_t length; int i; /* Retrieve the NGAP gNB instance associated with Mod_id */ ngap_gNB_instance_p = ngap_gNB_get_instance(instance); - DevAssert(e_rab_release_resp_p != NULL); + DevAssert(pdusession_release_resp_p != NULL); DevAssert(ngap_gNB_instance_p != NULL); if ((ue_context_p = ngap_gNB_get_ue_context(ngap_gNB_instance_p, - e_rab_release_resp_p->gNB_ue_ngap_id)) == NULL) { + pdusession_release_resp_p->gNB_ue_ngap_id)) == NULL) { /* The context for this gNB ue ngap id doesn't exist in the map of gNB UEs */ NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: %u\n", - e_rab_release_resp_p->gNB_ue_ngap_id); + pdusession_release_resp_p->gNB_ue_ngap_id); return -1; } /* Prepare the NGAP message to encode */ memset(&pdu, 0, sizeof(pdu)); pdu.present = NGAP_NGAP_PDU_PR_successfulOutcome; - pdu.choice.successfulOutcome.procedureCode = NGAP_ProcedureCode_id_E_RABRelease; + pdu.choice.successfulOutcome.procedureCode = NGAP_ProcedureCode_id_PDUSESSIONRelease; pdu.choice.successfulOutcome.criticality = NGAP_Criticality_reject; - pdu.choice.successfulOutcome.value.present = NGAP_SuccessfulOutcome__value_PR_E_RABReleaseResponse; - out = &pdu.choice.successfulOutcome.value.choice.E_RABReleaseResponse; + pdu.choice.successfulOutcome.value.present = NGAP_SuccessfulOutcome__value_PR_PDUSESSIONReleaseResponse; + out = &pdu.choice.successfulOutcome.value.choice.PDUSESSIONReleaseResponse; /* mandatory */ - ie = (NGAP_E_RABReleaseResponseIEs_t *)calloc(1, sizeof(NGAP_E_RABReleaseResponseIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID; + ie = (NGAP_PDUSESSIONReleaseResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONReleaseResponseIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_E_RABReleaseResponseIEs__value_PR_MME_UE_NGAP_ID; - ie->value.choice.MME_UE_NGAP_ID = ue_context_p->mme_ue_ngap_id; + ie->value.present = NGAP_PDUSESSIONReleaseResponseIEs__value_PR_AMF_UE_NGAP_ID; + ie->value.choice.AMF_UE_NGAP_ID = ue_context_p->amf_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ - ie = (NGAP_E_RABReleaseResponseIEs_t *)calloc(1, sizeof(NGAP_E_RABReleaseResponseIEs_t)); + ie = (NGAP_PDUSESSIONReleaseResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONReleaseResponseIEs_t)); ie->id = NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_E_RABReleaseResponseIEs__value_PR_GNB_UE_NGAP_ID; - ie->value.choice.GNB_UE_NGAP_ID = e_rab_release_resp_p->gNB_ue_ngap_id; + ie->value.present = NGAP_PDUSESSIONReleaseResponseIEs__value_PR_GNB_UE_NGAP_ID; + ie->value.choice.GNB_UE_NGAP_ID = pdusession_release_resp_p->gNB_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional */ - if (e_rab_release_resp_p->nb_of_e_rabs_released > 0) { - ie = (NGAP_E_RABReleaseResponseIEs_t *)calloc(1, sizeof(NGAP_E_RABReleaseResponseIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_E_RABReleaseListBearerRelComp; + if (pdusession_release_resp_p->nb_of_pdusessions_released > 0) { + ie = (NGAP_PDUSESSIONReleaseResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONReleaseResponseIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_PDUSESSIONReleaseListBearerRelComp; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_E_RABReleaseResponseIEs__value_PR_E_RABReleaseListBearerRelComp; + ie->value.present = NGAP_PDUSESSIONReleaseResponseIEs__value_PR_PDUSESSIONReleaseListBearerRelComp; - for (i = 0; i < e_rab_release_resp_p->nb_of_e_rabs_released; i++) { - NGAP_E_RABReleaseItemBearerRelCompIEs_t *item; - item = (NGAP_E_RABReleaseItemBearerRelCompIEs_t *)calloc(1, sizeof(NGAP_E_RABReleaseItemBearerRelCompIEs_t)); - item->id = NGAP_ProtocolIE_ID_id_E_RABReleaseItemBearerRelComp; + for (i = 0; i < pdusession_release_resp_p->nb_of_pdusessions_released; i++) { + NGAP_PDUSESSIONReleaseItemBearerRelCompIEs_t *item; + item = (NGAP_PDUSESSIONReleaseItemBearerRelCompIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONReleaseItemBearerRelCompIEs_t)); + item->id = NGAP_ProtocolIE_ID_id_PDUSESSIONReleaseItemBearerRelComp; item->criticality = NGAP_Criticality_ignore; - item->value.present = NGAP_E_RABReleaseItemBearerRelCompIEs__value_PR_E_RABReleaseItemBearerRelComp; - item->value.choice.E_RABReleaseItemBearerRelComp.e_RAB_ID = e_rab_release_resp_p->e_rab_release[i].e_rab_id; - NGAP_DEBUG("e_rab_release_resp: e_rab ID %ld\n", item->value.choice.E_RABReleaseItemBearerRelComp.e_RAB_ID); - ASN_SEQUENCE_ADD(&ie->value.choice.E_RABReleaseListBearerRelComp.list, item); + item->value.present = NGAP_PDUSESSIONReleaseItemBearerRelCompIEs__value_PR_PDUSESSIONReleaseItemBearerRelComp; + item->value.choice.PDUSESSIONReleaseItemBearerRelComp.e_RAB_ID = pdusession_release_resp_p->pdusession_release[i].pdusession_id; + NGAP_DEBUG("pdusession_release_resp: pdusession ID %ld\n", item->value.choice.PDUSESSIONReleaseItemBearerRelComp.e_RAB_ID); + ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONReleaseListBearerRelComp.list, item); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* optional */ - if (e_rab_release_resp_p->nb_of_e_rabs_failed > 0) { - ie = (NGAP_E_RABReleaseResponseIEs_t *)calloc(1, sizeof(NGAP_E_RABReleaseResponseIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_E_RABFailedToReleaseList; + if (pdusession_release_resp_p->nb_of_pdusessions_failed > 0) { + ie = (NGAP_PDUSESSIONReleaseResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONReleaseResponseIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_PDUSESSIONFailedToReleaseList; ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_E_RABReleaseResponseIEs__value_PR_E_RABList; + ie->value.present = NGAP_PDUSESSIONReleaseResponseIEs__value_PR_PDUSESSIONList; - for (i = 0; i < e_rab_release_resp_p->nb_of_e_rabs_failed; i++) { - NGAP_E_RABItemIEs_t *item; - item = (NGAP_E_RABItemIEs_t *)calloc(1, sizeof(NGAP_E_RABItemIEs_t)); - item->id = NGAP_ProtocolIE_ID_id_E_RABItem; + for (i = 0; i < pdusession_release_resp_p->nb_of_pdusessions_failed; i++) { + NGAP_PDUSESSIONItemIEs_t *item; + item = (NGAP_PDUSESSIONItemIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONItemIEs_t)); + item->id = NGAP_ProtocolIE_ID_id_PDUSESSIONItem; item->criticality = NGAP_Criticality_ignore; - item->value.present = NGAP_E_RABItemIEs__value_PR_E_RABItem; - item->value.choice.E_RABItem.e_RAB_ID = e_rab_release_resp_p->e_rabs_failed[i].e_rab_id; - item->value.choice.E_RABItem.cause.present = e_rab_release_resp_p->e_rabs_failed[i].cause; + item->value.present = NGAP_PDUSESSIONItemIEs__value_PR_PDUSESSIONItem; + item->value.choice.PDUSESSIONItem.e_RAB_ID = pdusession_release_resp_p->pdusessions_failed[i].pdusession_id; + item->value.choice.PDUSESSIONItem.cause.present = pdusession_release_resp_p->pdusessions_failed[i].cause; - switch(item->value.choice.E_RABItem.cause.present) { + switch(item->value.choice.PDUSESSIONItem.cause.present) { case NGAP_Cause_PR_radioNetwork: - item->value.choice.E_RABItem.cause.choice.radioNetwork = e_rab_release_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.radioNetwork = pdusession_release_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_transport: - item->value.choice.E_RABItem.cause.choice.transport = e_rab_release_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.transport = pdusession_release_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_nas: - item->value.choice.E_RABItem.cause.choice.nas = e_rab_release_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.nas = pdusession_release_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_protocol: - item->value.choice.E_RABItem.cause.choice.protocol = e_rab_release_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.protocol = pdusession_release_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_misc: - item->value.choice.E_RABItem.cause.choice.misc = e_rab_release_resp_p->e_rabs_failed[i].cause_value; + item->value.choice.PDUSESSIONItem.cause.choice.misc = pdusession_release_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_Cause_PR_NOTHING: @@ -1352,7 +1352,7 @@ int ngap_gNB_e_rab_release_resp(instance_t instance, break; } - ASN_SEQUENCE_ADD(&ie->value.choice.E_RABList.list, item); + ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONList.list, item); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); @@ -1368,19 +1368,19 @@ int ngap_gNB_e_rab_release_resp(instance_t instance, MSC_LOG_TX_MESSAGE( MSC_NGAP_GNB, - MSC_NGAP_MME, + MSC_NGAP_AMF, (const char *)buffer, length, - MSC_AS_TIME_FMT" E_RAN Release successfulOutcome gNB_ue_ngap_id %u mme_ue_ngap_id %u", + MSC_AS_TIME_FMT" E_RAN Release successfulOutcome gNB_ue_ngap_id %u amf_ue_ngap_id %u", 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - e_rab_release_resp_p->gNB_ue_ngap_id, - ue_context_p->mme_ue_ngap_id); + pdusession_release_resp_p->gNB_ue_ngap_id, + ue_context_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, - ue_context_p->mme_ref->assoc_id, buffer, + ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - NGAP_INFO("e_rab_release_response sended gNB_UE_NGAP_ID %d mme_ue_ngap_id %d nb_of_e_rabs_released %d nb_of_e_rabs_failed %d\n", - e_rab_release_resp_p->gNB_ue_ngap_id, ue_context_p->mme_ue_ngap_id,e_rab_release_resp_p->nb_of_e_rabs_released,e_rab_release_resp_p->nb_of_e_rabs_failed); + 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); return 0; } @@ -1390,14 +1390,14 @@ int ngap_gNB_path_switch_req(instance_t instance, { ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; struct ngap_gNB_ue_context_s *ue_context_p = NULL; - struct ngap_gNB_mme_data_s *mme_desc_p = NULL; + struct ngap_gNB_amf_data_s *amf_desc_p = NULL; NGAP_NGAP_PDU_t pdu; NGAP_PathSwitchRequest_t *out; NGAP_PathSwitchRequestIEs_t *ie; - NGAP_E_RABToBeSwitchedDLItemIEs_t *e_RABToBeSwitchedDLItemIEs; - NGAP_E_RABToBeSwitchedDLItem_t *e_RABToBeSwitchedDLItem; + NGAP_PDUSESSIONToBeSwitchedDLItemIEs_t *e_RABToBeSwitchedDLItemIEs; + NGAP_PDUSESSIONToBeSwitchedDLItem_t *e_RABToBeSwitchedDLItem; uint8_t *buffer = NULL; uint32_t length; @@ -1428,16 +1428,16 @@ int ngap_gNB_path_switch_req(instance_t instance, //return -1; //} - /* Select the MME corresponding to the provided GUMMEI. */ - mme_desc_p = ngap_gNB_nnsf_select_mme_by_gummei_no_cause(ngap_gNB_instance_p, path_switch_req_p->ue_gummei); + /* Select the AMF corresponding to the provided GUAMI. */ + amf_desc_p = ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_p, path_switch_req_p->ue_guami); - if (mme_desc_p == NULL) { + if (amf_desc_p == NULL) { /* - * In case gNB has no MME associated, the gNB should inform RRC and discard + * In case gNB has no AMF associated, the gNB should inform RRC and discard * this request. */ - NGAP_WARN("No MME is associated to the gNB\n"); + NGAP_WARN("No AMF is associated to the gNB\n"); // TODO: Inform RRC return -1; } @@ -1448,8 +1448,8 @@ int ngap_gNB_path_switch_req(instance_t instance, ue_context_p = ngap_gNB_allocate_new_UE_context(); DevAssert(ue_context_p != NULL); - /* Keep a reference to the selected MME */ - ue_context_p->mme_ref = mme_desc_p; + /* Keep a reference to the selected AMF */ + ue_context_p->amf_ref = amf_desc_p; ue_context_p->ue_initial_id = path_switch_req_p->ue_initial_id; ue_context_p->gNB_instance = ngap_gNB_instance_p; @@ -1469,7 +1469,7 @@ int ngap_gNB_path_switch_req(instance_t instance, } } while(1); - ue_context_p->mme_ue_ngap_id = path_switch_req_p->mme_ue_ngap_id; + ue_context_p->amf_ue_ngap_id = path_switch_req_p->amf_ue_ngap_id; /* Prepare the NGAP message to encode */ memset(&pdu, 0, sizeof(pdu)); @@ -1488,41 +1488,41 @@ int ngap_gNB_path_switch_req(instance_t instance, ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ - if (path_switch_req_p->nb_of_e_rabs > 0) { + if (path_switch_req_p->nb_of_pdusessions > 0) { ie = (NGAP_PathSwitchRequestIEs_t *)calloc(1, sizeof(NGAP_PathSwitchRequestIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_E_RABToBeSwitchedDLList; + ie->id = NGAP_ProtocolIE_ID_id_PDUSESSIONToBeSwitchedDLList; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_PathSwitchRequestIEs__value_PR_E_RABToBeSwitchedDLList; + ie->value.present = NGAP_PathSwitchRequestIEs__value_PR_PDUSESSIONToBeSwitchedDLList; - for (int i = 0; i < path_switch_req_p->nb_of_e_rabs; i++) { - e_RABToBeSwitchedDLItemIEs = (NGAP_E_RABToBeSwitchedDLItemIEs_t *)calloc(1, sizeof(NGAP_E_RABToBeSwitchedDLItemIEs_t)); - e_RABToBeSwitchedDLItemIEs->id = NGAP_ProtocolIE_ID_id_E_RABToBeSwitchedDLItem; + for (int i = 0; i < path_switch_req_p->nb_of_pdusessions; i++) { + e_RABToBeSwitchedDLItemIEs = (NGAP_PDUSESSIONToBeSwitchedDLItemIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONToBeSwitchedDLItemIEs_t)); + e_RABToBeSwitchedDLItemIEs->id = NGAP_ProtocolIE_ID_id_PDUSESSIONToBeSwitchedDLItem; e_RABToBeSwitchedDLItemIEs->criticality = NGAP_Criticality_reject; - e_RABToBeSwitchedDLItemIEs->value.present = NGAP_E_RABToBeSwitchedDLItemIEs__value_PR_E_RABToBeSwitchedDLItem; + e_RABToBeSwitchedDLItemIEs->value.present = NGAP_PDUSESSIONToBeSwitchedDLItemIEs__value_PR_PDUSESSIONToBeSwitchedDLItem; - e_RABToBeSwitchedDLItem = &e_RABToBeSwitchedDLItemIEs->value.choice.E_RABToBeSwitchedDLItem; - e_RABToBeSwitchedDLItem->e_RAB_ID = path_switch_req_p->e_rabs_tobeswitched[i].e_rab_id; - INT32_TO_OCTET_STRING(path_switch_req_p->e_rabs_tobeswitched[i].gtp_teid, &e_RABToBeSwitchedDLItem->gTP_TEID); + e_RABToBeSwitchedDLItem = &e_RABToBeSwitchedDLItemIEs->value.choice.PDUSESSIONToBeSwitchedDLItem; + e_RABToBeSwitchedDLItem->e_RAB_ID = path_switch_req_p->pdusessions_tobeswitched[i].pdusession_id; + INT32_TO_OCTET_STRING(path_switch_req_p->pdusessions_tobeswitched[i].gtp_teid, &e_RABToBeSwitchedDLItem->gTP_TEID); - e_RABToBeSwitchedDLItem->transportLayerAddress.size = path_switch_req_p->e_rabs_tobeswitched[i].gNB_addr.length; + e_RABToBeSwitchedDLItem->transportLayerAddress.size = path_switch_req_p->pdusessions_tobeswitched[i].gNB_addr.length; e_RABToBeSwitchedDLItem->transportLayerAddress.bits_unused = 0; e_RABToBeSwitchedDLItem->transportLayerAddress.buf = calloc(1,e_RABToBeSwitchedDLItem->transportLayerAddress.size); memcpy (e_RABToBeSwitchedDLItem->transportLayerAddress.buf, - path_switch_req_p->e_rabs_tobeswitched[i].gNB_addr.buffer, - path_switch_req_p->e_rabs_tobeswitched[i].gNB_addr.length); + path_switch_req_p->pdusessions_tobeswitched[i].gNB_addr.buffer, + path_switch_req_p->pdusessions_tobeswitched[i].gNB_addr.length); - NGAP_DEBUG("path_switch_req: e_rab ID %ld, teid %u, enb_addr %d.%d.%d.%d, SIZE %zu\n", + NGAP_DEBUG("path_switch_req: pdusession ID %ld, teid %u, enb_addr %d.%d.%d.%d, SIZE %zu\n", e_RABToBeSwitchedDLItem->e_RAB_ID, - path_switch_req_p->e_rabs_tobeswitched[i].gtp_teid, + path_switch_req_p->pdusessions_tobeswitched[i].gtp_teid, e_RABToBeSwitchedDLItem->transportLayerAddress.buf[0], e_RABToBeSwitchedDLItem->transportLayerAddress.buf[1], e_RABToBeSwitchedDLItem->transportLayerAddress.buf[2], e_RABToBeSwitchedDLItem->transportLayerAddress.buf[3], e_RABToBeSwitchedDLItem->transportLayerAddress.size); - ASN_SEQUENCE_ADD(&ie->value.choice.E_RABToBeSwitchedDLList.list, e_RABToBeSwitchedDLItemIEs); + ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONToBeSwitchedDLList.list, e_RABToBeSwitchedDLItemIEs); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); @@ -1530,10 +1530,10 @@ int ngap_gNB_path_switch_req(instance_t instance, /* mandatory */ ie = (NGAP_PathSwitchRequestIEs_t *)calloc(1, sizeof(NGAP_PathSwitchRequestIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_SourceMME_UE_NGAP_ID; + ie->id = NGAP_ProtocolIE_ID_id_SourceAMF_UE_NGAP_ID; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_PathSwitchRequestIEs__value_PR_MME_UE_NGAP_ID; - ie->value.choice.MME_UE_NGAP_ID = path_switch_req_p->mme_ue_ngap_id; + ie->value.present = NGAP_PathSwitchRequestIEs__value_PR_AMF_UE_NGAP_ID; + ie->value.choice.AMF_UE_NGAP_ID = path_switch_req_p->amf_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -1585,7 +1585,7 @@ int ngap_gNB_path_switch_req(instance_t instance, /* Assign a stream for this UE : * From 3GPP 36.412 7)Transport layers: - * Within the SCTP association established between one MME and gNB pair: + * Within the SCTP association established between one AMF and gNB pair: * - a single pair of stream identifiers shall be reserved for the sole use * of NGAP elementary procedures that utilize non UE-associated signalling. * - At least one pair of stream identifiers shall be reserved for the sole use @@ -1595,27 +1595,27 @@ int ngap_gNB_path_switch_req(instance_t instance, * the stream should not be changed during the communication of the * UE-associated signalling. */ - mme_desc_p->nextstream = (mme_desc_p->nextstream + 1) % mme_desc_p->out_streams; + amf_desc_p->nextstream = (amf_desc_p->nextstream + 1) % amf_desc_p->out_streams; - if ((mme_desc_p->nextstream == 0) && (mme_desc_p->out_streams > 1)) { - mme_desc_p->nextstream += 1; + if ((amf_desc_p->nextstream == 0) && (amf_desc_p->out_streams > 1)) { + amf_desc_p->nextstream += 1; } - ue_context_p->tx_stream = mme_desc_p->nextstream; + ue_context_p->tx_stream = amf_desc_p->nextstream; MSC_LOG_TX_MESSAGE( MSC_NGAP_GNB, - MSC_NGAP_MME, + MSC_NGAP_AMF, (const char *)buffer, length, - MSC_AS_TIME_FMT" E_RAN Setup successfulOutcome gNB_ue_ngap_id %u mme_ue_ngap_id %u", + MSC_AS_TIME_FMT" E_RAN Setup successfulOutcome gNB_ue_ngap_id %u amf_ue_ngap_id %u", 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_context_p->gNB_ue_ngap_id, - path_switch_req_p->mme_ue_ngap_id); + path_switch_req_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, - mme_desc_p->assoc_id, buffer, + amf_desc_p->assoc_id, buffer, length, ue_context_p->tx_stream); return ret; @@ -1624,22 +1624,22 @@ int ngap_gNB_path_switch_req(instance_t instance, //----------------------------------------------------------------------------- /* -* gNB generate a S1 E_RAB Modification Indication towards MME +* gNB generate a S1 PDUSESSION Modification Indication towards AMF */ -/*int ngap_gNB_generate_E_RAB_Modification_Indication( +/*int ngap_gNB_generate_PDUSESSION_Modification_Indication( instance_t instance, - ngap_e_rab_modification_ind_t *e_rab_modification_ind) + ngap_pdusession_modification_ind_t *pdusession_modification_ind) //----------------------------------------------------------------------------- { struct ngap_gNB_ue_context_s *ue_context_p = NULL; NGAP_NGAP_PDU_t pdu; - NGAP_E_RABModificationIndication_t *out = NULL; - NGAP_E_RABModificationIndicationIEs_t *ie = NULL; - NGAP_E_RABToBeModifiedItemBearerModInd_t *E_RAB_ToBeModifiedItem_BearerModInd = NULL; - NGAP_E_RABToBeModifiedItemBearerModIndIEs_t *E_RAB_ToBeModifiedItem_BearerModInd_IEs = NULL; + NGAP_PDUSESSIONModificationIndication_t *out = NULL; + NGAP_PDUSESSIONModificationIndicationIEs_t *ie = NULL; + NGAP_PDUSESSIONToBeModifiedItemBearerModInd_t *PDUSESSION_ToBeModifiedItem_BearerModInd = NULL; + NGAP_PDUSESSIONToBeModifiedItemBearerModIndIEs_t *PDUSESSION_ToBeModifiedItem_BearerModInd_IEs = NULL; - NGAP_E_RABNotToBeModifiedItemBearerModInd_t *E_RAB_NotToBeModifiedItem_BearerModInd = NULL; - NGAP_E_RABNotToBeModifiedItemBearerModIndIEs_t *E_RAB_NotToBeModifiedItem_BearerModInd_IEs = NULL; + NGAP_PDUSESSIONNotToBeModifiedItemBearerModInd_t *PDUSESSION_NotToBeModifiedItem_BearerModInd = NULL; + NGAP_PDUSESSIONNotToBeModifiedItemBearerModIndIEs_t *PDUSESSION_NotToBeModifiedItem_BearerModInd_IEs = NULL; ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; @@ -1648,117 +1648,117 @@ int ngap_gNB_path_switch_req(instance_t instance, uint32_t len = 0; int ret = 0; DevAssert(ngap_gNB_instance_p != NULL); - DevAssert(e_rab_modification_ind != NULL); + DevAssert(pdusession_modification_ind != NULL); - int num_e_rabs_tobemodified = e_rab_modification_ind->nb_of_e_rabs_tobemodified; - int num_e_rabs_nottobemodified = e_rab_modification_ind->nb_of_e_rabs_nottobemodified; + int num_pdusessions_tobemodified = pdusession_modification_ind->nb_of_pdusessions_tobemodified; + int num_pdusessions_nottobemodified = pdusession_modification_ind->nb_of_pdusessions_nottobemodified; uint32_t CSG_id = 0; if ((ue_context_p = ngap_gNB_get_ue_context(ngap_gNB_instance_p, - e_rab_modification_ind->gNB_ue_ngap_id)) == NULL) { + pdusession_modification_ind->gNB_ue_ngap_id)) == NULL) { // The context for this gNB ue ngap id doesn't exist in the map of gNB UEs NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: 0x%06x\n", - e_rab_modification_ind->gNB_ue_ngap_id); + pdusession_modification_ind->gNB_ue_ngap_id); return -1; } // 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_E_RABModificationIndication; + pdu.choice.initiatingMessage.procedureCode = NGAP_ProcedureCode_id_PDUSESSIONModificationIndication; pdu.choice.initiatingMessage.criticality = NGAP_Criticality_reject; - pdu.choice.initiatingMessage.value.present = NGAP_InitiatingMessage__value_PR_E_RABModificationIndication; - out = &pdu.choice.initiatingMessage.value.choice.E_RABModificationIndication; + pdu.choice.initiatingMessage.value.present = NGAP_InitiatingMessage__value_PR_PDUSESSIONModificationIndication; + out = &pdu.choice.initiatingMessage.value.choice.PDUSESSIONModificationIndication; // mandatory - ie = (NGAP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_E_RABModificationIndicationIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID; + ie = (NGAP_PDUSESSIONModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONModificationIndicationIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_E_RABModificationIndicationIEs__value_PR_MME_UE_NGAP_ID; - ie->value.choice.MME_UE_NGAP_ID = e_rab_modification_ind->mme_ue_ngap_id; + ie->value.present = NGAP_PDUSESSIONModificationIndicationIEs__value_PR_AMF_UE_NGAP_ID; + ie->value.choice.AMF_UE_NGAP_ID = pdusession_modification_ind->amf_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - ie = (NGAP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_E_RABModificationIndicationIEs_t)); + ie = (NGAP_PDUSESSIONModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONModificationIndicationIEs_t)); ie->id = NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_E_RABModificationIndicationIEs__value_PR_GNB_UE_NGAP_ID; - ie->value.choice.GNB_UE_NGAP_ID = e_rab_modification_ind->gNB_ue_ngap_id; + ie->value.present = NGAP_PDUSESSIONModificationIndicationIEs__value_PR_GNB_UE_NGAP_ID; + ie->value.choice.GNB_UE_NGAP_ID = pdusession_modification_ind->gNB_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); //E-RABs to be modified list - ie = (NGAP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_E_RABModificationIndicationIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_E_RABToBeModifiedListBearerModInd; + ie = (NGAP_PDUSESSIONModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONModificationIndicationIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_PDUSESSIONToBeModifiedListBearerModInd; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_E_RABModificationIndicationIEs__value_PR_E_RABToBeModifiedListBearerModInd; + ie->value.present = NGAP_PDUSESSIONModificationIndicationIEs__value_PR_PDUSESSIONToBeModifiedListBearerModInd; //The following two for-loops here will probably need to change. We should do a different type of search - for(int i=0; iid = NGAP_ProtocolIE_ID_id_E_RABToBeModifiedItemBearerModInd; - E_RAB_ToBeModifiedItem_BearerModInd_IEs->criticality = NGAP_Criticality_reject; - E_RAB_ToBeModifiedItem_BearerModInd_IEs->value.present = NGAP_E_RABToBeModifiedItemBearerModIndIEs__value_PR_E_RABToBeModifiedItemBearerModInd; - E_RAB_ToBeModifiedItem_BearerModInd = &E_RAB_ToBeModifiedItem_BearerModInd_IEs->value.choice.E_RABToBeModifiedItemBearerModInd; + for(int i=0; iid = NGAP_ProtocolIE_ID_id_PDUSESSIONToBeModifiedItemBearerModInd; + PDUSESSION_ToBeModifiedItem_BearerModInd_IEs->criticality = NGAP_Criticality_reject; + PDUSESSION_ToBeModifiedItem_BearerModInd_IEs->value.present = NGAP_PDUSESSIONToBeModifiedItemBearerModIndIEs__value_PR_PDUSESSIONToBeModifiedItemBearerModInd; + PDUSESSION_ToBeModifiedItem_BearerModInd = &PDUSESSION_ToBeModifiedItem_BearerModInd_IEs->value.choice.PDUSESSIONToBeModifiedItemBearerModInd; { - E_RAB_ToBeModifiedItem_BearerModInd->e_RAB_ID = e_rab_modification_ind->e_rabs_tobemodified[i].e_rab_id; + PDUSESSION_ToBeModifiedItem_BearerModInd->e_RAB_ID = pdusession_modification_ind->pdusessions_tobemodified[i].pdusession_id; - E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.size = e_rab_modification_ind->e_rabs_tobemodified[i].gNB_addr.length/8; - E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.bits_unused = e_rab_modification_ind->e_rabs_tobemodified[i].gNB_addr.length%8; - E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.buf = calloc(1, E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.size); - memcpy (E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.buf, e_rab_modification_ind->e_rabs_tobemodified[i].gNB_addr.buffer, - E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.size); + PDUSESSION_ToBeModifiedItem_BearerModInd->transportLayerAddress.size = pdusession_modification_ind->pdusessions_tobemodified[i].gNB_addr.length/8; + PDUSESSION_ToBeModifiedItem_BearerModInd->transportLayerAddress.bits_unused = pdusession_modification_ind->pdusessions_tobemodified[i].gNB_addr.length%8; + PDUSESSION_ToBeModifiedItem_BearerModInd->transportLayerAddress.buf = calloc(1, PDUSESSION_ToBeModifiedItem_BearerModInd->transportLayerAddress.size); + memcpy (PDUSESSION_ToBeModifiedItem_BearerModInd->transportLayerAddress.buf, pdusession_modification_ind->pdusessions_tobemodified[i].gNB_addr.buffer, + PDUSESSION_ToBeModifiedItem_BearerModInd->transportLayerAddress.size); - INT32_TO_OCTET_STRING(e_rab_modification_ind->e_rabs_tobemodified[i].gtp_teid, &E_RAB_ToBeModifiedItem_BearerModInd->dL_GTP_TEID); + INT32_TO_OCTET_STRING(pdusession_modification_ind->pdusessions_tobemodified[i].gtp_teid, &PDUSESSION_ToBeModifiedItem_BearerModInd->dL_GTP_TEID); } - ASN_SEQUENCE_ADD(&ie->value.choice.E_RABToBeModifiedListBearerModInd.list, E_RAB_ToBeModifiedItem_BearerModInd_IEs); + ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONToBeModifiedListBearerModInd.list, PDUSESSION_ToBeModifiedItem_BearerModInd_IEs); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); //E-RABs NOT to be modified list - ie = (NGAP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_E_RABModificationIndicationIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_E_RABNotToBeModifiedListBearerModInd; + ie = (NGAP_PDUSESSIONModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONModificationIndicationIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_PDUSESSIONNotToBeModifiedListBearerModInd; ie->criticality = NGAP_Criticality_reject; - if(num_e_rabs_nottobemodified > 0) { - ie->value.present = NGAP_E_RABModificationIndicationIEs__value_PR_E_RABNotToBeModifiedListBearerModInd; + if(num_pdusessions_nottobemodified > 0) { + ie->value.present = NGAP_PDUSESSIONModificationIndicationIEs__value_PR_PDUSESSIONNotToBeModifiedListBearerModInd; - for(int i=0; iid = NGAP_ProtocolIE_ID_id_E_RABNotToBeModifiedItemBearerModInd; - E_RAB_NotToBeModifiedItem_BearerModInd_IEs->criticality = NGAP_Criticality_reject; - E_RAB_NotToBeModifiedItem_BearerModInd_IEs->value.present = NGAP_E_RABNotToBeModifiedItemBearerModIndIEs__value_PR_E_RABNotToBeModifiedItemBearerModInd; - E_RAB_NotToBeModifiedItem_BearerModInd = &E_RAB_NotToBeModifiedItem_BearerModInd_IEs->value.choice.E_RABNotToBeModifiedItemBearerModInd; + for(int i=0; iid = NGAP_ProtocolIE_ID_id_PDUSESSIONNotToBeModifiedItemBearerModInd; + PDUSESSION_NotToBeModifiedItem_BearerModInd_IEs->criticality = NGAP_Criticality_reject; + PDUSESSION_NotToBeModifiedItem_BearerModInd_IEs->value.present = NGAP_PDUSESSIONNotToBeModifiedItemBearerModIndIEs__value_PR_PDUSESSIONNotToBeModifiedItemBearerModInd; + PDUSESSION_NotToBeModifiedItem_BearerModInd = &PDUSESSION_NotToBeModifiedItem_BearerModInd_IEs->value.choice.PDUSESSIONNotToBeModifiedItemBearerModInd; { - E_RAB_NotToBeModifiedItem_BearerModInd->e_RAB_ID = e_rab_modification_ind->e_rabs_nottobemodified[i].e_rab_id; + PDUSESSION_NotToBeModifiedItem_BearerModInd->e_RAB_ID = pdusession_modification_ind->pdusessions_nottobemodified[i].pdusession_id; - E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.size = e_rab_modification_ind->e_rabs_nottobemodified[i].gNB_addr.length/8; - E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.bits_unused = e_rab_modification_ind->e_rabs_nottobemodified[i].gNB_addr.length%8; - E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.buf = - calloc(1, E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.size); - memcpy (E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.buf, e_rab_modification_ind->e_rabs_nottobemodified[i].gNB_addr.buffer, - E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.size); + PDUSESSION_NotToBeModifiedItem_BearerModInd->transportLayerAddress.size = pdusession_modification_ind->pdusessions_nottobemodified[i].gNB_addr.length/8; + PDUSESSION_NotToBeModifiedItem_BearerModInd->transportLayerAddress.bits_unused = pdusession_modification_ind->pdusessions_nottobemodified[i].gNB_addr.length%8; + PDUSESSION_NotToBeModifiedItem_BearerModInd->transportLayerAddress.buf = + calloc(1, PDUSESSION_NotToBeModifiedItem_BearerModInd->transportLayerAddress.size); + memcpy (PDUSESSION_NotToBeModifiedItem_BearerModInd->transportLayerAddress.buf, pdusession_modification_ind->pdusessions_nottobemodified[i].gNB_addr.buffer, + PDUSESSION_NotToBeModifiedItem_BearerModInd->transportLayerAddress.size); - INT32_TO_OCTET_STRING(e_rab_modification_ind->e_rabs_nottobemodified[i].gtp_teid, &E_RAB_NotToBeModifiedItem_BearerModInd->dL_GTP_TEID); + INT32_TO_OCTET_STRING(pdusession_modification_ind->pdusessions_nottobemodified[i].gtp_teid, &PDUSESSION_NotToBeModifiedItem_BearerModInd->dL_GTP_TEID); } - ASN_SEQUENCE_ADD(&ie->value.choice.E_RABNotToBeModifiedListBearerModInd.list, E_RAB_NotToBeModifiedItem_BearerModInd_IEs); + ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONNotToBeModifiedListBearerModInd.list, PDUSESSION_NotToBeModifiedItem_BearerModInd_IEs); } } else{ - ie->value.present = NGAP_E_RABModificationIndicationIEs__value_PR_E_RABNotToBeModifiedListBearerModInd; - ie->value.choice.E_RABNotToBeModifiedListBearerModInd.list.size = 0; + ie->value.present = NGAP_PDUSESSIONModificationIndicationIEs__value_PR_PDUSESSIONNotToBeModifiedListBearerModInd; + ie->value.choice.PDUSESSIONNotToBeModifiedListBearerModInd.list.size = 0; } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - ie = (NGAP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_E_RABModificationIndicationIEs_t)); + ie = (NGAP_PDUSESSIONModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONModificationIndicationIEs_t)); ie->id = NGAP_ProtocolIE_ID_id_CSGMembershipInfo; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_E_RABModificationIndicationIEs__value_PR_CSGMembershipInfo; + ie->value.present = NGAP_PDUSESSIONModificationIndicationIEs__value_PR_CSGMembershipInfo; ie->value.choice.CSGMembershipInfo.cSGMembershipStatus = NGAP_CSGMembershipStatus_member; INT32_TO_BIT_STRING(CSG_id, &ie->value.choice.CSGMembershipInfo.cSG_Id); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); @@ -1772,27 +1772,27 @@ int ngap_gNB_path_switch_req(instance_t instance, // Non UE-Associated signalling -> stream = 0 NGAP_INFO("Size of encoded message: %d \n", len); ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, - ue_context_p->mme_ref->assoc_id, buffer, + ue_context_p->amf_ref->assoc_id, buffer, len, ue_context_p->tx_stream); -//ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, len, 0); +//ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, len, 0); return ret; }*/ -int ngap_gNB_generate_E_RAB_Modification_Indication( +int ngap_gNB_generate_PDUSESSION_Modification_Indication( instance_t instance, - ngap_e_rab_modification_ind_t *e_rab_modification_ind) + ngap_pdusession_modification_ind_t *pdusession_modification_ind) //----------------------------------------------------------------------------- { struct ngap_gNB_ue_context_s *ue_context_p = NULL; NGAP_NGAP_PDU_t pdu; - NGAP_E_RABModificationIndication_t *out = NULL; - NGAP_E_RABModificationIndicationIEs_t *ie = NULL; - NGAP_E_RABToBeModifiedItemBearerModInd_t *E_RAB_ToBeModifiedItem_BearerModInd = NULL; - NGAP_E_RABToBeModifiedItemBearerModIndIEs_t *E_RAB_ToBeModifiedItem_BearerModInd_IEs = NULL; + NGAP_PDUSESSIONModificationIndication_t *out = NULL; + NGAP_PDUSESSIONModificationIndicationIEs_t *ie = NULL; + NGAP_PDUSESSIONToBeModifiedItemBearerModInd_t *PDUSESSION_ToBeModifiedItem_BearerModInd = NULL; + NGAP_PDUSESSIONToBeModifiedItemBearerModIndIEs_t *PDUSESSION_ToBeModifiedItem_BearerModInd_IEs = NULL; - //NGAP_E_RABNotToBeModifiedItemBearerModInd_t *E_RAB_NotToBeModifiedItem_BearerModInd = NULL; - //NGAP_E_RABNotToBeModifiedItemBearerModIndIEs_t *E_RAB_NotToBeModifiedItem_BearerModInd_IEs = NULL; + //NGAP_PDUSESSIONNotToBeModifiedItemBearerModInd_t *PDUSESSION_NotToBeModifiedItem_BearerModInd = NULL; + //NGAP_PDUSESSIONNotToBeModifiedItemBearerModIndIEs_t *PDUSESSION_NotToBeModifiedItem_BearerModInd_IEs = NULL; ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; @@ -1801,119 +1801,119 @@ int ngap_gNB_generate_E_RAB_Modification_Indication( uint32_t len = 0; int ret = 0; DevAssert(ngap_gNB_instance_p != NULL); - DevAssert(e_rab_modification_ind != NULL); + DevAssert(pdusession_modification_ind != NULL); - int num_e_rabs_tobemodified = e_rab_modification_ind->nb_of_e_rabs_tobemodified; - //int num_e_rabs_nottobemodified = e_rab_modification_ind->nb_of_e_rabs_nottobemodified; + int num_pdusessions_tobemodified = pdusession_modification_ind->nb_of_pdusessions_tobemodified; + //int num_pdusessions_nottobemodified = pdusession_modification_ind->nb_of_pdusessions_nottobemodified; //uint32_t CSG_id = 0; //uint32_t pseudo_gtp_teid = 10; if ((ue_context_p = ngap_gNB_get_ue_context(ngap_gNB_instance_p, - e_rab_modification_ind->gNB_ue_ngap_id)) == NULL) { + pdusession_modification_ind->gNB_ue_ngap_id)) == NULL) { // The context for this gNB ue ngap id doesn't exist in the map of gNB UEs NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: 0x%06x\n", - e_rab_modification_ind->gNB_ue_ngap_id); + pdusession_modification_ind->gNB_ue_ngap_id); return -1; } // 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_E_RABModificationIndication; + pdu.choice.initiatingMessage.procedureCode = NGAP_ProcedureCode_id_PDUSESSIONModificationIndication; pdu.choice.initiatingMessage.criticality = NGAP_Criticality_reject; - pdu.choice.initiatingMessage.value.present = NGAP_InitiatingMessage__value_PR_E_RABModificationIndication; - out = &pdu.choice.initiatingMessage.value.choice.E_RABModificationIndication; + pdu.choice.initiatingMessage.value.present = NGAP_InitiatingMessage__value_PR_PDUSESSIONModificationIndication; + out = &pdu.choice.initiatingMessage.value.choice.PDUSESSIONModificationIndication; /* mandatory */ - ie = (NGAP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_E_RABModificationIndicationIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID; + ie = (NGAP_PDUSESSIONModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONModificationIndicationIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_E_RABModificationIndicationIEs__value_PR_MME_UE_NGAP_ID; - ie->value.choice.MME_UE_NGAP_ID = e_rab_modification_ind->mme_ue_ngap_id; + ie->value.present = NGAP_PDUSESSIONModificationIndicationIEs__value_PR_AMF_UE_NGAP_ID; + ie->value.choice.AMF_UE_NGAP_ID = pdusession_modification_ind->amf_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - ie = (NGAP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_E_RABModificationIndicationIEs_t)); + ie = (NGAP_PDUSESSIONModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONModificationIndicationIEs_t)); ie->id = NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_E_RABModificationIndicationIEs__value_PR_GNB_UE_NGAP_ID; - ie->value.choice.GNB_UE_NGAP_ID = e_rab_modification_ind->gNB_ue_ngap_id; + ie->value.present = NGAP_PDUSESSIONModificationIndicationIEs__value_PR_GNB_UE_NGAP_ID; + ie->value.choice.GNB_UE_NGAP_ID = pdusession_modification_ind->gNB_ue_ngap_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); //E-RABs to be modified list - ie = (NGAP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_E_RABModificationIndicationIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_E_RABToBeModifiedListBearerModInd; + ie = (NGAP_PDUSESSIONModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONModificationIndicationIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_PDUSESSIONToBeModifiedListBearerModInd; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_E_RABModificationIndicationIEs__value_PR_E_RABToBeModifiedListBearerModInd; + ie->value.present = NGAP_PDUSESSIONModificationIndicationIEs__value_PR_PDUSESSIONToBeModifiedListBearerModInd; //The following two for-loops here will probably need to change. We should do a different type of search - for(int i=0; iid = NGAP_ProtocolIE_ID_id_E_RABToBeModifiedItemBearerModInd; - E_RAB_ToBeModifiedItem_BearerModInd_IEs->criticality = NGAP_Criticality_reject; - E_RAB_ToBeModifiedItem_BearerModInd_IEs->value.present = NGAP_E_RABToBeModifiedItemBearerModIndIEs__value_PR_E_RABToBeModifiedItemBearerModInd; - E_RAB_ToBeModifiedItem_BearerModInd = &E_RAB_ToBeModifiedItem_BearerModInd_IEs->value.choice.E_RABToBeModifiedItemBearerModInd; + for(int i=0; iid = NGAP_ProtocolIE_ID_id_PDUSESSIONToBeModifiedItemBearerModInd; + PDUSESSION_ToBeModifiedItem_BearerModInd_IEs->criticality = NGAP_Criticality_reject; + PDUSESSION_ToBeModifiedItem_BearerModInd_IEs->value.present = NGAP_PDUSESSIONToBeModifiedItemBearerModIndIEs__value_PR_PDUSESSIONToBeModifiedItemBearerModInd; + PDUSESSION_ToBeModifiedItem_BearerModInd = &PDUSESSION_ToBeModifiedItem_BearerModInd_IEs->value.choice.PDUSESSIONToBeModifiedItemBearerModInd; { - E_RAB_ToBeModifiedItem_BearerModInd->e_RAB_ID = e_rab_modification_ind->e_rabs_tobemodified[i].e_rab_id; + PDUSESSION_ToBeModifiedItem_BearerModInd->e_RAB_ID = pdusession_modification_ind->pdusessions_tobemodified[i].pdusession_id; - E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.size = e_rab_modification_ind->e_rabs_tobemodified[i].gNB_addr.length/8; - E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.bits_unused = e_rab_modification_ind->e_rabs_tobemodified[i].gNB_addr.length%8; - E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.buf = calloc(1, E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.size); - memcpy (E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.buf, e_rab_modification_ind->e_rabs_tobemodified[i].gNB_addr.buffer, - E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.size); + PDUSESSION_ToBeModifiedItem_BearerModInd->transportLayerAddress.size = pdusession_modification_ind->pdusessions_tobemodified[i].gNB_addr.length/8; + PDUSESSION_ToBeModifiedItem_BearerModInd->transportLayerAddress.bits_unused = pdusession_modification_ind->pdusessions_tobemodified[i].gNB_addr.length%8; + PDUSESSION_ToBeModifiedItem_BearerModInd->transportLayerAddress.buf = calloc(1, PDUSESSION_ToBeModifiedItem_BearerModInd->transportLayerAddress.size); + memcpy (PDUSESSION_ToBeModifiedItem_BearerModInd->transportLayerAddress.buf, pdusession_modification_ind->pdusessions_tobemodified[i].gNB_addr.buffer, + PDUSESSION_ToBeModifiedItem_BearerModInd->transportLayerAddress.size); - INT32_TO_OCTET_STRING(e_rab_modification_ind->e_rabs_tobemodified[i].gtp_teid, &E_RAB_ToBeModifiedItem_BearerModInd->dL_GTP_TEID); + INT32_TO_OCTET_STRING(pdusession_modification_ind->pdusessions_tobemodified[i].gtp_teid, &PDUSESSION_ToBeModifiedItem_BearerModInd->dL_GTP_TEID); } - ASN_SEQUENCE_ADD(&ie->value.choice.E_RABToBeModifiedListBearerModInd.list, E_RAB_ToBeModifiedItem_BearerModInd_IEs); + ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONToBeModifiedListBearerModInd.list, PDUSESSION_ToBeModifiedItem_BearerModInd_IEs); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); //E-RABs NOT to be modified list - /*ie = (NGAP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_E_RABModificationIndicationIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_E_RABNotToBeModifiedListBearerModInd; + /*ie = (NGAP_PDUSESSIONModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONModificationIndicationIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_PDUSESSIONNotToBeModifiedListBearerModInd; ie->criticality = NGAP_Criticality_reject; - //if(num_e_rabs_nottobemodified > 0) { - ie->value.present = NGAP_E_RABModificationIndicationIEs__value_PR_E_RABNotToBeModifiedListBearerModInd; + //if(num_pdusessions_nottobemodified > 0) { + ie->value.present = NGAP_PDUSESSIONModificationIndicationIEs__value_PR_PDUSESSIONNotToBeModifiedListBearerModInd; - for(int i=0; iid = NGAP_ProtocolIE_ID_id_E_RABNotToBeModifiedItemBearerModInd; - E_RAB_NotToBeModifiedItem_BearerModInd_IEs->criticality = NGAP_Criticality_reject; - E_RAB_NotToBeModifiedItem_BearerModInd_IEs->value.present = NGAP_E_RABNotToBeModifiedItemBearerModIndIEs__value_PR_E_RABNotToBeModifiedItemBearerModInd; - E_RAB_NotToBeModifiedItem_BearerModInd = &E_RAB_NotToBeModifiedItem_BearerModInd_IEs->value.choice.E_RABNotToBeModifiedItemBearerModInd; + for(int i=0; iid = NGAP_ProtocolIE_ID_id_PDUSESSIONNotToBeModifiedItemBearerModInd; + PDUSESSION_NotToBeModifiedItem_BearerModInd_IEs->criticality = NGAP_Criticality_reject; + PDUSESSION_NotToBeModifiedItem_BearerModInd_IEs->value.present = NGAP_PDUSESSIONNotToBeModifiedItemBearerModIndIEs__value_PR_PDUSESSIONNotToBeModifiedItemBearerModInd; + PDUSESSION_NotToBeModifiedItem_BearerModInd = &PDUSESSION_NotToBeModifiedItem_BearerModInd_IEs->value.choice.PDUSESSIONNotToBeModifiedItemBearerModInd; { - E_RAB_NotToBeModifiedItem_BearerModInd->e_RAB_ID = 10; //e_rab_modification_ind->e_rabs_tobemodified[i].e_rab_id; + PDUSESSION_NotToBeModifiedItem_BearerModInd->e_RAB_ID = 10; //pdusession_modification_ind->pdusessions_tobemodified[i].pdusession_id; - E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.size = e_rab_modification_ind->e_rabs_tobemodified[i].gNB_addr.length/8; - E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.bits_unused = e_rab_modification_ind->e_rabs_tobemodified[i].gNB_addr.length%8; - E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.buf = - calloc(1, E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.size); - memcpy (E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.buf, e_rab_modification_ind->e_rabs_tobemodified[i].gNB_addr.buffer, - E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.size); + PDUSESSION_NotToBeModifiedItem_BearerModInd->transportLayerAddress.size = pdusession_modification_ind->pdusessions_tobemodified[i].gNB_addr.length/8; + PDUSESSION_NotToBeModifiedItem_BearerModInd->transportLayerAddress.bits_unused = pdusession_modification_ind->pdusessions_tobemodified[i].gNB_addr.length%8; + PDUSESSION_NotToBeModifiedItem_BearerModInd->transportLayerAddress.buf = + calloc(1, PDUSESSION_NotToBeModifiedItem_BearerModInd->transportLayerAddress.size); + memcpy (PDUSESSION_NotToBeModifiedItem_BearerModInd->transportLayerAddress.buf, pdusession_modification_ind->pdusessions_tobemodified[i].gNB_addr.buffer, + PDUSESSION_NotToBeModifiedItem_BearerModInd->transportLayerAddress.size); - //INT32_TO_OCTET_STRING(e_rab_modification_ind->e_rabs_tobemodified[i].gtp_teid, &E_RAB_NotToBeModifiedItem_BearerModInd->dL_GTP_TEID); - INT32_TO_OCTET_STRING(pseudo_gtp_teid, &E_RAB_NotToBeModifiedItem_BearerModInd->dL_GTP_TEID); + //INT32_TO_OCTET_STRING(pdusession_modification_ind->pdusessions_tobemodified[i].gtp_teid, &PDUSESSION_NotToBeModifiedItem_BearerModInd->dL_GTP_TEID); + INT32_TO_OCTET_STRING(pseudo_gtp_teid, &PDUSESSION_NotToBeModifiedItem_BearerModInd->dL_GTP_TEID); } - ASN_SEQUENCE_ADD(&ie->value.choice.E_RABNotToBeModifiedListBearerModInd.list, E_RAB_NotToBeModifiedItem_BearerModInd_IEs); + ASN_SEQUENCE_ADD(&ie->value.choice.PDUSESSIONNotToBeModifiedListBearerModInd.list, PDUSESSION_NotToBeModifiedItem_BearerModInd_IEs); } // } //else{ -// ie->value.present = NGAP_E_RABModificationIndicationIEs__value_PR_E_RABNotToBeModifiedListBearerModInd; -// ie->value.choice.E_RABNotToBeModifiedListBearerModInd.list.size = 0; +// ie->value.present = NGAP_PDUSESSIONModificationIndicationIEs__value_PR_PDUSESSIONNotToBeModifiedListBearerModInd; +// ie->value.choice.PDUSESSIONNotToBeModifiedListBearerModInd.list.size = 0; // } / ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);*/ - /*ie = (NGAP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_E_RABModificationIndicationIEs_t)); + /*ie = (NGAP_PDUSESSIONModificationIndicationIEs_t *)calloc(1, sizeof(NGAP_PDUSESSIONModificationIndicationIEs_t)); ie->id = NGAP_ProtocolIE_ID_id_CSGMembershipInfo; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_E_RABModificationIndicationIEs__value_PR_CSGMembershipInfo; + ie->value.present = NGAP_PDUSESSIONModificationIndicationIEs__value_PR_CSGMembershipInfo; ie->value.choice.CSGMembershipInfo.cSGMembershipStatus = NGAP_CSGMembershipStatus_member; INT32_TO_BIT_STRING(CSG_id, &ie->value.choice.CSGMembershipInfo.cSG_Id); ie->value.choice.CSGMembershipInfo.cSG_Id.bits_unused=5; @@ -1928,10 +1928,10 @@ int ngap_gNB_generate_E_RAB_Modification_Indication( // Non UE-Associated signalling -> stream = 0 NGAP_INFO("Size of encoded message: %d \n", len); ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, - ue_context_p->mme_ref->assoc_id, buffer, + ue_context_p->amf_ref->assoc_id, buffer, len, ue_context_p->tx_stream); -//ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, len, 0); +//ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, len, 0); return ret; } diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.h b/openair3/NGAP/ngap_gNB_nas_procedures.h index 8b12bd654f..5aa7cb8a6d 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.h +++ b/openair3/NGAP/ngap_gNB_nas_procedures.h @@ -41,19 +41,19 @@ int ngap_gNB_initial_ctxt_resp( int ngap_gNB_ue_capabilities(instance_t instance, ngap_ue_cap_info_ind_t *ue_cap_info_ind_p); -int ngap_gNB_e_rab_setup_resp(instance_t instance, - ngap_e_rab_setup_resp_t *e_rab_setup_resp_p); +int ngap_gNB_pdusession_setup_resp(instance_t instance, + ngap_pdusession_setup_resp_t *pdusession_setup_resp_p); -int ngap_gNB_e_rab_modify_resp(instance_t instance, - ngap_e_rab_modify_resp_t *e_rab_modify_resp_p); +int ngap_gNB_pdusession_modify_resp(instance_t instance, + ngap_pdusession_modify_resp_t *pdusession_modify_resp_p); -int ngap_gNB_e_rab_release_resp(instance_t instance, - ngap_e_rab_release_resp_t *e_rab_release_resp_p); +int ngap_gNB_pdusession_release_resp(instance_t instance, + ngap_pdusession_release_resp_t *pdusession_release_resp_p); int ngap_gNB_path_switch_req(instance_t instance, ngap_path_switch_req_t *path_switch_req_p); -int ngap_gNB_generate_E_RAB_Modification_Indication( - instance_t instance, ngap_e_rab_modification_ind_t *e_rab_modification_ind); +int ngap_gNB_generate_PDUSESSION_Modification_Indication( + instance_t instance, ngap_pdusession_modification_ind_t *pdusession_modification_ind); #endif /* NGAP_GNB_NAS_PROCEDURES_H_ */ diff --git a/openair3/NGAP/ngap_gNB_nnsf.c b/openair3/NGAP/ngap_gNB_nnsf.c index 11297e114c..6036897b56 100644 --- a/openair3/NGAP/ngap_gNB_nnsf.c +++ b/openair3/NGAP/ngap_gNB_nnsf.c @@ -36,108 +36,108 @@ #include "ngap_gNB_defs.h" #include "ngap_gNB_nnsf.h" -struct ngap_gNB_mme_data_s * -ngap_gNB_nnsf_select_mme(ngap_gNB_instance_t *instance_p, +struct ngap_gNB_amf_data_s * +ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p, rrc_establishment_cause_t cause) { - struct ngap_gNB_mme_data_s *mme_data_p = NULL; - struct ngap_gNB_mme_data_s *mme_highest_capacity_p = NULL; + struct ngap_gNB_amf_data_s *amf_data_p = NULL; + struct ngap_gNB_amf_data_s *amf_highest_capacity_p = NULL; uint8_t current_capacity = 0; - RB_FOREACH(mme_data_p, ngap_mme_map, &instance_p->ngap_mme_head) { - if (mme_data_p->state != NGAP_GNB_STATE_CONNECTED) { - /* The association between MME and gNB is not ready for the moment, - * go to the next known MME. + RB_FOREACH(amf_data_p, ngap_amf_map, &instance_p->ngap_amf_head) { + if (amf_data_p->state != NGAP_GNB_STATE_CONNECTED) { + /* The association between AMF and gNB is not ready for the moment, + * go to the next known AMF. */ - if (mme_data_p->state == NGAP_GNB_OVERLOAD) { - /* MME is overloaded. We have to check the RRC establishment - * cause and take decision to the select this MME depending on + if (amf_data_p->state == NGAP_GNB_OVERLOAD) { + /* AMF is overloaded. We have to check the RRC establishment + * cause and take decision to the select this AMF depending on * the overload state. */ if ((cause == RRC_CAUSE_MO_DATA) - && (mme_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) { + && (amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) { continue; } - if ((mme_data_p->overload_state == NGAP_OVERLOAD_REJECT_ALL_SIGNALLING) + if ((amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_ALL_SIGNALLING) && ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA))) { continue; } - if ((mme_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT) + if ((amf_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT) && ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA) || (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) { continue; } - /* At this point, the RRC establishment can be handled by the MME + /* At this point, the RRC establishment can be handled by the AMF * even if it is in overload state. */ } else { - /* The MME is not overloaded, association is simply not ready. */ + /* The AMF is not overloaded, association is simply not ready. */ continue; } } - if (current_capacity < mme_data_p->relative_mme_capacity) { - /* We find a better MME, keep a reference to it */ - current_capacity = mme_data_p->relative_mme_capacity; - mme_highest_capacity_p = mme_data_p; + if (current_capacity < amf_data_p->relative_amf_capacity) { + /* We find a better AMF, keep a reference to it */ + current_capacity = amf_data_p->relative_amf_capacity; + amf_highest_capacity_p = amf_data_p; } } - return mme_highest_capacity_p; + return amf_highest_capacity_p; } -struct ngap_gNB_mme_data_s * -ngap_gNB_nnsf_select_mme_by_plmn_id(ngap_gNB_instance_t *instance_p, +struct ngap_gNB_amf_data_s * +ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p, rrc_establishment_cause_t cause, int selected_plmn_identity) { - struct ngap_gNB_mme_data_s *mme_data_p = NULL; - struct ngap_gNB_mme_data_s *mme_highest_capacity_p = NULL; + struct ngap_gNB_amf_data_s *amf_data_p = NULL; + struct ngap_gNB_amf_data_s *amf_highest_capacity_p = NULL; uint8_t current_capacity = 0; - RB_FOREACH(mme_data_p, ngap_mme_map, &instance_p->ngap_mme_head) { - struct served_gummei_s *gummei_p = NULL; + RB_FOREACH(amf_data_p, ngap_amf_map, &instance_p->ngap_amf_head) { + struct served_guami_s *guami_p = NULL; struct plmn_identity_s *served_plmn_p = NULL; - if (mme_data_p->state != NGAP_GNB_STATE_CONNECTED) { - /* The association between MME and gNB is not ready for the moment, - * go to the next known MME. + if (amf_data_p->state != NGAP_GNB_STATE_CONNECTED) { + /* The association between AMF and gNB is not ready for the moment, + * go to the next known AMF. */ - if (mme_data_p->state == NGAP_GNB_OVERLOAD) { - /* MME is overloaded. We have to check the RRC establishment - * cause and take decision to the select this MME depending on + if (amf_data_p->state == NGAP_GNB_OVERLOAD) { + /* AMF is overloaded. We have to check the RRC establishment + * cause and take decision to the select this AMF depending on * the overload state. */ if ((cause == RRC_CAUSE_MO_DATA) - && (mme_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) { + && (amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) { continue; } - if ((mme_data_p->overload_state == NGAP_OVERLOAD_REJECT_ALL_SIGNALLING) + if ((amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_ALL_SIGNALLING) && ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA))) { continue; } - if ((mme_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT) + if ((amf_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT) && ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA) || (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) { continue; } - /* At this point, the RRC establishment can be handled by the MME + /* At this point, the RRC establishment can be handled by the AMF * even if it is in overload state. */ } else { - /* The MME is not overloaded, association is simply not ready. */ + /* The AMF is not overloaded, association is simply not ready. */ continue; } } - /* Looking for served GUMMEI PLMN Identity selected matching the one provided by the UE */ - STAILQ_FOREACH(gummei_p, &mme_data_p->served_gummei, next) { - STAILQ_FOREACH(served_plmn_p, &gummei_p->served_plmns, next) { + /* Looking for served GUAMI PLMN Identity selected matching the one provided by the UE */ + STAILQ_FOREACH(guami_p, &amf_data_p->served_guami, next) { + STAILQ_FOREACH(served_plmn_p, &guami_p->served_plmns, next) { if ((served_plmn_p->mcc == instance_p->mcc[selected_plmn_identity]) && (served_plmn_p->mnc == instance_p->mnc[selected_plmn_identity])) { break; @@ -146,254 +146,254 @@ ngap_gNB_nnsf_select_mme_by_plmn_id(ngap_gNB_instance_t *instance_p, /* if found, we can stop the outer loop, too */ if (served_plmn_p) break; } - /* if we didn't find such a served PLMN, go on with the next MME */ + /* if we didn't find such a served PLMN, go on with the next AMF */ if (!served_plmn_p) continue; - if (current_capacity < mme_data_p->relative_mme_capacity) { - /* We find a better MME, keep a reference to it */ - current_capacity = mme_data_p->relative_mme_capacity; - mme_highest_capacity_p = mme_data_p; + if (current_capacity < amf_data_p->relative_amf_capacity) { + /* We find a better AMF, keep a reference to it */ + current_capacity = amf_data_p->relative_amf_capacity; + amf_highest_capacity_p = amf_data_p; } } - return mme_highest_capacity_p; + return amf_highest_capacity_p; } -struct ngap_gNB_mme_data_s * -ngap_gNB_nnsf_select_mme_by_mme_code(ngap_gNB_instance_t *instance_p, +struct ngap_gNB_amf_data_s * +ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p, rrc_establishment_cause_t cause, int selected_plmn_identity, - uint8_t mme_code) + uint8_t amf_code) { - struct ngap_gNB_mme_data_s *mme_data_p = NULL; + struct ngap_gNB_amf_data_s *amf_data_p = NULL; - RB_FOREACH(mme_data_p, ngap_mme_map, &instance_p->ngap_mme_head) { - struct served_gummei_s *gummei_p = NULL; + RB_FOREACH(amf_data_p, ngap_amf_map, &instance_p->ngap_amf_head) { + struct served_guami_s *guami_p = NULL; - if (mme_data_p->state != NGAP_GNB_STATE_CONNECTED) { - /* The association between MME and gNB is not ready for the moment, - * go to the next known MME. + if (amf_data_p->state != NGAP_GNB_STATE_CONNECTED) { + /* The association between AMF and gNB is not ready for the moment, + * go to the next known AMF. */ - if (mme_data_p->state == NGAP_GNB_OVERLOAD) { - /* MME is overloaded. We have to check the RRC establishment - * cause and take decision to the select this MME depending on + if (amf_data_p->state == NGAP_GNB_OVERLOAD) { + /* AMF is overloaded. We have to check the RRC establishment + * cause and take decision to the select this AMF depending on * the overload state. */ if ((cause == RRC_CAUSE_MO_DATA) - && (mme_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) { + && (amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) { continue; } - if ((mme_data_p->overload_state == NGAP_OVERLOAD_REJECT_ALL_SIGNALLING) + if ((amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_ALL_SIGNALLING) && ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA))) { continue; } - if ((mme_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT) + if ((amf_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT) && ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA) || (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) { continue; } - /* At this point, the RRC establishment can be handled by the MME + /* At this point, the RRC establishment can be handled by the AMF * even if it is in overload state. */ } else { - /* The MME is not overloaded, association is simply not ready. */ + /* The AMF is not overloaded, association is simply not ready. */ continue; } } - /* Looking for MME code matching the one provided by NAS */ - STAILQ_FOREACH(gummei_p, &mme_data_p->served_gummei, next) { - struct mme_code_s *mme_code_p = NULL; + /* Looking for AMF code matching the one provided by NAS */ + STAILQ_FOREACH(guami_p, &amf_data_p->served_guami, next) { + struct amf_code_s *amf_code_p = NULL; struct plmn_identity_s *served_plmn_p = NULL; - STAILQ_FOREACH(served_plmn_p, &gummei_p->served_plmns, next) { + STAILQ_FOREACH(served_plmn_p, &guami_p->served_plmns, next) { if ((served_plmn_p->mcc == instance_p->mcc[selected_plmn_identity]) && (served_plmn_p->mnc == instance_p->mnc[selected_plmn_identity])) { break; } } - STAILQ_FOREACH(mme_code_p, &gummei_p->mme_codes, next) { - if (mme_code_p->mme_code == mme_code) { + STAILQ_FOREACH(amf_code_p, &guami_p->amf_codes, next) { + if (amf_code_p->amf_code == amf_code) { break; } } - /* The MME matches the parameters provided by the NAS layer -> - * the MME is knwown and the association is ready. - * Return the reference to the MME to use it for this UE. + /* The AMF matches the parameters provided by the NAS layer -> + * the AMF is knwown and the association is ready. + * Return the reference to the AMF to use it for this UE. */ - if (mme_code_p && served_plmn_p) { - return mme_data_p; + if (amf_code_p && served_plmn_p) { + return amf_data_p; } } } - /* At this point no MME matches the selected PLMN and MME code. In this case, + /* At this point no AMF matches the selected PLMN and AMF code. In this case, * return NULL. That way the RRC layer should know about it and reject RRC * connectivity. */ return NULL; } -struct ngap_gNB_mme_data_s * -ngap_gNB_nnsf_select_mme_by_gummei(ngap_gNB_instance_t *instance_p, +struct ngap_gNB_amf_data_s * +ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p, rrc_establishment_cause_t cause, - ngap_gummei_t gummei) + ngap_guami_t guami) { - struct ngap_gNB_mme_data_s *mme_data_p = NULL; + struct ngap_gNB_amf_data_s *amf_data_p = NULL; - RB_FOREACH(mme_data_p, ngap_mme_map, &instance_p->ngap_mme_head) { - struct served_gummei_s *gummei_p = NULL; + RB_FOREACH(amf_data_p, ngap_amf_map, &instance_p->ngap_amf_head) { + struct served_guami_s *guami_p = NULL; - if (mme_data_p->state != NGAP_GNB_STATE_CONNECTED) { - /* The association between MME and gNB is not ready for the moment, - * go to the next known MME. + if (amf_data_p->state != NGAP_GNB_STATE_CONNECTED) { + /* The association between AMF and gNB is not ready for the moment, + * go to the next known AMF. */ - if (mme_data_p->state == NGAP_GNB_OVERLOAD) { - /* MME is overloaded. We have to check the RRC establishment - * cause and take decision to the select this MME depending on + if (amf_data_p->state == NGAP_GNB_OVERLOAD) { + /* AMF is overloaded. We have to check the RRC establishment + * cause and take decision to the select this AMF depending on * the overload state. */ if ((cause == RRC_CAUSE_MO_DATA) - && (mme_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) { + && (amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_MO_DATA)) { continue; } - if ((mme_data_p->overload_state == NGAP_OVERLOAD_REJECT_ALL_SIGNALLING) + if ((amf_data_p->overload_state == NGAP_OVERLOAD_REJECT_ALL_SIGNALLING) && ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA))) { continue; } - if ((mme_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT) + if ((amf_data_p->overload_state == NGAP_OVERLOAD_ONLY_EMERGENCY_AND_MT) && ((cause == RRC_CAUSE_MO_SIGNALLING) || (cause == RRC_CAUSE_MO_DATA) || (cause == RRC_CAUSE_HIGH_PRIO_ACCESS))) { continue; } - /* At this point, the RRC establishment can be handled by the MME + /* At this point, the RRC establishment can be handled by the AMF * even if it is in overload state. */ } else { - /* The MME is not overloaded, association is simply not ready. */ + /* The AMF is not overloaded, association is simply not ready. */ continue; } } - /* Looking for MME gummei matching the one provided by NAS */ - STAILQ_FOREACH(gummei_p, &mme_data_p->served_gummei, next) { + /* Looking for AMF guami matching the one provided by NAS */ + STAILQ_FOREACH(guami_p, &amf_data_p->served_guami, next) { struct served_group_id_s *group_id_p = NULL; - struct mme_code_s *mme_code_p = NULL; + struct amf_code_s *amf_code_p = NULL; struct plmn_identity_s *served_plmn_p = NULL; - STAILQ_FOREACH(served_plmn_p, &gummei_p->served_plmns, next) { - if ((served_plmn_p->mcc == gummei.mcc) && - (served_plmn_p->mnc == gummei.mnc)) { + STAILQ_FOREACH(served_plmn_p, &guami_p->served_plmns, next) { + if ((served_plmn_p->mcc == guami.mcc) && + (served_plmn_p->mnc == guami.mnc)) { break; } } - STAILQ_FOREACH(mme_code_p, &gummei_p->mme_codes, next) { - if (mme_code_p->mme_code == gummei.mme_code) { + STAILQ_FOREACH(amf_code_p, &guami_p->amf_codes, next) { + if (amf_code_p->amf_code == guami.amf_code) { break; } } - STAILQ_FOREACH(group_id_p, &gummei_p->served_group_ids, next) { - if (group_id_p->mme_group_id == gummei.mme_group_id) { + STAILQ_FOREACH(group_id_p, &guami_p->served_group_ids, next) { + if (group_id_p->amf_group_id == guami.amf_group_id) { break; } } - /* The MME matches the parameters provided by the NAS layer -> - * the MME is knwown and the association is ready. - * Return the reference to the MME to use it for this UE. + /* The AMF matches the parameters provided by the NAS layer -> + * the AMF is knwown and the association is ready. + * Return the reference to the AMF to use it for this UE. */ if ((group_id_p != NULL) && - (mme_code_p != NULL) && + (amf_code_p != NULL) && (served_plmn_p != NULL)) { - return mme_data_p; + return amf_data_p; } } } - /* At this point no MME matches the provided GUMMEI. In this case, return + /* At this point no AMF matches the provided GUAMI. In this case, return * NULL. That way the RRC layer should know about it and reject RRC * connectivity. */ return NULL; } -struct ngap_gNB_mme_data_s * -ngap_gNB_nnsf_select_mme_by_gummei_no_cause(ngap_gNB_instance_t *instance_p, - ngap_gummei_t gummei) +struct ngap_gNB_amf_data_s * +ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p, + ngap_guami_t guami) { - struct ngap_gNB_mme_data_s *mme_data_p = NULL; - struct ngap_gNB_mme_data_s *mme_highest_capacity_p = NULL; + struct ngap_gNB_amf_data_s *amf_data_p = NULL; + struct ngap_gNB_amf_data_s *amf_highest_capacity_p = NULL; uint8_t current_capacity = 0; - RB_FOREACH(mme_data_p, ngap_mme_map, &instance_p->ngap_mme_head) { - struct served_gummei_s *gummei_p = NULL; + RB_FOREACH(amf_data_p, ngap_amf_map, &instance_p->ngap_amf_head) { + struct served_guami_s *guami_p = NULL; - if (mme_data_p->state != NGAP_GNB_STATE_CONNECTED) { - /* The association between MME and gNB is not ready for the moment, - * go to the next known MME. + if (amf_data_p->state != NGAP_GNB_STATE_CONNECTED) { + /* The association between AMF and gNB is not ready for the moment, + * go to the next known AMF. */ - if (mme_data_p->state == NGAP_GNB_OVERLOAD) { - /* MME is overloaded. We have to check the RRC establishment - * cause and take decision to the select this MME depending on + if (amf_data_p->state == NGAP_GNB_OVERLOAD) { + /* AMF is overloaded. We have to check the RRC establishment + * cause and take decision to the select this AMF depending on * the overload state. */ } else { - /* The MME is not overloaded, association is simply not ready. */ + /* The AMF is not overloaded, association is simply not ready. */ continue; } } - if (current_capacity < mme_data_p->relative_mme_capacity) { - /* We find a better MME, keep a reference to it */ - current_capacity = mme_data_p->relative_mme_capacity; - mme_highest_capacity_p = mme_data_p; + if (current_capacity < amf_data_p->relative_amf_capacity) { + /* We find a better AMF, keep a reference to it */ + current_capacity = amf_data_p->relative_amf_capacity; + amf_highest_capacity_p = amf_data_p; } - /* Looking for MME gummei matching the one provided by NAS */ - STAILQ_FOREACH(gummei_p, &mme_data_p->served_gummei, next) { + /* Looking for AMF guami matching the one provided by NAS */ + STAILQ_FOREACH(guami_p, &amf_data_p->served_guami, next) { struct served_group_id_s *group_id_p = NULL; - struct mme_code_s *mme_code_p = NULL; + struct amf_code_s *amf_code_p = NULL; struct plmn_identity_s *served_plmn_p = NULL; - STAILQ_FOREACH(served_plmn_p, &gummei_p->served_plmns, next) { - if ((served_plmn_p->mcc == gummei.mcc) && - (served_plmn_p->mnc == gummei.mnc)) { + STAILQ_FOREACH(served_plmn_p, &guami_p->served_plmns, next) { + if ((served_plmn_p->mcc == guami.mcc) && + (served_plmn_p->mnc == guami.mnc)) { break; } } - STAILQ_FOREACH(mme_code_p, &gummei_p->mme_codes, next) { - if (mme_code_p->mme_code == gummei.mme_code) { + STAILQ_FOREACH(amf_code_p, &guami_p->amf_codes, next) { + if (amf_code_p->amf_code == guami.amf_code) { break; } } - STAILQ_FOREACH(group_id_p, &gummei_p->served_group_ids, next) { - if (group_id_p->mme_group_id == gummei.mme_group_id) { + STAILQ_FOREACH(group_id_p, &guami_p->served_group_ids, next) { + if (group_id_p->amf_group_id == guami.amf_group_id) { break; } } - /* The MME matches the parameters provided by the NAS layer -> - * the MME is knwown and the association is ready. - * Return the reference to the MME to use it for this UE. + /* The AMF matches the parameters provided by the NAS layer -> + * the AMF is knwown and the association is ready. + * Return the reference to the AMF to use it for this UE. */ if ((group_id_p != NULL) && - (mme_code_p != NULL) && + (amf_code_p != NULL) && (served_plmn_p != NULL)) { - return mme_data_p; + return amf_data_p; } } } - /* At this point no MME matches the provided GUMMEI. Select the one with the + /* At this point no AMF matches the provided GUAMI. Select the one with the * highest relative capacity. - * In case the list of known MME is empty, simply return NULL, that way the RRC + * 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. */ - return mme_highest_capacity_p; + return amf_highest_capacity_p; } diff --git a/openair3/NGAP/ngap_gNB_nnsf.h b/openair3/NGAP/ngap_gNB_nnsf.h index 96ed885a38..7bb3a1f2f8 100644 --- a/openair3/NGAP/ngap_gNB_nnsf.h +++ b/openair3/NGAP/ngap_gNB_nnsf.h @@ -22,28 +22,28 @@ #ifndef NGAP_GNB_NNSF_H_ #define NGAP_GNB_NNSF_H_ -struct ngap_gNB_mme_data_s * -ngap_gNB_nnsf_select_mme(ngap_gNB_instance_t *instance_p, +struct ngap_gNB_amf_data_s * +ngap_gNB_nnsf_select_amf(ngap_gNB_instance_t *instance_p, rrc_establishment_cause_t cause); -struct ngap_gNB_mme_data_s * -ngap_gNB_nnsf_select_mme_by_plmn_id(ngap_gNB_instance_t *instance_p, +struct ngap_gNB_amf_data_s * +ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p, rrc_establishment_cause_t cause, int selected_plmn_identity); -struct ngap_gNB_mme_data_s* -ngap_gNB_nnsf_select_mme_by_mme_code(ngap_gNB_instance_t *instance_p, +struct ngap_gNB_amf_data_s* +ngap_gNB_nnsf_select_amf_by_amf_code(ngap_gNB_instance_t *instance_p, rrc_establishment_cause_t cause, int selected_plmn_identity, - uint8_t mme_code); + uint8_t amf_code); -struct ngap_gNB_mme_data_s* -ngap_gNB_nnsf_select_mme_by_gummei(ngap_gNB_instance_t *instance_p, +struct ngap_gNB_amf_data_s* +ngap_gNB_nnsf_select_amf_by_guami(ngap_gNB_instance_t *instance_p, rrc_establishment_cause_t cause, - ngap_gummei_t gummei); + ngap_guami_t guami); -struct ngap_gNB_mme_data_s* -ngap_gNB_nnsf_select_mme_by_gummei_no_cause(ngap_gNB_instance_t *instance_p, - ngap_gummei_t gummei); +struct ngap_gNB_amf_data_s* +ngap_gNB_nnsf_select_amf_by_guami_no_cause(ngap_gNB_instance_t *instance_p, + ngap_guami_t guami); #endif /* NGAP_GNB_NNSF_H_ */ diff --git a/openair3/NGAP/ngap_gNB_overload.c b/openair3/NGAP/ngap_gNB_overload.c index f960c004ad..5854496160 100644 --- a/openair3/NGAP/ngap_gNB_overload.c +++ b/openair3/NGAP/ngap_gNB_overload.c @@ -47,7 +47,7 @@ int ngap_gNB_handle_overload_start(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { - ngap_gNB_mme_data_t *mme_desc_p; + ngap_gNB_amf_data_t *amf_desc_p; NGAP_OverloadStart_t *container; NGAP_OverloadStartIEs_t *ie; @@ -65,16 +65,16 @@ int ngap_gNB_handle_overload_start(uint32_t assoc_id, /* Non UE-associated signalling -> stream 0 */ DevCheck(stream == 0, stream, 0, 0); - if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { - /* No MME context associated */ + if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) { + /* No AMF context associated */ return -1; } - /* Mark the MME as overloaded and set the overload state according to + /* Mark the AMF as overloaded and set the overload state according to * the value received. */ - mme_desc_p->state = NGAP_GNB_OVERLOAD; - mme_desc_p->overload_state = + amf_desc_p->state = NGAP_GNB_OVERLOAD; + amf_desc_p->overload_state = ie->value.choice.OverloadResponse.choice.overloadAction; return 0; @@ -84,23 +84,23 @@ int ngap_gNB_handle_overload_stop(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { - /* We received Overload stop message, meaning that the MME is no more + /* We received Overload stop message, meaning that the AMF is no more * overloaded. This is an empty message, with only message header and no * Information Element. */ DevAssert(pdu != NULL); - ngap_gNB_mme_data_t *mme_desc_p; + ngap_gNB_amf_data_t *amf_desc_p; /* Non UE-associated signalling -> stream 0 */ DevCheck(stream == 0, stream, 0, 0); - if ((mme_desc_p = ngap_gNB_get_MME(NULL, assoc_id, 0)) == NULL) { - /* No MME context associated */ + if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) { + /* No AMF context associated */ return -1; } - mme_desc_p->state = NGAP_GNB_STATE_CONNECTED; - mme_desc_p->overload_state = NGAP_NO_OVERLOAD; + amf_desc_p->state = NGAP_GNB_STATE_CONNECTED; + amf_desc_p->overload_state = NGAP_NO_OVERLOAD; return 0; } diff --git a/openair3/NGAP/ngap_gNB_overload.h b/openair3/NGAP/ngap_gNB_overload.h index c9fe0be4e0..8a3382e53b 100644 --- a/openair3/NGAP/ngap_gNB_overload.h +++ b/openair3/NGAP/ngap_gNB_overload.h @@ -25,7 +25,7 @@ /** * \brief Handle an overload start message **/ -// int ngap_gNB_handle_overload_start(gNB_mme_desc_t *gNB_desc_p, +// int ngap_gNB_handle_overload_start(gNB_amf_desc_t *gNB_desc_p, // sctp_queue_item_t *packet_p, // struct ngap_message_s *message_p); int ngap_gNB_handle_overload_start(uint32_t assoc_id, @@ -35,7 +35,7 @@ int ngap_gNB_handle_overload_start(uint32_t assoc_id, /** * \brief Handle an overload stop message **/ -// int ngap_gNB_handle_overload_stop(gNB_mme_desc_t *gNB_desc_p, +// int ngap_gNB_handle_overload_stop(gNB_amf_desc_t *gNB_desc_p, // sctp_queue_item_t *packet_p, // struct ngap_message_s *message_p); int ngap_gNB_handle_overload_stop(uint32_t assoc_id, diff --git a/openair3/NGAP/ngap_gNB_trace.c b/openair3/NGAP/ngap_gNB_trace.c index cb13345539..6d9af7635f 100644 --- a/openair3/NGAP/ngap_gNB_trace.c +++ b/openair3/NGAP/ngap_gNB_trace.c @@ -62,10 +62,10 @@ void ngap_gNB_generate_trace_failure(struct ngap_gNB_ue_context_s *ue_desc_p, /* mandatory */ ie = (NGAP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(NGAP_TraceFailureIndicationIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_MME_UE_NGAP_ID; + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; ie->criticality = NGAP_Criticality_reject; - ie->value.present = NGAP_TraceFailureIndicationIEs__value_PR_MME_UE_NGAP_ID; - ie->value.choice.MME_UE_NGAP_ID = ue_desc_p->mme_ue_ngap_id; + 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 */ @@ -96,8 +96,8 @@ void ngap_gNB_generate_trace_failure(struct ngap_gNB_ue_context_s *ue_desc_p, return; } - ngap_gNB_itti_send_sctp_data_req(ue_desc_p->mme_ref->ngap_gNB_instance->instance, - ue_desc_p->mme_ref->assoc_id, buffer, + 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); } @@ -108,7 +108,7 @@ int ngap_gNB_handle_trace_start(uint32_t assoc_id, NGAP_TraceStart_t *container; NGAP_TraceStartIEs_t *ie; struct ngap_gNB_ue_context_s *ue_desc_p = NULL; - struct ngap_gNB_mme_data_s *mme_ref_p; + struct ngap_gNB_amf_data_s *amf_ref_p; DevAssert(pdu != NULL); @@ -116,10 +116,10 @@ int ngap_gNB_handle_trace_start(uint32_t assoc_id, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_TraceStartIEs_t, ie, container, NGAP_ProtocolIE_ID_id_gNB_UE_NGAP_ID, TRUE); - mme_ref_p = ngap_gNB_get_MME(NULL, assoc_id, 0); - DevAssert(mme_ref_p != NULL); + amf_ref_p = ngap_gNB_get_AMF(NULL, assoc_id, 0); + DevAssert(amf_ref_p != NULL); if (ie != NULL) { - ue_desc_p = ngap_gNB_get_ue_context(mme_ref_p->ngap_gNB_instance, + ue_desc_p = ngap_gNB_get_ue_context(amf_ref_p->ngap_gNB_instance, ie->value.choice.GNB_UE_NGAP_ID); } if (ue_desc_p == NULL) { diff --git a/openair3/NGAP/ngap_gNB_trace.h b/openair3/NGAP/ngap_gNB_trace.h index f1ef60cb74..4770064981 100644 --- a/openair3/NGAP/ngap_gNB_trace.h +++ b/openair3/NGAP/ngap_gNB_trace.h @@ -25,18 +25,18 @@ // int ngap_gNB_generate_trace_failure(sctp_data_t *sctp_data_p, // int32_t stream, // uint32_t gNB_ue_ngap_id, -// uint32_t mme_ue_ngap_id, +// uint32_t amf_ue_ngap_id, // E_UTRAN_Trace_ID_t *trace_id, // Cause_t *cause_p); -// int ngap_gNB_handle_trace_start(gNB_mme_desc_t *gNB_desc_p, +// int ngap_gNB_handle_trace_start(gNB_amf_desc_t *gNB_desc_p, // sctp_queue_item_t *packet_p, // struct ngap_message_s *message_p); int ngap_gNB_handle_trace_start(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); -// int ngap_gNB_handle_deactivate_trace(gNB_mme_desc_t *gNB_desc_p, +// int ngap_gNB_handle_deactivate_trace(gNB_amf_desc_t *gNB_desc_p, // sctp_queue_item_t *packet_p, // struct ngap_message_s *message_p); int ngap_gNB_handle_deactivate_trace(uint32_t assoc_id, diff --git a/openair3/NGAP/ngap_gNB_ue_context.h b/openair3/NGAP/ngap_gNB_ue_context.h index 91af61acca..b5e64d8dd0 100644 --- a/openair3/NGAP/ngap_gNB_ue_context.h +++ b/openair3/NGAP/ngap_gNB_ue_context.h @@ -28,12 +28,12 @@ #define NGAP_GNB_UE_CONTEXT_H_ // Forward declarations -struct ngap_gNB_mme_data_s; +struct ngap_gNB_amf_data_s; struct ngap_ue_map; -struct gNB_mme_desc_s; +struct gNB_amf_desc_s; typedef enum { - /* UE has not been registered to a MME or UE association has failed. */ + /* UE has not been registered to a AMF or UE association has failed. */ NGAP_UE_DECONNECTED = 0x0, /* UE ngap state is waiting for initial context setup request message. */ NGAP_UE_WAITING_CSR = 0x1, @@ -46,7 +46,7 @@ typedef struct ngap_gNB_ue_context_s { /* Tree related data */ RB_ENTRY(ngap_gNB_ue_context_s) entries; - /* Uniquely identifies the UE between MME and gNB within the gNB. + /* Uniquely identifies the UE between AMF and gNB within the gNB. * This id is encoded on 24bits. */ unsigned gNB_ue_ngap_id:24; @@ -54,8 +54,8 @@ typedef struct ngap_gNB_ue_context_s { /* UE id for initial connection to NGAP */ uint16_t ue_initial_id; - /* Uniquely identifies the UE within MME. Encoded on 32 bits. */ - uint32_t mme_ue_ngap_id; + /* Uniquely identifies the UE within AMF. Encoded on 32 bits. */ + uint32_t amf_ue_ngap_id; /* Stream used for this particular UE */ int32_t tx_stream; @@ -64,8 +64,8 @@ typedef struct ngap_gNB_ue_context_s { /* Current UE state. */ ngap_ue_state ue_state; - /* Reference to MME data this UE is attached to */ - struct ngap_gNB_mme_data_s *mme_ref; + /* Reference to AMF data this UE is attached to */ + struct ngap_gNB_amf_data_s *amf_ref; /* Signaled by the UE in RRC Connection Setup Complete and used in NAS Uplink * to route NAS messages correctly. 0-based, not 1-based as in TS 36.331