Commit e138df26 authored by General ABS's avatar General ABS Committed by abs

Send F1AP UE context modification request for handover case

parent e324cfb9
......@@ -375,13 +375,13 @@ typedef struct cu_to_du_rrc_information_s {
}cu_to_du_rrc_information_t;
typedef struct du_to_cu_rrc_information_s {
uint8_t * cellGroupConfig;
uint32_t cellGroupConfig_length;
uint8_t * measGapConfig;
uint32_t measGapConfig_length;
uint8_t * requestedP_MaxFR1;
uint32_t requestedP_MaxFR1_length;
}du_to_cu_rrc_information_t;
uint8_t *cellGroupConfig;
uint32_t cellGroupConfig_length;
uint8_t *measGapConfig;
uint32_t measGapConfig_length;
uint8_t *requestedP_MaxFR1;
uint32_t requestedP_MaxFR1_length;
} du_to_cu_rrc_information_t;
typedef enum QoS_information_e {
NG_RAN_QoS = 0,
......
......@@ -142,6 +142,7 @@
#include "common/ran_context.h"
#include "conversions.h"
#include "NR_HandoverCommand.h"
//#define XER_PRINT
......@@ -1439,3 +1440,29 @@ uint8_t do_NR_Paging(uint8_t Mod_id, uint8_t *buffer, uint32_t tmsi) {
return((enc_rval.encoded+7)/8);
}
int16_t do_NR_HandoverCommand(uint8_t *ho_buf, int16_t ho_size, uint8_t *rrc_buffer, int16_t rrc_size) {
NR_HandoverCommand_t *ho_command = calloc(1,sizeof(NR_HandoverCommand_t));
ho_command->criticalExtensions.present = NR_HandoverCommand__criticalExtensions_PR_c1;
ho_command->criticalExtensions.choice.c1 = calloc(1,sizeof(struct NR_HandoverCommand__criticalExtensions__c1));
ho_command->criticalExtensions.choice.c1->present = NR_HandoverCommand__criticalExtensions__c1_PR_handoverCommand;
ho_command->criticalExtensions.choice.c1->choice.handoverCommand = calloc(1,sizeof(struct NR_HandoverCommand_IEs));
AssertFatal(OCTET_STRING_fromBuf(&ho_command->criticalExtensions.choice.c1->choice.handoverCommand->handoverCommandMessage, (char *)rrc_buffer, rrc_size) != -1,
"fatal: OCTET_STRING_fromBuf failed\n");
xer_fprint(stdout,&asn_DEF_NR_HandoverCommand, ho_command);
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_HandoverCommand,
NULL,
ho_command,
ho_buf,
ho_size);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return ((enc_rval.encoded+7)/8);
}
......@@ -193,4 +193,6 @@ int do_RRCReestablishmentComplete(uint8_t *buffer, size_t buffer_size, int64_t r
NR_MeasConfig_t *get_defaultMeasConfig(const module_id_t module_id);
uint8_t do_NR_Paging(uint8_t Mod_id, uint8_t *buffer, uint32_t tmsi);
int16_t do_NR_HandoverCommand(uint8_t *ho_buf, int16_t ho_size, uint8_t *rrc_buffer, int16_t rrc_size);
#endif /* __RRC_NR_MESSAGES_ASN1_MSG__H__ */
......@@ -64,8 +64,6 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge(
rrc_gNB_ue_context_t *const ue_context_pP
);
rrc_gNB_ue_context_t *rrc_gNB_allocate_new_UE_context(gNB_RRC_INST *rrc_instance_pP);
void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc,NR_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList, x2ap_ENDC_sgnb_addition_req_t *m, NR_CG_ConfigInfo_IEs_t * cg_config_info);
void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2ap_ENDC_sgnb_addition_req_t *m);
......
......@@ -102,6 +102,7 @@
#include "BIT_STRING.h"
#include "assertions.h"
#include "NR_HandoverCommand.h"
//#define XER_PRINT
......@@ -159,6 +160,16 @@ static void nr_rrc_addmod_drbs(int rnti,
///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------///
static instance_t get_instance_by_NR_physCellId(NR_PhysCellId_t physCellId)
{
for (int i = 0; i < RC.nb_nr_inst; i++) {
if (RC.nrrrc[i] && RC.nrrrc[i]->carrier.physCellId == physCellId) {
return i;
}
}
return -1;
}
static instance_t get_instance_by_NR_cellid(uint64_t nr_cellid)
{
for (int i = 0; i < RC.nb_nr_inst; i++) {
......@@ -179,6 +190,14 @@ static instance_t get_instance_by_F1_instance(instance_t f1_instance)
return -1;
}
static rnti_t get_new_rnti(gNB_RRC_INST *rrc) {
rnti_t rnti = 0;
do {
rnti = (taus() % 65518) + 1;
} while (rrc_gNB_get_ue_context_by_rnti(rrc, rnti) != NULL);
return rnti;
}
static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration)
{
......@@ -782,6 +801,75 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c
}
}
int16_t rrc_gNB_generate_HO_RRCReconfiguration(const protocol_ctxt_t *ctxt_pP,
const uint8_t modid_s,
const uint8_t modid_t,
rrc_gNB_ue_context_t *ue_context_pP,
rrc_gNB_ue_context_t *ue_context_old,
uint8_t *buffer,
const int16_t buffer_size,
NR_CellGroupConfig_t *cellGroupConfig) {
uint8_t rrc_buffer[RRC_BUF_SIZE];
uint8_t xid = rrc_gNB_get_next_transaction_identifier(modid_s);
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
ue_p->DRB_configList = ue_context_old->ue_context.DRB_configList;
// SRBs
for (int i = 0; i < maxSRBs; i++) {
ue_p->Srb[i].Active = ue_context_old->ue_context.Srb[i].Active;
}
NR_SRB_ToAddModList_t *SRBs = createSRBlist(ue_p, false);
// DRBs
NR_DRB_ToAddModList_t **DRB_configList2 = &ue_p->DRB_configList2[xid];
if (*DRB_configList2) {
free(*DRB_configList2);
}
*DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2));
for (int drb_idx = 0; drb_idx < ue_p->DRB_configList->list.count; drb_idx++) {
ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, ue_p->DRB_configList->list.array[drb_idx]);
}
int16_t rrc_size = do_RRCReconfiguration(ctxt_pP,
rrc_buffer,
RRC_BUF_SIZE,
xid,
SRBs,
ue_p->DRB_configList,
NULL,
NULL,
NULL,
NULL,
NULL,
ue_context_pP,
NULL,
NULL,
NULL,
cellGroupConfig);
AssertFatal(rrc_size > 0, "Handover command generation failed in %s, line %i\n", __FILE__, __LINE__);
nr_pdcp_data_req_srb(ctxt_pP->rntiMaybeUEid, DCCH, rrc_gNB_mui++, rrc_size, rrc_buffer, deliver_pdu_srb_f1, RC.nrrrc[modid_s]);
int16_t ho_size = do_NR_HandoverCommand(buffer,
buffer_size,
rrc_buffer,
rrc_size);
protocol_ctxt_t ctxt = {
.module_id = modid_t,
.rntiMaybeUEid = ue_p->rnti,
.enb_flag = 1,
};
nr_pdcp_add_srbs(ctxt.enb_flag, ctxt.rntiMaybeUEid, SRBs, 0, NULL, NULL);
AssertFatal(ho_size > 0, "Handover command generation failed in %s, line %i\n", __FILE__, __LINE__);
return ho_size;
}
//-----------------------------------------------------------------------------
void
rrc_gNB_modify_dedicatedRRCReconfiguration(
......
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