Commit db8822a8 authored by Raymond Knopp's avatar Raymond Knopp

UE-Capability parsing for NR components. Emulate CG-ConfigInfo generation for...

UE-Capability parsing for NR components. Emulate CG-ConfigInfo generation for phy-test mode. This version is ready for X2 EN-DC integration
parent becbb0a4
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "NR_RRCReconfiguration.h" #include "NR_RRCReconfiguration.h"
#include "NR_UE-NR-Capability.h" #include "NR_UE-NR-Capability.h"
#include "NR_UE-CapabilityRAT-ContainerList.h" #include "NR_UE-CapabilityRAT-ContainerList.h"
#include "LTE_UE-CapabilityRAT-ContainerList.h"
#include "NR_CG-Config.h" #include "NR_CG-Config.h"
#include "NR_CG-ConfigInfo.h" #include "NR_CG-ConfigInfo.h"
...@@ -64,7 +65,7 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge( ...@@ -64,7 +65,7 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge(
struct rrc_gNB_ue_context_s *rrc_gNB_allocate_new_UE_context(gNB_RRC_INST *rrc_instance_pP); struct rrc_gNB_ue_context_s *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); void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc,LTE_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList);
void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_p); void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_p);
......
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
#include "NR_DL-DCCH-Message.h" #include "NR_DL-DCCH-Message.h"
#include "NR_CellGroupConfig.h" #include "NR_CellGroupConfig.h"
#include "NR_MeasResults.h" #include "NR_MeasResults.h"
#include "LTE_UECapabilityInformation.h"
#include "LTE_UL-DCCH-Message.h"
#include "rlc.h" #include "rlc.h"
#include "rrc_eNB_UE_context.h" #include "rrc_eNB_UE_context.h"
...@@ -226,13 +228,55 @@ static void init_NR_SI(gNB_RRC_INST *rrc) { ...@@ -226,13 +228,55 @@ static void init_NR_SI(gNB_RRC_INST *rrc) {
if (phy_test > 0) { if (phy_test > 0) {
// This is for phytest only // This is for phytest only, emulate first X2 message if uecap.raw file is present
FILE *fd;
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(rrc);
fd = fopen("uecap.raw","r");
LOG_I(NR_RRC,"Adding new user (%p)\n",ue_context_p); if (fd != NULL) {
rrc_add_nsa_user(rrc,ue_context_p); char buffer[4096];
} int msg_len=fread(buffer,1,4096,fd);
LOG_I(RRC,"Read in %d bytes for uecap\n",msg_len);
LTE_UL_DCCH_Message_t *LTE_UL_DCCH_Message;
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
&asn_DEF_LTE_UL_DCCH_Message,
(void **)&LTE_UL_DCCH_Message,
(uint8_t *)buffer,
msg_len);
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 );
return;
}
fclose(fd);
xer_fprint(stdout,&asn_DEF_LTE_UL_DCCH_Message, LTE_UL_DCCH_Message);
// recreate enough of X2 EN-DC Container
AssertFatal(LTE_UL_DCCH_Message->message.choice.c1.present == LTE_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation,
"ueCapabilityInformation not present\n");
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));
CG_ConfigInfo->criticalExtensions.choice.c1->present = NR_CG_ConfigInfo__criticalExtensions__c1_PR_cg_ConfigInfo;
CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo = calloc(1,sizeof(*CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo));
NR_CG_ConfigInfo_IEs_t *cg_ConfigInfo = CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo;
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,buffer,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->ue_CapabilityInfo,
(const char *)buffer,
(enc_rval.encoded+7)>>3);
parse_CG_ConfigInfo(rrc,CG_ConfigInfo);
}
else {
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(rrc);
LOG_I(NR_RRC,"Adding new user (%p)\n",ue_context_p);
rrc_add_nsa_user(rrc,ue_context_p);
}
}
} }
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "NR_UE-NR-Capability.h" #include "NR_UE-NR-Capability.h"
#include "NR_CG-ConfigInfo.h" #include "NR_CG-ConfigInfo.h"
#include "NR_UE-CapabilityRAT-ContainerList.h" #include "NR_UE-CapabilityRAT-ContainerList.h"
#include "LTE_UE-CapabilityRAT-ContainerList.h"
#include "NR_CG-Config.h" #include "NR_CG-Config.h"
int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo) { int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo) {
...@@ -45,28 +46,21 @@ int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo) { ...@@ -45,28 +46,21 @@ int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo) {
NR_CG_ConfigInfo_IEs_t *cg_ConfigInfo = CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo; NR_CG_ConfigInfo_IEs_t *cg_ConfigInfo = CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo;
if (cg_ConfigInfo->ue_CapabilityInfo) { if (cg_ConfigInfo->ue_CapabilityInfo) {
// Decode UE-CapabilityRAT-ContainerList // Decode UE-CapabilityRAT-ContainerList
NR_UE_CapabilityRAT_ContainerList_t **UE_CapabilityRAT_ContainerList=NULL; LTE_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList=NULL;
asn_dec_rval_t dec_rval = uper_decode(NULL, asn_dec_rval_t dec_rval = uper_decode(NULL,
&asn_DEF_NR_UE_NR_Capability, &asn_DEF_LTE_UE_CapabilityRAT_ContainerList,
(void**)UE_CapabilityRAT_ContainerList, (void**)&UE_CapabilityRAT_ContainerList,
cg_ConfigInfo->ue_CapabilityInfo->buf, cg_ConfigInfo->ue_CapabilityInfo->buf,
cg_ConfigInfo->ue_CapabilityInfo->size, 0, 0); cg_ConfigInfo->ue_CapabilityInfo->size, 0, 0);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
LOG_E(RRC, "[InterNode] Failed to decode NR_UE_NR_Capability (%zu bits)\n", AssertFatal(1==0,"[InterNode] Failed to decode NR_UE_CapabilityRAT_ContainerList (%zu bits), size of OCTET_STRING %d\n",
dec_rval.consumed ); dec_rval.consumed, cg_ConfigInfo->ue_CapabilityInfo->size);
return(-1); }
} rrc_parse_ue_capabilities(rrc,UE_CapabilityRAT_ContainerList);
rrc_parse_ue_capabilities(rrc,*UE_CapabilityRAT_ContainerList);
} }
if (cg_ConfigInfo->candidateCellInfoListMN) { if (cg_ConfigInfo->candidateCellInfoListMN) AssertFatal(1==0,"Can't handle candidateCellInfoListMN yet\n");
LOG_E(RRC,"Can't handle candidateCellInfoListMN yet\n");
return(-1);
}
}
else {
LOG_E(RRC,"c1 extension is not cg_ConfigInfo, returning\n");
return(-1);
} }
else AssertFatal(1==0,"c1 extension is not cg_ConfigInfo, returning\n");
} }
else { else {
LOG_E(RRC,"c1 extension not found, returning\n"); LOG_E(RRC,"c1 extension not found, returning\n");
......
...@@ -33,24 +33,23 @@ ...@@ -33,24 +33,23 @@
#include "nr_rrc_defs.h" #include "nr_rrc_defs.h"
#include "NR_RRCReconfiguration.h" #include "NR_RRCReconfiguration.h"
#include "NR_UE-NR-Capability.h" #include "NR_UE-NR-Capability.h"
#include "NR_UE-CapabilityRAT-ContainerList.h" //#include "NR_UE-CapabilityRAT-ContainerList.h"
#include "LTE_UE-CapabilityRAT-ContainerList.h"
#include "NR_CG-Config.h" #include "NR_CG-Config.h"
void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc,NR_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList) { void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc,LTE_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList) {
struct rrc_gNB_ue_context_s *ue_context_p = NULL; struct rrc_gNB_ue_context_s *ue_context_p = NULL;
int rnti = taus()&65535; int rnti = taus()&65535;
OCTET_STRING_t *ueCapabilityRAT_Container_nr; OCTET_STRING_t *ueCapabilityRAT_Container_nr;
OCTET_STRING_t *ueCapabilityRAT_Container_MRDC; OCTET_STRING_t *ueCapabilityRAT_Container_MRDC;
int list_size;
AssertFatal(UE_CapabilityRAT_ContainerList!=NULL,"UE_CapabilityRAT_ContainerList is null\n"); AssertFatal(UE_CapabilityRAT_ContainerList!=NULL,"UE_CapabilityRAT_ContainerList is null\n");
AssertFatal(UE_CapabilityRAT_ContainerList->list.size != 2, "UE_CapabilityRAT_ContainerList->list.size %d != 2\n",UE_CapabilityRAT_ContainerList->list.size); AssertFatal((list_size=UE_CapabilityRAT_ContainerList->list.count) >= 2, "UE_CapabilityRAT_ContainerList->list.size %d < 2\n",UE_CapabilityRAT_ContainerList->list.count);
if (UE_CapabilityRAT_ContainerList->list.array[0]->rat_Type == NR_RAT_Type_nr) ueCapabilityRAT_Container_nr = &UE_CapabilityRAT_ContainerList->list.array[0]->ue_CapabilityRAT_Container; for (int i=0;i<list_size;i++) {
else if (UE_CapabilityRAT_ContainerList->list.array[0]->rat_Type == NR_RAT_Type_eutra_nr) ueCapabilityRAT_Container_MRDC = &UE_CapabilityRAT_ContainerList->list.array[0]->ue_CapabilityRAT_Container; if (UE_CapabilityRAT_ContainerList->list.array[i]->rat_Type == LTE_RAT_Type_nr) ueCapabilityRAT_Container_nr = &UE_CapabilityRAT_ContainerList->list.array[i]->ueCapabilityRAT_Container;
else if (UE_CapabilityRAT_ContainerList->list.array[i]->rat_Type == LTE_RAT_Type_eutra_nr) ueCapabilityRAT_Container_MRDC = &UE_CapabilityRAT_ContainerList->list.array[i]->ueCapabilityRAT_Container;
if (UE_CapabilityRAT_ContainerList->list.array[1]->rat_Type == NR_RAT_Type_nr) ueCapabilityRAT_Container_nr = &UE_CapabilityRAT_ContainerList->list.array[1]->ue_CapabilityRAT_Container; }
else if (UE_CapabilityRAT_ContainerList->list.array[1]->rat_Type == NR_RAT_Type_eutra_nr) ueCapabilityRAT_Container_MRDC = &UE_CapabilityRAT_ContainerList->list.array[1]->ue_CapabilityRAT_Container;
AssertFatal(ueCapabilityRAT_Container_nr!=NULL,"ueCapabilityRAT_Container_nr is NULL\n"); AssertFatal(ueCapabilityRAT_Container_nr!=NULL,"ueCapabilityRAT_Container_nr is NULL\n");
AssertFatal(ueCapabilityRAT_Container_MRDC!=NULL,"ueCapabilityRAT_Container_MRDC is NULL\n"); AssertFatal(ueCapabilityRAT_Container_MRDC!=NULL,"ueCapabilityRAT_Container_MRDC is NULL\n");
...@@ -65,7 +64,7 @@ void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc,NR_UE_CapabilityRAT_ContainerLi ...@@ -65,7 +64,7 @@ void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc,NR_UE_CapabilityRAT_ContainerLi
ueCapabilityRAT_Container_nr->size, 0, 0); ueCapabilityRAT_Container_nr->size, 0, 0);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
LOG_E(RRC, "Failed to decode UE NR capabilities (%zu bytes)\n", dec_rval.consumed); LOG_E(RRC, "Failed to decode UE NR capabilities (%zu bytes) container size %d\n", dec_rval.consumed,ueCapabilityRAT_Container_nr->size);
ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability, ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability,
ue_context_p->ue_context.UE_Capability_nr); ue_context_p->ue_context.UE_Capability_nr);
ue_context_p->ue_context.UE_Capability_nr = 0; ue_context_p->ue_context.UE_Capability_nr = 0;
...@@ -88,13 +87,13 @@ void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc,NR_UE_CapabilityRAT_ContainerLi ...@@ -88,13 +87,13 @@ void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc,NR_UE_CapabilityRAT_ContainerLi
// dump ue_capabilities // dump ue_capabilities
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { // if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_UE_NR_Capability, ue_context_p->ue_context.UE_Capability_nr); xer_fprint(stdout, &asn_DEF_NR_UE_NR_Capability, ue_context_p->ue_context.UE_Capability_nr);
} // }
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { // if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_UE_MRDC_Capability, ue_context_p->ue_context.UE_Capability_MRDC); 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); rrc_add_nsa_user(rrc,ue_context_p);
} }
......
...@@ -325,7 +325,7 @@ int8_t openair_rrc_top_init_ue_nr(void){ ...@@ -325,7 +325,7 @@ int8_t openair_rrc_top_init_ue_nr(void){
// read in files for RRCReconfiguration and RBconfig // read in files for RRCReconfiguration and RBconfig
FILE *fd; FILE *fd;
fd = fopen("reconfig.raw","r"); fd = fopen("reconfig.raw","r");
char *buffer[1024]; char buffer[1024];
int msg_len=fread(buffer,1,1024,fd); int msg_len=fread(buffer,1,1024,fd);
fclose(fd); fclose(fd);
process_nsa_message(NR_UE_rrc_inst, nr_SecondaryCellGroupConfig_r15, buffer,msg_len); process_nsa_message(NR_UE_rrc_inst, nr_SecondaryCellGroupConfig_r15, buffer,msg_len);
......
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