diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 4dc6a40bd8..a84133c819 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -987,7 +987,7 @@ add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION w add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE") add_boolean_option(UESIM_EXPANSION False "enable UESIM_EXPANSION with max 256 UE") add_boolean_option(ITTI_SIM False "enable itti simulator") - +add_boolean_option(RFSIM_NAS False "enable rfsim nas") ######################## # Include order ########################## @@ -2515,7 +2515,7 @@ if(NAS_UE) endif() -if(ITTI_SIM) +if(ITTI_SIM OR RFSIM_NAS) set(libnas_ue_api_OBJS ${NAS_SRC}UE/API/USER/at_command.c ${NAS_SRC}UE/API/USER/at_error.c @@ -3125,7 +3125,7 @@ target_link_libraries (nr-uesoftmodem -Wl,--start-group RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB PHY_COMMON PHY_NR_COMMON PHY_UE PHY_NR_UE PHY_RU LFDS NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB - NFAPI_USER_LIB S1AP_LIB S1AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB} + NFAPI_USER_LIB S1AP_LIB S1AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB} ${NAS_SIM_LIB} ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB -Wl,--end-group z dl) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 960b241047..c81ec37712 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -67,6 +67,7 @@ USRP_REC_PLAY="False" BUILD_ECLIPSE=0 NR="False" ITTI_SIM="False" +RFSIM_NAS="False" OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope msc" trap handle_ctrl_c INT @@ -260,6 +261,8 @@ function main() { --nrUE) nrUE=1 NR="True" + rfsimNas=1 + RFSIM_NAS="True" echo_info "Will compile NR UE" shift;; --mu) @@ -579,7 +582,7 @@ function main() { config_libconfig_shlib=params_libconfig # first generate the CMakefile in the right directory - if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" -o "$ittiSIM" = "1" ] ; then + if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" -o "$ittiSIM" = "1" -o "$rfsimNas" = "1" ] ; then # softmodem compilation @@ -604,6 +607,7 @@ function main() { echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )" >> $cmake_file echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file + echo "set ( RFSIM_NAS $RFSIM_NAS )" >> $cmake_file echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file cd $DIR/$build_dir/build eval $CMAKE_CMD diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 463c102d06..47bb80c4c8 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -378,6 +378,30 @@ int create_gNB_tasks(uint32_t gnb_nb) { } } + if (AMF_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==1)){ + if (gnb_nb > 0) { + if(NGAP_CONF_MODE){ + if (itti_create_task (TASK_NGAP, ngap_gNB_task, NULL) < 0) { + LOG_E(NGAP, "Create task for NGAP failed\n"); + return -1; + } + } else { + LOG_E(NGAP, "Ngap task not created\n"); + } + + if(!emulate_rf){ + if (itti_create_task (TASK_UDP, udp_eNB_task, NULL) < 0) { + LOG_E(UDP_, "Create task for UDP failed\n"); + return -1; + } + } + + if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) { + LOG_E(GTPU, "Create task for GTPV1U failed\n"); + return -1; + } + } + } if (gnb_nb > 0) { if (itti_create_task (TASK_GNB_APP, gNB_app_task, NULL) < 0) { diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 3ff0609e72..79fc1ed6d8 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -87,6 +87,10 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "executables/softmodem-common.h" #include "executables/thread-common.h" +#if defined(ITTI_SIM) || defined(RFSIM_NAS) +#include "nr_nas_msg_sim.h" +#endif + extern const char *duplex_mode[]; // Thread variables @@ -189,6 +193,11 @@ int create_tasks_nrue(uint32_t ue_nb) { LOG_E(NR_RRC, "Create task for RRC UE failed\n"); return -1; } + + if (itti_create_task (TASK_NAS_NRUE, nas_nrue_task, NULL) < 0) { + LOG_E(NR_RRC, "Create task for NAS UE failed\n"); + return -1; + } } itti_wait_ready(0); diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index d3aaf7ca3a..e13d9cfba0 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -113,7 +113,7 @@ nr_rrc_data_ind( //------------------------------------------------------------------------------ { rb_id_t DCCH_index = Srb_id; - LOG_I(RRC, "[UE %x] Frame %d: received a DCCH %ld message on SRB %ld with Size %d from eNB %d\n", + LOG_I(NR_RRC, "[UE %x] Frame %d: received a DCCH %ld message on SRB %ld with Size %d from gNB %d\n", ctxt_pP->module_id, ctxt_pP->frame, DCCH_index,Srb_id,sdu_sizeP, ctxt_pP->eNB_index); { MessageDef *message_p; diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 7de05b52a4..2f090da251 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -575,19 +575,6 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ( rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(&ctxt,ue_context_p); } -if (RC.nrrrc[ctxt.module_id]->node_type == ngran_gNB_CU) { - MessageDef *message_p; - message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ); - F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container = (uint8_t *)ue_context_p->ue_context.Srb1.Srb_info.Tx_buffer.Payload; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container_length = ue_context_p->ue_context.Srb1.Srb_info.Tx_buffer.payload_size; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue_context_p->ue_context.rnti; - - itti_send_msg_to_task (TASK_CU_F1, ctxt.module_id, message_p); - LOG_D(NR_RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n"); - } - return 0; } } @@ -802,25 +789,10 @@ rrc_gNB_process_NGAP_DOWNLINK_NAS( */ switch (RC.nrrrc[ctxt.module_id]->node_type) { case ngran_gNB_CU: - // create an ITTI message - // F1AP_DL_RRC_MESSAGE - message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_DL_RRC_MESSAGE); - F1AP_DL_RRC_MESSAGE (message_p).rrc_container = buffer; - F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = length; - F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; - F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0; - F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown - F1AP_DL_RRC_MESSAGE (message_p).rnti = ue_context_p->ue_context.rnti; - F1AP_DL_RRC_MESSAGE (message_p).srb_id = DCCH; - F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; - F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; - itti_send_msg_to_task (TASK_CU_F1, ctxt.module_id, message_p); - LOG_D(NR_RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n"); - /* Transfer data to PDCP */ nr_rrc_data_req ( &ctxt, - ue_context_p->ue_context.Srb2.Srb_info.Srb_id, + DCCH, // ue_context_p->ue_context.Srb2.Srb_info.Srb_id, (*rrc_gNB_mui)++, SDU_CONFIRM_NO, length, diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 650d6bf19b..53b79c910d 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -68,7 +68,7 @@ #include "RRC/NAS/rb_config.h" #include "SIMULATION/TOOLS/sim.h" // for taus -#if ITTI_SIM +#if defined(ITTI_SIM) || defined(RFSIM_NAS) #include "nr_nas_msg_sim.h" #endif @@ -1361,7 +1361,7 @@ static void rrc_ue_generate_RRCSetupComplete( const char *nas_msg; int nas_msg_length; if (AMF_MODE_ENABLED) { -#if ITTI_SIM +#if defined(ITTI_SIM) || defined(RFSIM_NAS) as_nas_info_t initialNasMsg; generateRegistrationRequest(&initialNasMsg); nas_msg = (char*)initialNasMsg.data; @@ -1790,6 +1790,9 @@ nr_rrc_ue_process_securityModeCommand( void rrc_ue_generate_RRCSetupRequest( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index ) { uint8_t i=0,rv[6]; + if(IS_SOFTMODEM_NOS1) { + AMF_MODE_ENABLED = 1; + } if(NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size ==0) { // Get RRCConnectionRequest, fill random for now // Generate random byte stream for contention resolution