Commit 3606c381 authored by francescomani's avatar francescomani

uecap file from command line at gnb for phytest and dora mode

parent a54c1f23
......@@ -111,16 +111,11 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
//Temp fix for inexistent NR upper layer
unsigned char NB_gNB_INST = 1;
char *uecap_file;
int UE_scan = 1;
int UE_scan_carrier = 0;
runmode_t mode = normal_txrx;
static double snr_dB=20;
FILE *input_fd=NULL;
#if MAX_NUM_CCs == 1
rx_gain_t rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain}};
double tx_gain[MAX_NUM_CCs][4] = {{20,0,0,0}};
......@@ -193,8 +188,6 @@ openair0_config_t openair0_cfg[MAX_CARDS];
double cpuf;
extern char uecap_xer[1024];
char uecap_xer_in=0;
/* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed
* this is very hackish - find a proper solution
......@@ -702,6 +695,7 @@ int main( int argc, char **argv ) {
// don't create if node doesn't connect to RRC/S1/GTP
AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n");
/* Start the agent. If it is turned off in the configuration, it won't start */
/*
RCconfig_nr_flexran();
......
......@@ -29,6 +29,7 @@
{"D" , CONFIG_HLP_DLBM_PHYTEST,0, u64ptr:&dlsch_slot_bitmap, defintval:0, TYPE_UINT64, 0}, \
{"U" , CONFIG_HLP_ULBM_PHYTEST,0, u64ptr:&ulsch_slot_bitmap, defintval:0, TYPE_UINT64, 0}, \
{"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \
{"uecap_file", CONFIG_HLP_UECAP_FILE, 0, strptr:(char **)&uecap_file, defstrval:"./", TYPE_STRING, 0}, \
{"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \
}
......@@ -41,6 +42,7 @@ extern uint32_t target_dl_bw;
extern uint32_t target_ul_bw;
extern uint64_t dlsch_slot_bitmap;
extern uint64_t ulsch_slot_bitmap;
extern char *uecap_file;
// In nr-gnb.c
extern void init_gNB(int single_thread_flag,int wait_for_sync);
......
......@@ -1533,7 +1533,7 @@ void NRRCConfig(void) {
config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL);
RC.nb_nr_inst = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
// Get num MACRLC instances
// Get num MACRLC instances
config_getlist( &MACRLCParamList,NULL,0, NULL);
RC.nb_nr_macrlc_inst = MACRLCParamList.numelt;
// Get num L1 instances
......
......@@ -520,6 +520,8 @@ typedef struct gNB_RRC_INST_s {
int cell_info_configured;
pthread_mutex_t cell_info_mutex;
char *uecap_file;
// security configuration (preferred algorithms)
nr_security_configuration_t security;
} gNB_RRC_INST;
......
......@@ -178,56 +178,12 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration
pthread_mutex_unlock(&rrc->cell_info_mutex);
if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0) {
// This is for phytest only, emulate first X2 message if uecap.raw file is present
FILE *fd;
fd = fopen("uecap.raw","r");
if (fd != NULL) {
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,NULL);
} else {
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(rrc);
ue_context_p->ue_context.spCellConfig = calloc(1, sizeof(struct NR_SpCellConfig));
ue_context_p->ue_context.spCellConfig->spCellConfigDedicated = configuration->scd;
LOG_I(NR_RRC,"Adding new user (%p)\n",ue_context_p);
if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) {
rrc_add_nsa_user(rrc,ue_context_p,NULL);
}
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(rrc);
ue_context_p->ue_context.spCellConfig = calloc(1, sizeof(struct NR_SpCellConfig));
ue_context_p->ue_context.spCellConfig->spCellConfigDedicated = configuration->scd;
LOG_I(NR_RRC,"Adding new user (%p)\n",ue_context_p);
if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) {
rrc_add_nsa_user(rrc,ue_context_p,NULL);
}
}
}
......
......@@ -38,6 +38,7 @@
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/RRC/LTE/rrc_eNB_GTPV1U.h"
#include "executables/softmodem-common.h"
#include "executables/nr-softmodem.h"
#include <openair2/RRC/NR/rrc_gNB_UE_context.h>
#include <openair3/ocp-gtpu/gtp_itf.h>
#include "UTIL/OSA/osa_defs.h"
......@@ -148,8 +149,11 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
NR_UE_NR_Capability_t* UE_Capability_nr = NULL;
char UE_NR_Capability_xer_fname[1024];
char UE_NR_Capability_xer[65536];
sprintf(UE_NR_Capability_xer_fname,"../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/uecap.xml");
FILE *f = fopen(UE_NR_Capability_xer_fname, "r");
FILE *f = NULL;
if (uecap_file) {
sprintf(UE_NR_Capability_xer_fname,"%s",uecap_file);
f = fopen(UE_NR_Capability_xer_fname, "r");
}
if(f){
size_t size = fread(UE_NR_Capability_xer, 1, sizeof UE_NR_Capability_xer, f);
if (size == 0 || size == sizeof UE_NR_Capability_xer)
......
......@@ -2644,8 +2644,9 @@ nr_rrc_ue_process_ueCapabilityEnquiry(
ue_CapabilityRAT_Container.rat_Type = NR_RAT_Type_nr;
NR_UE_NR_Capability_t* UE_Capability_nr = NULL;
FILE *f = NULL;
char *file_path = NR_UE_rrc_inst[ctxt_pP->module_id].uecap_file;
FILE *f = NULL;
if (file_path) {
sprintf(UE_NR_Capability_xer_fname,"%s",file_path);
f = fopen(UE_NR_Capability_xer_fname, "r");
......
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