Commit cf7df534 authored by luis_pereira87's avatar luis_pereira87

Merge remote-tracking branch 'origin/develop-NR_SA_F1AP_5GRECORDS-lts' into...

Merge remote-tracking branch 'origin/develop-NR_SA_F1AP_5GRECORDS-lts' into develop-NR_SA_F1AP_5GRECORDS-lts
parents 5bcba6cf c29142bf
......@@ -1021,7 +1021,6 @@ 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
......@@ -2464,107 +2463,6 @@ set (libnas_utils_OBJS
${NAS_SRC}COMMON/UTIL/OctetString.c
)
if(NAS_UE)
set(libnas_ue_api_OBJS
${NAS_SRC}UE/API/USER/at_command.c
${NAS_SRC}UE/API/USER/at_error.c
${NAS_SRC}UE/API/USER/at_response.c
${NAS_SRC}UE/API/USER/user_api.c
${NAS_SRC}UE/API/USER/user_indication.c
${NAS_SRC}UE/API/USIM/aka_functions.c
${NAS_SRC}UE/API/USIM/usim_api.c
)
set(libnas_ue_emm_OBJS
${NAS_SRC}UE/EMM/Attach.c
${NAS_SRC}UE/EMM/Authentication.c
${NAS_SRC}UE/EMM/Detach.c
${NAS_SRC}UE/EMM/emm_main.c
${NAS_SRC}UE/EMM/EmmStatusHdl.c
${NAS_SRC}UE/EMM/Identification.c
${NAS_SRC}UE/EMM/IdleMode.c
${NAS_SRC}UE/EMM/LowerLayer.c
${NAS_SRC}UE/EMM/SecurityModeControl.c
${NAS_SRC}UE/EMM/ServiceRequestHdl.c
${NAS_SRC}UE/EMM/TrackingAreaUpdate.c
)
set(libnas_ue_emm_sap_OBJS
${NAS_SRC}UE/EMM/SAP/emm_as.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttachNeeded.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c
${NAS_SRC}UE/EMM/SAP/EmmDeregistered.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredInitiated.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredLimitedService.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNoImsi.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNormalService.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredPlmnSearch.c
${NAS_SRC}UE/EMM/SAP/emm_esm.c
${NAS_SRC}UE/EMM/SAP/emm_fsm.c
${NAS_SRC}UE/EMM/SAP/EmmNull.c
${NAS_SRC}UE/EMM/SAP/emm_recv.c
${NAS_SRC}UE/EMM/SAP/emm_reg.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c
${NAS_SRC}UE/EMM/SAP/EmmRegistered.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredInitiated.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredLimitedService.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredNoCellAvailable.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredNormalService.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredPlmnSearch.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredUpdateNeeded.c
${NAS_SRC}UE/EMM/SAP/emm_sap.c
${NAS_SRC}UE/EMM/SAP/emm_send.c
${NAS_SRC}UE/EMM/SAP/EmmServiceRequestInitiated.c
${NAS_SRC}UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c
)
set (libnas_ue_esm_OBJS
${NAS_SRC}UE/ESM/DedicatedEpsBearerContextActivation.c
${NAS_SRC}UE/ESM/DefaultEpsBearerContextActivation.c
${NAS_SRC}UE/ESM/EpsBearerContextDeactivation.c
${NAS_SRC}UE/ESM/esm_ebr.c
${NAS_SRC}UE/ESM/esm_ebr_context.c
${NAS_SRC}UE/ESM/esm_ip.c
${NAS_SRC}UE/ESM/esm_main.c
${NAS_SRC}UE/ESM/esm_pt.c
${NAS_SRC}UE/ESM/EsmStatusHdl.c
${NAS_SRC}UE/ESM/PdnConnectivity.c
${NAS_SRC}UE/ESM/PdnDisconnect.c
)
set(libnas_ue_esm_sap_OBJS
${NAS_SRC}UE/ESM/SAP/esm_recv.c
${NAS_SRC}UE/ESM/SAP/esm_send.c
${NAS_SRC}UE/ESM/SAP/esm_sap.c
)
add_library(LIB_NAS_UE
${NAS_SRC}UE/nas_itti_messaging.c
${NAS_SRC}UE/nas_network.c
${NAS_SRC}UE/nas_parser.c
${NAS_SRC}UE/nas_proc.c
${NAS_SRC}UE/nas_user.c
${libnas_api_OBJS}
${libnas_ue_api_OBJS}
${libnas_emm_msg_OBJS}
${libnas_esm_msg_OBJS}
${libnas_ies_OBJS}
${libnas_utils_OBJS}
${libnas_ue_emm_OBJS}
${libnas_ue_emm_sap_OBJS}
${libnas_ue_esm_OBJS}
${libnas_ue_esm_sap_OBJS}
)
add_dependencies(LIB_NAS_UE rrc_flag)
set(NAS_UE_LIB LIB_NAS_UE)
include_directories(${NAS_SRC}UE)
include_directories(${NAS_SRC}UE/API/USER)
include_directories(${NAS_SRC}UE/API/USIM)
include_directories(${NAS_SRC}UE/EMM)
include_directories(${NAS_SRC}UE/EMM/SAP)
include_directories(${NAS_SRC}UE/ESM)
include_directories(${NAS_SRC}UE/ESM/SAP)
endif()
if(ITTI_SIM OR RFSIM_NAS)
set(libnas_ue_api_OBJS
${NAS_SRC}UE/API/USER/at_command.c
......@@ -2588,6 +2486,7 @@ if(ITTI_SIM OR RFSIM_NAS)
${NAS_SRC}UE/EMM/ServiceRequestHdl.c
${NAS_SRC}UE/EMM/TrackingAreaUpdate.c
)
set(libnas_ue_emm_sap_OBJS
${NAS_SRC}UE/EMM/SAP/emm_as.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttachNeeded.c
......@@ -2683,6 +2582,26 @@ if(ITTI_SIM OR RFSIM_NAS)
add_dependencies(LIB_NAS_SIMUE rrc_flag)
set(NAS_SIM_LIB LIB_NAS_SIMUE)
add_library(LIB_NAS_UE
${NAS_SRC}UE/nas_itti_messaging.c
${NAS_SRC}UE/nas_network.c
${NAS_SRC}UE/nas_parser.c
${NAS_SRC}UE/nas_proc.c
${NAS_SRC}UE/nas_user.c
${libnas_api_OBJS}
${libnas_ue_api_OBJS}
${libnas_emm_msg_OBJS}
${libnas_esm_msg_OBJS}
${libnas_ies_OBJS}
${libnas_utils_OBJS}
${libnas_ue_emm_OBJS}
${libnas_ue_emm_sap_OBJS}
${libnas_ue_esm_OBJS}
${libnas_ue_esm_sap_OBJS}
)
add_dependencies(LIB_NAS_UE rrc_flag)
set(NAS_UE_LIB LIB_NAS_UE)
include_directories(${NAS_SRC}NR_UE)
include_directories(${NAS_SRC}UE)
include_directories(${NAS_SRC}UE/API/USER)
......
......@@ -68,7 +68,6 @@ USRP_REC_PLAY="False"
BUILD_ECLIPSE=0
NR="False"
ITTI_SIM="False"
RFSIM_NAS="False"
SANITIZE_ADDRESS="False"
OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope msc"
RU=0
......@@ -274,9 +273,8 @@ function main() {
--nrUE)
RU=0
nrUE=1
rfsimNas=1
RFSIM_NAS="True"
NR="True"
rfsimNas=1
echo_info "Will compile NR UE"
shift;;
--mu)
......@@ -633,7 +631,6 @@ function main() {
echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file
echo "set ( RU $RU )" >> $cmake_file
echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file
echo "set ( RFSIM_NAS $RFSIM_NAS )" >> $cmake_file
echo "set ( SANITIZE_ADDRESS $SANITIZE_ADDRESS )" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
cd $DIR/$build_dir/build
......
......@@ -136,7 +136,7 @@ extern "C" {
LOG_E(TMR,"Queue for %s task contains %ld messages\n", itti_get_task_name(destination_task_id), s );
if ( s > 50 )
LOG_I(TMR,"Queue for %s task size: %ld\n",itti_get_task_name(destination_task_id), s+1);
LOG_I(TMR,"Queue for %s task size: %ld (last message %s)\n",itti_get_task_name(destination_task_id), s+1,ITTI_MSG_NAME(message));
t->message_queue.insert(t->message_queue.begin(), message);
eventfd_t sem_counter = 1;
......
......@@ -86,7 +86,7 @@
#include "T.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include <nfapi/oai_integration/nfapi_pnf.h>
#include <PHY/NR_TRANSPORT/nr_ulsch.h>
#include <openair1/PHY/NR_TRANSPORT/nr_ulsch.h>
#include <PHY/NR_ESTIMATION/nr_ul_estimation.h>
//#define DEBUG_THREADS 1
......
......@@ -86,9 +86,7 @@ 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_STRUCT thread_struct;
......@@ -195,12 +193,10 @@ int create_tasks_nrue(uint32_t ue_nb) {
LOG_E(NR_RRC, "Create task for RRC UE failed\n");
return -1;
}
#if defined(ITTI_SIM) || defined(RFSIM_NAS)
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;
}
#endif
}
itti_wait_ready(0);
......
......@@ -65,22 +65,6 @@
#define MAX_NUM_CHANNEL_BITS (14*1200*6) // 14 symbols, 1200 REs, 12 bits/RE
#define MAX_NUM_RE (14*1200)
#if !defined(SI_RNTI)
#define SI_RNTI (rnti_t)0xffff
#define SI_RNTI_MBMS (rnti_t)0xfff9
#endif
#if !defined(M_RNTI)
#define M_RNTI (rnti_t)0xfffd
#endif
#if !defined(P_RNTI)
#define P_RNTI (rnti_t)0xfffe
#endif
#if !defined(CBA_RNTI)
#define CBA_RNTI (rnti_t)0xfff4
#endif
#if !defined(C_RNTI)
#define C_RNTI (rnti_t)0x1234
#endif
// These are the codebook indexes according to Table 6.3.4.2.3-1 of 36.211
//1 layer
#define PMI_2A_11 0
......
......@@ -267,6 +267,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN);
A = rel15->TBSize[0]<<3;
if ( dlsch->rnti != SI_RNTI )
trace_NRpdu(DIRECTION_DOWNLINK, a, rel15->TBSize[0], 0, WS_C_RNTI, dlsch->rnti, frame, slot,0, 0);
NR_gNB_SCH_STATS_t *stats=NULL;
int first_free=-1;
......
......@@ -91,6 +91,7 @@ int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB);
void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB);
void clear_pusch_stats(PHY_VARS_gNB *gNB);
NR_gNB_SCH_STATS_t *get_ulsch_stats(PHY_VARS_gNB *gNB,NR_gNB_ULSCH_t *ulsch);
......@@ -66,7 +66,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
uint8_t Mod_id, fd_occasion, preamble_index, restricted_set, not_found;
uint16_t rootSequenceIndex, prach_fmt_id, NCS, *prach_root_sequence_map, preamble_offset = 0;
uint16_t preamble_shift = 0, preamble_index0, n_shift_ra, n_shift_ra_bar, d_start=0, numshift, N_ZC, u, offset, offset2, first_nonzero_root_idx;
uint16_t preamble_shift = 0, preamble_index0, n_shift_ra, n_shift_ra_bar, d_start=INT16_MAX, numshift, N_ZC, u, offset, offset2, first_nonzero_root_idx;
int16_t prach_tmp[98304*2*4] __attribute__((aligned(32)));
int16_t Ncp = 0, amp, *prach, *prach2, *prachF, *Xu;
......
......@@ -549,7 +549,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
int occ_length = 0;
int occ_Index = 0;
int BWPsize = 0;
int BWPstart = 0;
int BWPstart = INT_MAX;
NR_UE_HARQ_STATUS_t *harq_status = &ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[dl_harq_pid]->harq_ack;
......
......@@ -195,21 +195,13 @@ typedef uint8_t mme_code_t;
typedef uint32_t m_tmsi_t;
//Random UE identity length = 40 bits
#if ! defined(NOT_A_RANDOM_UE_IDENTITY)
#define NOT_A_RANDOM_UE_IDENTITY (uint64_t)0xFFFFFFFF
#endif
#if ! defined(NOT_A_RNTI)
#define NOT_A_RNTI (rnti_t)0
#endif
#if ! defined(M_RNTI)
#define M_RNTI (rnti_t)0xFFFD
#endif
#if ! defined(P_RNTI)
#define P_RNTI (rnti_t)0xFFFE
#endif
#if ! defined(SI_RNTI)
#define SI_RNTI (rnti_t)0xFFFF
#endif
#define CBA_RNTI (rnti_t)0xfff4
#define OAI_C_RNTI (rnti_t)0x1234
typedef enum config_action_e {
CONFIG_ACTION_NULL = 0,
CONFIG_ACTION_ADD = 1,
......
......@@ -38,13 +38,6 @@
#include "common/ran_context.h"
#include "openair3/UTILS/conversions.h"
// undefine C_RNTI from
// openair1/PHY/LTE_TRANSPORT/transport_common.h which
// replaces in ie->value.choice.C_RNTI, causing
// a compile error
#undef C_RNTI
// Bing Kai: create CU and DU context, and put all the information there.
uint64_t du_ue_f1ap_id = 0;
uint32_t f1ap_assoc_id = 0;
......
......@@ -56,13 +56,6 @@
#include "intertask_interface.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
// undefine C_RNTI from
// openair1/PHY/LTE_TRANSPORT/transport_common.h which
// replaces in ie->value.choice.C_RNTI, causing
// a compile error
#undef C_RNTI
extern f1ap_setup_req_t *f1ap_du_data;
extern RAN_CONTEXT_t RC;
extern f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB];
......
......@@ -41,13 +41,6 @@
#include "openair2/RRC/NR/rrc_gNB_UE_context.h"
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
// undefine C_RNTI from
// openair1/PHY/LTE_TRANSPORT/transport_common.h which
// replaces in ie->value.choice.C_RNTI, causing
// a compile error
#undef C_RNTI
extern f1ap_setup_req_t *f1ap_du_data;
extern f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB];
extern RAN_CONTEXT_t RC;
......
......@@ -50,6 +50,7 @@
#include "f1ap_cu_task.h"
#include "f1ap_du_task.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include <openair2/LAYER2/nr_pdcp/nr_pdcp.h>
extern unsigned char NB_gNB_INST;
extern RAN_CONTEXT_t RC;
......
......@@ -169,4 +169,9 @@ uint8_t get_transformPrecoding(const NR_BWP_UplinkCommon_t *initialUplinkBWP,
int rnti_type,
uint8_t configuredGrant);
void nr_mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP) ;
#endif
......@@ -191,6 +191,10 @@ void nr_process_mac_pdu(module_id_t module_idP,
uint16_t mac_ce_len, mac_subheader_len, mac_sdu_len;
NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info;
if ( pduP[0] != UL_SCH_LCID_PADDING )
trace_NRpdu(DIRECTION_UPLINK, pduP, mac_pdu_len ,UE_id, WS_C_RNTI, UE_info->rnti[UE_id], frameP, 0, 0, 0);
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
// For both DL/UL-SCH
// Except:
......
......@@ -66,7 +66,9 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity,
}
/* SRBs always have MAC-I, even if integrity is not active */
if (entity->has_integrity || entity->type == NR_PDCP_SRB) {
if ( // FIXME: DRB creation is with integrity, but we don't receive it
// entity->has_integrity ||
entity->type == NR_PDCP_SRB) {
integrity_size = 4;
} else {
integrity_size = 0;
......
......@@ -38,7 +38,7 @@
#include "common/ran_context.h"
#include "NR_UL-CCCH-Message.h"
#undef C_RNTI // C_RNTI is used in F1AP generated code, prevent preprocessor replace
#include "openair2/F1AP/f1ap_du_rrc_message_transfer.h"
#include "openair2/LAYER2/PROTO_AGENT/proto_agent.h"
......@@ -425,7 +425,7 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size)
int is_enb;
/* is it SRB? */
for (i = 0; i < 2; i++) {
for (i = 0; i < sizeofArray(ue->srb); i++) {
if (entity == ue->srb[i]) {
is_srb = 1;
rb_id = i+1;
......@@ -434,7 +434,7 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size)
}
/* maybe DRB? */
for (i = 0; i < 5; i++) {
for (i = 0; i < sizeofArray(ue->drb) ; i++) {
if (entity == ue->drb[i]) {
is_srb = 0;
rb_id = i+1;
......
......@@ -49,8 +49,6 @@
#include "intertask_interface.h"
#include "flexran_agent_extern.h"
#undef C_RNTI // C_RNTI is used in F1AP generated code, prevent preprocessor replace
//#include "f1ap_du_rrc_message_transfer.h"
#include "openair2/F1AP/f1ap_du_rrc_message_transfer.h"
extern RAN_CONTEXT_t RC;
......
......@@ -45,7 +45,7 @@
#include "NR_BCCH-BCH-Message.h"
#include "rrc_gNB_UE_context.h"
#include <openair2/RRC/NR/MESSAGES/asn1_msg.h>
#include <openair2/UTIL/OPT/opt.h>
#include <openair2/F1AP/f1ap_du_rrc_message_transfer.h>
extern RAN_CONTEXT_t RC;
......@@ -209,7 +209,6 @@ nr_rrc_data_req(
message_p);
LOG_I(NR_RRC,"send RRC_DCCH_DATA_REQ to PDCP\n");
//trace_NRpdu(DIRECTION_DOWNLINK, message_buffer, sdu_sizeP, 0, WS_M_RNTI, ctxt_pP->rnti, ctxt_pP->frame, ctxt_pP->subframe,0, 0);
/* Hack: only trigger PDCP if in CU, otherwise it is triggered by RU threads
* Ideally, PDCP would not neet to be triggered like this but react to ITTI
* messages automatically */
......
......@@ -356,7 +356,7 @@ typedef struct gNB_RRC_UE_s {
/* list of e_rab to be setup by RRC layers */
/* list of pdu session to be setup by RRC layers */
e_rab_param_t e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB];
pdu_session_param_t pdusession[NR_NB_RB_MAX];//[NGAP_MAX_PDU_SESSION];
pdu_session_param_t pduSession[NR_NB_RB_MAX];//[NGAP_MAX_PDU_SESSION];
//release e_rabs
uint8_t nb_release_of_e_rabs;
e_rab_failed_t e_rabs_release_failed[S1AP_MAX_E_RAB];
......
This diff is collapsed.
This diff is collapsed.
......@@ -135,7 +135,7 @@ rrc_gNB_allocate_new_UE_context(
for(int i = 0; i < NB_RB_MAX; i++) {
new_p->ue_context.e_rab[i].xid = -1;
new_p->ue_context.pdusession[i].xid = -1;
new_p->ue_context.pduSession[i].xid = -1;
new_p->ue_context.modify_e_rab[i].xid = -1;
}
......
......@@ -69,9 +69,7 @@
#include "SIMULATION/TOOLS/sim.h" // for taus
#include <executables/softmodem-common.h>
#if defined(ITTI_SIM) || defined(RFSIM_NAS)
#include "nr_nas_msg_sim.h"
#endif
NR_UE_RRC_INST_t *NR_UE_rrc_inst;
/* NAS Attach request with IMSI */
......@@ -1349,14 +1347,21 @@ static void rrc_ue_generate_RRCSetupComplete(
AssertFatal(1==0,"2 > csi_MeasConfig is not null\n");
if (AMF_MODE_ENABLED) {
#if defined(ITTI_SIM) || defined(RFSIM_NAS)
#if defined(ITTI_SIM)
as_nas_info_t initialNasMsg;
generateRegistrationRequest(&initialNasMsg);
generateRegistrationRequest(&initialNasMsg, ctxt_pP->module_id);
nas_msg = (char*)initialNasMsg.data;
nas_msg_length = initialNasMsg.length;
#else
nas_msg = (char *) NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data;
nas_msg_length = NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.length;
if (get_softmodem_params()->sa) {
as_nas_info_t initialNasMsg;
generateRegistrationRequest(&initialNasMsg, ctxt_pP->module_id);
nas_msg = (char*)initialNasMsg.data;
nas_msg_length = initialNasMsg.length;
} else {
nas_msg = (char *) NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data;
nas_msg_length = NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.length;
}
#endif
} else {
nas_msg = nr_nas_attach_req_imsi;
......@@ -2281,7 +2286,6 @@ nr_rrc_ue_establish_srb2(
if (Srb_id != 1) {
LOG_E(NR_RRC,"[UE %d] Frame %d: Received message on DL-DCCH (SRB%ld), should not have ...\n",
ctxt_pP->module_id, ctxt_pP->frame, Srb_id);
return -1;
} else {
LOG_D(NR_RRC, "Received message on SRB%ld\n", Srb_id);
}
......
......@@ -441,6 +441,10 @@ static void SendFrameNR(guint8 radioType, guint8 direction, guint8 rntiType,
tmp16 = htons(subframe); // frame counter : this will give an expert info as wireshark expects SF and not F
memcpy(frameBuffer+frameOffset, &tmp16, 2);
frameOffset += 2;
if (direction == 0 ) { //ulink
frameBuffer[frameOffset++] = MAC_NR_PHR_TYPE2_OTHERCELL_TAG;
frameBuffer[frameOffset++] = 0;
}
/***************************************/
/* Now write the MAC PDU */
......
......@@ -194,23 +194,23 @@ static int encode_guti_5gs_mobile_identity(Guti5GSMobileIdentity_t *guti, uint8_
static int encode_suci_5gs_mobile_identity(Suci5GSMobileIdentity_t *suci, uint8_t *buffer)
{
uint32_t encoded = 0;
*(buffer + encoded) = 0x00 | (suci->supiformat << 4) | (suci->typeofidentity);
*(buffer + encoded) = (suci->supiformat << 4) | (suci->typeofidentity);
encoded++;
*(buffer + encoded) = 0x00 | ((suci->mccdigit2 & 0xf) << 4) |
*(buffer + encoded) = ((suci->mccdigit2 & 0xf) << 4) |
(suci->mccdigit1 & 0xf);
encoded++;
*(buffer + encoded) = 0x00 | ((suci->mncdigit3 & 0xf) << 4) |
*(buffer + encoded) = ((suci->mncdigit3 & 0xf) << 4) |
(suci->mccdigit3 & 0xf);
encoded++;
*(buffer + encoded) = 0x00 | ((suci->mncdigit2 & 0xf) << 4) |
*(buffer + encoded) = ((suci->mncdigit2 & 0xf) << 4) |
(suci->mncdigit1 & 0xf);
encoded++;
*(buffer + encoded) = 0x00 | ((suci->routingindicatordigit2 & 0xf) << 4) |
*(buffer + encoded) = ((suci->routingindicatordigit2 & 0xf) << 4) |
(suci->routingindicatordigit1 & 0xf);
encoded++;
*(buffer + encoded) = 0x00 | ((suci->routingindicatordigit4 & 0xf) << 4) |
*(buffer + encoded) = ((suci->routingindicatordigit4 & 0xf) << 4) |
(suci->routingindicatordigit3 & 0xf);
encoded++;
......@@ -220,8 +220,15 @@ static int encode_suci_5gs_mobile_identity(Suci5GSMobileIdentity_t *suci, uint8_
*(buffer + encoded) = suci->homenetworkpki;
encoded++;
IES_ENCODE_U32(buffer, encoded, suci->schemeoutput);
char *ptr=suci->schemeoutput;
while ( ptr < suci->schemeoutput+strlen(suci->schemeoutput) ) {
buffer[encoded]=((*(ptr+1)-'0')<<4) | (*(ptr) -'0');
encoded++;
ptr+=2;
}
if (strlen(suci->schemeoutput)%2 == 1)
buffer[encoded++]=((*(ptr-1)-'0')) | 0xF0;
return encoded;
}
......
......@@ -64,7 +64,7 @@ typedef struct {
uint8_t spare6:1;
uint8_t protectionschemeId:4;
uint8_t homenetworkpki;
uint32_t schemeoutput;
char schemeoutput[32];
} Suci5GSMobileIdentity_t;
typedef struct {
......
......@@ -387,5 +387,6 @@ void processNAS(void *msg, NRUEcontext_t *UE);
int identityRequest(void **msg, NRUEcontext_t *UE);
int authenticationRequest(void **msg, NRUEcontext_t *UE);
int securityModeCommand(void **msg, NRUEcontext_t *UE);
void servingNetworkName(uint8_t *msg, char * imsiStr, int nmc_size);
#endif
This diff is collapsed.
......@@ -56,6 +56,7 @@
#define FGS_SECURITY_MODE_COMMAND 0b01011101 /* 93 = 0x5d */
#define FGS_SECURITY_MODE_COMPLETE 0b01011110 /* 94 = 0x5e */
#define FGS_UPLINK_NAS_TRANSPORT 0b01100111 /* 103= 0x67 */
#define FGS_DOWNLINK_NAS_TRANSPORT 0b01101000 /* 104= 0x68 */
// message type for 5GS session management
#define FGS_PDU_SESSION_ESTABLISHMENT_REQ 0b11000001 /* 193= 0xc1 */
......@@ -115,9 +116,7 @@ typedef union {
fgs_nas_message_plain_t plain;
} fgs_nas_message_t;
void generateRegistrationRequest(as_nas_info_t *initialNasMsg);
void generateIdentityResponse(as_nas_info_t *initialNasMsg, uint8_t identitytype);
void generateAuthenticationResp(as_nas_info_t *initialNasMsg, uint8_t *buf);
void generateRegistrationRequest(as_nas_info_t *initialNasMsg, int Mod_id);
void generateSecurityModeComplete(as_nas_info_t *initialNasMsg);
void generateRegistrationComplete(as_nas_info_t *initialNasMsg, SORTransparentContainer *sortransparentcontainer);
void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg);
......
......@@ -20,9 +20,11 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <ctype.h>
#include <openair3/UICC/usim_interface.h>
#include <openair3/NAS/COMMON/milenage.h>
extern uint16_t NB_UE_INST;
#define UICC_SECTION "uicc"
#define UICC_CONFIG_HELP_OPTIONS " list of comma separated options to interface a simulated (real UICC to be developped). Available options: \n"\
......@@ -34,18 +36,20 @@
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define UICC_PARAMS_DESC {\
{"imsi", "USIM IMSI\n", 0, strptr:&(uicc->imsiStr), defstrval:"", TYPE_STRING, 0 },\
{"imsi", "USIM IMSI\n", 0, strptr:&(uicc->imsiStr), defstrval:"2089900007487", TYPE_STRING, 0 },\
{"nmc_size" "number of digits in NMC", 0, iptr:&(uicc->nmc_size), defintval:2, TYPE_INT, 0 },\
{"key", "USIM Ki\n", 0, strptr:&(uicc->keyStr), defstrval:"", TYPE_STRING, 0 },\
{"opc", "USIM OPc\n", 0, strptr:&(uicc->opcStr), defstrval:"", TYPE_STRING, 0 },\
{"key", "USIM Ki\n", 0, strptr:&(uicc->keyStr), defstrval:"fec86ba6eb707ed08905757b1bb44b8f", TYPE_STRING, 0 },\
{"opc", "USIM OPc\n", 0, strptr:&(uicc->opcStr), defstrval:"c42449363bbad02b66d16bc975d77cc1", TYPE_STRING, 0 },\
{"amf", "USIM amf\n", 0, strptr:&(uicc->amfStr), defstrval:"8000", TYPE_STRING, 0 },\
{"sqn", "USIM sqn\n", 0, strptr:&(uicc->sqnStr), defstrval:"000000", TYPE_STRING, 0 },\
};
static uicc_t** uiccArray=NULL;
const char *hexTable="0123456789abcdef";
static inline uint8_t mkDigit(unsigned char in) {
for (int i=0; i<16; i++)
if (in==hexTable[i])
if (tolower(in)==hexTable[i])
return i;
LOG_E(SIM,"Impossible hexa input: %c\n",in);
return 0;
......@@ -65,7 +69,7 @@ uicc_t *init_uicc(char *sectionName) {
// we can read the IMSI from the USIM
// key, OPc, sqn, amf don't need to be read from the true USIM
int ret = config_get( uicc_params,sizeof(uicc_params)/sizeof(paramdef_t),sectionName);
AssertFatal(ret >= 0, "configuration couldn't be performed");
AssertFatal(ret >= 0, "configuration couldn't be performed for uicc name: %s", sectionName);
LOG_I(SIM, "UICC simulation: IMSI=%s, Ki=%s, OPc=%s\n", uicc->imsiStr, uicc->keyStr, uicc->opcStr);
to_hex(uicc->keyStr,uicc->key, sizeof(uicc->key) );
to_hex(uicc->opcStr,uicc->opc, sizeof(uicc->opc) );
......@@ -90,3 +94,15 @@ void uicc_milenage_generate(uint8_t *autn, uicc_t *uicc) {
log_dump(SIM,autn,sizeof(autn), LOG_DUMP_CHAR,"milenage output autn:");
}
uicc_t * checkUicc(int Mod_id) {
AssertFatal(Mod_id < NB_UE_INST, "Mod_id must be less than NB_UE_INST. Mod_id:%d NB_UE_INST:%d", Mod_id,NB_UE_INST);
if(uiccArray==NULL){
uiccArray=(uicc_t **)calloc(1,sizeof(uicc_t*)*NB_UE_INST);
}
if (!uiccArray[Mod_id]) {
char uiccName[64];
sprintf(uiccName,"uicc%d", Mod_id);
uiccArray[Mod_id]=(void*)init_uicc(uiccName);
}
return (uicc_t*) uiccArray[Mod_id];
}
......@@ -66,6 +66,8 @@ typedef struct {
/*
* Read the configuration file, section name variable to be able to manage several UICC
*/
uicc_t *checkUicc(int Mod_id);
uicc_t *init_uicc(char *sectionName);
void uicc_milenage_generate(uint8_t * autn, uicc_t *uicc);
uicc_t * checkUicc(int Mod_id);
#endif
......@@ -550,6 +550,7 @@ int gtpv1u_update_ngu_tunnel(
const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP,
const rnti_t prior_rnti
) {
AssertFatal( false, "to be developped\n");
return GTPNOK;
}
......
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