Commit 63bc9a9b authored by s.rampalli's avatar s.rampalli Committed by Rigiel

coding done need to verify testing part

parent 9747773f
......@@ -97,6 +97,7 @@
#include "SIMULATION/TOOLS/sim.h" // for taus
#define ASN_MAX_ENCODE_SIZE 4096
#define NUMBEROF_DRBS_TOBE_ADDED 1
static int encode_CG_ConfigInfo(char *buffer,int buffer_size,rrc_eNB_ue_context_t *const ue_context_pP,int *enc_size);
static int is_en_dc_supported(LTE_UE_EUTRA_Capability_t *c);
static void free_rb_config(struct NR_RadioBearerConfig *rb_config);
......@@ -2124,6 +2125,27 @@ rrc_eNB_generate_RRCConnectionReestablishmentReject(
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
ue_p->Srb0.Tx_buffer.payload_size);
}
#ifdef GES_ENDC_SUPPORT
void rrc_generate_SgNBReleaseRequest(
const protocol_ctxt_t *const ctxt_pP,
rrc_eNB_ue_context_t *const ue_context_pP
)
//-----------------------------------------------------------------------------
{
MessageDef *msg;
msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_ENDC_SGNB_RELEASE_REQ);
memset(&(X2AP_ENDC_SGNB_RELEASE_REQ(msg)), 0, sizeof(x2ap_ENDC_sgnb_release_req_t));
// X2AP_ENDC_SGNB_RELEASE_REQ(msg).MeNB_ue_x2_id = ;
// X2AP_ENDC_SGNB_RELEASE_REQ(msg).SgNB_ue_x2_id = ;
// X2AP_ENDC_SGNB_RELEASE_REQ(msg).cause = ;
// X2AP_ENDC_SGNB_RELEASE_REQ(msg).target_physCellId = ;
LOG_I(RRC,
"[eNB %d] frame %d UE rnti %x transmitting sgnb release request to sgnb \n",
ctxt_pP->module_id,ctxt_pP->frame,ctxt_pP->rnti);
itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg);
return;
}
#endif
//-----------------------------------------------------------------------------
/*
......@@ -2144,6 +2166,15 @@ rrc_eNB_generate_RRCConnectionRelease(
memset(buffer, 0, RRC_BUF_SIZE);
T(T_ENB_RRC_CONNECTION_RELEASE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
#ifdef GES_ENDC_SUPPORT
if(ue_context_pP != NULL)
{
if(ue_context_pP->ue_context.Status == RRC_NR_NSA)
{
//rrc_eNB_generate_SgNBReleaseRequest(ctxt_pP,ue_context_pP);
}
}
#endif
size = do_RRCConnectionRelease(ctxt_pP->module_id, buffer,rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id));
ue_context_pP->ue_context.ue_reestablishment_timer = 0;
ue_context_pP->ue_context.ue_release_timer = 0;
......@@ -4344,6 +4375,7 @@ static int encode_CG_ConfigInfo(
asn_enc_rval_t enc_rval;
int RRC_OK = 1;
int index = 0;
char temp_buff[4096];
rb_config = calloc(1,sizeof( struct NR_RadioBearerConfig));
AssertFatal(rb_config != NULL,"failed to allocate memory for rb_config");
......@@ -4356,7 +4388,7 @@ static int encode_CG_ConfigInfo(
= calloc(ue_context_pP->ue_context.DRB_configList->list.count, sizeof(struct NR_DRB_ToAddMod));
AssertFatal( rb_config->drb_ToAddModList->list.array != NULL,
"falied to allocate memory for list.array");
for(index = 0;index < ue_context_pP->ue_context.DRB_configList->list.count;index++) {
for(index = 0;index < NUMBEROF_DRBS_TOBE_ADDED;index++) {
rb_config->drb_ToAddModList->list.array[index]
= calloc(1,sizeof(struct NR_DRB_ToAddMod));
AssertFatal(rb_config->drb_ToAddModList->list.array[index] != NULL,
......@@ -4373,7 +4405,30 @@ static int encode_CG_ConfigInfo(
rb_config->drb_ToAddModList->list.array[index]->cnAssociation->choice.eps_BearerIdentity
=*(ue_context_pP->ue_context.DRB_configList->list.array[index]->eps_BearerIdentity);
}
rb_config->drb_ToAddModList->list.array[index]->pdcp_Config = calloc(1,sizeof(struct NR_PDCP_Config));
rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb = calloc(1,sizeof(struct NR_PDCP_Config__drb));
rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb->discardTimer = calloc(1,sizeof(long*));
*rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb->discardTimer
= *(ue_context_pP->ue_context.DRB_configList->list.array[index]->pdcp_Config->discardTimer);
rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb->pdcp_SN_SizeUL = calloc(1,sizeof(long*));
*rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb->pdcp_SN_SizeUL
= NR_PDCP_Config__drb__pdcp_SN_SizeUL_len18bits;
rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb->pdcp_SN_SizeDL = calloc(1,sizeof(long*));
*rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb->pdcp_SN_SizeDL
= NR_PDCP_Config__drb__pdcp_SN_SizeDL_len18bits;
rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb->headerCompression.present
= NR_PDCP_Config__drb__headerCompression_PR_notUsed;
rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->drb->headerCompression.choice.notUsed = 0;
rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->t_Reordering = calloc(1,sizeof(long*));
*rb_config->drb_ToAddModList->list.array[index]->pdcp_Config->t_Reordering
= NR_PDCP_Config__t_Reordering_ms0;
}
rb_config->securityConfig = calloc(1,sizeof(struct NR_SecurityConfig ));
rb_config->securityConfig->securityAlgorithmConfig = calloc(1,sizeof(struct NR_SecurityAlgorithmConfig));
rb_config->securityConfig->securityAlgorithmConfig->cipheringAlgorithm = NR_CipheringAlgorithm_nea0;
rb_config->securityConfig->securityAlgorithmConfig->integrityProtAlgorithm = NULL;
rb_config->securityConfig->keyToUse = calloc(1,sizeof(long*));
*rb_config->securityConfig->keyToUse = NR_SecurityConfig__keyToUse_master;
}
cg_configinfo = calloc(1,sizeof(struct NR_CG_ConfigInfo));
......@@ -4392,7 +4447,17 @@ static int encode_CG_ConfigInfo(
cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo->ue_CapabilityInfo
= calloc(1,sizeof( OCTET_STRING_t));
AssertFatal(cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo->
ue_CapabilityInfo != NULL, "failed to allocate memory for ue_capabilityinfo");
ue_CapabilityInfo != NULL, "failed to allocate memory for ue_capabilityinfo");
#if 1
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UE_CapabilityRAT_ContainerList,NULL,
(void*)ue_context_pP->ue_context.UE_Capability,temp_buff,4096);
AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
OCTET_STRING_fromBuf( cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo->ue_CapabilityInfo,
(const char *)temp_buff,(enc_rval.encoded+7)>>3);
#endif
#if 0
cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo->ue_CapabilityInfo->size
= ue_context_pP->ue_context.UE_Capability_size;
cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo->ue_CapabilityInfo->buf
......@@ -4401,8 +4466,19 @@ static int encode_CG_ConfigInfo(
ue_CapabilityInfo->buf != NULL, "failed to allocate memory for buf");
memcpy(cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo->ue_CapabilityInfo->buf,
ue_context_pP->ue_context.UE_Capability,ue_context_pP->ue_context.UE_Capability_size);
#endif
#if 1
cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo->mcg_RB_Config
= calloc(1,sizeof(OCTET_STRING_t));
AssertFatal(cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo->
mcg_RB_Config != NULL, "failed to allocate memory for mcg_rb_config");
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_RadioBearerConfig,NULL,(void *)rb_config,temp_buff,4096);
AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
OCTET_STRING_fromBuf(cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo->mcg_RB_Config,
(const char *)temp_buff, (enc_rval.encoded+7)>>3);
#endif
#if 0
AssertFatal(cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo->
mcg_RB_Config != NULL, "failed to allocate memory for mcg_rb_config");
cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo->mcg_RB_Config->size
......@@ -4413,8 +4489,9 @@ static int encode_CG_ConfigInfo(
mcg_RB_Config->buf != NULL,"failed to allocate memory for buf");
memcpy(cg_configinfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo->mcg_RB_Config->buf,
rb_config,sizeof(struct NR_RadioBearerConfig));
#endif
// this xer_fprint can be enabled for additional debugging messages
// xer_fprint(stdout,&asn_DEF_NR_CG_ConfigInfo,(void*)cg_configinfo);
xer_fprint(stdout,&asn_DEF_NR_CG_ConfigInfo,(void*)cg_configinfo);
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CG_ConfigInfo,NULL,(void*)cg_configinfo,
buffer,buffer_size);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
......
......@@ -296,11 +296,12 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu
void rrc_gNB_process_AdditionRequestInformation(const module_id_t gnb_mod_idP, x2ap_ENDC_sgnb_addition_req_t *m) {
LTE_UL_DCCH_Message_t *LTE_UL_DCCH_Message = NULL;
//LTE_UL_DCCH_Message_t *LTE_UL_DCCH_Message = NULL;
struct NR_CG_ConfigInfo *cg_configinfo = NULL;
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
&asn_DEF_LTE_UL_DCCH_Message,
(void **)&LTE_UL_DCCH_Message,
&asn_DEF_NR_CG_ConfigInfo,
(void **)&cg_configinfo,
(uint8_t *)m->rrc_buffer,
(int) m->rrc_buffer_size);//m->rrc_buffer_size);
......@@ -309,13 +310,14 @@ void rrc_gNB_process_AdditionRequestInformation(const module_id_t gnb_mod_idP, x
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
AssertFatal(1==0,"NR_UL_DCCH_MESSAGE decode error\n");
// free the memory
SEQUENCE_free( &asn_DEF_LTE_UL_DCCH_Message, LTE_UL_DCCH_Message, 1 );
SEQUENCE_free(&asn_DEF_NR_CG_ConfigInfo, cg_configinfo, 1);
return;
}
xer_fprint(stdout,&asn_DEF_LTE_UL_DCCH_Message, LTE_UL_DCCH_Message);
xer_fprint(stdout,&asn_DEF_NR_CG_ConfigInfo, cg_configinfo);
// recreate enough of X2 EN-DC Container
AssertFatal(LTE_UL_DCCH_Message->message.choice.c1.present == LTE_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation,
AssertFatal(cg_configinfo->criticalExtensions.choice.c1->present == NR_CG_ConfigInfo__criticalExtensions__c1_PR_cg_ConfigInfo,
"ueCapabilityInformation not present\n");
#if 0
NR_CG_ConfigInfo_t *CG_ConfigInfo = calloc(1,sizeof(*CG_ConfigInfo));
CG_ConfigInfo->criticalExtensions.present = NR_CG_ConfigInfo__criticalExtensions_PR_c1;
CG_ConfigInfo->criticalExtensions.choice.c1 = calloc(1,sizeof(*CG_ConfigInfo->criticalExtensions.choice.c1));
......@@ -325,11 +327,12 @@ void rrc_gNB_process_AdditionRequestInformation(const module_id_t gnb_mod_idP, x
cg_ConfigInfo->ue_CapabilityInfo = calloc(1,sizeof(*cg_ConfigInfo->ue_CapabilityInfo));
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UE_CapabilityRAT_ContainerList,NULL,(void*)&LTE_UL_DCCH_Message->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList,m->rrc_buffer,m->rrc_buffer_size);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
enc_rval.failed_type->name, enc_rval.encoded);
OCTET_STRING_fromBuf(cg_ConfigInfo->ue_CapabilityInfo,
(const char *)m->rrc_buffer,
(enc_rval.encoded+7)>>3);
parse_CG_ConfigInfo(rrc,CG_ConfigInfo,m);
(const char *)m->rrc_buffer,
(enc_rval.encoded+7)>>3);
#endif
parse_CG_ConfigInfo(rrc,cg_configinfo,m);
}
......
......@@ -56,7 +56,7 @@ int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo, x2
AssertFatal(1==0,"[InterNode] Failed to decode NR_UE_CapabilityRAT_ContainerList (%zu bits), size of OCTET_STRING %lu\n",
dec_rval.consumed, cg_ConfigInfo->ue_CapabilityInfo->size);
}
rrc_parse_ue_capabilities(rrc,UE_CapabilityRAT_ContainerList, m);
rrc_parse_ue_capabilities(rrc,UE_CapabilityRAT_ContainerList, m,cg_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo);
}
if (cg_ConfigInfo->candidateCellInfoListMN) AssertFatal(1==0,"Can't handle candidateCellInfoListMN yet\n");
}
......
......@@ -39,7 +39,7 @@
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/RRC/LTE/rrc_eNB_GTPV1U.h"
void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, LTE_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList, x2ap_ENDC_sgnb_addition_req_t *m) {
void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, LTE_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList, x2ap_ENDC_sgnb_addition_req_t *m, struct NR_CG_ConfigInfo_IEs * cg_config_info) {
struct rrc_gNB_ue_context_s *ue_context_p = NULL;
OCTET_STRING_t *ueCapabilityRAT_Container_nr = NULL;
......@@ -98,10 +98,10 @@ void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, LTE_UE_CapabilityRAT_Container
xer_fprint(stdout, &asn_DEF_NR_UE_MRDC_Capability, ue_context_p->ue_context.UE_Capability_MRDC);
}
rrc_add_nsa_user(rrc,ue_context_p, m);
rrc_add_nsa_user(rrc,ue_context_p, m, cg_config_info);
}
void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_p, x2ap_ENDC_sgnb_addition_req_t *m) {
void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_p, x2ap_ENDC_sgnb_addition_req_t *m, struct NR_CG_ConfigInfo_IEs * cg_config_info) {
// generate nr-Config-r15 containers for LTE RRC : inside message for X2 EN-DC (CG-Config Message from 38.331)
......@@ -133,7 +133,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
ue_context_p->ue_context.rb_config = calloc(1,sizeof(NR_RRCReconfiguration_t));
fill_default_rbconfig(ue_context_p->ue_context.rb_config);
fill_default_rbconfig(ue_context_p->ue_context.rb_config,m, cg_config_info);
ue_context_p->ue_id_rnti = ue_context_p->ue_context.secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity;
NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config));
memset((void*)CG_Config,0,sizeof(*CG_Config));
......
......@@ -2032,8 +2032,20 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon
reconfig->nonCriticalExtension = NULL;
}
void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig) {
void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig, x2ap_ENDC_sgnb_addition_req_t *m, struct NR_CG_ConfigInfo_IEs *cg_config_info) {
if(cg_config_info->mcg_RB_Config) {
asn_dec_rval dec_rval = uper_decode(NULL,
&asn_DEF_NR_RadioBearerConfig,
(void**)&rbconfig,
cg_config_info->mcg_RB_Config->buf,
cg_ConfigInfo->mcg_RB_Config->size, 0, 0);
if((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
AssertFatal(1==0,"[InterNode] Failed to decode mcg_rb_config (%zu bits), size of OCTET_STRING %lu\n",
dec_rval.consumed, cg_ConfigInfo->ue_CapabilityInfo->size);
}
}
#if 0
rbconfig->srb_ToAddModList = NULL;
rbconfig->srb3_ToRelease = NULL;
rbconfig->drb_ToAddModList = calloc(1,sizeof(*rbconfig->drb_ToAddModList));
......@@ -2074,6 +2086,7 @@ void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig) {
rbconfig->securityConfig->securityAlgorithmConfig->integrityProtAlgorithm=NULL;
rbconfig->securityConfig->keyToUse = calloc(1,sizeof(*rbconfig->securityConfig->keyToUse));
*rbconfig->securityConfig->keyToUse = NR_SecurityConfig__keyToUse_master;
#endif
xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)rbconfig);
}
......
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