Commit 0fdc6711 authored by wujing's avatar wujing

fix merge problems in ittisim

parent c994c2ad
...@@ -1097,12 +1097,40 @@ rrc_gNB_decode_dcch( ...@@ -1097,12 +1097,40 @@ rrc_gNB_decode_dcch(
ue_context_p->ue_context.ue_release_timer = 0; ue_context_p->ue_context.ue_release_timer = 0;
break; break;
case NR_UL_DCCH_MessageType__c1_PR_securityModeComplete:
case NR_UL_DCCH_MessageType__c1_PR_ulInformationTransfer:
LOG_I(NR_RRC,"Recived RRC GNB UL Information Transfer \n");
if(!ue_context_p) {
LOG_I(NR_RRC, "Processing ulInformationTransfer UE %x, ue_context_p is NULL\n", ctxt_pP->rnti);
break;
}
LOG_D(NR_RRC,"[MSG] RRC UL Information Transfer \n");
LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP,
"[MSG] RRC UL Information Transfer \n");
MSC_LOG_RX_MESSAGE(
MSC_RRC_GNB,
MSC_RRC_UE,
Rx_sdu,
sdu_sizeP,
MSC_AS_TIME_FMT" ulInformationTransfer UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_p->ue_context.rnti,
sdu_sizeP);
if (AMF_MODE_ENABLED == 1) {
rrc_gNB_send_NGAP_UPLINK_NAS(ctxt_pP,
ue_context_p,
ul_dcch_msg);
}
break;
case NR_UL_DCCH_MessageType__c1_PR_securityModeComplete:
// to avoid segmentation fault // to avoid segmentation fault
if(!ue_context_p) { if(!ue_context_p) {
LOG_I(NR_RRC, "Processing securityModeComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti); LOG_I(NR_RRC, "Processing securityModeComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti);
break; break;
} }
LOG_I(NR_RRC, LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" received securityModeComplete on UL-DCCH %d from UE\n", PROTOCOL_NR_RRC_CTXT_UE_FMT" received securityModeComplete on UL-DCCH %d from UE\n",
...@@ -1122,6 +1150,31 @@ rrc_gNB_decode_dcch( ...@@ -1122,6 +1150,31 @@ rrc_gNB_decode_dcch(
rrc_gNB_generate_UECapabilityEnquiry(ctxt_pP, ue_context_p); rrc_gNB_generate_UECapabilityEnquiry(ctxt_pP, ue_context_p);
//rrc_gNB_generate_defaultRRCReconfiguration(ctxt_pP, ue_context_p); //rrc_gNB_generate_defaultRRCReconfiguration(ctxt_pP, ue_context_p);
break; break;
case NR_UL_DCCH_MessageType__c1_PR_securityModeFailure:
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP,
"[MSG] NR RRC Security Mode Failure\n");
MSC_LOG_RX_MESSAGE(
MSC_RRC_GNB,
MSC_RRC_UE,
Rx_sdu,
sdu_sizeP,
MSC_AS_TIME_FMT" securityModeFailure UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_p->ue_context.rnti,
sdu_sizeP);
LOG_W(NR_RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(securityModeFailure) ---> RRC_gNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH,
sdu_sizeP);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)ul_dcch_msg);
}
rrc_gNB_generate_UECapabilityEnquiry(ctxt_pP, ue_context_p);
break;
case NR_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: case NR_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation:
if(!ue_context_p) { if(!ue_context_p) {
...@@ -1227,10 +1280,14 @@ rrc_gNB_decode_dcch( ...@@ -1227,10 +1280,14 @@ rrc_gNB_decode_dcch(
if(eutra_index == -1) if(eutra_index == -1)
break; break;
} }
if (AMF_MODE_ENABLED == 1) {
rrc_gNB_generate_defaultRRCReconfiguration(ctxt_pP, ue_context_p); rrc_gNB_send_NGAP_UE_CAPABILITIES_IND(ctxt_pP,
break; ue_context_p,
ul_dcch_msg);
}
rrc_gNB_generate_defaultRRCReconfiguration(ctxt_pP, ue_context_p);
break;
default: default:
break; break;
......
...@@ -61,6 +61,9 @@ ...@@ -61,6 +61,9 @@
#include "assertions.h" #include "assertions.h"
#include "conversions.h" #include "conversions.h"
#if defined(TEST_S1C_AMF)
#include "oaisim_amf_test_s1c.h"
#endif
ngap_gNB_config_t ngap_config; ngap_gNB_config_t ngap_config;
...@@ -95,6 +98,7 @@ static void ngap_gNB_register_amf(ngap_gNB_instance_t *instance_p, ...@@ -95,6 +98,7 @@ static void ngap_gNB_register_amf(ngap_gNB_instance_t *instance_p,
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
sctp_new_association_req_t *sctp_new_association_req_p = NULL; sctp_new_association_req_t *sctp_new_association_req_p = NULL;
ngap_gNB_amf_data_t *ngap_amf_data_p = NULL; ngap_gNB_amf_data_t *ngap_amf_data_p = NULL;
struct ngap_gNB_amf_data_s *amf = NULL;
DevAssert(instance_p != NULL); DevAssert(instance_p != NULL);
DevAssert(amf_ip_address != NULL); DevAssert(amf_ip_address != NULL);
message_p = itti_alloc_new_message(TASK_NGAP, SCTP_NEW_ASSOCIATION_REQ); message_p = itti_alloc_new_message(TASK_NGAP, SCTP_NEW_ASSOCIATION_REQ);
...@@ -110,29 +114,50 @@ static void ngap_gNB_register_amf(ngap_gNB_instance_t *instance_p, ...@@ -110,29 +114,50 @@ static void ngap_gNB_register_amf(ngap_gNB_instance_t *instance_p,
local_ip_addr, local_ip_addr,
sizeof(*local_ip_addr)); sizeof(*local_ip_addr));
NGAP_INFO("[gNB %d] check the amf registration state\n",instance_p->instance); NGAP_INFO("[gNB %d] check the amf registration state\n",instance_p->instance);
amf = NULL;
/* Create new AMF descriptor */
ngap_amf_data_p = calloc(1, sizeof(*ngap_amf_data_p)); if ( amf == NULL ) {
DevAssert(ngap_amf_data_p != NULL); /* Create new AMF descriptor */
ngap_amf_data_p->cnx_id = ngap_gNB_fetch_add_global_cnx_id(); ngap_amf_data_p = calloc(1, sizeof(*ngap_amf_data_p));
sctp_new_association_req_p->ulp_cnx_id = ngap_amf_data_p->cnx_id; DevAssert(ngap_amf_data_p != NULL);
ngap_amf_data_p->assoc_id = -1; ngap_amf_data_p->cnx_id = ngap_gNB_fetch_add_global_cnx_id();
ngap_amf_data_p->broadcast_plmn_num = broadcast_plmn_num; sctp_new_association_req_p->ulp_cnx_id = ngap_amf_data_p->cnx_id;
memcpy(&ngap_amf_data_p->amf_s1_ip, ngap_amf_data_p->assoc_id = -1;
amf_ip_address, ngap_amf_data_p->broadcast_plmn_num = broadcast_plmn_num;
sizeof(*amf_ip_address)); memcpy(&ngap_amf_data_p->amf_s1_ip,
for (int i = 0; i < broadcast_plmn_num; ++i) amf_ip_address,
ngap_amf_data_p->broadcast_plmn_index[i] = broadcast_plmn_index[i]; sizeof(*amf_ip_address));
for (int i = 0; i < broadcast_plmn_num; ++i)
ngap_amf_data_p->ngap_gNB_instance = instance_p; ngap_amf_data_p->broadcast_plmn_index[i] = broadcast_plmn_index[i];
STAILQ_INIT(&ngap_amf_data_p->served_guami);
/* Insert the new descriptor in list of known AMF ngap_amf_data_p->ngap_gNB_instance = instance_p;
* but not yet associated. STAILQ_INIT(&ngap_amf_data_p->served_guami);
*/ /* Insert the new descriptor in list of known AMF
RB_INSERT(ngap_amf_map, &instance_p->ngap_amf_head, ngap_amf_data_p); * but not yet associated.
ngap_amf_data_p->state = NGAP_GNB_STATE_WAITING; */
instance_p->ngap_amf_nb ++; RB_INSERT(ngap_amf_map, &instance_p->ngap_amf_head, ngap_amf_data_p);
instance_p->ngap_amf_pending_nb ++; 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,
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_amf_data_p->assoc_id = -1;
ngap_amf_data_p->ngap_gNB_instance = instance_p;
*/
} else {
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,
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); itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p);
} }
...@@ -255,10 +280,13 @@ static ...@@ -255,10 +280,13 @@ static
void ngap_gNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { void ngap_gNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) {
int result; int result;
DevAssert(sctp_data_ind != NULL); DevAssert(sctp_data_ind != NULL);
#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, ngap_gNB_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream,
sctp_data_ind->buffer, sctp_data_ind->buffer_length); sctp_data_ind->buffer, sctp_data_ind->buffer_length);
#endif
result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
} }
......
...@@ -344,11 +344,11 @@ int ngap_gNB_handle_nas_downlink(uint32_t assoc_id, ...@@ -344,11 +344,11 @@ int ngap_gNB_handle_nas_downlink(uint32_t assoc_id,
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
/* UE-related procedure -> stream != 0 */ /* UE-related procedure -> stream != 0 */
if (stream == 0) { // if (stream == 0) {
NGAP_ERROR("[SCTP %d] Received UE-related procedure on stream == 0\n", // NGAP_ERROR("[SCTP %d] Received UE-related procedure on stream == 0\n",
assoc_id); // assoc_id);
return -1; // return -1;
} // }
if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) { if ((amf_desc_p = ngap_gNB_get_AMF(NULL, assoc_id, 0)) == NULL) {
NGAP_ERROR( NGAP_ERROR(
...@@ -581,6 +581,7 @@ int ngap_gNB_nas_non_delivery_ind(instance_t instance, ...@@ -581,6 +581,7 @@ int ngap_gNB_nas_non_delivery_ind(instance_t instance,
/* Prepare the NGAP message to encode */ /* Prepare the NGAP message to encode */
memset(&pdu, 0, sizeof(pdu)); memset(&pdu, 0, sizeof(pdu));
pdu.present = NGAP_NGAP_PDU_PR_initiatingMessage; pdu.present = NGAP_NGAP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage = (NGAP_InitiatingMessage_t *)calloc(1,sizeof(NGAP_InitiatingMessage_t));
pdu.choice.initiatingMessage->procedureCode = NGAP_ProcedureCode_id_NASNonDeliveryIndication; pdu.choice.initiatingMessage->procedureCode = NGAP_ProcedureCode_id_NASNonDeliveryIndication;
pdu.choice.initiatingMessage->criticality = NGAP_Criticality_ignore; pdu.choice.initiatingMessage->criticality = NGAP_Criticality_ignore;
pdu.choice.initiatingMessage->value.present = NGAP_InitiatingMessage__value_PR_NASNonDeliveryIndication; pdu.choice.initiatingMessage->value.present = NGAP_InitiatingMessage__value_PR_NASNonDeliveryIndication;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment