Commit 37d52bdf authored by wujing's avatar wujing

Merge branch 'develop_SA_SIM' into develop_SA_L3

 Conflicts:
	openair2/RRC/NR/nr_rrc_proto.h
	openair2/RRC/NR/rrc_gNB.c
	openair2/RRC/NR_UE/rrc_UE.c
	openair2/RRC/NR_UE/rrc_defs.h
	openair3/NGAP/ngap_gNB_nas_procedures.c
parents 19118c13 a53d6795
...@@ -48,6 +48,7 @@ typedef enum { ...@@ -48,6 +48,7 @@ typedef enum {
MSC_MAC_ENB, MSC_MAC_ENB,
MSC_RLC_ENB, MSC_RLC_ENB,
MSC_PDCP_ENB, MSC_PDCP_ENB,
MSC_PDCP_GNB,
MSC_RRC_ENB, MSC_RRC_ENB,
MSC_RRC_GNB, MSC_RRC_GNB,
MSC_IP_ENB, MSC_IP_ENB,
......
...@@ -30,4 +30,7 @@ MESSAGE_DEF(GTPV1U_ENB_DATA_FORWARDING_IND, MESSAGE_PRIORITY_MED, gtpv1u_enb_dat ...@@ -30,4 +30,7 @@ MESSAGE_DEF(GTPV1U_ENB_DATA_FORWARDING_IND, MESSAGE_PRIORITY_MED, gtpv1u_enb_dat
MESSAGE_DEF(GTPV1U_ENB_END_MARKER_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_end_marker_req_t, Gtpv1uEndMarkerReq) MESSAGE_DEF(GTPV1U_ENB_END_MARKER_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_end_marker_req_t, Gtpv1uEndMarkerReq)
MESSAGE_DEF(GTPV1U_ENB_END_MARKER_IND, MESSAGE_PRIORITY_MED, gtpv1u_enb_end_marker_ind_t, Gtpv1uEndMarkerInd) MESSAGE_DEF(GTPV1U_ENB_END_MARKER_IND, MESSAGE_PRIORITY_MED, gtpv1u_enb_end_marker_ind_t, Gtpv1uEndMarkerInd)
MESSAGE_DEF(GTPV1U_ENB_S1_REQ, MESSAGE_PRIORITY_MED, Gtpv1uS1Req, gtpv1uS1Req) MESSAGE_DEF(GTPV1U_ENB_S1_REQ, MESSAGE_PRIORITY_MED, Gtpv1uS1Req, gtpv1uS1Req)
MESSAGE_DEF(GTPV1U_GNB_DELETE_TUNNEL_REQ, MESSAGE_PRIORITY_MED, gtpv1u_gnb_delete_tunnel_req_t, NRGtpv1uDeleteTunnelReq)
MESSAGE_DEF(GTPV1U_GNB_DELETE_TUNNEL_RESP, MESSAGE_PRIORITY_MED, gtpv1u_gnb_delete_tunnel_resp_t, NRGtpv1uDeleteTunnelResp)
MESSAGE_DEF(GTPV1U_GNB_NG_REQ, MESSAGE_PRIORITY_MED, Gtpv1uNGReq, gtpv1uNGReq) MESSAGE_DEF(GTPV1U_GNB_NG_REQ, MESSAGE_PRIORITY_MED, Gtpv1uNGReq, gtpv1uNGReq)
...@@ -40,7 +40,10 @@ ...@@ -40,7 +40,10 @@
#define GTPV1U_ENB_END_MARKER_IND(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uEndMarkerInd #define GTPV1U_ENB_END_MARKER_IND(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uEndMarkerInd
#define GTPV1U_ENB_S1_REQ(mSGpTR) (mSGpTR)->ittiMsg.gtpv1uS1Req #define GTPV1U_ENB_S1_REQ(mSGpTR) (mSGpTR)->ittiMsg.gtpv1uS1Req
#define GTPV1U_GNB_NG_REQ(mSGpTR) (mSGpTR)->ittiMsg.gtpv1uNGReq
#define GTPV1U_GNB_DELETE_TUNNEL_REQ(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uDeleteTunnelReq
#define GTPV1U_GNB_DELETE_TUNNEL_RESP(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uDeleteTunnelResp
#define GTPV1U_GNB_NG_REQ(mSGpTR) (mSGpTR)->ittiMsg.gtpv1uNGReq
#define GTPV1U_ALL_TUNNELS_TEID (teid_t)0xFFFFFFFF #define GTPV1U_ALL_TUNNELS_TEID (teid_t)0xFFFFFFFF
...@@ -195,4 +198,16 @@ typedef struct gtpv1u_gnb_create_tunnel_resp_s { ...@@ -195,4 +198,16 @@ typedef struct gtpv1u_gnb_create_tunnel_resp_s {
transport_layer_addr_t gnb_addr; transport_layer_addr_t gnb_addr;
} gtpv1u_gnb_create_tunnel_resp_t; } gtpv1u_gnb_create_tunnel_resp_t;
typedef struct gtpv1u_gnb_delete_tunnel_req_s {
rnti_t rnti;
uint8_t num_pdusession;
pdusessionid_t pdusession_id[NR_GTPV1U_MAX_BEARERS_PER_UE];
} gtpv1u_gnb_delete_tunnel_req_t;
typedef struct gtpv1u_gnb_delete_tunnel_resp_s {
rnti_t rnti;
uint8_t status; ///< Status of NGU endpoint deleteion (Failed = 0xFF or Success = 0x0)
teid_t gnb_NGu_teid; ///< local NGU Tunnel Endpoint Identifier to be deleted
} gtpv1u_gnb_delete_tunnel_resp_t;
#endif /* GTPV1_U_MESSAGES_TYPES_H_ */ #endif /* GTPV1_U_MESSAGES_TYPES_H_ */
...@@ -741,6 +741,10 @@ typedef struct ngap_ue_release_command_s { ...@@ -741,6 +741,10 @@ typedef struct ngap_ue_release_command_s {
typedef struct pdusession_release_s { typedef struct pdusession_release_s {
/* Unique pdusession_id for the UE. */ /* Unique pdusession_id for the UE. */
uint8_t pdusession_id; uint8_t pdusession_id;
/* Octet string data */
uint8_t *transfer_buffer;
/* Length of the octet string */
uint32_t transfer_length;
} pdusession_release_t; } pdusession_release_t;
typedef struct ngap_ue_release_req_s { typedef struct ngap_ue_release_req_s {
......
...@@ -523,6 +523,7 @@ typedef struct gNB_MAC_INST_s { ...@@ -523,6 +523,7 @@ typedef struct gNB_MAC_INST_s {
/// UL handle /// UL handle
uint32_t ul_handle; uint32_t ul_handle;
UE_info_t UE_info;
// MAC function execution peformance profiler // MAC function execution peformance profiler
/// processing time of eNB scheduler /// processing time of eNB scheduler
......
This diff is collapsed.
...@@ -91,7 +91,7 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP, ...@@ -91,7 +91,7 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
int CC_id, int CC_id,
uint8_t *const buffer, uint8_t *const buffer,
const uint8_t transaction_id, const uint8_t transaction_id,
NR_SRB_ToAddModList_t *SRB_configList); NR_SRB_ToAddModList_t **SRB_configList);
uint8_t do_NR_SecurityModeCommand( uint8_t do_NR_SecurityModeCommand(
const protocol_ctxt_t *const ctxt_pP, const protocol_ctxt_t *const ctxt_pP,
uint8_t *const buffer, uint8_t *const buffer,
...@@ -106,11 +106,18 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, ...@@ -106,11 +106,18 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
uint8_t do_NR_RRCRelease(uint8_t *buffer, uint8_t do_NR_RRCRelease(uint8_t *buffer,
uint8_t Transaction_id); uint8_t Transaction_id);
uint16_t do_RRCReconfiguration( uint16_t do_RRCReconfiguration(
const protocol_ctxt_t *const ctxt_pP, const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP, uint8_t *buffer,
uint8_t *buffer, uint8_t Transaction_id,
uint8_t Transaction_id, NR_SRB_ToAddModList_t *SRB_configList,
gNB_RRC_INST *gnb_rrc_inst); NR_DRB_ToAddModList_t *DRB_configList,
NR_DRB_ToReleaseList_t *DRB_releaseList,
NR_SecurityConfig_t *security_config,
NR_SDAP_Config_t *sdap_config,
NR_MeasConfig_t *meas_config,
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList
*dedicatedNAS_MessageList,
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig);
uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t do_RRCSetupComplete(uint8_t Mod_id,
uint8_t *buffer, uint8_t *buffer,
...@@ -138,4 +145,23 @@ do_NR_DLInformationTransfer( ...@@ -138,4 +145,23 @@ do_NR_DLInformationTransfer(
uint8_t do_NR_ULInformationTransfer(uint8_t **buffer, uint8_t do_NR_ULInformationTransfer(uint8_t **buffer,
uint32_t pdu_length, uint32_t pdu_length,
uint8_t *pdu_buffer); uint8_t *pdu_buffer);
\ No newline at end of file
uint8_t do_RRCReestablishmentRequest(uint8_t Mod_id, uint8_t *buffer, uint16_t c_rnti);
uint8_t
do_RRCReestablishment(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP,
int CC_id,
uint8_t *const buffer,
//const uint8_t transmission_mode,
const uint8_t Transaction_id,
NR_SRB_ToAddModList_t **SRB_configList
);
uint8_t
do_RRCReestablishmentComplete(
uint8_t *buffer,
int64_t rrc_TransactionIdentifier);
...@@ -261,7 +261,10 @@ typedef enum pdu_session_satus_e { ...@@ -261,7 +261,10 @@ typedef enum pdu_session_satus_e {
PDU_SESSION_STATUS_NEW, PDU_SESSION_STATUS_NEW,
PDU_SESSION_STATUS_DONE, PDU_SESSION_STATUS_DONE,
PDU_SESSION_STATUS_ESTABLISHED, PDU_SESSION_STATUS_ESTABLISHED,
PDU_SESSION_STATUS_REESTABLISHED, // after HO
PDU_SESSION_STATUS_TOMODIFY, // ENDC NSA
PDU_SESSION_STATUS_FAILED, PDU_SESSION_STATUS_FAILED,
PDU_SESSION_STATUS_TORELEASE // to release DRB between eNB and UE
} pdu_session_status_t; } pdu_session_status_t;
typedef struct pdu_session_param_s { typedef struct pdu_session_param_s {
...@@ -323,7 +326,7 @@ typedef struct gNB_RRC_UE_s { ...@@ -323,7 +326,7 @@ typedef struct gNB_RRC_UE_s {
NR_EstablishmentCause_t establishment_cause; NR_EstablishmentCause_t establishment_cause;
/* Information from UE RRC ConnectionReestablishmentRequest */ /* Information from UE RRC ConnectionReestablishmentRequest */
NR_ReestablishmentCause_t reestablishment_cause; NR_ReestablishmentCause_t reestablishment_cause;
/* UE id for initial connection to S1AP */ /* UE id for initial connection to S1AP */
uint16_t ue_initial_id; uint16_t ue_initial_id;
...@@ -342,6 +345,8 @@ typedef struct gNB_RRC_UE_s { ...@@ -342,6 +345,8 @@ typedef struct gNB_RRC_UE_s {
uint8_t nb_of_e_rabs; uint8_t nb_of_e_rabs;
/* Total number of pdu session already setup in the list */ /* Total number of pdu session already setup in the list */
uint8_t setup_pdu_sessions; uint8_t setup_pdu_sessions;
/* Number of e_rab to be setup in the list */
uint8_t nb_of_e_rabs;
/* Number of pdu session to be setup in the list */ /* Number of pdu session to be setup in the list */
uint8_t nb_of_pdusessions; uint8_t nb_of_pdusessions;
/* Number of e_rab to be modified in the list */ /* Number of e_rab to be modified in the list */
...@@ -349,10 +354,14 @@ typedef struct gNB_RRC_UE_s { ...@@ -349,10 +354,14 @@ typedef struct gNB_RRC_UE_s {
uint8_t nb_of_failed_e_rabs; uint8_t nb_of_failed_e_rabs;
e_rab_param_t modify_e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB]; e_rab_param_t modify_e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB];
/* list of e_rab to be setup by RRC layers */ /* list of e_rab to be setup by RRC layers */
/* list of pdu session to be setup by RRC layers */
e_rab_param_t e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB];
pdu_session_param_t pdusession[NR_NB_RB_MAX];//[NGAP_MAX_PDU_SESSION]; pdu_session_param_t pdusession[NR_NB_RB_MAX];//[NGAP_MAX_PDU_SESSION];
//release e_rabs //release e_rabs
uint8_t nb_release_of_e_rabs; uint8_t nb_release_of_e_rabs;
e_rab_failed_t e_rabs_release_failed[S1AP_MAX_E_RAB]; e_rab_failed_t e_rabs_release_failed[S1AP_MAX_E_RAB];
uint8_t nb_release_of_pdusessions;
pdusession_failed_t pdusessions_release_failed[NGAP_MAX_PDUSESSION];
// LG: For GTPV1 TUNNELS // LG: For GTPV1 TUNNELS
uint32_t gnb_gtp_teid[S1AP_MAX_E_RAB]; uint32_t gnb_gtp_teid[S1AP_MAX_E_RAB];
transport_layer_addr_t gnb_gtp_addrs[S1AP_MAX_E_RAB]; transport_layer_addr_t gnb_gtp_addrs[S1AP_MAX_E_RAB];
...@@ -371,6 +380,9 @@ typedef struct gNB_RRC_UE_s { ...@@ -371,6 +380,9 @@ typedef struct gNB_RRC_UE_s {
uint32_t ue_reestablishment_timer; uint32_t ue_reestablishment_timer;
uint32_t ue_reestablishment_timer_thres; uint32_t ue_reestablishment_timer_thres;
uint8_t e_rab_release_command_flag; uint8_t e_rab_release_command_flag;
uint8_t pdu_session_release_command_flag;
uint32_t ue_rrc_inactivity_timer;
int8_t reestablishment_xid;
//------------------------------------------------------------------------------// //------------------------------------------------------------------------------//
NR_CellGroupId_t cellGroupId; NR_CellGroupId_t cellGroupId;
struct NR_SpCellConfig *spCellConfig; struct NR_SpCellConfig *spCellConfig;
...@@ -429,6 +441,8 @@ typedef struct { ...@@ -429,6 +441,8 @@ typedef struct {
NR_SRB_INFO SI; NR_SRB_INFO SI;
NR_SRB_INFO Srb0; NR_SRB_INFO Srb0;
int initial_csi_index[MAX_NR_RRC_UE_CONTEXTS]; int initial_csi_index[MAX_NR_RRC_UE_CONTEXTS];
int physCellId;
int p_gNB;
} rrc_gNB_carrier_data_t; } rrc_gNB_carrier_data_t;
//--------------------------------------------------- //---------------------------------------------------
......
...@@ -145,3 +145,11 @@ nr_rrc_data_req( ...@@ -145,3 +145,11 @@ nr_rrc_data_req(
int int
nr_rrc_mac_remove_ue(module_id_t mod_idP, nr_rrc_mac_remove_ue(module_id_t mod_idP,
rnti_t rntiP); rnti_t rntiP);
void
rrc_gNB_generate_dedicatedRRCReconfiguration_release(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP,
uint8_t xid,
uint32_t nas_length,
uint8_t *nas_buffer);
This diff is collapsed.
...@@ -1230,3 +1230,165 @@ rrc_gNB_send_NGAP_UE_CAPABILITIES_IND( ...@@ -1230,3 +1230,165 @@ rrc_gNB_send_NGAP_UE_CAPABILITIES_IND(
LOG_I(NR_RRC,"Send message to ngap: NGAP_UE_CAPABILITIES_IND\n"); LOG_I(NR_RRC,"Send message to ngap: NGAP_UE_CAPABILITIES_IND\n");
} }
//------------------------------------------------------------------------------
void
rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP,
uint8_t xid
)
//------------------------------------------------------------------------------
{
int pdu_sessions_released = 0;
MessageDef *msg_p;
msg_p = itti_alloc_new_message (TASK_RRC_GNB, NGAP_PDUSESSION_RELEASE_RESPONSE);
NGAP_PDUSESSION_RELEASE_RESPONSE (msg_p).gNB_ue_ngap_id = ue_context_pP->ue_context.gNB_ue_ngap_id;
for (int i = 0; i < NB_RB_MAX; i++) {
if (xid == ue_context_pP->ue_context.pdusession[i].xid) {
NGAP_PDUSESSION_RELEASE_RESPONSE (msg_p).pdusession_release[pdu_sessions_released].pdusession_id =
ue_context_pP->ue_context.pdusession[i].param.pdusession_id;
pdu_sessions_released++;
//clear
memset(&ue_context_pP->ue_context.pdusession[i], 0, sizeof(pdu_session_param_t));
}
}
NGAP_PDUSESSION_RELEASE_RESPONSE (msg_p).nb_of_pdusessions_released = pdu_sessions_released;
NGAP_PDUSESSION_RELEASE_RESPONSE (msg_p).nb_of_pdusessions_failed = ue_context_pP->ue_context.nb_release_of_pdusessions;
memcpy(&(NGAP_PDUSESSION_RELEASE_RESPONSE (msg_p).pdusessions_failed[0]), &ue_context_pP->ue_context.pdusessions_release_failed[0],
sizeof(pdusession_failed_t)*ue_context_pP->ue_context.nb_release_of_pdusessions);
ue_context_pP->ue_context.setup_pdu_sessions -= pdu_sessions_released;
LOG_I(NR_RRC,"NGAP PDUSESSION RELEASE RESPONSE: GNB_UE_NGAP_ID %d release_pdu_sessions %d setup_pdu_sessions %d \n",
NGAP_PDUSESSION_RELEASE_RESPONSE (msg_p).gNB_ue_ngap_id,
pdu_sessions_released, ue_context_pP->ue_context.setup_pdu_sessions);
itti_send_msg_to_task (TASK_NGAP, ctxt_pP->instance, msg_p);
//clear xid
for(int i = 0; i < NB_RB_MAX; i++) {
ue_context_pP->ue_context.pdusession[i].xid = -1;
}
//clear release pdusessions
ue_context_pP->ue_context.nb_release_of_pdusessions = 0;
memset(&ue_context_pP->ue_context.pdusessions_release_failed[0], 0, sizeof(pdusession_failed_t)*NGAP_MAX_PDUSESSION);
}
//------------------------------------------------------------------------------
int
rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(
MessageDef *msg_p,
const char *msg_name,
instance_t instance
)
//------------------------------------------------------------------------------
{
uint32_t gNB_ue_ngap_id;
rrc_gNB_ue_context_t *ue_context_p = NULL;
protocol_ctxt_t ctxt;
pdusession_release_t pdusession_release_params[NGAP_MAX_PDUSESSION];
uint8_t nb_pdusessions_torelease;
MessageDef *msg_delete_tunnels_p = NULL;
uint8_t xid;
int i, pdusession;
uint8_t b_existed,is_existed;
uint8_t pdusession_release_drb = 0;
memcpy(&pdusession_release_params[0], &(NGAP_PDUSESSION_RELEASE_COMMAND (msg_p).pdusession_release_params[0]),
sizeof(pdusession_release_t)*NGAP_MAX_PDUSESSION);
gNB_ue_ngap_id = NGAP_PDUSESSION_RELEASE_COMMAND(msg_p).gNB_ue_ngap_id;
nb_pdusessions_torelease = NGAP_PDUSESSION_RELEASE_COMMAND(msg_p).nb_pdusessions_torelease;
if (nb_pdusessions_torelease > NGAP_MAX_PDUSESSION) {
return -1;
}
ue_context_p = rrc_gNB_get_ue_context_from_ngap_ids(instance, UE_INITIAL_ID_INVALID, gNB_ue_ngap_id);
LOG_I(NR_RRC, "[gNB %d] Received %s: gNB_ue_ngap_id %d \n", instance, msg_name, gNB_ue_ngap_id);
if (ue_context_p != NULL) {
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0);
xid = rrc_gNB_get_next_transaction_identifier(ctxt.module_id);
LOG_I(NR_RRC,"PDU Session Release Command: AMF_UE_NGAP_ID %lu GNB_UE_NGAP_ID %d release_pdusessions %d \n",
NGAP_PDUSESSION_RELEASE_COMMAND (msg_p).amf_ue_ngap_id&0x000000FFFFFFFFFF, gNB_ue_ngap_id, nb_pdusessions_torelease);
for (pdusession = 0; pdusession < nb_pdusessions_torelease; pdusession++) {
b_existed = 0;
is_existed = 0;
for (i = pdusession-1; i >= 0; i--) {
if (pdusession_release_params[pdusession].pdusession_id == pdusession_release_params[i].pdusession_id) {
is_existed = 1;
break;
}
}
if(is_existed == 1) {
// pdusession_id is existed
continue;
}
for (i = 0; i < NR_NB_RB_MAX; i++) {
if (pdusession_release_params[pdusession].pdusession_id == ue_context_p->ue_context.pdusession[i].param.pdusession_id) {
b_existed = 1;
break;
}
}
if(b_existed == 0) {
// no pdusession_id
LOG_I(NR_RRC, "no pdusession_id \n");
ue_context_p->ue_context.pdusessions_release_failed[ue_context_p->ue_context.nb_release_of_pdusessions].pdusession_id = pdusession_release_params[pdusession].pdusession_id;
ue_context_p->ue_context.pdusessions_release_failed[ue_context_p->ue_context.nb_release_of_pdusessions].cause = NGAP_CAUSE_RADIO_NETWORK;
ue_context_p->ue_context.pdusessions_release_failed[ue_context_p->ue_context.nb_release_of_pdusessions].cause_value = 30;
ue_context_p->ue_context.nb_release_of_pdusessions++;
} else {
if(ue_context_p->ue_context.pdusession[i].status == PDU_SESSION_STATUS_FAILED) {
ue_context_p->ue_context.pdusession[i].xid = xid;
continue;
} else if(ue_context_p->ue_context.pdusession[i].status == PDU_SESSION_STATUS_ESTABLISHED) {
LOG_I(NR_RRC, "RELEASE pdusession %d \n", ue_context_p->ue_context.pdusession[i].param.pdusession_id);
ue_context_p->ue_context.pdusession[i].status = PDU_SESSION_STATUS_TORELEASE;
ue_context_p->ue_context.pdusession[i].xid = xid;
pdusession_release_drb++;
} else {
// pdusession_id status NG
ue_context_p->ue_context.pdusessions_release_failed[ue_context_p->ue_context.nb_release_of_pdusessions].pdusession_id = pdusession_release_params[pdusession].pdusession_id;
ue_context_p->ue_context.pdusessions_release_failed[ue_context_p->ue_context.nb_release_of_pdusessions].cause = NGAP_CAUSE_RADIO_NETWORK;
ue_context_p->ue_context.pdusessions_release_failed[ue_context_p->ue_context.nb_release_of_pdusessions].cause_value = 0;
ue_context_p->ue_context.nb_release_of_pdusessions++;
}
}
}
if(pdusession_release_drb > 0) {
//TODO RRCReconfiguration To UE
LOG_I(NR_RRC, "Send RRCReconfiguration To UE \n");
rrc_gNB_generate_dedicatedRRCReconfiguration_release(&ctxt, ue_context_p, xid, NGAP_PDUSESSION_RELEASE_COMMAND (msg_p).nas_pdu.length, NGAP_PDUSESSION_RELEASE_COMMAND (msg_p).nas_pdu.buffer);
} else {
//gtp tunnel delete
LOG_I(NR_RRC, "gtp tunnel delete \n");
msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_GNB, GTPV1U_GNB_DELETE_TUNNEL_REQ);
memset(&GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p)));
GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti;
for(i = 0; i < NB_RB_MAX; i++) {
if(xid == ue_context_p->ue_context.pdusession[i].xid) {
GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).pdusession_id[GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_pdusession++] = ue_context_p->ue_context.gnb_gtp_psi[i];
ue_context_p->ue_context.gnb_gtp_teid[i] = 0;
memset(&ue_context_p->ue_context.gnb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.gnb_gtp_addrs[i]));
ue_context_p->ue_context.gnb_gtp_psi[i] = 0;
}
}
itti_send_msg_to_task(TASK_GTPV1_U, instance, msg_delete_tunnels_p);
//NGAP_PDUSESSION_RELEASE_RESPONSE
rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(&ctxt, ue_context_p, xid);
LOG_I(NR_RRC, "Send PDU Session Release Response \n");
}
} else {
LOG_E(NR_RRC, "PDU Session Release Command: AMF_UE_NGAP_ID %lu GNB_UE_NGAP_ID %d Error ue_context_p NULL \n",
NGAP_PDUSESSION_RELEASE_COMMAND (msg_p).amf_ue_ngap_id&0x000000FFFFFFFFFF, NGAP_PDUSESSION_RELEASE_COMMAND(msg_p).gNB_ue_ngap_id);
return -1;
}
return 0;
}
...@@ -142,4 +142,25 @@ rrc_gNB_send_NGAP_UE_CAPABILITIES_IND( ...@@ -142,4 +142,25 @@ rrc_gNB_send_NGAP_UE_CAPABILITIES_IND(
NR_UL_DCCH_Message_t *const ul_dcch_msg NR_UL_DCCH_Message_t *const ul_dcch_msg
); );
int
rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(
MessageDef *msg_p,
const char *msg_name,
instance_t instance
);
void
rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP,
uint8_t xid
);
void
nr_rrc_pdcp_config_security(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *const ue_context_pP,
const uint8_t send_security_mode_command
);
#endif #endif
...@@ -134,6 +134,7 @@ rrc_gNB_allocate_new_UE_context( ...@@ -134,6 +134,7 @@ rrc_gNB_allocate_new_UE_context(
new_p->local_uid = nr_uid_linear_allocator_new(rrc_instance_pP); new_p->local_uid = nr_uid_linear_allocator_new(rrc_instance_pP);
for(int i = 0; i < NB_RB_MAX; i++) { for(int i = 0; i < NB_RB_MAX; i++) {
new_p->ue_context.e_rab[i].xid = -1;
new_p->ue_context.pdusession[i].xid = -1; new_p->ue_context.pdusession[i].xid = -1;
new_p->ue_context.modify_e_rab[i].xid = -1; new_p->ue_context.modify_e_rab[i].xid = -1;
} }
......
...@@ -183,15 +183,15 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ ...@@ -183,15 +183,15 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
if (m->nb_e_rabs_tobeadded>0) { if (m->nb_e_rabs_tobeadded>0) {
for (int i=0; i<m->nb_e_rabs_tobeadded; i++) { for (int i=0; i<m->nb_e_rabs_tobeadded; i++) {
// Add the new E-RABs at the corresponding rrc ue context of the gNB // Add the new E-RABs at the corresponding rrc ue context of the gNB
ue_context_p->ue_context.pdusession[i].param.pdusession_id = m->e_rabs_tobeadded[i].e_rab_id; ue_context_p->ue_context.e_rab[i].param.e_rab_id = m->e_rabs_tobeadded[i].e_rab_id;
ue_context_p->ue_context.pdusession[i].param.gtp_teid = m->e_rabs_tobeadded[i].gtp_teid; ue_context_p->ue_context.e_rab[i].param.gtp_teid = m->e_rabs_tobeadded[i].gtp_teid;
memcpy(&ue_context_p->ue_context.pdusession[i].param.upf_addr, &m->e_rabs_tobeadded[i].sgw_addr, sizeof(transport_layer_addr_t)); memcpy(&ue_context_p->ue_context.e_rab[i].param.sgw_addr, &m->e_rabs_tobeadded[i].sgw_addr, sizeof(transport_layer_addr_t));
ue_context_p->ue_context.nb_of_pdusessions++; ue_context_p->ue_context.nb_of_e_rabs++;
//Fill the required E-RAB specific information for the creation of the S1-U tunnel between the gNB and the SGW //Fill the required E-RAB specific information for the creation of the S1-U tunnel between the gNB and the SGW
create_tunnel_req.eps_bearer_id[i] = ue_context_p->ue_context.pdusession[i].param.pdusession_id; create_tunnel_req.eps_bearer_id[i] = ue_context_p->ue_context.e_rab[i].param.e_rab_id;
create_tunnel_req.sgw_S1u_teid[i] = ue_context_p->ue_context.pdusession[i].param.gtp_teid; create_tunnel_req.sgw_S1u_teid[i] = ue_context_p->ue_context.e_rab[i].param.gtp_teid;
memcpy(&create_tunnel_req.sgw_addr[i], &ue_context_p->ue_context.pdusession[i].param.upf_addr, sizeof(transport_layer_addr_t)); memcpy(&create_tunnel_req.sgw_addr[i], &ue_context_p->ue_context.e_rab[i].param.sgw_addr, sizeof(transport_layer_addr_t));
inde_list[i] = i; inde_list[i] = i;
LOG_I(RRC,"S1-U tunnel: index %d target sgw ip %d.%d.%d.%d length %d gtp teid %u\n", LOG_I(RRC,"S1-U tunnel: index %d target sgw ip %d.%d.%d.%d length %d gtp teid %u\n",
i, i,
...@@ -218,8 +218,8 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ ...@@ -218,8 +218,8 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).nb_e_rabs_admitted_tobeadded = m->nb_e_rabs_tobeadded; X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).nb_e_rabs_admitted_tobeadded = m->nb_e_rabs_tobeadded;
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).target_assoc_id = m->target_assoc_id; X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).target_assoc_id = m->target_assoc_id;
for(int i=0; i<ue_context_p->ue_context.nb_of_pdusessions; i++) { for(int i=0; i<ue_context_p->ue_context.nb_of_e_rabs; i++) {
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].e_rab_id = ue_context_p->ue_context.pdusession[i].param.pdusession_id; X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].e_rab_id = ue_context_p->ue_context.e_rab[i].param.e_rab_id;
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gtp_teid = create_tunnel_resp.enb_S1u_teid[i]; X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gtp_teid = create_tunnel_resp.enb_S1u_teid[i];
memcpy(&X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gnb_addr, &create_tunnel_resp.enb_addr, sizeof(transport_layer_addr_t)); memcpy(&X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).e_rabs_admitted_tobeadded[i].gnb_addr, &create_tunnel_resp.enb_addr, sizeof(transport_layer_addr_t));
//The length field in the X2AP targetting structure is expected in bits but the create_tunnel_resp returns the address length in bytes //The length field in the X2AP targetting structure is expected in bits but the create_tunnel_resp returns the address length in bytes
......
This diff is collapsed.
...@@ -126,7 +126,6 @@ typedef struct NR_UE_RRC_INST_s { ...@@ -126,7 +126,6 @@ typedef struct NR_UE_RRC_INST_s {
/* KeNB as computed from parameters within USIM card */ /* KeNB as computed from parameters within USIM card */
uint8_t kgnb[32]; uint8_t kgnb[32];
/* Used integrity/ciphering algorithms */ /* Used integrity/ciphering algorithms */
//RRC_LIST_TYPE(NR_SecurityAlgorithmConfig_t, NR_SecurityAlgorithmConfig) SecurityAlgorithmConfig_list; //RRC_LIST_TYPE(NR_SecurityAlgorithmConfig_t, NR_SecurityAlgorithmConfig) SecurityAlgorithmConfig_list;
NR_CipheringAlgorithm_t cipheringAlgorithm; NR_CipheringAlgorithm_t cipheringAlgorithm;
......
...@@ -104,7 +104,7 @@ int config_sync_var=-1; ...@@ -104,7 +104,7 @@ int config_sync_var=-1;
openair0_config_t openair0_cfg[MAX_CARDS]; openair0_config_t openair0_cfg[MAX_CARDS];
volatile int start_gNB = 0; //volatile int start_gNB = 0;
volatile int oai_exit = 0; volatile int oai_exit = 0;
//static int wait_for_sync = 0; //static int wait_for_sync = 0;
...@@ -543,7 +543,7 @@ int main( int argc, char **argv ) ...@@ -543,7 +543,7 @@ int main( int argc, char **argv )
} }
AMF_MODE_ENABLED = !IS_SOFTMODEM_NOS1; AMF_MODE_ENABLED = !IS_SOFTMODEM_NOS1;
// AMF_MODE_ENABLED = 0; // AMF_MODE_ENABLED = 0;
NGAP_CONF_MODE = !IS_SOFTMODEM_NOS1; //!get_softmodem_params()->phy_test; NGAP_CONF_MODE = !IS_SOFTMODEM_NOS1; //!get_softmodem_params()->phy_test;
#if T_TRACER #if T_TRACER
......
...@@ -551,6 +551,173 @@ gtpv1u_create_ngu_tunnel( ...@@ -551,6 +551,173 @@ gtpv1u_create_ngu_tunnel(
return ret; return ret;
} }
int gtpv1u_update_ngu_tunnel(
const instance_t instanceP,
const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP,
const rnti_t prior_rnti
) {
/* Local tunnel end-point identifier */
teid_t ngu_teid = 0;
nr_gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL;
nr_gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL;
nr_gtpv1u_ue_data_t *gtpv1u_ue_data_new_p = NULL;
//MessageDef *message_p = NULL;
hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS;
int i,j;
uint8_t bearers_num = 0,bearers_total = 0;
//-----------------------
// PDCP->GTPV1U mapping
//-----------------------
hash_rc = hashtable_get(RC.nr_gtpv1u_data_g->ue_mapping, prior_rnti, (void **)&gtpv1u_ue_data_p);
if(hash_rc != HASH_TABLE_OK) {
LOG_E(GTPU,"Error get ue_mapping(rnti=%x) from GTPV1U hashtable error\n", prior_rnti);
return -1;
}
gtpv1u_ue_data_new_p = calloc (1, sizeof(nr_gtpv1u_ue_data_t));
memcpy(gtpv1u_ue_data_new_p,gtpv1u_ue_data_p,sizeof(nr_gtpv1u_ue_data_t));
gtpv1u_ue_data_new_p->ue_id = create_tunnel_req_pP->rnti;
hash_rc = hashtable_insert(RC.nr_gtpv1u_data_g->ue_mapping, create_tunnel_req_pP->rnti, gtpv1u_ue_data_new_p);
//AssertFatal(hash_rc == HASH_TABLE_OK, "Error inserting ue_mapping in GTPV1U hashtable");
if ( hash_rc != HASH_TABLE_OK ) {
LOG_E(GTPU,"Failed to insert ue_mapping(rnti=%x) in GTPV1U hashtable\n",create_tunnel_req_pP->rnti);
return -1;
} else {
LOG_I(GTPU, "inserting ue_mapping(rnti=%x) in GTPV1U hashtable\n",
create_tunnel_req_pP->rnti);
}
hash_rc = hashtable_remove(RC.nr_gtpv1u_data_g->ue_mapping, prior_rnti);
LOG_I(GTPU, "hashtable_remove ue_mapping(rnti=%x) in GTPV1U hashtable\n",
prior_rnti);
//-----------------------
// GTPV1U->PDCP mapping
//-----------------------
bearers_total =gtpv1u_ue_data_new_p->num_bearers;
for(j = 0; j<GTPV1U_MAX_BEARERS_ID; j++) {
if(gtpv1u_ue_data_new_p->bearers[j].state != BEARER_IN_CONFIG)
continue;
bearers_num++;
for (i = 0; i < create_tunnel_req_pP->num_tunnels; i++) {
if(j == (create_tunnel_req_pP->pdusession_id[i]-GTPV1U_BEARER_OFFSET))
break;
}
if(i < create_tunnel_req_pP->num_tunnels) {
ngu_teid = gtpv1u_ue_data_new_p->bearers[j].teid_gNB;
hash_rc = hashtable_get(RC.nr_gtpv1u_data_g->teid_mapping, ngu_teid, (void **)&gtpv1u_teid_data_p);
if (hash_rc == HASH_TABLE_OK) {
gtpv1u_teid_data_p->ue_id = create_tunnel_req_pP->rnti;
gtpv1u_teid_data_p->pdu_session_id = create_tunnel_req_pP->pdusession_id[i];
LOG_I(GTPU, "updata teid_mapping te_id %u (prior_rnti %x rnti %x) in GTPV1U hashtable\n",
ngu_teid,prior_rnti,create_tunnel_req_pP->rnti);
} else {
LOG_W(GTPU, "Error get teid mapping(s1u_teid=%u) from GTPV1U hashtable", ngu_teid);
}
} else {
ngu_teid = gtpv1u_ue_data_new_p->bearers[j].teid_gNB;
hash_rc = hashtable_remove(RC.nr_gtpv1u_data_g->teid_mapping, ngu_teid);
if (hash_rc != HASH_TABLE_OK) {
LOG_D(GTPU, "Removed user rnti %x , enb S1U teid %u not found\n", prior_rnti, ngu_teid);
}
gtpv1u_ue_data_new_p->bearers[j].state = BEARER_DOWN;
gtpv1u_ue_data_new_p->num_bearers--;
LOG_I(GTPU, "delete teid_mapping te_id %u (rnti%x) bearer_id %d in GTPV1U hashtable\n",
ngu_teid,prior_rnti,j+GTPV1U_BEARER_OFFSET);;
}
if(bearers_num > bearers_total)
break;
}
return 0;
}
//-----------------------------------------------------------------------------
int gtpv1u_delete_ngu_tunnel(
const instance_t instanceP,
const gtpv1u_gnb_delete_tunnel_req_t *const req_pP) {
NwGtpv1uUlpApiT stack_req;
NwGtpv1uRcT rc = NW_GTPV1U_FAILURE;
MessageDef *message_p = NULL;
nr_gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL;
hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS;
teid_t teid_gNB = 0;
int pdusession_index = 0;
message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_GNB_DELETE_TUNNEL_RESP);
GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).rnti = req_pP->rnti;
GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).status = 0;
hash_rc = hashtable_get(RC.nr_gtpv1u_data_g->ue_mapping, req_pP->rnti, (void **)&gtpv1u_ue_data_p);
if (hash_rc == HASH_TABLE_OK) {
for (pdusession_index = 0; pdusession_index < req_pP->num_pdusession; pdusession_index++) {
teid_gNB = gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].teid_gNB;
LOG_D(GTPU, "Rx GTPV1U_ENB_DELETE_TUNNEL user rnti %x eNB S1U teid %u eps bearer id %u\n",
req_pP->rnti, teid_gNB, req_pP->pdusession_id[pdusession_index]);
{
memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT));
stack_req.apiType = NW_GTPV1U_ULP_API_DESTROY_TUNNEL_ENDPOINT;
LOG_D(GTPU, "gtpv1u_delete_ngu_tunnel pdusession %u %u\n",
req_pP->pdusession_id[pdusession_index],
teid_gNB);
stack_req.apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle =
gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].teid_gNB_stack_session;
rc = nwGtpv1uProcessUlpReq(RC.nr_gtpv1u_data_g->gtpv1u_stack, &stack_req);
LOG_D(GTPU, ".\n");
}
if (rc != NW_GTPV1U_OK) {
GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).status |= 0xFF;
LOG_E(GTPU, "NW_GTPV1U_ULP_API_DESTROY_TUNNEL_ENDPOINT failed");
}
//-----------------------
// PDCP->GTPV1U mapping
//-----------------------
gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].state = BEARER_DOWN;
gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].teid_gNB = 0;
gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].teid_upf = 0;
gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].upf_ip_addr = 0;
gtpv1u_ue_data_p->num_bearers -= 1;
if (gtpv1u_ue_data_p->num_bearers == 0) {
hash_rc = hashtable_remove(RC.nr_gtpv1u_data_g->ue_mapping, req_pP->rnti);
LOG_D(GTPU, "Removed user rnti %x,no more bearers configured\n", req_pP->rnti);
}
//-----------------------
// GTPV1U->PDCP mapping
//-----------------------
hash_rc = hashtable_remove(RC.nr_gtpv1u_data_g->teid_mapping, teid_gNB);
if (hash_rc != HASH_TABLE_OK) {
LOG_D(GTPU, "Removed user rnti %x , gNB NGU teid %u not found\n", req_pP->rnti, teid_gNB);
}
}
}// else silently do nothing
LOG_D(GTPU, "Tx GTPV1U_GNB_DELETE_TUNNEL_RESP user rnti %x gNB NGU teid %u status %u\n",
GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).rnti,
GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).gnb_NGu_teid,
GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).status);
MSC_LOG_TX_MESSAGE(
MSC_GTPU_GNB,
MSC_RRC_GNB,
NULL,0,
"0 GTPV1U_GNB_DELETE_TUNNEL_RESP rnti %x teid %x",
GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).rnti,
teid_gNB);
return itti_send_msg_to_task(TASK_RRC_GNB, instanceP, message_p);
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static int gtpv1u_gNB_send_init_udp(const Gtpv1uNGReq *req) { static int gtpv1u_gNB_send_init_udp(const Gtpv1uNGReq *req) {
// Create and alloc new message // Create and alloc new message
...@@ -603,6 +770,10 @@ void *gtpv1u_gNB_process_itti_msg(void *notUsed) { ...@@ -603,6 +770,10 @@ void *gtpv1u_gNB_process_itti_msg(void *notUsed) {
gtpv1u_ng_req(instance, &received_message_p->ittiMsg.gtpv1uNGReq); gtpv1u_ng_req(instance, &received_message_p->ittiMsg.gtpv1uNGReq);
break; break;
case GTPV1U_GNB_DELETE_TUNNEL_REQ:
gtpv1u_delete_ngu_tunnel(instance, &received_message_p->ittiMsg.NRGtpv1uDeleteTunnelReq);
break;
case TERMINATE_MESSAGE: { case TERMINATE_MESSAGE: {
if (RC.nr_gtpv1u_data_g->ue_mapping != NULL) { if (RC.nr_gtpv1u_data_g->ue_mapping != NULL) {
hashtable_destroy (&(RC.nr_gtpv1u_data_g->ue_mapping)); hashtable_destroy (&(RC.nr_gtpv1u_data_g->ue_mapping));
......
...@@ -40,5 +40,12 @@ gtpv1u_create_ngu_tunnel( ...@@ -40,5 +40,12 @@ gtpv1u_create_ngu_tunnel(
const gtpv1u_gnb_create_tunnel_req_t * const create_tunnel_req_pP, const gtpv1u_gnb_create_tunnel_req_t * const create_tunnel_req_pP,
gtpv1u_gnb_create_tunnel_resp_t * const create_tunnel_resp_pP); gtpv1u_gnb_create_tunnel_resp_t * const create_tunnel_resp_pP);
int
gtpv1u_update_ngu_tunnel(
const instance_t instanceP,
const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP,
const rnti_t prior_rnti
);
#endif /* GTPV1U_GNB_TASK_H_ */ #endif /* GTPV1U_GNB_TASK_H_ */
...@@ -525,6 +525,8 @@ void generateSecurityModeComplete(as_nas_info_t *initialNasMsg) ...@@ -525,6 +525,8 @@ void generateSecurityModeComplete(as_nas_info_t *initialNasMsg)
} }
void generateRegistrationComplete(as_nas_info_t *initialNasMsg, SORTransparentContainer *sortransparentcontainer) { void generateRegistrationComplete(as_nas_info_t *initialNasMsg, SORTransparentContainer *sortransparentcontainer) {
//wait send RRCReconfigurationComplete and InitialContextSetupResponse
sleep(1);
int length = 0; int length = 0;
int size = 0; int size = 0;
fgs_nas_message_t nas_msg; fgs_nas_message_t nas_msg;
...@@ -603,6 +605,8 @@ void generateRegistrationComplete(as_nas_info_t *initialNasMsg, SORTransparentCo ...@@ -603,6 +605,8 @@ void generateRegistrationComplete(as_nas_info_t *initialNasMsg, SORTransparentCo
} }
void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){
//wait send RegistrationComplete
usleep(100*150);
int size = 0; int size = 0;
fgs_nas_message_t nas_msg; fgs_nas_message_t nas_msg;
memset(&nas_msg, 0, sizeof(fgs_nas_message_t)); memset(&nas_msg, 0, sizeof(fgs_nas_message_t));
......
...@@ -1754,7 +1754,7 @@ int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id, ...@@ -1754,7 +1754,7 @@ int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id,
return 0; return 0;
} }
// handle e-rab release command and send it to rrc_end // handle pdu session release command and send it to rrc_end
static static
int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id, int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
...@@ -1772,7 +1772,7 @@ int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id, ...@@ -1772,7 +1772,7 @@ int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id,
container = &pdu->choice.initiatingMessage->value.choice.PDUSessionResourceReleaseCommand; container = &pdu->choice.initiatingMessage->value.choice.PDUSessionResourceReleaseCommand;
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("[SCTP %d] Received E-RAB release command for non existing AMF context\n", assoc_id); NGAP_ERROR("[SCTP %d] Received pdu session release command for non existing AMF context\n", assoc_id);
return -1; return -1;
} }
...@@ -1805,11 +1805,11 @@ int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id, ...@@ -1805,11 +1805,11 @@ int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id,
} }
/* Initial context request = UE-related procedure -> stream != 0 */ /* Initial context request = UE-related procedure -> stream != 0 */
if (stream == 0) { // if (stream == 0) {
NGAP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n", // NGAP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n",
assoc_id, stream); // assoc_id, stream);
return -1; // return -1;
} // }
ue_desc_p->rx_stream = stream; ue_desc_p->rx_stream = stream;
...@@ -1818,7 +1818,7 @@ int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id, ...@@ -1818,7 +1818,7 @@ int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id,
(uint64_t)ue_desc_p->amf_ue_ngap_id, amf_ue_ngap_id); (uint64_t)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 %lu amf_ue_ngap_id %lu\n", NGAP_DEBUG("[SCTP %d] Received pdu session release command for gNB_UE_NGAP_ID %lu amf_ue_ngap_id %lu\n",
assoc_id, gnb_ue_ngap_id, amf_ue_ngap_id); assoc_id, gnb_ue_ngap_id, amf_ue_ngap_id);
message_p = itti_alloc_new_message(TASK_NGAP, NGAP_PDUSESSION_RELEASE_COMMAND); message_p = itti_alloc_new_message(TASK_NGAP, NGAP_PDUSESSION_RELEASE_COMMAND);
NGAP_PDUSESSION_RELEASE_COMMAND(message_p).gNB_ue_ngap_id = gnb_ue_ngap_id; NGAP_PDUSESSION_RELEASE_COMMAND(message_p).gNB_ue_ngap_id = gnb_ue_ngap_id;
...@@ -1850,7 +1850,18 @@ int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id, ...@@ -1850,7 +1850,18 @@ int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id,
item_p = (NGAP_PDUSessionResourceToReleaseItemRelCmd_t *)ie->value.choice.PDUSessionResourceToReleaseListRelCmd.list.array[i]; item_p = (NGAP_PDUSessionResourceToReleaseItemRelCmd_t *)ie->value.choice.PDUSessionResourceToReleaseListRelCmd.list.array[i];
NGAP_PDUSESSION_RELEASE_COMMAND(message_p).pdusession_release_params[i].pdusession_id = item_p->pDUSessionID; NGAP_PDUSESSION_RELEASE_COMMAND(message_p).pdusession_release_params[i].pdusession_id = item_p->pDUSessionID;
NGAP_DEBUG("[SCTP] Received E-RAB release command for pDUSessionID id %ld\n", item_p->pDUSessionID); if(item_p->pDUSessionResourceReleaseCommandTransfer.size > 0) {
NGAP_PDUSESSION_RELEASE_COMMAND(message_p).pdusession_release_params[i].transfer_length = item_p->pDUSessionResourceReleaseCommandTransfer.size;
NGAP_PDUSESSION_RELEASE_COMMAND(message_p).pdusession_release_params[i].transfer_buffer = malloc(sizeof(uint8_t) * item_p->pDUSessionResourceReleaseCommandTransfer.size);
memcpy(NGAP_PDUSESSION_RELEASE_COMMAND(message_p).pdusession_release_params[i].transfer_buffer,
item_p->pDUSessionResourceReleaseCommandTransfer.buf,
item_p->pDUSessionResourceReleaseCommandTransfer.size);
}else {
NGAP_PDUSESSION_RELEASE_COMMAND(message_p).pdusession_release_params[i].transfer_length = 0;
NGAP_PDUSESSION_RELEASE_COMMAND(message_p).pdusession_release_params[i].transfer_buffer = NULL;
NGAP_ERROR("[NGAP] Received pdu session release command for pDUSessionResourceReleaseCommandTransfer is NULL!\n");
}
NGAP_DEBUG("[NGAP] Received pdu session release command for pDUSessionID id %ld\n", item_p->pDUSessionID);
} }
} else { } else {
return -1; return -1;
......
...@@ -852,21 +852,22 @@ int ngap_gNB_initial_ctxt_resp( ...@@ -852,21 +852,22 @@ int ngap_gNB_initial_ctxt_resp(
return -1; return -1;
} }
MSC_LOG_TX_MESSAGE( MSC_LOG_TX_MESSAGE(
MSC_NGAP_GNB, MSC_NGAP_GNB,
MSC_NGAP_AMF, MSC_NGAP_AMF,
(const char *)buffer, (const char *)buffer,
length, length,
MSC_AS_TIME_FMT" InitialContextSetup successfulOutcome gNB_ue_ngap_id %u amf_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), 0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
initial_ctxt_resp_p->gNB_ue_ngap_id, initial_ctxt_resp_p->gNB_ue_ngap_id,
ue_context_p->amf_ue_ngap_id); ue_context_p->amf_ue_ngap_id);
/* UE associated signalling -> use the allocated stream */ /* UE associated signalling -> use the allocated stream */
ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, LOG_I(NR_RRC,"Send message to sctp: NGAP_InitialContextSetupResponse\n");
ue_context_p->amf_ref->assoc_id, buffer, ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance,
length, ue_context_p->tx_stream); ue_context_p->amf_ref->assoc_id, buffer,
length, ue_context_p->tx_stream);
return 0;
return 0;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -1421,7 +1422,52 @@ int ngap_gNB_pdusession_release_resp(instance_t instance, ...@@ -1421,7 +1422,52 @@ int ngap_gNB_pdusession_release_resp(instance_t instance,
ie = (NGAP_PDUSessionResourceReleaseResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSessionResourceReleaseResponseIEs_t)); ie = (NGAP_PDUSessionResourceReleaseResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSessionResourceReleaseResponseIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceReleasedListRelRes; ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceReleasedListRelRes;
ie->criticality = NGAP_Criticality_ignore; ie->criticality = NGAP_Criticality_ignore;
ie->value.present = NGAP_PDUSessionResourceReleaseResponseIEs__value_PR_PDUSessionResourceReleasedListRelRes; ie->value.present = NGAP_PDUSessionResourceReleaseResponseIEs__value_PR_AMF_UE_NGAP_ID;
asn_uint642INTEGER(&ie->value.choice.AMF_UE_NGAP_ID, ue_context_p->amf_ue_ngap_id);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (NGAP_PDUSessionResourceReleaseResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSessionResourceReleaseResponseIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID;
ie->criticality = NGAP_Criticality_ignore;
ie->value.present = NGAP_PDUSessionResourceReleaseResponseIEs__value_PR_RAN_UE_NGAP_ID;
ie->value.choice.RAN_UE_NGAP_ID = pdusession_release_resp_p->gNB_ue_ngap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* optional */
if (pdusession_release_resp_p->nb_of_pdusessions_released > 0) {
ie = (NGAP_PDUSessionResourceReleaseResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSessionResourceReleaseResponseIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceReleasedListRelRes;
ie->criticality = NGAP_Criticality_ignore;
ie->value.present = NGAP_PDUSessionResourceReleaseResponseIEs__value_PR_PDUSessionResourceReleasedListRelRes;
for (i = 0; i < pdusession_release_resp_p->nb_of_pdusessions_released; i++) {
NGAP_PDUSessionResourceReleasedItemRelRes_t *item;
item = (NGAP_PDUSessionResourceReleasedItemRelRes_t *)calloc(1, sizeof(NGAP_PDUSessionResourceReleasedItemRelRes_t));
item->pDUSessionID = pdusession_release_resp_p->pdusession_release[i].pdusession_id;
if(pdusession_release_resp_p->pdusession_release[i].transfer_length > 0){
item->pDUSessionResourceReleaseResponseTransfer.size = pdusession_release_resp_p->pdusession_release[i].transfer_length;
item->pDUSessionResourceReleaseResponseTransfer.buf = malloc(sizeof(uint8_t) * pdusession_release_resp_p->pdusession_release[i].transfer_length);
memcpy(item->pDUSessionResourceReleaseResponseTransfer.buf,
pdusession_release_resp_p->pdusession_release[i].transfer_buffer,
pdusession_release_resp_p->pdusession_release[i].transfer_length);
}else {
item->pDUSessionResourceReleaseResponseTransfer.size = 0;
item->pDUSessionResourceReleaseResponseTransfer.buf = NULL;
NGAP_DEBUG("pdusession_release_resp: transfer_buffer is NULL!\n");
#ifdef ITTI_SIM
//For testing only
item->pDUSessionResourceReleaseResponseTransfer.buf = malloc(sizeof(uint8_t) * 1);
item->pDUSessionResourceReleaseResponseTransfer.size = 1;
uint8_t temp = 0;
memcpy(item->pDUSessionResourceReleaseResponseTransfer.buf,
&temp,
item->pDUSessionResourceReleaseResponseTransfer.size);
#endif
}
NGAP_DEBUG("pdusession_release_resp: pdusession ID %ld\n", item->pDUSessionID);
ASN_SEQUENCE_ADD(&ie->value.choice.PDUSessionResourceReleasedListRelRes.list, item);
}
for (i = 0; i < pdusession_release_resp_p->nb_of_pdusessions_released; i++) { for (i = 0; i < pdusession_release_resp_p->nb_of_pdusessions_released; i++) {
NGAP_PDUSessionResourceReleasedItemRelRes_t *item; NGAP_PDUSessionResourceReleasedItemRelRes_t *item;
......
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