From 92c100bb5a326dbb26ea914653e873675231fa6d Mon Sep 17 00:00:00 2001 From: WANG Tsu-Han Date: Thu, 16 Jan 2020 11:30:27 +0100 Subject: [PATCH 01/32] remove uhd_set_thread_priority function --- executables/nr-ru.c | 7 ------- targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c | 1 - targets/ARCH/COMMON/common_lib.h | 4 ---- targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c | 1 - targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp | 1 - targets/ARCH/LMSSDR/USERSPACE/LIB/sodera_lib.cpp | 1 - targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 11 ----------- targets/ARCH/tcp_bridge/tcp_bridge.c | 1 - targets/ARCH/tcp_bridge/tcp_bridge_oai.c | 1 - 9 files changed, 28 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index a9c306461c..af8fb6c131 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1250,13 +1250,6 @@ static void *ru_thread_tx( void *param ) { wait_on_condition(&proc->mutex_FH1,&proc->cond_FH1,&proc->instance_cnt_FH1,"ru_thread_tx"); printf( "ru_thread_tx ready\n"); - - if(ru->rfdevice.uhd_set_thread_priority != NULL) - { - LOG_I(PHY,"set ru_thread_tx uhd priority \n"); - ru->rfdevice.uhd_set_thread_priority(); - } - while (!oai_exit) { LOG_D(PHY,"ru_thread_tx: Waiting for TX processing\n"); diff --git a/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c b/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c index f6ac1fc6e1..c4e593ca92 100644 --- a/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c +++ b/targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c @@ -1147,7 +1147,6 @@ int device_init(openair0_device *device, device->trx_set_gains_func = trx_brf_set_gains; device->openair0_cfg = openair0_cfg; device->priv = (void *)brf; - device->uhd_set_thread_priority = NULL; calibrate_rf(device); diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index 7052d6d40b..bba6bcd93d 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -400,10 +400,6 @@ struct openair0_device_t { * \param arg pointer to capabilities or configuration */ void (*configure_rru)(int idx, void *arg); - - /*! \brief set UHD thread priority - */ - void (*uhd_set_thread_priority)(void); }; /* type of device init function, implemented in shared lib */ diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c index 259b1fc277..c5822a3650 100644 --- a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c +++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c @@ -417,7 +417,6 @@ int transport_init(openair0_device *device, device->trx_stop_func = trx_eth_stop; device->trx_set_freq_func = trx_eth_set_freq; device->trx_set_gains_func = trx_eth_set_gains; - device->uhd_set_thread_priority = NULL; if (eth->flags == ETH_RAW_MODE) { device->trx_write_func = trx_eth_write_raw; diff --git a/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp b/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp index c563569506..a57ebf8b6d 100644 --- a/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp +++ b/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp @@ -405,7 +405,6 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg){ device->trx_stop_func = trx_lms_stop; device->trx_set_freq_func = trx_lms_set_freq; device->trx_set_gains_func = trx_lms_set_gains; - device->uhd_set_thread_priority = NULL; device->openair0_cfg = openair0_cfg; diff --git a/targets/ARCH/LMSSDR/USERSPACE/LIB/sodera_lib.cpp b/targets/ARCH/LMSSDR/USERSPACE/LIB/sodera_lib.cpp index 9b11415631..6f1afe47c0 100644 --- a/targets/ARCH/LMSSDR/USERSPACE/LIB/sodera_lib.cpp +++ b/targets/ARCH/LMSSDR/USERSPACE/LIB/sodera_lib.cpp @@ -706,7 +706,6 @@ int openair0_dev_init_sodera(openair0_device* device, openair0_config_t *openair device->trx_stop_func = trx_sodera_stop; device->trx_set_freq_func = trx_sodera_set_freq; device->trx_set_gains_func = trx_sodera_set_gains; - device->uhd_set_thread_priority = NULL; s->sample_rate = openair0_cfg[0].sample_rate; s->channelscount = openair0_cfg[0].rx_num_channels; diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index e2418bcb76..eb8c6ec010 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -893,15 +893,6 @@ int trx_usrp_reset_stats(openair0_device *device) { return(0); } -/*! \brief Set uhd priority - */ -static void uhd_set_thread_priority(void) { - uhd::set_thread_priority_safe(1.0); -} - -void noop_func(void) { - return; -} extern "C" { int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { LOG_D(HW, "openair0_cfg[0].sdr_addrs == '%s'\n", openair0_cfg[0].sdr_addrs); @@ -941,7 +932,6 @@ extern "C" { set_rx_gain_offset(&openair0_cfg[0],0,bw_gain_adjust); device->trx_write_func = trx_usrp_write_recplay; device->trx_read_func = trx_usrp_read_recplay; - device->uhd_set_thread_priority = noop_func; std::cerr << "USRP device initialized in subframes replay mode for " << s->recplay_state->u_sf_loops << " loops. Use mmap=" << s->recplay_state->use_mmap << std::endl; } else { @@ -1294,7 +1284,6 @@ extern "C" { LOG_I(HW,"Device timestamp: %f...\n", s->usrp->get_time_now().get_real_secs()); device->trx_write_func = trx_usrp_write; device->trx_read_func = trx_usrp_read; - device->uhd_set_thread_priority = uhd_set_thread_priority; s->sample_rate = openair0_cfg[0].sample_rate; // TODO: diff --git a/targets/ARCH/tcp_bridge/tcp_bridge.c b/targets/ARCH/tcp_bridge/tcp_bridge.c index 3e2979f849..8b287acfa1 100644 --- a/targets/ARCH/tcp_bridge/tcp_bridge.c +++ b/targets/ARCH/tcp_bridge/tcp_bridge.c @@ -267,7 +267,6 @@ int device_init(openair0_device* device, openair0_config_t *openair0_cfg) device->trx_set_gains_func = tcp_bridge_set_gains; device->trx_write_func = tcp_bridge_write; device->trx_read_func = tcp_bridge_read; - device->uhd_set_thread_priority = NULL; device->priv = tcp_bridge; diff --git a/targets/ARCH/tcp_bridge/tcp_bridge_oai.c b/targets/ARCH/tcp_bridge/tcp_bridge_oai.c index 7c06d14360..c3d5355876 100644 --- a/targets/ARCH/tcp_bridge/tcp_bridge_oai.c +++ b/targets/ARCH/tcp_bridge/tcp_bridge_oai.c @@ -413,7 +413,6 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { device->trx_set_freq_func = tcp_bridge_set_freq; device->trx_set_gains_func = tcp_bridge_set_gains; device->trx_write_func = tcp_bridge_write; - device->uhd_set_thread_priority = NULL; if (tcp_bridge->is_enb) { device->trx_read_func = tcp_bridge_read; From dff766ae15875c4ae8819e859579e34738e610a4 Mon Sep 17 00:00:00 2001 From: Javier Morgade Date: Mon, 20 Jan 2020 10:34:41 +0100 Subject: [PATCH 02/32] =?UTF-8?q?=09*HOTFIX:=20After=20develop/develop-nr?= =?UTF-8?q?=20merge=20UE=20was=20crashing=20with=20MBMS=20U-Plane=20traffi?= =?UTF-8?q?c=20running=20=09-New=20MAC=20SDU=20integrity=20check=20in=20ue?= =?UTF-8?q?=5Fprocedures=20.c=20introduced=20for=20MCH=20channels.=20=09-T?= =?UTF-8?q?his=20SDU=20behavior=20didn=E2=80=99t=20show=20up=20with=20form?= =?UTF-8?q?er=20develop=20=09-TOCHECK=20whether=20NFAPI=20was=20properly?= =?UTF-8?q?=20merged=20on=20the=20eNB=20side.=20=09-eNB=5Fscheduler=5Fmch?= =?UTF-8?q?=20has=20been=20slightly=20rearranged.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit *BUGFIX: -In dlsch_demodulation.c “ rxF_comp_d.m” was continuously being written to disk *New reference config file added (lte-fdd-mbms-basic-sim.conf) for rfsim environment --- .../conf_files/lte-fdd-mbms-basic-sim.conf | 418 ++++++++++++++++++ .../PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c | 8 +- openair2/LAYER2/MAC/eNB_scheduler_mch.c | 181 +++++--- openair2/LAYER2/MAC/ue_procedures.c | 3 + 4 files changed, 552 insertions(+), 58 deletions(-) create mode 100644 ci-scripts/conf_files/lte-fdd-mbms-basic-sim.conf diff --git a/ci-scripts/conf_files/lte-fdd-mbms-basic-sim.conf b/ci-scripts/conf_files/lte-fdd-mbms-basic-sim.conf new file mode 100644 index 0000000000..53261ec32d --- /dev/null +++ b/ci-scripts/conf_files/lte-fdd-mbms-basic-sim.conf @@ -0,0 +1,418 @@ +Active_eNBs = ( "eNB-Eurecom-LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB-Eurecom-LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } ); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "3GPP_eNODEB"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2680000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + pbch_repetition = "FALSE"; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 0; + pucch_nCS_AN = 0; + pucch_n1_AN = 0; + pdsch_referenceSignalPower = -27; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -96; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -104; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + ue_TransmissionMode = 1; + + //Parameters for SIB18 + rxPool_sc_CP_Len = "normal"; + rxPool_sc_Period = "sf40"; + rxPool_data_CP_Len = "normal"; + rxPool_ResourceConfig_prb_Num = 20; + rxPool_ResourceConfig_prb_Start = 5; + rxPool_ResourceConfig_prb_End = 44; + rxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + rxPool_ResourceConfig_offsetIndicator_choice = 0; + rxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; +/* rxPool_dataHoppingConfig_hoppingParameter = 0; + rxPool_dataHoppingConfig_numSubbands = "ns1"; + rxPool_dataHoppingConfig_rbOffset = 0; + rxPool_commTxResourceUC-ReqAllowed = "TRUE"; +*/ + // Parameters for SIB19 + discRxPool_cp_Len = "normal" + discRxPool_discPeriod = "rf32" + discRxPool_numRetx = 1; + discRxPool_numRepetition = 2; + discRxPool_ResourceConfig_prb_Num = 5; + discRxPool_ResourceConfig_prb_Start = 3; + discRxPool_ResourceConfig_prb_End = 21; + discRxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + discRxPool_ResourceConfig_offsetIndicator_choice = 0; + discRxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; + + } + ); + + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + enable_measurement_reports = "no"; + + ///X2 + enable_x2 = "no"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + + ////////// MCE parameters: + target_mce_m2_ip_address = ( { ipv4 = "127.0.0.7"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + ///M2 + enable_enb_m2 = "yes"; + + + mbms_configuration_data_list = ( + { + mbsfn_sync_area = 0x0001; + mbms_service_area_list=( + { + mbms_service_area=0x0001; + } + ); + } + + ); + + + + NETWORK_INTERFACES : + { + + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; + ENB_PORT_FOR_X2C = 36422; # Spec 36422 + + ENB_IPV4_ADDRESS_FOR_M2C = "127.0.0.2/24"; + ENB_PORT_FOR_M2C = 36443; # Spec 36443 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + phy_test_mode = 0; + puSch10xSnr = 200; + puCch10xSnr = 200; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +MCEs = ( + { + MCE_ID = 0xe00; + + MCE_name = "MCE-Vicomtech-LTEBox"; + + //M2 + enable_mce_m2 = "yes"; + + //M3 + enable_mce_m3 = "yes"; + + target_mme_m3_ip_address = ( { ipv4 = "127.0.0.18"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + + + NETWORK_INTERFACES : + { + MCE_INTERFACE_NAME_FOR_M2_ENB = "lo"; + MCE_IPV4_ADDRESS_FOR_M2C = "127.0.0.7/24"; + MCE_PORT_FOR_M2C = 36443; # Spec 36443 + + MCE_INTERFACE_NAME_FOR_M3_MME = "lo"; + MCE_IPV4_ADDRESS_FOR_M3C = "127.0.0.3/24"; + MCE_PORT_FOR_M3C = 36444; # Spec 36444 + }; + + plnm: + { + mcc = 208; + mnc = 93; + mnc_length = 2; + }; + + mbms_sched_info : + { + mcch_update_time = 10; + mbms_area_config_list = ( + { + common_sf_allocation_period = 1; #rf4(0) rf8(1) rf16(2) rf32(3) rf64(4) rf128(5) rf256(6) + mbms_area_id = 0; + pmch_config_list = ( + { + allocated_sf_end=32; + data_mcs=14; + mch_scheduling_period = 0; #rf8(0) + mbms_session_list = ( + { + #plnm + service_id ->tmgi + plnm: + { + mcc = 208; + mnc = 93; + mnc_length = 2; + } + service_id=0; #keep this allways as 0 (workaround for TUN if) + lcid=5; #this must be properly defined lcid:6+service:0 -> rab_id:5 //with new RLC set lcid either 4 or 5 + } + ); + } + ); + + mbms_sf_config_list = ( + { + radioframe_allocation_period=0; #n1(0) n2(1) n4(2) n8(3) n16(4) n32(5) + radioframe_alloocation_offset=0; + num_frame="oneFrame"; + subframe_allocation=57; #xx111001 + //num_frame="fourFrame"; + //subframe_allocation=14548987; # + } + ); + + } + ); + }; + + + mcch_config_per_mbsfn_area = ( + { + mbsfn_area = 0; + pdcch_length = 1; #s1(0), s2(1) + repetition_period = 0; #rf32(0), rf64(1), rf128(2), rf256(3) + offset = 0; + modification_period = 0; #rf512(0; rf1024(1) + subframe_allocation_info = 32; #BITSTRING (6bits -> one frame) xx100000 + mcs = 1; #n2(0), n7(1), n13(2), n19(3) + } + ); + + #); #end mbms_scheduling_info + + } +); + +MMEs = ( + { + MME_ID = 0xe00; + + MME_name = "MME-MBMS-Vicomtech-LTEBox"; + + //M3 + enable_mme_m3 = "yes"; + NETWORK_INTERFACES : + { + MME_INTERFACE_NAME_FOR_M3_MCE = "lo"; + MME_IPV4_ADDRESS_FOR_M3C = "127.0.0.18/24"; + MME_PORT_FOR_M3C = 36444; # Spec 36444 + + }; + } +); + + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 125; + eNB_instances = [0]; + + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + +NETWORK_CONTROLLER : +{ + FLEXRAN_ENABLED = "no"; + FLEXRAN_INTERFACE_NAME = "ens3"; + FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; + FLEXRAN_PORT = 2210; + FLEXRAN_CACHE = "/mnt/oai_agent_cache"; + FLEXRAN_AWAIT_RECONF = "no"; +}; + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c index 412cd3fbef..2fd84f563c 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c @@ -547,10 +547,10 @@ int rx_pdsch(PHY_VARS_UE *ue, pdsch_vars[eNB_id]->log2_maxh, measurements); // log2_maxh+I0_shift - if (symbol == 5) { - LOG_M("rxF_comp_d.m","rxF_c_d",&pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); - } - +// if (symbol == 5) { +// LOG_M("rxF_comp_d.m","rxF_c_d",&pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); +// } +// if ((rx_type==rx_IC_single_stream) && (eNB_id_in_connected_eNB)) { dlsch_channel_compensation(pdsch_vars[eNB_id_i]->rxdataF_ext, diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c index 2d308430a5..e351b69bb0 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c @@ -48,11 +48,11 @@ #include "pdcp.h" #include "assertions.h" -#if defined(ENABLE_ITTI) - #include "intertask_interface.h" -#endif - -#include "SIMULATION/TOOLS/sim.h" // for taus +//#if defined(ENABLE_ITTI) +//#include "intertask_interface.h" +//#endif +// +#include "SIMULATION/TOOLS/sim.h" // for taus #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 @@ -60,37 +60,38 @@ extern RAN_CONTEXT_t RC; - -int8_t get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id, uint8_t mbsfn_sync_area) { - // currently there is one-to-one mapping between sf allocation pattern and sync area - if (mbsfn_sync_area >= MAX_MBSFN_AREA) { - LOG_W(MAC, - "[eNB %d] CC_id %d MBSFN synchronization area %d out of range\n ", - module_idP, CC_id, mbsfn_sync_area); - return -1; - } else if (RC.mac[module_idP]-> - common_channels[CC_id].mbsfn_SubframeConfig[mbsfn_sync_area] - != NULL) { - return mbsfn_sync_area; - } else { - LOG_W(MAC, - "[eNB %d] CC_id %d MBSFN Subframe Config pattern %d not found \n ", - module_idP, CC_id, mbsfn_sync_area); - return -1; - } +int8_t +get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id, + uint8_t mbsfn_sync_area) +{ + // currently there is one-to-one mapping between sf allocation pattern and sync area + if (mbsfn_sync_area > MAX_MBSFN_AREA) { + LOG_W(MAC, + "[eNB %d] CC_id %d MBSFN synchronization area %d out of range\n ", + module_idP, CC_id, mbsfn_sync_area); + return -1; + } else if (RC.mac[module_idP]-> + common_channels[CC_id].mbsfn_SubframeConfig[mbsfn_sync_area] + != NULL) { + return mbsfn_sync_area; + } else { + LOG_W(MAC, + "[eNB %d] CC_id %d MBSFN Subframe Config pattern %d not found \n ", + module_idP, CC_id, mbsfn_sync_area); + return -1; + } } static uint32_t bytes_in_buffer=0; -static uint8_t msi_pmch_stop=0; +static uint32_t msi_pmch_stop=0; //static uint8_t msi_active=0; //static uint8_t msi_pmch_stop2=0; uint16_t mbms_rab_id = 2047; -static uint8_t msi_sfs=0; +static uint32_t msi_sfs=0; //MSI_ELEMENT * ptr =NULL; - int schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP, sub_frame_t subframeP) @@ -121,8 +122,9 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP, int mcch_mcs = -1; uint16_t TBS, j = -1, padding = 0, post_padding = 0; mac_rlc_status_resp_t rlc_status; + //mac_rlc_status_resp_t rlc_status2; int num_mtch; - int msi_length, i, k; + int msi_length=0, i, k; //uint8_t l =0; unsigned char sdu_lcids[11], num_sdus = 0, offset = 0; uint16_t sdu_lengths[11], sdu_length_total = 0; @@ -511,9 +513,11 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP, // 2nd: Create MSI, get MCCH from RRC and MTCHs from RLC // there is MSI (MCH Scheduling Info) + uint16_t msi_control_element[29], *msi_ptr; + char *buffer_pointer=NULL; if (msi_flag == 1) { // Create MSI here - uint16_t msi_control_element[29], *msi_ptr; + //uint16_t msi_control_element[29], *msi_ptr; msi_ptr = &msi_control_element[0]; //((MSI_ELEMENT *) msi_ptr)->lcid = MCCH_LCHANID; //MCCH @@ -543,9 +547,11 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP, msi_pmch_stop = msi_sfs-1; else msi_pmch_stop = msi_sfs; + + msi_pmch_stop = msi_sfs; - if( msi_pmch_stop > cc->pmch_Config[0]->sf_AllocEnd_r9) - LOG_W(MAC,"e-MBMS Buffer Overflow\n"); + //if( msi_pmch_stop > cc->pmch_Config[0]->sf_AllocEnd_r9) + //LOG_W(MAC,"e-MBMS Buffer Overflow\n"); if(msi_pmch_stop>=num_sf_alloc /*&& msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9*/) { ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0; // last subframeP of this mtch (only one mtch now) & stop_sf limited to 256 @@ -584,6 +590,8 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP, memcpy((char *) &mch_buffer[sdu_length_total], msi_control_element, msi_length); + buffer_pointer = (char *) &mch_buffer[sdu_length_total]; + sdu_lcids[num_sdus] = MCH_SCHDL_INFO; sdu_lengths[num_sdus] = msi_length; sdu_length_total += sdu_lengths[num_sdus]; @@ -594,12 +602,26 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP, } // there is MCCH if (mcch_flag == 1) { + + //LOG_E(MAC, + //"[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE COUNTING (mod %d)\n",module_idP, CC_id, frameP, subframeP,frameP%2==0); + if(1/*frameP%2==0*/){ LOG_D(MAC, "[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE (area %d, sfAlloc %d)\n", module_idP, CC_id, frameP, subframeP, i, j); - mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH, 0xFFFC, 1, &cc->MCCH_pdu.payload[0], + mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH, 0xFFFC, 1, &cc->MCCH_pdu.payload[0], i); // this is the mbsfn sync area index + } + else{ + LOG_E(MAC, + "[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE COUNTING (area %d, sfAlloc %d)\n", + module_idP, CC_id, frameP, subframeP, i, j); + +// +// mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH_COUNTING, 0xFFFC, 1, &cc->MCCH_pdu.payload[0], +// i); // this is the mbsfn sync area index + } mcch_sdu_length+=1; //RLC ? @@ -629,6 +651,15 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP, sdu_lcids[num_sdus] = MCCH_LCHANID; sdu_lengths[num_sdus] = mcch_sdu_length; + // LOG_W(MAC,"MCCH RLC %x:",(unsigned char)mch_buffer[sdu_length_total]); + // for (int kk = 7; kk >= 0; kk--) + // { + // printf("%d",(((unsigned char)mch_buffer[sdu_length_total]) >> kk) & 1 ? '1' : '0'); + // } + // printf("\n"); + //mch_buffer[sdu_length_total] = (unsigned char)0; + + if (sdu_lengths[num_sdus] > 128) { header_len_mcch = 3; } @@ -641,6 +672,7 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP, } } + TBS = get_TBS_DL(/*cc->pmch_Config[0]->dataMCS_r9*/cc->MCH_pdu.mcs, to_prb(cc->mib->message.dl_Bandwidth)); // do not let mcch and mtch multiplexing when relaying is active @@ -686,7 +718,7 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP, mbms_rab_id = cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9; rlc_status = - mac_rlc_status_ind(module_idP, 0, frameP, subframeP, + mac_rlc_status_ind(module_idP, 0/*0xfffd*/, frameP, subframeP, module_idP, ENB_FLAG_YES, MBMS_FLAG_YES, cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9, //MTCH, @@ -697,36 +729,77 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP, bytes_in_buffer = rlc_status.bytes_in_buffer; - msi_sfs = rlc_status.bytes_in_buffer/TBS+(rlc_status.bytes_in_buffer%TBS?1:0); + if( !(mcch_flag==1 || msi_flag==1) ) + msi_sfs = rlc_status.bytes_in_buffer/(TBS- header_len_mcch - header_len_msi -sdu_length_total - header_len_mtch)+(rlc_status.bytes_in_buffer%(TBS- header_len_mcch - header_len_msi -sdu_length_total - header_len_mtch)?1:0); + //uint16_t msi_control_element[29], *msi_ptr; + // + // + uint16_t TBS_MTCH = + get_TBS_DL(cc->pmch_Config[0]->dataMCS_r9, to_prb(cc->mib->message.dl_Bandwidth)); + if(msi_flag==1 && buffer_pointer!=NULL){ + msi_ptr = &msi_control_element[0]; + + //memcpy(buffer_pointer, + // msi_control_element, msi_length); + + // msi_pmch_stop = rlc_status.bytes_in_buffer/TBS+(rlc_status.bytes_in_buffer%TBS?1:0); + msi_pmch_stop = (rlc_status.bytes_in_buffer - header_len_mcch - header_len_msi -sdu_length_total - header_len_mtch)/(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)+((rlc_status.bytes_in_buffer-TBS-header_len_mcch - header_len_msi -sdu_length_total)%(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)?0:0); + + if( msi_pmch_stop > cc->pmch_Config[0]->sf_AllocEnd_r9) + LOG_E(MAC,"e-MBMS Buffer Overflow\n"); + if(msi_pmch_stop>=num_sf_alloc /*&& msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9*/) { + ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0; // last subframeP of this mtch (only one mtch now) & stop_sf limited to 256 + //((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = msi_pmch_stop; + ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = (msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[0]->sf_AllocEnd_r9); + msi_pmch_stop = (msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[0]->sf_AllocEnd_r9); + }else{ + ((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = 0x7; // last subframeP of this mtch (only one mtch now) + ((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = 0xFF; + msi_pmch_stop=0; + } + LOG_I(MAC,"frameP %d, subframeP %d rlc_status.bytes_in_buffer %d stop_sf_LSB %d\n",frameP,subframeP,rlc_status.bytes_in_buffer,((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB); + //LOG_W(MAC,"frameP %d, subframeP %d rlc_status.bytes_in_buffer %d stop_sf_LSB %d msi_calc:%d remainder %d\n",frameP,subframeP,rlc_status.bytes_in_buffer,((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB,rlc_status.bytes_in_buffer/(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)+((rlc_status.bytes_in_buffer-TBS-header_len_mcch - header_len_msi -sdu_length_total)%(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)?0:0),((rlc_status.bytes_in_buffer-TBS-header_len_mcch - header_len_msi -sdu_length_total)%(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)?0:0)); + + memcpy(buffer_pointer, + msi_control_element, msi_length); + + } LOG_D(MAC, - "e-MBMS log channel %u frameP %d, subframeP %d, rlc_status.bytes_in_buffer is %d TBS %d pmch_stop %d msi_sfs %d\n", - MTCH, frameP, subframeP, rlc_status.bytes_in_buffer,TBS,msi_pmch_stop,msi_sfs); + "e-MBMS log channel %u frameP %d, subframeP %d, rlc_status.bytes_in_buffer is %d TBS_MTCH %d pmch_stop %d msi_sfs %d\n", + MTCH, frameP, subframeP, rlc_status.bytes_in_buffer,TBS_MTCH,msi_pmch_stop,msi_sfs); - if (rlc_status.bytes_in_buffer > 0 || msi_pmch_stop > 0 /*msi_pmch_stop>=num_sf_alloc*/ ) { + if ((rlc_status.bytes_in_buffer > 0 && msi_pmch_stop > 0) && ((msi_flag!=1 || mcch_flag!=1)) /*|| (rlc_status.bytes_in_buffer > 0 && (msi_flag==1 || mcch_flag==1))*//*|| msi_sfs > cc->pmch_Config[0]->sf_AllocEnd_r9 */ /*msi_pmch_stop>=num_sf_alloc*/ ) { //if(rlc_status.bytes_in_buffer > 0){ - LOG_I(MAC, + LOG_D(MAC, "[eNB %d][MBMS USER-PLANE], CC_id %d, Frame %d, MTCH->MCH, Requesting %d bytes from RLC (header len mtch %d) rlc_status.bytes_in_buffer %d\n", module_idP, CC_id, frameP, TBS - header_len_mcch - header_len_msi - sdu_length_total - header_len_mtch, header_len_mtch, rlc_status.bytes_in_buffer); - sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES,cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9, 0, //not used + sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0/*0xfffd*/, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES,cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9, 0, //not used (char *) &mch_buffer[sdu_length_total] ,0, 0 ); + + // LOG_I(MAC,"RLC %x:",(unsigned char)mch_buffer[sdu_length_total]); + // for (int kk = 7; kk >= 0; kk--) + // { + // printf("%d",(((unsigned char)mch_buffer[sdu_length_total]) >> kk) & 1 ? '1' : '0'); + // } + // printf("\n"); //sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,frameP, MBMS_FLAG_NO, MTCH+(MAX_NUM_RB*(MAX_MOBILES_PER_ENB+1)), (char*)&mch_buffer[sdu_length_total]); - LOG_I(MAC, + LOG_D(MAC, "[eNB %d][MBMS USER-PLANE] CC_id %d Got %d bytes for MTCH %d msi_pmch_stop %d msi_sfs %d sdu_lengths[num_sdus] %d\n", module_idP, CC_id, sdu_lengths[num_sdus], MTCH,msi_pmch_stop,msi_sfs, sdu_lengths[num_sdus]); cc->mtch_active = 1; sdu_lcids[num_sdus] = cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9/*MTCH*/; sdu_length_total += sdu_lengths[num_sdus]; - if (msi_pmch_stop != 0) + if (msi_pmch_stop != 0 && msi_flag !=1) msi_pmch_stop--; @@ -833,14 +906,14 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP, } /* Tracing of PDU is done on UE side */ - if (opt_enabled == 1) { - trace_pdu(DIRECTION_DOWNLINK, (uint8_t *) cc->MCH_pdu.payload, TBS, module_idP, WS_M_RNTI , 0xffff, // M_RNTI = 6 in wirehsark + //if (opt_enabled == 1) { + trace_pdu(DIRECTION_DOWNLINK, (uint8_t *) cc->MCH_pdu.payload, TBS, module_idP, WS_M_RNTI , 0xfffd, // M_RNTI = 6 in wirehsark RC.mac[module_idP]->frame, RC.mac[module_idP]->subframe, 0, 0); LOG_D(OPT, "[eNB %d][MCH] CC_id %d Frame %d : MAC PDU with size %d\n", module_idP, CC_id, frameP, TBS); - } + //} eNB_MAC_INST *eNB = RC.mac[module_idP]; dl_req = &eNB->DL_req[CC_id].dl_config_request_body; @@ -1370,7 +1443,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, header_len_msi = 3; } - LOG_D(MAC, + LOG_W(MAC, "[eNB %d] CC_id %d Frame %d : MSI->MCH, length of MSI is %d bytes TBS %d, bytes in buffer %d stop_sf_LSB %d msi_sfs %d cc->pmch_Config[0]->sf_AllocEnd_r9 %ld\n", module_idP, CC_id, frameP, msi_length,TBS, bytes_in_buffer,msi_pmch_stop,msi_sfs,cc->pmch_Config[0]->sf_AllocEnd_r9); @@ -1485,7 +1558,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, mbms_rab_id = cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9; rlc_status = - mac_rlc_status_ind(module_idP, 0, frameP, subframeP, + mac_rlc_status_ind(module_idP, 0/*0xfffd*/, frameP, subframeP, module_idP, ENB_FLAG_YES, MBMS_FLAG_YES, cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9, //MTCH, @@ -1510,7 +1583,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, TBS - header_len_mcch - header_len_msi - sdu_length_total - header_len_mtch, header_len_mtch, rlc_status.bytes_in_buffer); - sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES,cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9, 0, //not used + sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0/*0xfffd*/, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_YES,cc->mbms_SessionList[0]->list.array[0]->logicalChannelIdentity_r9, 0, //not used (char *) &mch_buffer[sdu_length_total] ,0, @@ -1632,14 +1705,14 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, } /* Tracing of PDU is done on UE side */ - if (opt_enabled == 1) { + //if (opt_enabled == 1) { trace_pdu(DIRECTION_DOWNLINK, (uint8_t *) cc->MCH_pdu.payload, TBS, module_idP, WS_M_RNTI , 0xffff, // M_RNTI = 6 in wirehsark RC.mac[module_idP]->frame, RC.mac[module_idP]->subframe, 0, 0); LOG_D(OPT, "[eNB %d][MCH] CC_id %d Frame %d : MAC PDU with size %d\n", module_idP, CC_id, frameP, TBS); - } + //} /* for (j=0;jMCH_pdu.mcs=0; - //LOG_D(MAC," MCH_pdu.mcs is %d\n", RC.mac[module_idP]->MCH_pdu.mcs); - //#warning "MCH pdu should take the CC_id index" - return (&RC.mac[module_idP]->common_channels[CC_id].MCH_pdu); + sub_frame_t subframeP) +{ + // RC.mac[module_idP]->MCH_pdu.mcs=0; + //LOG_D(MAC," MCH_pdu.mcs is %d\n", RC.mac[module_idP]->MCH_pdu.mcs); +//#warning "MCH pdu should take the CC_id index" + return (&RC.mac[module_idP]->common_channels[CC_id].MCH_pdu); } diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index d4277917eb..1244125bb6 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -746,6 +746,9 @@ ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP, LOG_D(MAC, "[UE %d] parse_mch_header, found %d sdus\n", module_idP, num_sdu); + if(sdu[0]==0 && sdu[1]==0) + num_sdu=0; + for (i = 0; i < num_sdu; i++) { if (rx_lcids[i] == MCH_SCHDL_INFO) { if (rx_lengths[i] & 0x01) { From a21c1b1f73aa315452b4aee6f144cc6ca2946125 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 10 Oct 2019 16:30:45 +0200 Subject: [PATCH 03/32] Remove unused sleep function() --- openair2/ENB_APP/flexran_agent_timer.c | 12 ------------ openair2/ENB_APP/flexran_agent_timer.h | 3 --- 2 files changed, 15 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_timer.c b/openair2/ENB_APP/flexran_agent_timer.c index 143c2df889..621fe9f846 100644 --- a/openair2/ENB_APP/flexran_agent_timer.c +++ b/openair2/ENB_APP/flexran_agent_timer.c @@ -172,18 +172,6 @@ err_code_t flexran_agent_destroy_timers(void) { return 0; } -void flexran_agent_sleep_until(struct timespec *ts, int delay) { - ts->tv_nsec += delay; - - if(ts->tv_nsec >= 1000*1000*1000) { - ts->tv_nsec -= 1000*1000*1000; - ts->tv_sec++; - } - - clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, ts, NULL); -} - - err_code_t flexran_agent_stop_timer(long timer_id) { struct flexran_agent_timer_element_s *e=NULL; struct flexran_agent_timer_element_s search; diff --git a/openair2/ENB_APP/flexran_agent_timer.h b/openair2/ENB_APP/flexran_agent_timer.h index 06443c14d1..d72490f38f 100644 --- a/openair2/ENB_APP/flexran_agent_timer.h +++ b/openair2/ENB_APP/flexran_agent_timer.h @@ -125,8 +125,5 @@ Protocol__FlexranMessage * flexran_agent_process_timeout(long timer_id, void* ti /* Comparator function comparing two timers. Decides the ordering of the timers */ int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b); -/*Specify a delay in nanoseconds to timespec and sleep until then*/ -void flexran_agent_sleep_until(struct timespec *ts, int delay); - /* RB_PROTOTYPE is for .h files */ RB_PROTOTYPE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer); From 7415d08138a9e982faf0bf88291284026b4fe647 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 15 Oct 2019 10:05:57 +0200 Subject: [PATCH 04/32] FlexRAN: Simplify stats request handling * only set up timer for sending requests * simplify interface for timer setup * on timer expiry, do not pass through stats request function but directly send the reply * Remove whatever report structure and use stats request directly for inferring the data to send --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 47 +- .../CONTROL_MODULES/MAC/flexran_agent_mac.h | 8 +- .../MAC/flexran_agent_mac_internal.h | 6 - .../CONTROL_MODULES/PDCP/flexran_agent_pdcp.c | 28 +- .../CONTROL_MODULES/PDCP/flexran_agent_pdcp.h | 6 +- .../CONTROL_MODULES/RRC/flexran_agent_rrc.c | 39 +- .../CONTROL_MODULES/RRC/flexran_agent_rrc.h | 10 +- openair2/ENB_APP/flexran_agent.c | 2 - openair2/ENB_APP/flexran_agent_common.h | 10 +- openair2/ENB_APP/flexran_agent_defs.h | 34 -- openair2/ENB_APP/flexran_agent_handler.c | 478 +++++------------- openair2/ENB_APP/flexran_agent_timer.c | 46 +- openair2/ENB_APP/flexran_agent_timer.h | 18 +- 13 files changed, 221 insertions(+), 511 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 51ec781de3..d64c1d3ea7 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -63,9 +63,12 @@ pthread_mutex_t sc_update_mtx = PTHREAD_MUTEX_INITIALIZER; int flexran_agent_mac_stats_reply(mid_t mod_id, - const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, - Protocol__FlexCellStatsReport **cell_report) { + int n_ue, + uint32_t ue_flags, + Protocol__FlexCellStatsReport **cell_report, + int n_cc, + uint32_t cc_flags) { // Protocol__FlexHeader *header; @@ -75,18 +78,16 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, int enb_id = mod_id; /* Allocate memory for list of UE reports */ - if (report_config->nr_ue > 0) { + if (n_ue > 0) { - for (i = 0; i < report_config->nr_ue; i++) { + for (i = 0; i < n_ue; i++) { - UE_id = flexran_get_mac_ue_id(mod_id, i); - - ue_report[i]->rnti = report_config->ue_report_type[i].ue_rnti; - ue_report[i]->has_rnti = 1; + const rnti_t rnti = ue_report[i]->rnti; + UE_id = flexran_get_mac_ue_id_rnti(mod_id, rnti); /* Check flag for creation of buffer status report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR) { + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR) { //TODO should be automated ue_report[i]->n_bsr = 4; uint32_t *elem; @@ -103,7 +104,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, } /* Check flag for creation of PHR report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PHR) { + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PHR) { ue_report[i]->phr = flexran_get_ue_phr (enb_id, UE_id); // eNB_UE_list->UE_template[UE_PCCID(enb_id,UE_id)][UE_id].phr_info; ue_report[i]->has_phr = 1; ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PHR; @@ -111,7 +112,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, } /* Check flag for creation of RLC buffer status report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) { + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) { ue_report[i]->n_rlc_report = 3; // Set this to the number of LCs for this UE. This needs to be generalized for for LCs Protocol__FlexRlcBsr ** rlc_reports; rlc_reports = malloc(sizeof(Protocol__FlexRlcBsr *) * ue_report[i]->n_rlc_report); @@ -157,7 +158,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, } /* Check flag for creation of MAC CE buffer status report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS) { + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS) { // TODO: Fill in the actual MAC CE buffer status report ue_report[i]->pending_mac_ces = (flexran_get_MAC_CE_bitmap_TA(enb_id, UE_id, 0) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; // Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the @@ -169,7 +170,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, } /* Check flag for creation of DL CQI report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI) { + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI) { // TODO: Fill in the actual DL CQI report for the UE based on its configuration Protocol__FlexDlCqiReport * dl_report; dl_report = malloc(sizeof(Protocol__FlexDlCqiReport)); @@ -420,7 +421,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, } /* Check flag for creation of paging buffer status report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS) { + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS) { //TODO: Fill in the actual paging buffer status report. For this field to be valid, the RNTI //set in the report must be a P-RNTI Protocol__FlexPagingBufferReport *paging_report; @@ -474,7 +475,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, } /* Check flag for creation of UL CQI report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI) { + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI) { //Fill in the full UL CQI report of the UE Protocol__FlexUlCqiReport *full_ul_report; @@ -559,7 +560,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI; } - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_STATS) { + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_STATS) { Protocol__FlexMacStats *macstats; macstats = malloc(sizeof(Protocol__FlexMacStats)); @@ -668,15 +669,15 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, } /* Allocate memory for list of cell reports */ - if (report_config->nr_cc > 0) { + if (n_cc > 0) { // Fill in the Cell reports - for (i = 0; i < report_config->nr_cc; i++) { + for (i = 0; i < n_cc; i++) { /* Check flag for creation of noise and interference report */ - if(report_config->cc_report_type[i].cc_report_flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) { + if(cc_flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) { // TODO: Fill in the actual noise and interference report for this cell Protocol__FlexNoiseInterferenceReport *ni_report; ni_report = malloc(sizeof(Protocol__FlexNoiseInterferenceReport)); @@ -710,8 +711,8 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, error: if (cell_report != NULL) { - if (report_config->nr_cc > 0) { - for (i = 0; i < report_config->nr_cc; i++) { + if (n_cc > 0) { + for (i = 0; i < n_cc; i++) { if (cell_report[i]->noise_inter_report != NULL) { free(cell_report[i]->noise_inter_report); cell_report[i]->noise_inter_report = NULL; @@ -723,8 +724,8 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, } if (ue_report != NULL) { - if (report_config->nr_ue > 0) { - for (i = 0; i < report_config->nr_ue; i++) { + if (n_ue > 0) { + for (i = 0; i < n_ue; i++) { if (ue_report[i]->bsr != NULL) { free(ue_report[i]->bsr); ue_report[i]->bsr = NULL; diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h index 8ca855a6b3..68a572e2b2 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h @@ -52,7 +52,13 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle int flexran_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg); /* Statistics reply protocol message constructor and destructor */ -int flexran_agent_mac_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report); +int flexran_agent_mac_stats_reply(mid_t mod_id, + Protocol__FlexUeStatsReport **ue_report, + int n_ue, + uint32_t ue_flags, + Protocol__FlexCellStatsReport **cell_report, + int n_cc, + uint32_t cc_flags); int flexran_agent_mac_destroy_stats_reply(Protocol__FlexStatsReply *reply); /* DL MAC scheduling decision protocol message constructor (empty command) and destructor */ diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h index 01fc51f6a6..957fe6065e 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h @@ -61,12 +61,6 @@ err_code_t flexran_agent_init_cont_mac_stats_update(mid_t mod_id); err_code_t flexran_agent_destroy_cont_mac_stats_update(mid_t mod_id); -/*Enable/Disable the continuous stats update service for the MAC*/ -err_code_t flexran_agent_enable_cont_mac_stats_update(mid_t mod_id, xid_t xid, - stats_request_config_t *stats_req); - -err_code_t flexran_agent_disable_cont_mac_stats_update(mid_t mod_id); - Protocol__FlexranMessage * flexran_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_report, Protocol__FlexranMessage *old_report); diff --git a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c index 293ebab7a8..67da5fa452 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c +++ b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c @@ -65,25 +65,17 @@ void flexran_agent_pdcp_aggregate_stats(const mid_t mod_id, int flexran_agent_pdcp_stats_reply(mid_t mod_id, - const report_config_t *report_config, - Protocol__FlexUeStatsReport **ue_report, - Protocol__FlexCellStatsReport **cell_report) { - - - // Protocol__FlexHeader *header; - int i; - // int cc_id = 0; - - - /* Allocate memory for list of UE reports */ - if (report_config->nr_ue > 0) { + Protocol__FlexUeStatsReport **ue_report, + int n_ue, + uint32_t ue_flags) { + if (n_ue > 0) { - for (i = 0; i < report_config->nr_ue; i++) { - const rnti_t rnti = report_config->ue_report_type[i].ue_rnti; + for (int i = 0; i < n_ue; i++) { + const rnti_t rnti = ue_report[i]->rnti; const uint16_t uid = flexran_get_pdcp_uid_from_rnti(mod_id, rnti); /* Check flag for creation of buffer status report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PDCP_STATS) { + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PDCP_STATS) { Protocol__FlexPdcpStats *pdcp_aggr_stats; pdcp_aggr_stats = malloc(sizeof(Protocol__FlexPdcpStats)); @@ -129,12 +121,6 @@ int flexran_agent_pdcp_stats_reply(mid_t mod_id, error: LOG_W(FLEXRAN_AGENT, "Can't allocate PDCP stats\n"); - - /* if (cell_report != NULL) - free(cell_report); - if (ue_report != NULL) - free(ue_report); - */ return -1; } diff --git a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h index 246f9709b5..11decf0298 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h +++ b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h @@ -48,9 +48,9 @@ /* Send to the controller all the pdcp stat updates that occured during this subframe*/ int flexran_agent_pdcp_stats_reply(mid_t mod_id, - const report_config_t *report_config, - Protocol__FlexUeStatsReport **ue_report, - Protocol__FlexCellStatsReport **cell_report); + Protocol__FlexUeStatsReport **ue_report, + int n_ue, + uint32_t ue_flags); int flexran_agent_pdcp_destroy_stats_reply(Protocol__FlexStatsReply *reply); /* Get the stats from RAN API and aggregate them per USER*/ diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c index 6299e101a4..92c9917622 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c @@ -380,18 +380,15 @@ void flexran_trigger_rrc_measurements (mid_t mod_id, LTE_MeasResults_t* measRes int flexran_agent_rrc_stats_reply(mid_t mod_id, - const report_config_t *report_config, - Protocol__FlexUeStatsReport **ue_report, - Protocol__FlexCellStatsReport **cell_report) { - - if (report_config->nr_ue > 0) { - rnti_t rntis[report_config->nr_ue]; - flexran_get_rrc_rnti_list(mod_id, rntis, report_config->nr_ue); - for (int i = 0; i < report_config->nr_ue; i++) { - const rnti_t rnti = rntis[i]; + Protocol__FlexUeStatsReport **ue_report, + int n_ue, + uint32_t ue_flags) { + if (n_ue > 0) { + for (int i = 0; i < n_ue; i++) { + const rnti_t rnti = ue_report[i]->rnti; /* Check flag for creation of buffer status report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RRC_MEASUREMENTS) { + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RRC_MEASUREMENTS) { /*Source cell EUTRA Measurements*/ Protocol__FlexRrcMeasurements *rrc_measurements; @@ -531,7 +528,7 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, } return 0; error: - for (int i = 0; i < report_config->nr_ue; i++) { + for (int i = 0; i < n_ue; i++) { if (ue_report[i]->rrc_measurements && ue_report[i]->rrc_measurements->neigh_meas != NULL) { for (int j = 0; j < ue_report[i]->rrc_measurements->neigh_meas->n_eutra_meas; j++) { free(ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]); @@ -540,8 +537,6 @@ int flexran_agent_rrc_stats_reply(mid_t mod_id, } } - if (cell_report != NULL) - free(cell_report); if (ue_report != NULL) free(ue_report); return -1; @@ -575,20 +570,18 @@ int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexStatsReply *reply) } int flexran_agent_rrc_gtp_stats_reply(mid_t mod_id, - const report_config_t *report_config, - Protocol__FlexUeStatsReport **ue_report, - Protocol__FlexCellStatsReport **cell_report) { + Protocol__FlexUeStatsReport **ue_report, + int n_ue, + uint32_t ue_flags) { /* This function fills the GTP part of the statistics. The necessary * information is, for our purposes, completely maintained in the RRC layer. * It would be possible to add a GTP module that handles this, though. */ - if (report_config->nr_ue > 0) { - rnti_t rntis[report_config->nr_ue]; - flexran_get_rrc_rnti_list(mod_id, rntis, report_config->nr_ue); - for (int i = 0; i < report_config->nr_ue; i++) { - const rnti_t rnti = rntis[i]; + if (n_ue > 0) { + for (int i = 0; i < n_ue; i++) { + const rnti_t rnti = ue_report[i]->rnti; /* Check flag for creation of buffer status report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_GTP_STATS) { + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_GTP_STATS) { /* get number of rabs for this UE */ const int num_e_rab = flexran_agent_rrc_gtp_num_e_rab(mod_id, rnti); @@ -618,7 +611,7 @@ int flexran_agent_rrc_gtp_stats_reply(mid_t mod_id, } return 0; error: - for (int i = 0; i < report_config->nr_ue; i++) { + for (int i = 0; i < n_ue; i++) { if (!ue_report[i]->gtp_stats) continue; for (int r = 0; r < ue_report[i]->n_gtp_stats; ++r) { if (ue_report[i]->gtp_stats[r]) { diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h index fdf00ff841..1aa110a3e9 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h @@ -57,12 +57,18 @@ int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg); void flexran_trigger_rrc_measurements (mid_t mod_id, LTE_MeasResults_t *); /* Statistics reply protocol message constructor and destructor */ -int flexran_agent_rrc_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report); +int flexran_agent_rrc_stats_reply(mid_t mod_id, + Protocol__FlexUeStatsReport **ue_report, + int n_ue, + uint32_t ue_flags); int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexStatsReply *reply); /* Statistic reply for GTP statistics which OAI stores also in the RRC layer. * This might be moved to a separate GTP module in the future */ -int flexran_agent_rrc_gtp_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report); +int flexran_agent_rrc_gtp_stats_reply(mid_t mod_id, + Protocol__FlexUeStatsReport **ue_report, + int n_ue, + uint32_t ue_flags); int flexran_agent_rrc_gtp_destroy_stats_reply(Protocol__FlexStatsReply *reply); /* Fill the RRC part of a ue_config message */ diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index f73e808865..e6ecf4250d 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -202,8 +202,6 @@ int flexran_agent_start(mid_t mod_id) *flexran_agent_register_channel(mod_id, channel, FLEXRAN_AGENT_MAC); */ - /*Initialize the continuous stats update mechanism*/ - flexran_agent_init_cont_stats_update(mod_id); pthread_t t; threadCreate(&t, receive_thread, flexran, "flexran", -1, OAI_PRIORITY_RT); diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h index f116eb6591..4887842fa6 100644 --- a/openair2/ENB_APP/flexran_agent_common.h +++ b/openair2/ENB_APP/flexran_agent_common.h @@ -153,21 +153,17 @@ Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id, Protocol__FlexranMessage *flexran_agent_handle_timed_task(void *args); /*Top level Statistics hanlder*/ +Protocol__FlexranMessage *flexran_agent_send_stats_reply(void *args); int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); /* Function to be used to handle reply message . */ -int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg); +int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const Protocol__FlexStatsRequest *stats_req, Protocol__FlexranMessage **msg); int flexran_agent_destroy_stats_reply(Protocol__FlexranMessage *msg); /* Top level Statistics request protocol message constructor and destructor */ -int flexran_agent_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg); +//int flexran_agent_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg); int flexran_agent_destroy_stats_request(Protocol__FlexranMessage *msg); -err_code_t flexran_agent_init_cont_stats_update(mid_t mod_id); - -err_code_t flexran_agent_enable_cont_stats_update(mid_t mod_id, xid_t xid, stats_request_config_t *stats_req) ; -err_code_t flexran_agent_disable_cont_stats_update(mid_t mod_id); - /* Handle a received eNB config reply message as an "order" to reconfigure. It * does not come as a reconfiguration message as this is a "structured" * ProtoBuf message (as opposed to "unstructured" YAML). There is no destructor diff --git a/openair2/ENB_APP/flexran_agent_defs.h b/openair2/ENB_APP/flexran_agent_defs.h index 706688286d..1b6102590b 100644 --- a/openair2/ENB_APP/flexran_agent_defs.h +++ b/openair2/ENB_APP/flexran_agent_defs.h @@ -193,38 +193,4 @@ typedef struct { } agent_reconf_rrc; - -/* These structs will be used to give - instructions for the type of stats reports - we need to create */ - - -typedef struct { - uint16_t ue_rnti; - uint32_t ue_report_flags; /* Indicates the report elements - required for this UE id. See - FlexRAN specification 1.2.4.2 */ -} ue_report_type_t; - -typedef struct { - uint16_t cc_id; - uint32_t cc_report_flags; /* Indicates the report elements - required for this CC index. See - FlexRAN specification 1.2.4.3 */ -} cc_report_type_t; - -typedef struct { - int nr_ue; - ue_report_type_t *ue_report_type; - int nr_cc; - cc_report_type_t *cc_report_type; -} report_config_t; - -typedef struct stats_request_config_s{ - uint8_t report_type; - uint8_t report_frequency; - uint16_t period; /*In number of subframes*/ - report_config_t *config; -} stats_request_config_t; - #endif diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index e089675b62..e7ce0f317b 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -196,335 +196,186 @@ err_code_t flexran_agent_destroy_flexran_message(Protocol__FlexranMessage *msg) /* Top Level Statistics Report +*/ - */ - - - -int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg){ - - // TODO: Must deal with sanitization of input - // TODO: Must check if RNTIs and cell ids of the request actually exist - // TODO: Must resolve conflicts among stats requests - - int i; - err_code_t err_code = 0; - xid_t xid; - uint32_t usec_interval, sec_interval; - - //TODO: We do not deal with multiple CCs at the moment and eNB id is 0 - int enb_id = mod_id; - - //eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; - //UE_list_t *eNB_UE_list= &eNB->UE_list; - - report_config_t report_config; - - uint32_t ue_flags = 0; - uint32_t c_flags = 0; - +int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { + *msg = NULL; Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; - Protocol__FlexStatsRequest *stats_req = input->stats_request_msg; - xid = (stats_req->header)->xid; + const xid_t xid = stats_req->header->xid; - // Check the type of request that is made - switch(stats_req->body_case) { - case PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ; - Protocol__FlexCompleteStatsRequest *comp_req = stats_req->complete_stats_request; - if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_OFF) { - /*Disable both periodic and continuous updates*/ - // flexran_agent_disable_cont_stats_update(mod_id); - flexran_agent_destroy_timer_by_task_id(xid); - *msg = NULL; - return 0; - } else { //One-off, periodical or continuous reporting - //Set the proper flags - ue_flags = comp_req->ue_report_flags; - c_flags = comp_req->cell_report_flags; - //Create a list of all eNB RNTIs and cells + if (stats_req->body_case != PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST) { + LOG_E(FLEXRAN_AGENT, "only complete stats are supported at the moment\n"); + return -1; + } + Protocol__FlexCompleteStatsRequest *comp_req = stats_req->complete_stats_request; + flexran_agent_timer_args_t *timer_args = NULL; - //Set the number of UEs and create list with their RNTIs stats configs - report_config.nr_ue = 0; - if (flexran_agent_get_rrc_xface(mod_id)) - report_config.nr_ue = flexran_get_rrc_num_ues(mod_id); - else if (flexran_agent_get_mac_xface(mod_id)) - report_config.nr_ue = flexran_get_mac_num_ues(mod_id); - - if (flexran_agent_get_rrc_xface(mod_id) && flexran_agent_get_mac_xface(mod_id) - && flexran_get_rrc_num_ues(mod_id) != flexran_get_mac_num_ues(mod_id)) { - const int nrrc = flexran_get_rrc_num_ues(mod_id); - const int nmac = flexran_get_mac_num_ues(mod_id); - report_config.nr_ue = nrrc < nmac ? nrrc : nmac; - LOG_E(FLEXRAN_AGENT, "%s(): different numbers of UEs in RRC (%d) and MAC (%d), reporting for %d UEs\n", - __func__, nrrc, nmac, report_config.nr_ue); - } - report_config.ue_report_type = malloc(sizeof(ue_report_type_t) * report_config.nr_ue); - if (report_config.ue_report_type == NULL) { - // TODO: Add appropriate error code - err_code = -100; - goto error; - } - if (flexran_agent_get_rrc_xface(mod_id)) { - rnti_t rntis[report_config.nr_ue]; - flexran_get_rrc_rnti_list(mod_id, rntis, report_config.nr_ue); - for (i = 0; i < report_config.nr_ue; i++) { - report_config.ue_report_type[i].ue_rnti = rntis[i]; - report_config.ue_report_type[i].ue_report_flags = ue_flags; - } - } - if (flexran_agent_get_mac_xface(mod_id) && !flexran_agent_get_rrc_xface(mod_id)) { - for (i = 0; i < report_config.nr_ue; i++) { - const int UE_id = flexran_get_mac_ue_id(mod_id, i); - report_config.ue_report_type[i].ue_rnti = flexran_get_mac_ue_crnti(enb_id, UE_id); - report_config.ue_report_type[i].ue_report_flags = ue_flags; - } - } - //Set the number of CCs and create a list with the cell stats configs - report_config.nr_cc = MAX_NUM_CCs; - report_config.cc_report_type = malloc(sizeof(cc_report_type_t) * report_config.nr_cc); - if (report_config.cc_report_type == NULL) { - // TODO: Add appropriate error code - err_code = -100; - goto error; - } - for (i = 0; i < report_config.nr_cc; i++) { - //TODO: Must fill in the proper cell ids - report_config.cc_report_type[i].cc_id = i; - report_config.cc_report_type[i].cc_report_flags = c_flags; - } - /* Check if request was periodical */ - if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_PERIODICAL) { - /* Create a one off flexran message as an argument for the periodical task */ - Protocol__FlexranMessage *timer_msg = NULL; - stats_request_config_t request_config; - request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS; - request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE; - request_config.period = 0; - /* Need to make sure that the ue flags are saved (Bug) */ - if (report_config.nr_ue == 0) { - report_config.nr_ue = 1; - report_config.ue_report_type = malloc(sizeof(ue_report_type_t)); - if (report_config.ue_report_type == NULL) { - // TODO: Add appropriate error code - err_code = -100; - goto error; - } - report_config.ue_report_type[0].ue_rnti = 0; // Dummy value - report_config.ue_report_type[0].ue_report_flags = ue_flags; - } - request_config.config = &report_config; - if (flexran_agent_stats_request(enb_id, xid, &request_config, &timer_msg) == -1) { - err_code = -100; - goto error; - } - /* Create a timer */ - long timer_id = 0; - flexran_agent_timer_args_t *timer_args = malloc(sizeof(flexran_agent_timer_args_t)); - memset (timer_args, 0, sizeof(flexran_agent_timer_args_t)); - timer_args->mod_id = enb_id; - timer_args->msg = timer_msg; - /*Convert subframes to usec time*/ - usec_interval = 1000*comp_req->sf; - sec_interval = 0; - /*add seconds if required*/ - if (usec_interval >= 1000*1000) { - sec_interval = usec_interval/(1000*1000); - usec_interval = usec_interval%(1000*1000); - } - flexran_agent_create_timer(sec_interval, usec_interval, FLEXRAN_AGENT_DEFAULT, - enb_id, FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, xid, - flexran_agent_handle_timed_task,(void*) timer_args, &timer_id); - } else if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_CONTINUOUS) { - /*If request was for continuous updates, disable the previous configuration and - set up a new one*/ - flexran_agent_disable_cont_stats_update(mod_id); - stats_request_config_t request_config; - request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS; - request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE; - request_config.period = 0; - /* Need to make sure that the ue flags are saved (Bug) */ - if (report_config.nr_ue == 0) { - report_config.nr_ue = 1; - report_config.ue_report_type = malloc(sizeof(ue_report_type_t)); - if (report_config.ue_report_type == NULL) { - // TODO: Add appropriate error code - err_code = -100; - goto error; - } - report_config.ue_report_type[0].ue_rnti = 0; // Dummy value - report_config.ue_report_type[0].ue_report_flags = ue_flags; - } - request_config.config = &report_config; - flexran_agent_enable_cont_stats_update(enb_id, xid, &request_config); - } - } - break; - case PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST:; - Protocol__FlexCellStatsRequest *cell_req = stats_req->cell_stats_request; - // UE report config will be blank - report_config.nr_ue = 0; - report_config.ue_report_type = NULL; - report_config.nr_cc = cell_req->n_cell; - report_config.cc_report_type = malloc(sizeof(cc_report_type_t) * report_config.nr_cc); - if (report_config.cc_report_type == NULL) { - // TODO: Add appropriate error code - err_code = -100; - goto error; - } - for (i = 0; i < report_config.nr_cc; i++) { - //TODO: Must fill in the proper cell ids - report_config.cc_report_type[i].cc_id = cell_req->cell[i]; - report_config.cc_report_type[i].cc_report_flags = cell_req->flags; - } - break; - case PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST:; - Protocol__FlexUeStatsRequest *ue_req = stats_req->ue_stats_request; - // Cell report config will be blank - report_config.nr_cc = 0; - report_config.cc_report_type = NULL; - report_config.nr_ue = ue_req->n_rnti; - report_config.ue_report_type = malloc(sizeof(ue_report_type_t) * report_config.nr_ue); - if (report_config.ue_report_type == NULL) { - // TODO: Add appropriate error code - err_code = -100; - goto error; - } - for (i = 0; i < report_config.nr_ue; i++) { - const int UE_id = flexran_get_mac_ue_id(mod_id, i); - report_config.ue_report_type[i].ue_rnti = ue_req->rnti[UE_id]; - report_config.ue_report_type[i].ue_report_flags = ue_req->flags; - } - break; + switch (comp_req->report_frequency) { + case PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_OFF: + flexran_agent_destroy_timer_by_task_id(xid); + return 0; + case PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE: + LOG_E(FLEXRAN_AGENT, "one-shot timer not implemented yet\n"); + return -1; + case PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_PERIODICAL: + /* Create a one off flexran message as an argument for the periodical task */ + timer_args = calloc(1, sizeof(flexran_agent_timer_args_t)); + AssertFatal(timer_args, "cannot allocate memory for timer\n"); + timer_args->mod_id = mod_id; + timer_args->msg = input; + flexran_agent_create_timer(mod_id, comp_req->sf, + FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, xid, + flexran_agent_send_stats_reply, timer_args); + /* return 1: do not dispose comp_req message we received, we still need it */ + return 1; + case PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_CONTINUOUS: + LOG_E(FLEXRAN_AGENT, "unsupported report frequency continuous\n"); + return -1; default: - //TODO: Add appropriate error code - err_code = -100; - goto error; + LOG_E(FLEXRAN_AGENT, "unknown report frequency\n"); + return -1; } - - if (flexran_agent_stats_reply(enb_id, xid, &report_config, msg )) { - err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; - goto error; - } - - if (report_config.ue_report_type) - free(report_config.ue_report_type); - if (report_config.cc_report_type) - free(report_config.cc_report_type); - - return 0; - - error : - LOG_E(FLEXRAN_AGENT, "%s(): errno %d occured\n", __func__, err_code); - return err_code; } /* Top level reply */ +Protocol__FlexranMessage *flexran_agent_send_stats_reply(void *args) { + const flexran_agent_timer_args_t *timer_args = args; + const mid_t enb_id = timer_args->mod_id; + const Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)timer_args->msg; + const Protocol__FlexStatsRequest *stats_req = input->stats_request_msg; + const xid_t xid = stats_req->header->xid; -int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg){ + Protocol__FlexranMessage *reply = NULL; + err_code_t rc = flexran_agent_stats_reply(enb_id, xid, stats_req, &reply); + if (rc < 0) { + LOG_E(FLEXRAN_AGENT, "%s(): errno %d occured, cannot send stats_reply\n", + __func__, rc); + return NULL; + } + return reply; +} + +int flexran_agent_stats_reply(mid_t enb_id, + xid_t xid, + const Protocol__FlexStatsRequest *stats_req, + Protocol__FlexranMessage **msg) { Protocol__FlexHeader *header = NULL; Protocol__FlexUeStatsReport **ue_report = NULL; Protocol__FlexCellStatsReport **cell_report = NULL; Protocol__FlexStatsReply *stats_reply_msg = NULL; err_code_t err_code = PROTOCOL__FLEXRAN_ERR__UNEXPECTED; - int i,j; + AssertFatal(stats_req->body_case == PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST, + "%s() handles only complete stats requests\n", + __func__); + const uint32_t cell_flags = stats_req->complete_stats_request->cell_report_flags; + const uint32_t ue_flags = stats_req->complete_stats_request->ue_report_flags; - if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) { - goto error; + /* TODO: get_number in own function */ + int n_ue = 0; + if (flexran_agent_get_rrc_xface(enb_id)) + n_ue = flexran_get_rrc_num_ues(enb_id); + else if (flexran_agent_get_mac_xface(enb_id)) + n_ue = flexran_get_mac_num_ues(enb_id); + + if (flexran_agent_get_rrc_xface(enb_id) && flexran_agent_get_mac_xface(enb_id) + && flexran_get_rrc_num_ues(enb_id) != flexran_get_mac_num_ues(enb_id)) { + const int nrrc = flexran_get_rrc_num_ues(enb_id); + const int nmac = flexran_get_mac_num_ues(enb_id); + n_ue = nrrc < nmac ? nrrc : nmac; + LOG_E(FLEXRAN_AGENT, "%s(): different numbers of UEs in RRC (%d) and MAC (%d), reporting for %d UEs\n", + __func__, nrrc, nmac, n_ue); } - stats_reply_msg = malloc(sizeof(Protocol__FlexStatsReply)); - - if (stats_reply_msg == NULL) { - goto error; + rnti_t rntis[n_ue]; + if (flexran_agent_get_rrc_xface(enb_id)) + flexran_get_rrc_rnti_list(enb_id, rntis, n_ue); + if (flexran_agent_get_mac_xface(enb_id) && !flexran_agent_get_rrc_xface(enb_id)) { + for (int i = 0; i < n_ue; i++) { + const int UE_id = flexran_get_mac_ue_id(enb_id, i); + rntis[i] = flexran_get_mac_ue_crnti(enb_id, UE_id); + } } - protocol__flex_stats_reply__init(stats_reply_msg); - stats_reply_msg->header = header; - - stats_reply_msg->n_ue_report = report_config->nr_ue; - stats_reply_msg->n_cell_report = report_config->nr_cc; - - // UE report - - ue_report = malloc(sizeof(Protocol__FlexUeStatsReport *) * report_config->nr_ue); + int n_cc = MAX_NUM_CCs; + ue_report = calloc(n_ue, sizeof(Protocol__FlexUeStatsReport *)); if (ue_report == NULL) { goto error; } - - for (i = 0; i < report_config->nr_ue; i++) { - - ue_report[i] = malloc(sizeof(Protocol__FlexUeStatsReport)); - if (ue_report[i] == NULL) { - goto error; - } - protocol__flex_ue_stats_report__init(ue_report[i]); - ue_report[i]->rnti = report_config->ue_report_type[i].ue_rnti; - ue_report[i]->has_rnti = 1; - ue_report[i]->has_flags = 1; /* actual flags are filled in the CMs below */ - + for (int i = 0; i < n_ue; i++) { + ue_report[i] = malloc(sizeof(Protocol__FlexUeStatsReport)); + if (ue_report[i] == NULL) { + goto error; + } + protocol__flex_ue_stats_report__init(ue_report[i]); + ue_report[i]->rnti = rntis[i]; + ue_report[i]->has_rnti = 1; + ue_report[i]->has_flags = 1; /* actual flags are filled in the CMs below */ } - // cell rpoert - - cell_report = malloc(sizeof(Protocol__FlexCellStatsReport *) * report_config->nr_cc); + cell_report = calloc(n_cc, sizeof(Protocol__FlexCellStatsReport *)); if (cell_report == NULL) { goto error; } - - for (i = 0; i < report_config->nr_cc; i++) { - - cell_report[i] = malloc(sizeof(Protocol__FlexCellStatsReport)); - if(cell_report[i] == NULL) { - goto error; - } - - protocol__flex_cell_stats_report__init(cell_report[i]); - cell_report[i]->carrier_index = report_config->cc_report_type[i].cc_id; - cell_report[i]->has_carrier_index = 1; - cell_report[i]->has_flags = 1; /* actual flags are filled in the CMs below */ - + for (int i = 0; i < n_cc; i++) { + cell_report[i] = malloc(sizeof(Protocol__FlexCellStatsReport)); + if(cell_report[i] == NULL) { + goto error; + } + protocol__flex_cell_stats_report__init(cell_report[i]); + cell_report[i]->carrier_index = i; + cell_report[i]->has_carrier_index = 1; + cell_report[i]->has_flags = 1; /* actual flags are filled in the CMs below */ } /* MAC reply split */ if (flexran_agent_get_mac_xface(enb_id) - && flexran_agent_mac_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { + && flexran_agent_mac_stats_reply(enb_id, + ue_report, n_ue, ue_flags, + cell_report, n_cc, cell_flags) < 0) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; goto error; } /* RRC reply split */ if (flexran_agent_get_rrc_xface(enb_id) - && flexran_agent_rrc_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { + && flexran_agent_rrc_stats_reply(enb_id, ue_report, n_ue, ue_flags) < 0) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; goto error; } /* PDCP reply split */ if (flexran_agent_get_pdcp_xface(enb_id) - && flexran_agent_pdcp_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { + && flexran_agent_pdcp_stats_reply(enb_id, ue_report, n_ue, ue_flags) < 0) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; goto error; } /* GTP reply split, currently performed through RRC module */ if (flexran_agent_get_rrc_xface(enb_id) - && flexran_agent_rrc_gtp_stats_reply(enb_id, report_config, ue_report, cell_report) < 0) { + && flexran_agent_rrc_gtp_stats_reply(enb_id, ue_report, n_ue, ue_flags) < 0) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; goto error; } - stats_reply_msg->cell_report = cell_report; - stats_reply_msg->ue_report = ue_report; - - *msg = malloc(sizeof(Protocol__FlexranMessage)); - if(*msg == NULL) { + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) { goto error; } + stats_reply_msg = malloc(sizeof(Protocol__FlexStatsReply)); + AssertFatal(stats_reply_msg, "no memory for stats_reply_msg\n"); + protocol__flex_stats_reply__init(stats_reply_msg); + stats_reply_msg->header = header; + stats_reply_msg->n_ue_report = n_ue; + stats_reply_msg->ue_report = ue_report; + stats_reply_msg->n_cell_report = n_cc; + stats_reply_msg->cell_report = cell_report; + + *msg = malloc(sizeof(Protocol__FlexranMessage)); + AssertFatal(*msg, "no memory for stats_reply container msg\n"); protocol__flexran_message__init(*msg); (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG; (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; @@ -546,7 +397,7 @@ error : } if (ue_report != NULL) { - for (j = 0; j < report_config->nr_ue; j++) { + for (int j = 0; j < n_ue; j++) { if (ue_report[j] != NULL) { free(ue_report[j]); } @@ -556,7 +407,7 @@ error : } if (cell_report != NULL) { - for (j = 0; j < report_config->nr_cc; j++) { + for (int j = 0; j < n_cc; j++) { if (cell_report[j] != NULL) { free(cell_report[j]); } @@ -572,6 +423,7 @@ error : Top Level Request */ +/* int flexran_agent_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, @@ -678,6 +530,7 @@ int flexran_agent_stats_request(mid_t mod_id, //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } +*/ int flexran_agent_destroy_stats_request(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG) @@ -719,88 +572,3 @@ int flexran_agent_destroy_stats_reply(Protocol__FlexranMessage *msg) free(msg); return 0; } - -err_code_t flexran_agent_disable_cont_stats_update(mid_t mod_id) { - /*Disable the continuous updates for the MAC*/ - if (pthread_mutex_lock(stats_context[mod_id].mutex)) { - goto error; - } - stats_context[mod_id].cont_update = 0; - stats_context[mod_id].xid = 0; - if (stats_context[mod_id].stats_req != NULL) { - flexran_agent_destroy_flexran_message(stats_context[mod_id].stats_req); - } - if (stats_context[mod_id].prev_stats_reply != NULL) { - flexran_agent_destroy_flexran_message(stats_context[mod_id].prev_stats_reply); - } - if (pthread_mutex_unlock(stats_context[mod_id].mutex)) { - goto error; - } - return 0; - - error: - LOG_E(FLEXRAN_AGENT, "stats_context for eNB %d is not initialized\n", mod_id); - return -1; - -} - -err_code_t flexran_agent_enable_cont_stats_update(mid_t mod_id, - xid_t xid, stats_request_config_t *stats_req) { - - if (pthread_mutex_lock(stats_context[mod_id].mutex)) { - goto error; - } - - Protocol__FlexranMessage *req_msg = NULL; - - flexran_agent_stats_request(mod_id, xid, stats_req, &req_msg); - - if (req_msg != NULL) { - stats_context[mod_id].stats_req = req_msg; - stats_context[mod_id].prev_stats_reply = NULL; - - stats_context[mod_id].cont_update = 1; - stats_context[mod_id].xid = xid; - } - - if (pthread_mutex_unlock(stats_context[mod_id].mutex)) { - goto error; - } - return 0; - - error: - LOG_E(FLEXRAN_AGENT, "stats_context for eNB %d is not initialized\n", mod_id); - return -1; -} - - -err_code_t flexran_agent_init_cont_stats_update(mid_t mod_id) { - - - /*Initially the continuous update is set to false*/ - stats_context[mod_id].cont_update = 0; - stats_context[mod_id].is_initialized = 1; - stats_context[mod_id].stats_req = NULL; - stats_context[mod_id].prev_stats_reply = NULL; - stats_context[mod_id].mutex = calloc(1, sizeof(pthread_mutex_t)); - if (stats_context[mod_id].mutex == NULL) - goto error; - if (pthread_mutex_init(stats_context[mod_id].mutex, NULL) != 0) - goto error; - - return 0; - - error: - return -1; -} - -err_code_t flexran_agent_destroy_cont_stats_update(mid_t mod_id) { - - stats_context[mod_id].cont_update = 0; - stats_context[mod_id].is_initialized = 0; - flexran_agent_destroy_flexran_message(stats_context[mod_id].stats_req); - flexran_agent_destroy_flexran_message(stats_context[mod_id].prev_stats_reply); - free(stats_context[mod_id].mutex); - - return 1; -} diff --git a/openair2/ENB_APP/flexran_agent_timer.c b/openair2/ENB_APP/flexran_agent_timer.c index 621fe9f846..e4ce1b82d4 100644 --- a/openair2/ENB_APP/flexran_agent_timer.c +++ b/openair2/ENB_APP/flexran_agent_timer.c @@ -58,48 +58,48 @@ int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct return 0; } -err_code_t flexran_agent_create_timer(uint32_t interval_sec, - uint32_t interval_usec, - agent_id_t agent_id, - instance_t instance, +err_code_t flexran_agent_create_timer(mid_t mod_id, + uint32_t sf, uint32_t timer_type, - xid_t xid, + xid_t xid, flexran_agent_timer_callback_t cb, - void *timer_args, - long *timer_id) { - struct flexran_agent_timer_element_s *e = calloc(1, sizeof(*e)); - DevAssert(e != NULL); - //uint32_t timer_id; + void *timer_args) { int ret=-1; - if ((interval_sec == 0) && (interval_usec == 0 )) { - free(e); + if (sf <= 0) return TIMER_NULL; - } - if (timer_type >= FLEXRAN_AGENT_TIMER_TYPE_MAX) { - free(e); + if (timer_type >= FLEXRAN_AGENT_TIMER_TYPE_MAX) return TIMER_TYPE_INVALIDE; - } + uint32_t interval_usec = sf * 1000; + uint32_t interval_sec = 0; + if (interval_usec >= 1000 * 1000) { + interval_sec = interval_usec / (1000 * 1000); + interval_usec = interval_usec % (1000 * 1000); + } + struct flexran_agent_timer_element_s *e = calloc(1, sizeof(*e)); + DevAssert(e != NULL); + long timer_id = 0; + AssertFatal(e, "cannot allocate memory for FlexRAN timer!\n"); if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_ONESHOT) { ret = timer_setup(interval_sec, interval_usec, TASK_FLEXRAN_AGENT, - instance, + mod_id, TIMER_ONE_SHOT, timer_args, - timer_id); + &timer_id); e->type = TIMER_ONE_SHOT; } else if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_PERIODIC ) { ret = timer_setup(interval_sec, interval_usec, TASK_FLEXRAN_AGENT, - instance, + mod_id, TIMER_PERIODIC, timer_args, - timer_id); + &timer_id); e->type = TIMER_PERIODIC; } @@ -108,10 +108,10 @@ err_code_t flexran_agent_create_timer(uint32_t interval_sec, return TIMER_SETUP_FAILED; } - e->agent_id = agent_id; - e->instance = instance; + e->agent_id = mod_id; + e->instance = mod_id; e->state = FLEXRAN_AGENT_TIMER_STATE_ACTIVE; - e->timer_id = *timer_id; + e->timer_id = timer_id; e->xid = xid; e->timer_args = timer_args; e->cb = cb; diff --git a/openair2/ENB_APP/flexran_agent_timer.h b/openair2/ENB_APP/flexran_agent_timer.h index d72490f38f..4fbf44a7e2 100644 --- a/openair2/ENB_APP/flexran_agent_timer.h +++ b/openair2/ENB_APP/flexran_agent_timer.h @@ -89,17 +89,13 @@ typedef struct flexran_agent_timer_instance_s{ err_code_t flexran_agent_init_timer(void); -/* Create a timer for some agent related event with id xid. Will store the id - of the generated timer in timer_id */ -err_code_t flexran_agent_create_timer(uint32_t interval_sec, - uint32_t interval_usec, - agent_id_t agent_id, - instance_t instance, - uint32_t timer_type, - xid_t xid, - flexran_agent_timer_callback_t cb, - void* timer_args, - long *timer_id); +/* Create a timer for some agent related event with id xid. */ +err_code_t flexran_agent_create_timer(mid_t mod_id, + uint32_t sf, + uint32_t timer_type, + xid_t xid, + flexran_agent_timer_callback_t cb, + void *timer_args); /* Destroy all existing timers */ err_code_t flexran_agent_destroy_timers(void); From 5c4aa309ebe2c75c02209d3caa499eeadba43c89 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 17 Oct 2019 17:30:23 +0200 Subject: [PATCH 05/32] FlexRAN: helper function to get No. UEs --- openair2/ENB_APP/flexran_agent_common.c | 37 ++++++++++++++---------- openair2/ENB_APP/flexran_agent_common.h | 4 +++ openair2/ENB_APP/flexran_agent_handler.c | 16 +--------- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index ac18f16069..552c58555b 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -598,21 +598,7 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl goto error; ue_config_reply_msg->header = header; - ue_config_reply_msg->n_ue_config = 0; - - if (flexran_agent_get_rrc_xface(mod_id)) - ue_config_reply_msg->n_ue_config = flexran_get_rrc_num_ues(mod_id); - else if (flexran_agent_get_mac_xface(mod_id)) - ue_config_reply_msg->n_ue_config = flexran_get_mac_num_ues(mod_id); - - if (flexran_agent_get_rrc_xface(mod_id) && flexran_agent_get_mac_xface(mod_id) - && flexran_get_rrc_num_ues(mod_id) != flexran_get_mac_num_ues(mod_id)) { - const int nrrc = flexran_get_rrc_num_ues(mod_id); - const int nmac = flexran_get_mac_num_ues(mod_id); - ue_config_reply_msg->n_ue_config = nrrc < nmac ? nrrc : nmac; - LOG_E(FLEXRAN_AGENT, "%s(): different numbers of UEs in RRC (%d) and MAC (%d), reporting for %lu UEs\n", - __func__, nrrc, nmac, ue_config_reply_msg->n_ue_config); - } + ue_config_reply_msg->n_ue_config = flexran_agent_get_num_ues(mod_id); Protocol__FlexUeConfig **ue_config; @@ -935,3 +921,24 @@ int flexran_agent_handle_ue_config_reply(mid_t mod_id, const void *params, Proto *msg = NULL; return 0; } + +int flexran_agent_get_num_ues(mid_t mod_id) { + const int has_rrc = flexran_agent_get_rrc_xface(mod_id) != NULL; + const int has_mac = flexran_agent_get_mac_xface(mod_id) != NULL; + DevAssert(has_rrc || has_mac); + if (has_rrc && !has_mac) + return flexran_get_rrc_num_ues(mod_id); + if (!has_rrc && has_mac) + return flexran_get_mac_num_ues(mod_id); + + /* has both */ + const int nrrc = flexran_get_rrc_num_ues(mod_id); + const int nmac = flexran_get_mac_num_ues(mod_id); + if (nrrc != nmac) { + const int n_ue = nrrc < nmac ? nrrc : nmac; + LOG_E(FLEXRAN_AGENT, "%s(): different numbers of UEs in RRC (%d) and MAC (%d), reporting for %d UEs\n", + __func__, nrrc, nmac, n_ue); + return n_ue; + } + return nrrc; +} diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h index 4887842fa6..fcca7d4212 100644 --- a/openair2/ENB_APP/flexran_agent_common.h +++ b/openair2/ENB_APP/flexran_agent_common.h @@ -179,4 +179,8 @@ int flexran_agent_handle_enb_config_reply(mid_t mod_id, const void* params, Prot * request message. */ int flexran_agent_handle_ue_config_reply(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg); +/* Return the number of UEs in the BS of this agent across RRC/MAC. If they + * disagree, prints an error and returns the minimum of both. */ +int flexran_agent_get_num_ues(mid_t mod_id); + #endif diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index e7ce0f317b..c3e9286441 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -274,21 +274,7 @@ int flexran_agent_stats_reply(mid_t enb_id, const uint32_t cell_flags = stats_req->complete_stats_request->cell_report_flags; const uint32_t ue_flags = stats_req->complete_stats_request->ue_report_flags; - /* TODO: get_number in own function */ - int n_ue = 0; - if (flexran_agent_get_rrc_xface(enb_id)) - n_ue = flexran_get_rrc_num_ues(enb_id); - else if (flexran_agent_get_mac_xface(enb_id)) - n_ue = flexran_get_mac_num_ues(enb_id); - - if (flexran_agent_get_rrc_xface(enb_id) && flexran_agent_get_mac_xface(enb_id) - && flexran_get_rrc_num_ues(enb_id) != flexran_get_mac_num_ues(enb_id)) { - const int nrrc = flexran_get_rrc_num_ues(enb_id); - const int nmac = flexran_get_mac_num_ues(enb_id); - n_ue = nrrc < nmac ? nrrc : nmac; - LOG_E(FLEXRAN_AGENT, "%s(): different numbers of UEs in RRC (%d) and MAC (%d), reporting for %d UEs\n", - __func__, nrrc, nmac, n_ue); - } + int n_ue = flexran_agent_get_num_ues(enb_id); rnti_t rntis[n_ue]; if (flexran_agent_get_rrc_xface(enb_id)) From 233affc9dd32d43f437d770b65a3b264bcaba652 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 17 Oct 2019 17:30:52 +0200 Subject: [PATCH 06/32] FlexRAN: include header, not C file --- openair2/ENB_APP/flexran_agent_task_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/flexran_agent_task_manager.c b/openair2/ENB_APP/flexran_agent_task_manager.c index 4a0fee1f5b..f20e6c8969 100644 --- a/openair2/ENB_APP/flexran_agent_task_manager.c +++ b/openair2/ENB_APP/flexran_agent_task_manager.c @@ -33,7 +33,7 @@ #include #include "flexran_agent_task_manager.h" -#include "flexran_agent_common.c" +#include "flexran_agent_common.h" /* Util macros */ From b6d466d772d21eb87472b2ea99741a5e48471eb4 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 21 Oct 2019 11:57:33 +0200 Subject: [PATCH 07/32] FlexRAN: reimplement timers without ITTI The timer code used to trigger periodic statistics message sending used ITTI. Together with a high frequency reporting (e.g. 1ms), this resulted in high CPU usage. This commit reimplements this: * using a thread that is synchronized to the RU (if there is no MAC, we assume there is no RU generating a tick so we create the tick source ourselves) * no RB trees but plain arrays * smaller interface for users * slight user interface changes * remove stopped timer state: such timer might be simply removed * remove one-shot timers --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 6 +- .../MAC/flexran_agent_mac_defs.h | 7 +- openair2/ENB_APP/flexran_agent.c | 50 +-- openair2/ENB_APP/flexran_agent_common.h | 9 +- openair2/ENB_APP/flexran_agent_defs.h | 30 -- openair2/ENB_APP/flexran_agent_handler.c | 59 +-- openair2/ENB_APP/flexran_agent_timer.c | 367 +++++++++++------- openair2/ENB_APP/flexran_agent_timer.h | 89 +---- openair2/LAYER2/MAC/eNB_scheduler.c | 2 + 9 files changed, 281 insertions(+), 338 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index d64c1d3ea7..04563b960e 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1562,11 +1562,10 @@ int flexran_agent_register_mac_xface(mid_t mod_id) return -1; } - //xface->agent_ctxt = &shared_ctxt[mod_id]; xface->flexran_agent_send_sr_info = flexran_agent_send_sr_info; xface->flexran_agent_send_sf_trigger = flexran_agent_send_sf_trigger; - //xface->flexran_agent_send_update_mac_stats = flexran_agent_send_update_mac_stats; xface->flexran_agent_get_pending_dl_mac_config = flexran_agent_get_pending_dl_mac_config; + xface->flexran_agent_notify_tick = flexran_agent_timer_signal; xface->dl_scheduler_loaded_lib = NULL; xface->ul_scheduler_loaded_lib = NULL; @@ -1689,11 +1688,10 @@ int flexran_agent_unregister_mac_xface(mid_t mod_id) return -1; } AGENT_MAC_xface *xface = agent_mac_xface[mod_id]; - //xface->agent_ctxt = NULL; xface->flexran_agent_send_sr_info = NULL; xface->flexran_agent_send_sf_trigger = NULL; - //xface->flexran_agent_send_update_mac_stats = NULL; xface->flexran_agent_get_pending_dl_mac_config = NULL; + xface->flexran_agent_notify_tick = NULL; xface->dl_scheduler_loaded_lib = NULL; xface->ul_scheduler_loaded_lib = NULL; diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h index 5c1fc1379c..dfde583387 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h @@ -54,10 +54,9 @@ typedef struct { void (*flexran_agent_get_pending_dl_mac_config)(mid_t mod_id, Protocol__FlexranMessage **msg); - /// Notify the controller for a state change of a particular UE, by sending the proper - /// UE state change message (ACTIVATION, DEACTIVATION, HANDOVER) - // int (*flexran_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti, - // uint8_t state_change); + /// Notify the controller of another (RU) tick, i.e. new subframe. Used to + /// synchronize the eNB and the agent. + void (*flexran_agent_notify_tick)(mid_t mod_id); void *dl_scheduler_loaded_lib; diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index e6ecf4250d..a8ee9b98e8 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -33,27 +33,14 @@ #include #include -void *receive_thread(void *args); -Protocol__FlexranMessage *flexran_agent_timeout(void* args); - - int agent_task_created = 0; /* * enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller * and can interact with other itti tasks */ void *flexran_agent_task(void *args){ - - //flexran_agent_info_t *d = (flexran_agent_info_t *) args; - Protocol__FlexranMessage *msg; - void *data; - int size; - err_code_t err_code=0; - int priority = 0; - - MessageDef *msg_p = NULL; - int result; - struct flexran_agent_timer_element_s * elem = NULL; + MessageDef *msg_p = NULL; + int result; itti_mark_task_ready(TASK_FLEXRAN_AGENT); @@ -71,20 +58,6 @@ void *flexran_agent_task(void *args){ case MESSAGE_TEST: LOG_I(FLEXRAN_AGENT, "Received %s\n", ITTI_MSG_NAME(msg_p)); break; - - case TIMER_HAS_EXPIRED: - msg = flexran_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); - if (msg != NULL){ - data=flexran_agent_pack_message(msg,&size); - elem = get_timer_entry(msg_p->ittiMsg.timer_has_expired.timer_id); - if (flexran_agent_msg_send(elem->agent_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) { - err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); - } - break; default: LOG_E(FLEXRAN_AGENT, "Received unexpected message %s\n", ITTI_MSG_NAME (msg_p)); @@ -93,10 +66,6 @@ void *flexran_agent_task(void *args){ result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - continue; - error: - if (err_code != 0) - LOG_E(FLEXRAN_AGENT,"flexran_agent_task: error %d occured\n",err_code); } while (1); return NULL; @@ -245,7 +214,7 @@ int flexran_agent_start(mid_t mod_id) * initilize a timer */ - flexran_agent_init_timer(); + flexran_agent_timer_init(mod_id); /* * start the enb agent task for tx and interaction with the underlying network function @@ -286,16 +255,3 @@ error: return 1; } - -Protocol__FlexranMessage *flexran_agent_timeout(void* args){ - - // flexran_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args)); - //memcpy (timer_args, args, sizeof(*timer_args)); - flexran_agent_timer_args_t *timer_args = (flexran_agent_timer_args_t *) args; - - LOG_UI(FLEXRAN_AGENT, "flexran_agent %d timeout\n", timer_args->mod_id); - //LOG_I(FLEXRAN_AGENT, "eNB action %d ENB flags %d \n", timer_args->cc_actions,timer_args->cc_report_flags); - //LOG_I(FLEXRAN_AGENT, "UE action %d UE flags %d \n", timer_args->ue_actions,timer_args->ue_report_flags); - - return NULL; -} diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h index fcca7d4212..fe7b49107c 100644 --- a/openair2/ENB_APP/flexran_agent_common.h +++ b/openair2/ENB_APP/flexran_agent_common.h @@ -150,10 +150,15 @@ Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id, uint32_t size); /* Function to be used to send a message to a dispatcher once the appropriate event is triggered. */ -Protocol__FlexranMessage *flexran_agent_handle_timed_task(void *args); +Protocol__FlexranMessage *flexran_agent_handle_timed_task( + mid_t mod_id, + Protocol__FlexranMessage *msg); /*Top level Statistics hanlder*/ -Protocol__FlexranMessage *flexran_agent_send_stats_reply(void *args); +Protocol__FlexranMessage *flexran_agent_send_stats_reply( + mid_t mod_id, + const Protocol__FlexranMessage *msg); + int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); /* Function to be used to handle reply message . */ diff --git a/openair2/ENB_APP/flexran_agent_defs.h b/openair2/ENB_APP/flexran_agent_defs.h index 1b6102590b..20aac5f56e 100644 --- a/openair2/ENB_APP/flexran_agent_defs.h +++ b/openair2/ENB_APP/flexran_agent_defs.h @@ -107,36 +107,6 @@ typedef uint8_t lcid_t; typedef int32_t err_code_t; -/*---------Timer Enums --------- */ - -typedef enum { - /* oneshot timer: */ - FLEXRAN_AGENT_TIMER_TYPE_ONESHOT = 0, - - /* periodic timer */ - FLEXRAN_AGENT_TIMER_TYPE_PERIODIC = 1, - - /* Inactive state: initial state for any timer. */ - FLEXRAN_AGENT_TIMER_TYPE_EVENT_DRIVEN = 2, - - /* Max number of states available */ - FLEXRAN_AGENT_TIMER_TYPE_MAX, -} flexran_agent_timer_type_t; - - -typedef enum { - /* Inactive state: initial state for any timer. */ - FLEXRAN_AGENT_TIMER_STATE_INACTIVE = 0x0, - - /* Inactive state: initial state for any timer. */ - FLEXRAN_AGENT_TIMER_STATE_ACTIVE = 0x1, - - /* Inactive state: initial state for any timer. */ - FLEXRAN_AGENT_TIMER_STATE_STOPPED = 0x2, - - /* Max number of states available */ - FLEXRAN_AGENT_TIMER_STATE_MAX, -} flexran_agent_timer_state_t; #define FLEXRAN_CAP_LOPHY(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOPHY)) > 0) #define FLEXRAN_CAP_HIPHY(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIPHY)) > 0) diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index c3e9286441..1bae0776a3 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -154,39 +154,20 @@ void * flexran_agent_pack_message(Protocol__FlexranMessage *msg, return NULL; } -Protocol__FlexranMessage *flexran_agent_handle_timed_task(void *args) { +Protocol__FlexranMessage *flexran_agent_handle_timed_task( + mid_t mod_id, + Protocol__FlexranMessage *msg) { err_code_t err_code; - flexran_agent_timer_args_t *timer_args = (flexran_agent_timer_args_t *) args; - Protocol__FlexranMessage *timed_task, *reply_message; - timed_task = timer_args->msg; - err_code = ((*agent_messages_callback[timed_task->msg_case-1][timed_task->msg_dir-1])(timer_args->mod_id, (void *) timed_task, &reply_message)); - if ( err_code < 0 ){ - goto error; + Protocol__FlexranMessage *reply_message; + err_code = ((*agent_messages_callback[msg->msg_case-1][msg->msg_dir-1])( + mod_id, msg, &reply_message)); + if (err_code < 0) { + LOG_E(FLEXRAN_AGENT, "could not handle message: errno %d occured\n", err_code); + return NULL; } return reply_message; - - error: - LOG_E(FLEXRAN_AGENT,"errno %d occured\n",err_code); - return NULL; -} - -Protocol__FlexranMessage* flexran_agent_process_timeout(long timer_id, void* timer_args){ - - struct flexran_agent_timer_element_s *found = get_timer_entry(timer_id); - - if (found == NULL ) goto error; - LOG_D(FLEXRAN_AGENT, "Found the entry (%p): timer_id is 0x%lx 0x%lx\n", found, timer_id, found->timer_id); - - if (timer_args == NULL) - LOG_W(FLEXRAN_AGENT,"null timer args\n"); - - return found->cb(timer_args); - - error: - LOG_E(FLEXRAN_AGENT, "can't get the timer element\n"); - return NULL; } err_code_t flexran_agent_destroy_flexran_message(Protocol__FlexranMessage *msg) { @@ -209,24 +190,21 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr return -1; } Protocol__FlexCompleteStatsRequest *comp_req = stats_req->complete_stats_request; - flexran_agent_timer_args_t *timer_args = NULL; switch (comp_req->report_frequency) { case PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_OFF: - flexran_agent_destroy_timer_by_task_id(xid); + flexran_agent_destroy_timer(mod_id, xid); return 0; case PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE: LOG_E(FLEXRAN_AGENT, "one-shot timer not implemented yet\n"); return -1; case PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_PERIODICAL: /* Create a one off flexran message as an argument for the periodical task */ - timer_args = calloc(1, sizeof(flexran_agent_timer_args_t)); - AssertFatal(timer_args, "cannot allocate memory for timer\n"); - timer_args->mod_id = mod_id; - timer_args->msg = input; + LOG_I(FLEXRAN_AGENT, "periodical timer xid %d cell_flags %d ue_flags %d\n", + xid, comp_req->cell_report_flags, comp_req->ue_report_flags); flexran_agent_create_timer(mod_id, comp_req->sf, FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, xid, - flexran_agent_send_stats_reply, timer_args); + flexran_agent_send_stats_reply, input); /* return 1: do not dispose comp_req message we received, we still need it */ return 1; case PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_CONTINUOUS: @@ -241,15 +219,14 @@ int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr /* Top level reply */ -Protocol__FlexranMessage *flexran_agent_send_stats_reply(void *args) { - const flexran_agent_timer_args_t *timer_args = args; - const mid_t enb_id = timer_args->mod_id; - const Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)timer_args->msg; - const Protocol__FlexStatsRequest *stats_req = input->stats_request_msg; +Protocol__FlexranMessage *flexran_agent_send_stats_reply( + mid_t mod_id, + const Protocol__FlexranMessage *msg) { + const Protocol__FlexStatsRequest *stats_req = msg->stats_request_msg; const xid_t xid = stats_req->header->xid; Protocol__FlexranMessage *reply = NULL; - err_code_t rc = flexran_agent_stats_reply(enb_id, xid, stats_req, &reply); + err_code_t rc = flexran_agent_stats_reply(mod_id, xid, stats_req, &reply); if (rc < 0) { LOG_E(FLEXRAN_AGENT, "%s(): errno %d occured, cannot send stats_reply\n", __func__, rc); diff --git a/openair2/ENB_APP/flexran_agent_timer.c b/openair2/ENB_APP/flexran_agent_timer.c index e4ce1b82d4..ffbac39983 100644 --- a/openair2/ENB_APP/flexran_agent_timer.c +++ b/openair2/ENB_APP/flexran_agent_timer.c @@ -21,175 +21,266 @@ /*! \file flexran_agent_timer.c * \brief FlexRAN Timer - * \author shahab SHARIAT BAGHERI - * \date 2017 - * \version 0.1 - */ - -/* - * timer primitives + * \author Robert Schmidt + * \date 2019 + * \version 0.2 */ #include "flexran_agent_timer.h" +#include "flexran_agent_extern.h" +#include +#include -//struct flexran_agent_map agent_map; -flexran_agent_timer_instance_t timer_instance; -int agent_timer_init = 0; -err_code_t flexran_agent_init_timer(void) { - LOG_I(FLEXRAN_AGENT, "init RB tree\n"); +#define MAX_NUM_TIMERS 10 - if (!agent_timer_init) { - RB_INIT(&timer_instance.flexran_agent_head); - agent_timer_init = 1; +typedef struct flexran_agent_timer_element_s { + mid_t mod_id; + xid_t xid; /* The id of the task as received by the controller message*/ + uint32_t sf; + uint64_t next; + flexran_agent_timer_callback_t cb; + Protocol__FlexranMessage *msg; +} flexran_agent_timer_element_t; + +typedef struct flexran_agent_timer_extern_source_s { + pthread_mutex_t mutex_sync; + pthread_cond_t cond; + int wait; +} flexran_agent_timer_extern_source_t; + +struct timesync { + void *param_sync; + void (*fsync)(void *); + pthread_t thread; + + uint64_t current; + uint64_t next; + + int timer_num; + flexran_agent_timer_element_t *timer[MAX_NUM_TIMERS]; + pthread_mutex_t mutex_timer; + + int exit; +}; +struct timesync timesync[NUM_MAX_ENB]; + +int flexran_agent_timer_signal_init(struct timesync *sync); +int flexran_agent_timer_source_setup(struct timesync *sync); +void *flexran_agent_timer_thread(void *args); +void flexran_agent_timer_remove_internal(struct timesync *sync, int index); +void flexran_agent_timer_process(flexran_agent_timer_element_t *t); + + +err_code_t flexran_agent_timer_init(mid_t mod_id) { + struct timesync *sync = ×ync[mod_id]; + sync->current = 0; + sync->next = 0; + sync->timer_num = 0; + for (int i = 0; i < MAX_NUM_TIMERS; ++i) + sync->timer[i] = NULL; + pthread_mutex_init(&sync->mutex_timer, NULL); + sync->exit = 0; + + /* if there is a MAC, we assume we can have a tick from the MAC interface + * (external tick source). Otherwise, generate a tick internally via the + * timerfd linux library. The init functions set everything up and the thread + * will use whatever is available. */ + int (*init)(struct timesync *) = flexran_agent_get_mac_xface(mod_id) ? + flexran_agent_timer_signal_init : flexran_agent_timer_source_setup; + if (init(timesync) < 0 + || pthread_create(&sync->thread, NULL, flexran_agent_timer_thread, sync) != 0) { + sync->thread = 0; + if (sync->param_sync) + free(sync->param_sync); + LOG_E(FLEXRAN_AGENT, "could not start timer thread\n"); + return TIMER_SETUP_FAILED; } - return PROTOCOL__FLEXRAN_ERR__NO_ERR; } -RB_GENERATE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer); +void flexran_agent_timer_exit(mid_t mod_id) { + timesync[mod_id].exit = 1; +} -/* The timer_id might not be the best choice for the comparison */ -int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b) { - if (a->timer_id < b->timer_id) return -1; +void flexran_agent_timer_source_sync(void *sync) { + int fd = *(int *)sync; + uint64_t occ; + int rc __attribute__((unused)) = read(fd, &occ, sizeof(occ)); +} - if (a->timer_id > b->timer_id) return 1; +int flexran_agent_timer_source_setup(struct timesync *sync) { + sync->param_sync = malloc(sizeof(int)); + if (!sync->param_sync) + return -1; + int fd = timerfd_create(CLOCK_MONOTONIC, 0); + if (fd < 0) + return fd; - // equal timers + const uint64_t period_ns = 1000000; // 1ms + struct itimerspec t; + t.it_interval.tv_sec = period_ns / 1000000000; + t.it_interval.tv_nsec = period_ns % 1000000000; + t.it_value.tv_sec = period_ns / 1000000000; + t.it_value.tv_nsec = period_ns % 1000000000; + int rc = timerfd_settime(fd, 0, &t, NULL); + if (rc != 0) + return -1; + *(int *)sync->param_sync = fd; + sync->fsync = flexran_agent_timer_source_sync; return 0; } +void flexran_agent_timer_signal_sync(void *param_sync) { + flexran_agent_timer_extern_source_t *sync = param_sync; + pthread_mutex_lock(&sync->mutex_sync); + while (sync->wait) { + pthread_cond_wait(&sync->cond, &sync->mutex_sync); + } + sync->wait = 1; + pthread_mutex_unlock(&sync->mutex_sync); +} + +int flexran_agent_timer_signal_init(struct timesync *sync) { + flexran_agent_timer_extern_source_t *s = malloc(sizeof(flexran_agent_timer_extern_source_t)); + if (!s) + return TIMER_SETUP_FAILED; + if (pthread_mutex_init(&s->mutex_sync, NULL) < 0) + return TIMER_SETUP_FAILED; + if (pthread_cond_init(&s->cond, NULL) < 0) + return TIMER_SETUP_FAILED; + s->wait = 1; + sync->param_sync = s; + sync->fsync = flexran_agent_timer_signal_sync; + return 0; +} + +void flexran_agent_timer_signal(mid_t mod_id) { + flexran_agent_timer_extern_source_t *sync = timesync[mod_id].param_sync; + pthread_mutex_lock(&sync->mutex_sync); + sync->wait = 0; + pthread_mutex_unlock(&sync->mutex_sync); + pthread_cond_signal(&sync->cond); +} + +void *flexran_agent_timer_thread(void *args) { + struct timesync *sync = args; + while (1) { + sync->fsync(sync->param_sync); + if (sync->exit) + break; + + pthread_mutex_lock(&sync->mutex_timer); + sync->current++; + + if (sync->current < sync->next) { + pthread_mutex_unlock(&sync->mutex_timer); + continue; + } + + for (int i = 0; i < sync->timer_num; ++i) { + flexran_agent_timer_element_t *t = sync->timer[i]; + if (sync->current == t->next) { + flexran_agent_timer_process(t); + t->next += t->sf; + } + if (sync->next == sync->current || t->next < sync->next) + sync->next = t->next; + } + pthread_mutex_unlock(&sync->mutex_timer); + } + LOG_W(FLEXRAN_AGENT, "terminated timer thread\n"); + return NULL; +} + +void flexran_agent_timer_process(flexran_agent_timer_element_t *t) { + Protocol__FlexranMessage *msg = t->cb(t->mod_id, t->msg); + if (!msg) + return; + + int size = 0; + void *data = flexran_agent_pack_message(msg, &size); + if (flexran_agent_msg_send(t->mod_id, FLEXRAN_AGENT_DEFAULT, data, size, 0) < 0) + LOG_E(FLEXRAN_AGENT, "error while sending message for timer xid %d\n", t->xid); +} + + err_code_t flexran_agent_create_timer(mid_t mod_id, uint32_t sf, - uint32_t timer_type, + flexran_agent_timer_type_t timer_type, xid_t xid, flexran_agent_timer_callback_t cb, - void *timer_args) { - int ret=-1; - - if (sf <= 0) + Protocol__FlexranMessage *msg) { + if (sf == 0) return TIMER_NULL; + if (cb == NULL) + return TIMER_SETUP_FAILED; + AssertFatal(timer_type != FLEXRAN_AGENT_TIMER_TYPE_ONESHOT, + "one shot timer not yet implemented\n"); - if (timer_type >= FLEXRAN_AGENT_TIMER_TYPE_MAX) - return TIMER_TYPE_INVALIDE; - - uint32_t interval_usec = sf * 1000; - uint32_t interval_sec = 0; - if (interval_usec >= 1000 * 1000) { - interval_sec = interval_usec / (1000 * 1000); - interval_usec = interval_usec % (1000 * 1000); - } - struct flexran_agent_timer_element_s *e = calloc(1, sizeof(*e)); - DevAssert(e != NULL); - long timer_id = 0; - AssertFatal(e, "cannot allocate memory for FlexRAN timer!\n"); - if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_ONESHOT) { - ret = timer_setup(interval_sec, - interval_usec, - TASK_FLEXRAN_AGENT, - mod_id, - TIMER_ONE_SHOT, - timer_args, - &timer_id); - - e->type = TIMER_ONE_SHOT; - } else if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_PERIODIC ) { - ret = timer_setup(interval_sec, - interval_usec, - TASK_FLEXRAN_AGENT, - mod_id, - TIMER_PERIODIC, - timer_args, - &timer_id); - e->type = TIMER_PERIODIC; - } - - if (ret < 0 ) { - free(e); + flexran_agent_timer_element_t *t = malloc(sizeof(flexran_agent_timer_element_t)); + if (!t) { + LOG_E(FLEXRAN_AGENT, "no memory for new timer %d\n", xid); return TIMER_SETUP_FAILED; } + t->mod_id = mod_id; + t->xid = xid; + t->sf = sf; + t->cb = cb; + t->msg = msg; - e->agent_id = mod_id; - e->instance = mod_id; - e->state = FLEXRAN_AGENT_TIMER_STATE_ACTIVE; - e->timer_id = timer_id; - e->xid = xid; - e->timer_args = timer_args; - e->cb = cb; - /*element should be a real pointer*/ - RB_INSERT(flexran_agent_map, &timer_instance.flexran_agent_head, e); - LOG_I(FLEXRAN_AGENT,"Created a new timer with id 0x%lx for agent %d, instance %d \n", - e->timer_id, e->agent_id, e->instance); - return 0; -} - -err_code_t flexran_agent_destroy_timer(long timer_id) { - struct flexran_agent_timer_element_s *e = get_timer_entry(timer_id); - - if (e != NULL ) { - RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e); - flexran_agent_destroy_flexran_message(e->timer_args->msg); - free(e); + struct timesync *sync = ×ync[mod_id]; + pthread_mutex_lock(&sync->mutex_timer); + if (sync->timer_num >= MAX_NUM_TIMERS) { + pthread_mutex_unlock(&sync->mutex_timer); + LOG_E(FLEXRAN_AGENT, "maximum number of timers (%d) reached while adding timer %d\n", + sync->timer_num, xid); + free(t); + return TIMER_SETUP_FAILED; } - - if (timer_remove(timer_id) < 0 ) - goto error; - + /* TODO check that xid does not exist? */ + t->next = sync->current + 1; + if (sync->next <= sync->current || t->next < sync->next) + sync->next = t->next; + sync->timer[sync->timer_num] = t; + sync->timer_num++; + pthread_mutex_unlock(&sync->mutex_timer); + LOG_D(FLEXRAN_AGENT, "added new timer xid %d for agent %d\n", xid, mod_id); return 0; -error: - LOG_E(FLEXRAN_AGENT, "timer can't be removed\n"); - return TIMER_REMOVED_FAILED ; } -err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid) { - struct flexran_agent_timer_element_s *e = NULL; - long timer_id; - RB_FOREACH(e, flexran_agent_map, &timer_instance.flexran_agent_head) { - if (e->xid == xid) { - timer_id = e->timer_id; - RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e); - flexran_agent_destroy_flexran_message(e->timer_args->msg); - free(e); +err_code_t flexran_agent_destroy_timers(mid_t mod_id) { + struct timesync *sync = ×ync[mod_id]; + pthread_mutex_lock(&sync->mutex_timer); + for (int i = sync->timer_num - 1; i < 0; --i) { + flexran_agent_timer_remove_internal(sync, i); + } + pthread_mutex_unlock(&sync->mutex_timer); + return 0; +} - if (timer_remove(timer_id) < 0 ) { - goto error; - } +err_code_t flexran_agent_destroy_timer(mid_t mod_id, xid_t xid) { + struct timesync *sync = ×ync[mod_id]; + pthread_mutex_lock(&sync->mutex_timer); + for (int i = 0; i < sync->timer_num; ++i) { + if (sync->timer[i]->xid == xid) { + flexran_agent_timer_remove_internal(sync, i); + pthread_mutex_unlock(&sync->mutex_timer); + return 0; } } - return 0; -error: - LOG_E(FLEXRAN_AGENT, "timer can't be removed\n"); - return TIMER_REMOVED_FAILED ; + pthread_mutex_unlock(&sync->mutex_timer); + LOG_E(FLEXRAN_AGENT, "could not find timer %d\n", xid); + return TIMER_ELEMENT_NOT_FOUND; } -err_code_t flexran_agent_destroy_timers(void) { - struct flexran_agent_timer_element_s *e = NULL; - RB_FOREACH(e, flexran_agent_map, &timer_instance.flexran_agent_head) { - RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e); - timer_remove(e->timer_id); - flexran_agent_destroy_flexran_message(e->timer_args->msg); - free(e); - } - return 0; -} - -err_code_t flexran_agent_stop_timer(long timer_id) { - struct flexran_agent_timer_element_s *e=NULL; - struct flexran_agent_timer_element_s search; - memset(&search, 0, sizeof(struct flexran_agent_timer_element_s)); - search.timer_id = timer_id; - e = RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search); - - if (e != NULL ) { - e->state = FLEXRAN_AGENT_TIMER_STATE_STOPPED; - } - - timer_remove(timer_id); - return 0; -} - -struct flexran_agent_timer_element_s *get_timer_entry(long timer_id) { - struct flexran_agent_timer_element_s search; - memset(&search, 0, sizeof(struct flexran_agent_timer_element_s)); - search.timer_id = timer_id; - return RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search); +/* this function assumes that the timer lock is held */ +void flexran_agent_timer_remove_internal(struct timesync *sync, int index) { + LOG_I(FLEXRAN_AGENT, "remove timer xid %d (index %d) for agent %d\n", + sync->timer[index]->xid, index, sync->timer[index]->mod_id); + flexran_agent_destroy_flexran_message(sync->timer[index]->msg); + free(sync->timer[index]); + for (int i = index + 1; i < sync->timer_num; ++i) + sync->timer[i - 1] = sync->timer[i]; + sync->timer_num--; + sync->timer[sync->timer_num] = NULL; } diff --git a/openair2/ENB_APP/flexran_agent_timer.h b/openair2/ENB_APP/flexran_agent_timer.h index 4fbf44a7e2..b1cf8df51f 100644 --- a/openair2/ENB_APP/flexran_agent_timer.h +++ b/openair2/ENB_APP/flexran_agent_timer.h @@ -26,100 +26,45 @@ * \version 0.1 */ -#include -#include +#ifndef _FLEXRAN_AGENT_TIMER_ +#define _FLEXRAN_AGENT_TIMER_ #include "flexran_agent_common.h" -#include "flexran_agent_common_internal.h" -#include "flexran_agent_extern.h" #include "flexran_agent_defs.h" - -# include "tree.h" -# include "intertask_interface.h" - - - -/******************* - * timer primitves - *******************/ - #define TIMER_NULL -1 #define TIMER_TYPE_INVALIDE -2 #define TIMER_SETUP_FAILED -3 #define TIMER_REMOVED_FAILED -4 #define TIMER_ELEMENT_NOT_FOUND -5 +typedef enum { + FLEXRAN_AGENT_TIMER_TYPE_ONESHOT, + FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, +} flexran_agent_timer_type_t; /* Type of the callback executed when the timer expired */ -typedef Protocol__FlexranMessage *(*flexran_agent_timer_callback_t)(void*); +typedef Protocol__FlexranMessage *(*flexran_agent_timer_callback_t)( + mid_t mod_id, const Protocol__FlexranMessage *msg); +err_code_t flexran_agent_timer_init(mid_t mod_id); +void flexran_agent_timer_exit(mid_t mod_id); -typedef struct flexran_agent_timer_args_s{ - mid_t mod_id; - Protocol__FlexranMessage *msg; -} flexran_agent_timer_args_t; - - -typedef struct flexran_agent_timer_element_s{ - RB_ENTRY(flexran_agent_timer_element_s) entry; - - agent_id_t agent_id; - instance_t instance; - - flexran_agent_timer_type_t type; - flexran_agent_timer_state_t state; - - uint32_t interval_sec; - uint32_t interval_usec; - - long timer_id; /* Timer id returned by the timer API*/ - xid_t xid; /*The id of the task as received by the controller - message*/ - - flexran_agent_timer_callback_t cb; - flexran_agent_timer_args_t *timer_args; - -} flexran_agent_timer_element_t; - -typedef struct flexran_agent_timer_instance_s{ - RB_HEAD(flexran_agent_map, flexran_agent_timer_element_s) flexran_agent_head; -}flexran_agent_timer_instance_t; - - -err_code_t flexran_agent_init_timer(void); +/* Signals next subframe for FlexRAN timers */ +void flexran_agent_timer_signal(mid_t mod_id); /* Create a timer for some agent related event with id xid. */ err_code_t flexran_agent_create_timer(mid_t mod_id, uint32_t sf, - uint32_t timer_type, + flexran_agent_timer_type_t timer_type, xid_t xid, flexran_agent_timer_callback_t cb, - void *timer_args); + Protocol__FlexranMessage *msg); /* Destroy all existing timers */ -err_code_t flexran_agent_destroy_timers(void); - -/* Destroy the timer with the given timer_id */ -err_code_t flexran_agent_destroy_timer(long timer_id); +err_code_t flexran_agent_destroy_timers(mid_t mod_id); /* Destroy the timer for task with id xid */ -err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid); +err_code_t flexran_agent_destroy_timer(mid_t mod_id, xid_t xid); -/* Stop a timer */ -err_code_t flexran_agent_stop_timer(long timer_id); - -/* Restart the given timer */ -err_code_t flexran_agent_restart_timer(long *timer_id); - -/* Find the timer with the given timer_id */ -struct flexran_agent_timer_element_s * get_timer_entry(long timer_id); - -/* Obtain the protocol message stored in the given expired timer */ -Protocol__FlexranMessage * flexran_agent_process_timeout(long timer_id, void* timer_args); - -/* Comparator function comparing two timers. Decides the ordering of the timers */ -int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b); - -/* RB_PROTOTYPE is for .h files */ -RB_PROTOTYPE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer); +#endif /* _FLEXRAN_AGENT_TIMER_ */ diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 3659933378..ae3f57bd8a 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -988,6 +988,8 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, if (flexran_agent_get_mac_xface(module_idP) && subframeP == 9) { flexran_agent_slice_update(module_idP); } + if (flexran_agent_get_mac_xface(module_idP)) + flexran_agent_get_mac_xface(module_idP)->flexran_agent_notify_tick(module_idP); stop_meas(&(eNB->eNB_scheduler)); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, VCD_FUNCTION_OUT); From f87c1cbb92489a8eed6a1b3b74afcc2edf70e7e1 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 8 Nov 2019 09:22:52 +0100 Subject: [PATCH 08/32] FlexRAN refactor+format MAC stats function --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 1214 ++++++++--------- .../CONTROL_MODULES/MAC/flexran_agent_mac.h | 17 +- openair2/ENB_APP/flexran_agent_handler.c | 5 +- 3 files changed, 565 insertions(+), 671 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 04563b960e..1a8c2cefa8 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -62,676 +62,528 @@ int n_ue_slice_assoc_updates = 0; pthread_mutex_t sc_update_mtx = PTHREAD_MUTEX_INITIALIZER; -int flexran_agent_mac_stats_reply(mid_t mod_id, - Protocol__FlexUeStatsReport **ue_report, - int n_ue, - uint32_t ue_flags, - Protocol__FlexCellStatsReport **cell_report, - int n_cc, - uint32_t cc_flags) { - - - // Protocol__FlexHeader *header; - int i, j, k; - int UE_id; - int cc_id = 0; - int enb_id = mod_id; - - /* Allocate memory for list of UE reports */ - if (n_ue > 0) { - - - for (i = 0; i < n_ue; i++) { - - const rnti_t rnti = ue_report[i]->rnti; - UE_id = flexran_get_mac_ue_id_rnti(mod_id, rnti); - - /* Check flag for creation of buffer status report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR) { - //TODO should be automated - ue_report[i]->n_bsr = 4; - uint32_t *elem; - elem = (uint32_t *) malloc(sizeof(uint32_t)*ue_report[i]->n_bsr); - if (elem == NULL) - goto error; - for (j = 0; j < ue_report[i]->n_bsr; j++) { - // NN: we need to know the cc_id here, consider the first one - elem[j] = flexran_get_ue_bsr_ul_buffer_info (enb_id, i, j); - } - - ue_report[i]->bsr = elem; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR; - } - - /* Check flag for creation of PHR report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PHR) { - ue_report[i]->phr = flexran_get_ue_phr (enb_id, UE_id); // eNB_UE_list->UE_template[UE_PCCID(enb_id,UE_id)][UE_id].phr_info; - ue_report[i]->has_phr = 1; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PHR; - - } - - /* Check flag for creation of RLC buffer status report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) { - ue_report[i]->n_rlc_report = 3; // Set this to the number of LCs for this UE. This needs to be generalized for for LCs - Protocol__FlexRlcBsr ** rlc_reports; - rlc_reports = malloc(sizeof(Protocol__FlexRlcBsr *) * ue_report[i]->n_rlc_report); - if (rlc_reports == NULL) - goto error; - - // NN: see LAYER2/openair2_proc.c for rlc status - for (j = 0; j < ue_report[i]->n_rlc_report; j++) { - - rlc_reports[j] = malloc(sizeof(Protocol__FlexRlcBsr)); - if (rlc_reports[j] == NULL){ - for (k = 0; k < j; k++){ - free(rlc_reports[k]); - } - free(rlc_reports); - goto error; - } - protocol__flex_rlc_bsr__init(rlc_reports[j]); - rlc_reports[j]->lc_id = j+1; - rlc_reports[j]->has_lc_id = 1; - rlc_reports[j]->tx_queue_size = flexran_get_tx_queue_size(enb_id, UE_id, j + 1); - rlc_reports[j]->has_tx_queue_size = 1; - - //TODO:Set tx queue head of line delay in ms - rlc_reports[j]->tx_queue_hol_delay = flexran_get_hol_delay(enb_id, UE_id, j + 1); - rlc_reports[j]->has_tx_queue_hol_delay = 1; - //TODO:Set retransmission queue size in bytes - rlc_reports[j]->retransmission_queue_size = 10; - rlc_reports[j]->has_retransmission_queue_size = 0; - //TODO:Set retransmission queue head of line delay in ms - rlc_reports[j]->retransmission_queue_hol_delay = 100; - rlc_reports[j]->has_retransmission_queue_hol_delay = 0; - //TODO DONE:Set current size of the pending message in bytes - rlc_reports[j]->status_pdu_size = flexran_get_num_pdus_buffer(enb_id, UE_id, j + 1); - rlc_reports[j]->has_status_pdu_size = 1; - - } - // Add RLC buffer status reports to the full report - if (ue_report[i]->n_rlc_report > 0) - ue_report[i]->rlc_report = rlc_reports; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS; - - } - - /* Check flag for creation of MAC CE buffer status report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS) { - // TODO: Fill in the actual MAC CE buffer status report - ue_report[i]->pending_mac_ces = (flexran_get_MAC_CE_bitmap_TA(enb_id, UE_id, 0) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; - // Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the - // PROTOCOL__FLEX_CE_TYPE__FLPCET_ values - // found in stats_common.pb-c.h. See - // flex_ce_type in FlexRAN specification - ue_report[i]->has_pending_mac_ces = 1; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS; - } - - /* Check flag for creation of DL CQI report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI) { - // TODO: Fill in the actual DL CQI report for the UE based on its configuration - Protocol__FlexDlCqiReport * dl_report; - dl_report = malloc(sizeof(Protocol__FlexDlCqiReport)); - if (dl_report == NULL) - goto error; - protocol__flex_dl_cqi_report__init(dl_report); - - dl_report->sfn_sn = flexran_get_sfn_sf(enb_id); - dl_report->has_sfn_sn = 1; - //Set the number of DL CQI reports for this UE. One for each CC - dl_report->n_csi_report = flexran_get_active_CC(enb_id, UE_id); - dl_report->n_csi_report = 1 ; - //Create the actual CSI reports. - Protocol__FlexDlCsi **csi_reports; - csi_reports = malloc(sizeof(Protocol__FlexDlCsi *)*dl_report->n_csi_report); - if (csi_reports == NULL) { - free(dl_report); - goto error; - } - for (j = 0; j < dl_report->n_csi_report; j++) { - - csi_reports[j] = malloc(sizeof(Protocol__FlexDlCsi)); - if (csi_reports[j] == NULL) { - for (k = 0; k < j; k++) { - free(csi_reports[k]); - } - free(csi_reports); - csi_reports = NULL; - goto error; - } - protocol__flex_dl_csi__init(csi_reports[j]); - //The servCellIndex for this report - csi_reports[j]->serv_cell_index = j; - csi_reports[j]->has_serv_cell_index = 1; - //The rank indicator value for this cc - csi_reports[j]->ri = flexran_get_current_RI(enb_id, UE_id, j); - csi_reports[j]->has_ri = 1; - //TODO: the type of CSI report based on the configuration of the UE - //For now we only support type P10, which only needs a wideband value - //The full set of types can be found in stats_common.pb-c.h and - //in the FlexRAN specifications - csi_reports[j]->type = PROTOCOL__FLEX_CSI_TYPE__FLCSIT_P10; - csi_reports[j]->has_type = 1; - csi_reports[j]->report_case = PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI; - - if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI){ - - Protocol__FlexCsiP10 *csi10; - csi10 = malloc(sizeof(Protocol__FlexCsiP10)); - if (csi10 == NULL) { - for (k = 0; k <= j; k++) { - free(csi_reports[k]); - } - free(csi_reports); - csi_reports = NULL; - goto error; - } - protocol__flex_csi_p10__init(csi10); - //TODO: set the wideband value - // NN: this is also depends on cc_id - csi10->wb_cqi = flexran_get_ue_wcqi (enb_id, UE_id); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,UE_id)][UE_id].dl_cqi; - csi10->has_wb_cqi = 1; - //Add the type of measurements to the csi report in the proper union type - csi_reports[j]->p10csi = csi10; - } - - else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P11CSI){ - - - Protocol__FlexCsiP11 *csi11; - csi11 = malloc(sizeof(Protocol__FlexCsiP11)); - if (csi11 == NULL) { - for (k = 0; k <= j; k++) { - free(csi_reports[k]); - } - free(csi_reports); - csi_reports = NULL; - goto error; - } - protocol__flex_csi_p11__init(csi11); - - csi11->wb_cqi = malloc(sizeof(csi11->wb_cqi)); - csi11->n_wb_cqi = 1; - csi11->wb_cqi[0] = flexran_get_ue_wcqi (enb_id, UE_id); - // According To spec 36.213 - - if (flexran_get_antenna_ports(enb_id, j) == 2 && csi_reports[j]->ri == 1) { - // TODO PMI - csi11->wb_pmi = flexran_get_ue_wpmi(enb_id, UE_id, 0); - csi11->has_wb_pmi = 1; - - } - - else if (flexran_get_antenna_ports(enb_id, j) == 2 && csi_reports[j]->ri == 2){ - // TODO PMI - csi11->wb_pmi = flexran_get_ue_wpmi(enb_id, UE_id, 0); - csi11->has_wb_pmi = 1; - - } - - else if (flexran_get_antenna_ports(enb_id, j) == 4 && csi_reports[j]->ri == 2){ - // TODO PMI - csi11->wb_pmi = flexran_get_ue_wpmi(enb_id, UE_id, 0); - csi11->has_wb_pmi = 1; - - - } - - csi11->has_wb_pmi = 0; - - csi_reports[j]->p11csi = csi11; - - } - - - - - - else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P20CSI){ - - Protocol__FlexCsiP20 *csi20; - csi20 = malloc(sizeof(Protocol__FlexCsiP20)); - if (csi20 == NULL) { - for (k = 0; k <= j; k++) { - free(csi_reports[k]); - } - free(csi_reports); - csi_reports = NULL; - goto error; - } - protocol__flex_csi_p20__init(csi20); - - csi20->wb_cqi = flexran_get_ue_wcqi (enb_id, UE_id); - csi20->has_wb_cqi = 1; - - - csi20->bandwidth_part_index = 1 ;//TODO - csi20->has_bandwidth_part_index = 1; - - csi20->sb_index = 1 ;//TODO - csi20->has_sb_index = 1 ; - - - csi_reports[j]->p20csi = csi20; - - - } - - else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P21CSI){ - - // Protocol__FlexCsiP21 *csi21; - // csi21 = malloc(sizeof(Protocol__FlexCsiP21)); - // if (csi21 == NULL) - // goto error; - // protocol__flex_csi_p21__init(csi21); - - // csi21->wb_cqi = flexran_get_ue_wcqi (enb_id, UE_id); - - - // csi21->wb_pmi = flexran_get_ue_pmi(enb_id); //TDO inside - // csi21->has_wb_pmi = 1; - - // csi21->sb_cqi = 1; // TODO - - // csi21->bandwidth_part_index = 1 ; //TDO inside - // csi21->has_bandwidth_part_index = 1 ; - - // csi21->sb_index = 1 ;//TODO - // csi21->has_sb_index = 1 ; - - - // csi_reports[j]->p20csi = csi21; - - } - - else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A12CSI){ - - - // Protocol__FlexCsiA12 *csi12; - // csi12 = malloc(sizeof(Protocol__FlexCsiA12)); - // if (csi12 == NULL) - // goto error; - // protocol__flex_csi_a12__init(csi12); - - // csi12->wb_cqi = flexran_get_ue_wcqi (enb_id, UE_id); - - // csi12->sb_pmi = 1 ; //TODO inside - - // TODO continou - } - - else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A22CSI){ - - // Protocol__FlexCsiA22 *csi22; - // csi22 = malloc(sizeof(Protocol__FlexCsiA22)); - // if (csi22 == NULL) - // goto error; - // protocol__flex_csi_a22__init(csi22); - - // csi22->wb_cqi = flexran_get_ue_wcqi (enb_id, UE_id); - - // csi22->sb_cqi = 1 ; //TODO inside - - // csi22->wb_pmi = flexran_get_ue_wcqi (enb_id, UE_id); - // csi22->has_wb_pmi = 1; - - // csi22->sb_pmi = 1 ; //TODO inside - // csi22->has_wb_pmi = 1; - - // csi22->sb_list = flexran_get_ue_wcqi (enb_id, UE_id); - - - } - - else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A20CSI){ - - // Protocol__FlexCsiA20 *csi20; - // csi20 = malloc(sizeof(Protocol__FlexCsiA20)); - // if (csi20 == NULL) - // goto error; - // protocol__flex_csi_a20__init(csi20); - - // csi20->wb_cqi = flexran_get_ue_wcqi (enb_id, UE_id); - // csi20->has_wb_cqi = 1; - - // csi20>sb_cqi = 1 ; //TODO inside - // csi20>has_sb_cqi = 1 ; - - // csi20->sb_list = 1; // TODO inside - - - } - - else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A30CSI){ - - } - - else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A31CSI){ - - } - - } - //Add the csi reports to the full DL CQI report - dl_report->csi_report = csi_reports; - //Add the DL CQI report to the stats report - ue_report[i]->dl_cqi_report = dl_report; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI; - } - - /* Check flag for creation of paging buffer status report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS) { - //TODO: Fill in the actual paging buffer status report. For this field to be valid, the RNTI - //set in the report must be a P-RNTI - Protocol__FlexPagingBufferReport *paging_report; - paging_report = malloc(sizeof(Protocol__FlexPagingBufferReport)); - if (paging_report == NULL) - goto error; - protocol__flex_paging_buffer_report__init(paging_report); - //Set the number of pending paging messages - paging_report->n_paging_info = 1; - //Provide a report for each pending paging message - Protocol__FlexPagingInfo **p_info; - p_info = malloc(sizeof(Protocol__FlexPagingInfo *) * paging_report->n_paging_info); - if (p_info == NULL){ - free(paging_report); - goto error; - } - - for (j = 0; j < paging_report->n_paging_info; j++) { - - p_info[j] = malloc(sizeof(Protocol__FlexPagingInfo)); - if (p_info[j] == NULL) { - for (k = 0; k < j; k++) { - free(p_info[k]); - } - free(p_info); - p_info = NULL; - free(paging_report); - goto error; - } - protocol__flex_paging_info__init(p_info[j]); - //TODO: Set paging index. This index is the same that will be used for the scheduling of the - //paging message by the controller - p_info[j]->paging_index = 10; - p_info[j]->has_paging_index = 1; - //TODO:Set the paging message size - p_info[j]->paging_message_size = 100; - p_info[j]->has_paging_message_size = 1; - //TODO: Set the paging subframe - p_info[j]->paging_subframe = 10; - p_info[j]->has_paging_subframe = 1; - //TODO: Set the carrier index for the pending paging message - p_info[j]->carrier_index = 0; - p_info[j]->has_carrier_index = 1; - - } - //Add all paging info to the paging buffer rerport - paging_report->paging_info = p_info; - //Add the paging report to the UE report - ue_report[i]->pbr = paging_report; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS; - } - - /* Check flag for creation of UL CQI report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI) { - - //Fill in the full UL CQI report of the UE - Protocol__FlexUlCqiReport *full_ul_report; - full_ul_report = malloc(sizeof(Protocol__FlexUlCqiReport)); - if(full_ul_report == NULL) - goto error; - protocol__flex_ul_cqi_report__init(full_ul_report); - //TODO:Set the SFN and SF of the generated report - full_ul_report->sfn_sn = flexran_get_sfn_sf(enb_id); - full_ul_report->has_sfn_sn = 1; - //TODO:Set the number of UL measurement reports based on the types of measurements - //configured for this UE and on the servCellIndex - full_ul_report->n_cqi_meas = 1; - Protocol__FlexUlCqi **ul_report; - ul_report = malloc(sizeof(Protocol__FlexUlCqi *) * full_ul_report->n_cqi_meas); - if(ul_report == NULL) { - free(full_ul_report); - goto error; - } - //Fill each UL report of the UE for each of the configured report types - for(j = 0; j < full_ul_report->n_cqi_meas; j++) { - - ul_report[j] = malloc(sizeof(Protocol__FlexUlCqi)); - if(ul_report[j] == NULL) { - for (k = 0; k < j; k++) { - free(ul_report[k]); - } - free(ul_report); - free(full_ul_report); - goto error; - } - protocol__flex_ul_cqi__init(ul_report[j]); - //TODO: Set the type of the UL report. As an example set it to SRS UL report - // See enum flex_ul_cqi_type in FlexRAN specification for more details - ul_report[j]->type = PROTOCOL__FLEX_UL_CQI_TYPE__FLUCT_SRS; - ul_report[j]->has_type = 1; - //TODO:Set the number of SINR measurements based on the report type - //See struct flex_ul_cqi in FlexRAN specification for more details - ul_report[j]->n_sinr = 0; - uint32_t *sinr_meas; - sinr_meas = (uint32_t *) malloc(sizeof(uint32_t) * ul_report[j]->n_sinr); - if (sinr_meas == NULL) { - for (k = 0; k < j; k++) { - free(ul_report[k]); - } - free(ul_report); - free(full_ul_report); - goto error; - } - //TODO:Set the SINR measurements for the specified type - for (k = 0; k < ul_report[j]->n_sinr; k++) { - sinr_meas[k] = 10; - } - ul_report[j]->sinr = sinr_meas; - //TODO: Set the servCellIndex for this report - ul_report[j]->serv_cell_index = 0; - ul_report[j]->has_serv_cell_index = 1; - - //Set the list of UL reports of this UE to the full UL report - full_ul_report->cqi_meas = ul_report; - - full_ul_report->n_pucch_dbm = MAX_NUM_CCs; - full_ul_report->pucch_dbm = malloc(sizeof(Protocol__FlexPucchDbm *) * full_ul_report->n_pucch_dbm); - - for (j = 0; j < MAX_NUM_CCs; j++) { - - full_ul_report->pucch_dbm[j] = malloc(sizeof(Protocol__FlexPucchDbm)); - protocol__flex_pucch_dbm__init(full_ul_report->pucch_dbm[j]); - full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1; - full_ul_report->pucch_dbm[j]->serv_cell_index = j; - - if(flexran_get_p0_pucch_dbm(enb_id, UE_id, j) != -1){ - full_ul_report->pucch_dbm[j]->p0_pucch_dbm = flexran_get_p0_pucch_dbm(enb_id, UE_id, j); - full_ul_report->pucch_dbm[j]->has_p0_pucch_dbm = 1; - } - } - - - } - // Add full UL CQI report to the UE report - ue_report[i]->ul_cqi_report = full_ul_report; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI; - - } - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_STATS) { - - Protocol__FlexMacStats *macstats; - macstats = malloc(sizeof(Protocol__FlexMacStats)); - if (macstats == NULL) - goto error; - protocol__flex_mac_stats__init(macstats); - - - macstats->total_bytes_sdus_dl = flexran_get_total_size_dl_mac_sdus(mod_id, UE_id, cc_id); - macstats->has_total_bytes_sdus_dl = 1; - - macstats->total_bytes_sdus_ul = flexran_get_total_size_ul_mac_sdus(mod_id, UE_id, cc_id); - macstats->has_total_bytes_sdus_ul = 1; - - macstats->tbs_dl = flexran_get_TBS_dl(mod_id, UE_id, cc_id); - macstats->has_tbs_dl = 1; - - macstats->tbs_ul = flexran_get_TBS_ul(mod_id, UE_id, cc_id); - macstats->has_tbs_ul = 1; - - macstats->prb_retx_dl = flexran_get_num_prb_retx_dl_per_ue(mod_id, UE_id, cc_id); - macstats->has_prb_retx_dl = 1; - - macstats->prb_retx_ul = flexran_get_num_prb_retx_ul_per_ue(mod_id, UE_id, cc_id); - macstats->has_prb_retx_ul = 1; - - macstats->prb_dl = flexran_get_num_prb_dl_tx_per_ue(mod_id, UE_id, cc_id); - macstats->has_prb_dl = 1; - - macstats->prb_ul = flexran_get_num_prb_ul_rx_per_ue(mod_id, UE_id, cc_id); - macstats->has_prb_ul = 1; - - macstats->mcs1_dl = flexran_get_mcs1_dl(mod_id, UE_id, cc_id); - macstats->has_mcs1_dl = 1; - - macstats->mcs2_dl = flexran_get_mcs2_dl(mod_id, UE_id, cc_id); - macstats->has_mcs2_dl = 1; - - macstats->mcs1_ul = flexran_get_mcs1_ul(mod_id, UE_id, cc_id); - macstats->has_mcs1_ul = 1; - - macstats->mcs2_ul = flexran_get_mcs2_ul(mod_id, UE_id, cc_id); - macstats->has_mcs2_ul = 1; - - macstats->total_prb_dl = flexran_get_total_prb_dl_tx_per_ue(mod_id, UE_id, cc_id); - macstats->has_total_prb_dl = 1; - - macstats->total_prb_ul = flexran_get_total_prb_ul_rx_per_ue(mod_id, UE_id, cc_id); - macstats->has_total_prb_ul = 1; - - macstats->total_pdu_dl = flexran_get_total_num_pdu_dl(mod_id, UE_id, cc_id); - macstats->has_total_pdu_dl = 1; - - macstats->total_pdu_ul = flexran_get_total_num_pdu_ul(mod_id, UE_id, cc_id); - macstats->has_total_pdu_ul = 1; - - macstats->total_tbs_dl = flexran_get_total_TBS_dl(mod_id, UE_id, cc_id); - macstats->has_total_tbs_dl = 1; - - macstats->total_tbs_ul = flexran_get_total_TBS_ul(mod_id, UE_id, cc_id); - macstats->has_total_tbs_ul = 1; - - macstats->harq_round = flexran_get_harq_round(mod_id, cc_id, UE_id); - macstats->has_harq_round = 1; - - Protocol__FlexMacSdusDl ** mac_sdus; - mac_sdus = malloc(sizeof(Protocol__FlexMacSdusDl) * flexran_get_num_mac_sdu_tx(mod_id, UE_id, cc_id)); - if (mac_sdus == NULL) { - free(macstats); - goto error; - } - - macstats->n_mac_sdus_dl = flexran_get_num_mac_sdu_tx(mod_id, UE_id, cc_id); - - for (j = 0; j < macstats->n_mac_sdus_dl; j++){ - - - mac_sdus[j] = malloc(sizeof(Protocol__FlexMacSdusDl)); - protocol__flex_mac_sdus_dl__init(mac_sdus[j]); - - mac_sdus[j]->lcid = flexran_get_mac_sdu_lcid_index(mod_id, UE_id, cc_id, j); - mac_sdus[j]->has_lcid = 1; - - mac_sdus[j]->sdu_length = flexran_get_mac_sdu_size(mod_id, UE_id, cc_id, mac_sdus[j]->lcid); - mac_sdus[j]->has_sdu_length = 1; - - - } - - - macstats->mac_sdus_dl = mac_sdus; - - - ue_report[i]->mac_stats = macstats; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_STATS; - } - - - - - } - - - - - } - - /* Allocate memory for list of cell reports */ - if (n_cc > 0) { - - - // Fill in the Cell reports - for (i = 0; i < n_cc; i++) { - - - /* Check flag for creation of noise and interference report */ - if(cc_flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) { - // TODO: Fill in the actual noise and interference report for this cell - Protocol__FlexNoiseInterferenceReport *ni_report; - ni_report = malloc(sizeof(Protocol__FlexNoiseInterferenceReport)); - if(ni_report == NULL) - goto error; - protocol__flex_noise_interference_report__init(ni_report); - // Current frame and subframe number - ni_report->sfn_sf = flexran_get_sfn_sf(enb_id); - ni_report->has_sfn_sf = 1; - //TODO:Received interference power in dbm - ni_report->rip = 0; - ni_report->has_rip = 1; - //TODO:Thermal noise power in dbm - ni_report->tnp = 0; - ni_report->has_tnp = 1; - - ni_report->p0_nominal_pucch = flexran_get_p0_nominal_pucch(enb_id, 0); - ni_report->has_p0_nominal_pucch = 1; - cell_report[i]->noise_inter_report = ni_report; - cell_report[i]->flags |= PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE; - } +int flexran_agent_mac_stats_reply_ue(mid_t mod_id, + Protocol__FlexUeStatsReport **ue_report, + int n_ue, + uint32_t ue_flags) { + const int cc_id = 0; // TODO: make for multiple CCs + + for (int i = 0; i < n_ue; i++) { + const rnti_t rnti = ue_report[i]->rnti; + const int UE_id = flexran_get_mac_ue_id_rnti(mod_id, rnti); + + /* buffer status report */ + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR) { + ue_report[i]->n_bsr = 4; //TODO should be automated + uint32_t *elem = (uint32_t *) malloc(sizeof(uint32_t)*ue_report[i]->n_bsr); + if (elem == NULL) + goto error; + for (int j = 0; j < ue_report[i]->n_bsr; j++) { + elem[j] = flexran_get_ue_bsr_ul_buffer_info (mod_id, i, j); + } + ue_report[i]->bsr = elem; + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR; + } + + /* power headroom report */ + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PHR) { + ue_report[i]->phr = flexran_get_ue_phr (mod_id, UE_id); + ue_report[i]->has_phr = 1; + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PHR; + } + + /* Check flag for creation of RLC buffer status report */ + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) { + ue_report[i]->n_rlc_report = 3; // Set this to the number of LCs for this UE. This needs to be generalized for for LCs + Protocol__FlexRlcBsr ** rlc_reports; + rlc_reports = malloc(sizeof(Protocol__FlexRlcBsr *) * ue_report[i]->n_rlc_report); + if (rlc_reports == NULL) + goto error; + + for (int j = 0; j < ue_report[i]->n_rlc_report; j++) { + rlc_reports[j] = malloc(sizeof(Protocol__FlexRlcBsr)); + if (rlc_reports[j] == NULL) { + for (int k = 0; k < j; k++) { + free(rlc_reports[k]); + } + free(rlc_reports); + goto error; + } + protocol__flex_rlc_bsr__init(rlc_reports[j]); + rlc_reports[j]->lc_id = j+1; + rlc_reports[j]->has_lc_id = 1; + rlc_reports[j]->tx_queue_size = flexran_get_tx_queue_size(mod_id, UE_id, j + 1); + rlc_reports[j]->has_tx_queue_size = 1; + + rlc_reports[j]->tx_queue_hol_delay = flexran_get_hol_delay(mod_id, UE_id, j + 1); + rlc_reports[j]->has_tx_queue_hol_delay = 1; + //TODO:Set retransmission queue size in bytes + rlc_reports[j]->retransmission_queue_size = 10; + rlc_reports[j]->has_retransmission_queue_size = 0; + //TODO:Set retransmission queue head of line delay in ms + rlc_reports[j]->retransmission_queue_hol_delay = 100; + rlc_reports[j]->has_retransmission_queue_hol_delay = 0; + rlc_reports[j]->status_pdu_size = flexran_get_num_pdus_buffer(mod_id, UE_id, j + 1); + rlc_reports[j]->has_status_pdu_size = 1; + + } + if (ue_report[i]->n_rlc_report > 0) + ue_report[i]->rlc_report = rlc_reports; + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS; + } + + /* MAC CE buffer status report */ + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS) { + // TODO: Fill in the actual MAC CE buffer status report + ue_report[i]->pending_mac_ces = (flexran_get_MAC_CE_bitmap_TA(mod_id, UE_id, 0) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; + // Use as bitmap. Set one or more of the; + // PROTOCOL__FLEX_CE_TYPE__FLPCET_ values + // found in stats_common.pb-c.h. See + // flex_ce_type in FlexRAN specification + ue_report[i]->has_pending_mac_ces = 1; + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS; + } + + /* DL CQI report */ + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI) { + // TODO: Fill in the actual DL CQI report for the UE based on its configuration + Protocol__FlexDlCqiReport * dl_report; + dl_report = malloc(sizeof(Protocol__FlexDlCqiReport)); + if (dl_report == NULL) + goto error; + protocol__flex_dl_cqi_report__init(dl_report); + + dl_report->sfn_sn = flexran_get_sfn_sf(mod_id); + dl_report->has_sfn_sn = 1; + dl_report->n_csi_report = flexran_get_active_CC(mod_id, UE_id); + dl_report->n_csi_report = 1 ; + //Create the actual CSI reports. + Protocol__FlexDlCsi **csi_reports; + csi_reports = malloc(sizeof(Protocol__FlexDlCsi *)*dl_report->n_csi_report); + if (csi_reports == NULL) { + free(dl_report); + goto error; + } + for (int j = 0; j < dl_report->n_csi_report; j++) { + csi_reports[j] = malloc(sizeof(Protocol__FlexDlCsi)); + if (csi_reports[j] == NULL) { + for (int k = 0; k < j; k++) { + free(csi_reports[k]); + } + free(csi_reports); + csi_reports = NULL; + goto error; + } + protocol__flex_dl_csi__init(csi_reports[j]); + csi_reports[j]->serv_cell_index = j; + csi_reports[j]->has_serv_cell_index = 1; + csi_reports[j]->ri = flexran_get_current_RI(mod_id, UE_id, j); + csi_reports[j]->has_ri = 1; + //TODO: the type of CSI report based on the configuration of the UE + //For now we only support type P10, which only needs a wideband value + csi_reports[j]->type = PROTOCOL__FLEX_CSI_TYPE__FLCSIT_P10; + csi_reports[j]->has_type = 1; + csi_reports[j]->report_case = PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI; + + if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI) { + Protocol__FlexCsiP10 *csi10; + csi10 = malloc(sizeof(Protocol__FlexCsiP10)); + if (csi10 == NULL) { + for (int k = 0; k <= j; k++) { + free(csi_reports[k]); } + free(csi_reports); + csi_reports = NULL; + goto error; + } + protocol__flex_csi_p10__init(csi10); + csi10->wb_cqi = flexran_get_ue_wcqi(mod_id, UE_id); + csi10->has_wb_cqi = 1; + csi_reports[j]->p10csi = csi10; + } + + /* + else if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P11CSI) { + Protocol__FlexCsiP11 *csi11; + csi11 = malloc(sizeof(Protocol__FlexCsiP11)); + if (csi11 == NULL) { + for (int k = 0; k <= j; k++) { + free(csi_reports[k]); + } + free(csi_reports); + csi_reports = NULL; + goto error; + } + protocol__flex_csi_p11__init(csi11); + + csi11->wb_cqi = malloc(sizeof(csi11->wb_cqi)); + csi11->n_wb_cqi = 1; + csi11->wb_cqi[0] = flexran_get_ue_wcqi (mod_id, UE_id); + // According To spec 36.213 + + if (flexran_get_antenna_ports(mod_id, j) == 2 && csi_reports[j]->ri == 1) { + // TODO PMI + csi11->wb_pmi = flexran_get_ue_wpmi(mod_id, UE_id, 0); + csi11->has_wb_pmi = 1; + + } + + else if (flexran_get_antenna_ports(mod_id, j) == 2 && csi_reports[j]->ri == 2) { + // TODO PMI + csi11->wb_pmi = flexran_get_ue_wpmi(mod_id, UE_id, 0); + csi11->has_wb_pmi = 1; + + } + + else if (flexran_get_antenna_ports(mod_id, j) == 4 && csi_reports[j]->ri == 2) { + // TODO PMI + csi11->wb_pmi = flexran_get_ue_wpmi(mod_id, UE_id, 0); + csi11->has_wb_pmi = 1; + } + + csi11->has_wb_pmi = 0; + csi_reports[j]->p11csi = csi11; + } + else if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P20CSI) { + + Protocol__FlexCsiP20 *csi20; + csi20 = malloc(sizeof(Protocol__FlexCsiP20)); + if (csi20 == NULL) { + for (int k = 0; k <= j; k++) { + free(csi_reports[k]); + } + free(csi_reports); + csi_reports = NULL; + goto error; + } + protocol__flex_csi_p20__init(csi20); + + csi20->wb_cqi = flexran_get_ue_wcqi (mod_id, UE_id); + csi20->has_wb_cqi = 1; + csi20->bandwidth_part_index = 1 ; //TODO + csi20->has_bandwidth_part_index = 0; + csi20->sb_index = 1; //TODO + csi20->has_sb_index = 1; + csi_reports[j]->p20csi = csi20; + } + else if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P21CSI) { + + // Protocol__FlexCsiP21 *csi21; + // csi21 = malloc(sizeof(Protocol__FlexCsiP21)); + // if (csi21 == NULL) + // goto error; + // protocol__flex_csi_p21__init(csi21); + + // csi21->wb_cqi = flexran_get_ue_wcqi (mod_id, UE_id); + + + // csi21->wb_pmi = flexran_get_ue_pmi(mod_id); //TDO inside + // csi21->has_wb_pmi = 1; + + // csi21->sb_cqi = 1; // TODO + + // csi21->bandwidth_part_index = 1 ; //TDO inside + // csi21->has_bandwidth_part_index = 1 ; + + // csi21->sb_index = 1 ;//TODO + // csi21->has_sb_index = 1 ; + + + // csi_reports[j]->p20csi = csi21; + + } + + else if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A12CSI) { + + + // Protocol__FlexCsiA12 *csi12; + // csi12 = malloc(sizeof(Protocol__FlexCsiA12)); + // if (csi12 == NULL) + // goto error; + // protocol__flex_csi_a12__init(csi12); + + // csi12->wb_cqi = flexran_get_ue_wcqi (mod_id, UE_id); + + // csi12->sb_pmi = 1 ; //TODO inside + + // TODO continou + } + + else if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A22CSI) { + + // Protocol__FlexCsiA22 *csi22; + // csi22 = malloc(sizeof(Protocol__FlexCsiA22)); + // if (csi22 == NULL) + // goto error; + // protocol__flex_csi_a22__init(csi22); + + // csi22->wb_cqi = flexran_get_ue_wcqi (mod_id, UE_id); + + // csi22->sb_cqi = 1 ; //TODO inside + + // csi22->wb_pmi = flexran_get_ue_wcqi (mod_id, UE_id); + // csi22->has_wb_pmi = 1; + + // csi22->sb_pmi = 1 ; //TODO inside + // csi22->has_wb_pmi = 1; + + // csi22->sb_list = flexran_get_ue_wcqi (mod_id, UE_id); + + + } + + else if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A20CSI) { + + // Protocol__FlexCsiA20 *csi20; + // csi20 = malloc(sizeof(Protocol__FlexCsiA20)); + // if (csi20 == NULL) + // goto error; + // protocol__flex_csi_a20__init(csi20); + + // csi20->wb_cqi = flexran_get_ue_wcqi (mod_id, UE_id); + // csi20->has_wb_cqi = 1; + + // csi20>sb_cqi = 1 ; //TODO inside + // csi20>has_sb_cqi = 1 ; + + // csi20->sb_list = 1; // TODO inside + + + } + + else if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A30CSI) { + + } + + else if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A31CSI) { + + } + */ + + } + dl_report->csi_report = csi_reports; + ue_report[i]->dl_cqi_report = dl_report; + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI; + } + + /* paging buffer status report */ + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS) { + //TODO: Fill in the actual paging buffer status report. For this field to be valid, the RNTI + //set in the report must be a P-RNTI + Protocol__FlexPagingBufferReport *paging_report; + paging_report = malloc(sizeof(Protocol__FlexPagingBufferReport)); + if (paging_report == NULL) + goto error; + protocol__flex_paging_buffer_report__init(paging_report); + paging_report->n_paging_info = 1; + Protocol__FlexPagingInfo **p_info; + p_info = malloc(sizeof(Protocol__FlexPagingInfo *) * paging_report->n_paging_info); + if (p_info == NULL) { + free(paging_report); + goto error; + } + + for (int j = 0; j < paging_report->n_paging_info; j++) { + + p_info[j] = malloc(sizeof(Protocol__FlexPagingInfo)); + if (p_info[j] == NULL) { + for (int k = 0; k < j; k++) { + free(p_info[k]); + } + free(p_info); + p_info = NULL; + free(paging_report); + goto error; + } + protocol__flex_paging_info__init(p_info[j]); + //TODO: Set paging index. This index is the same that will be used for the scheduling of the + //paging message by the controller + p_info[j]->paging_index = 10; + p_info[j]->has_paging_index = 0; + //TODO:Set the paging message size + p_info[j]->paging_message_size = 100; + p_info[j]->has_paging_message_size = 0; + //TODO: Set the paging subframe + p_info[j]->paging_subframe = 10; + p_info[j]->has_paging_subframe = 0; + //TODO: Set the carrier index for the pending paging message + p_info[j]->carrier_index = 0; + p_info[j]->has_carrier_index = 0; + + } + //Add all paging info to the paging buffer rerport + paging_report->paging_info = p_info; + //Add the paging report to the UE report + ue_report[i]->pbr = paging_report; + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS; + } + + /* Check flag for creation of UL CQI report */ + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI) { + + //Fill in the full UL CQI report of the UE + Protocol__FlexUlCqiReport *full_ul_report; + full_ul_report = malloc(sizeof(Protocol__FlexUlCqiReport)); + if (full_ul_report == NULL) + goto error; + protocol__flex_ul_cqi_report__init(full_ul_report); + full_ul_report->sfn_sn = flexran_get_sfn_sf(mod_id); + full_ul_report->has_sfn_sn = 1; + //TODO:Set the number of UL measurement reports based on the types of measurements + //configured for this UE and on the servCellIndex + full_ul_report->n_cqi_meas = 1; + Protocol__FlexUlCqi **ul_report; + ul_report = malloc(sizeof(Protocol__FlexUlCqi *) * full_ul_report->n_cqi_meas); + if (ul_report == NULL) { + free(full_ul_report); + goto error; + } + //Fill each UL report of the UE for each of the configured report types + for (int j = 0; j < full_ul_report->n_cqi_meas; j++) { + + ul_report[j] = malloc(sizeof(Protocol__FlexUlCqi)); + if (ul_report[j] == NULL) { + for (int k = 0; k < j; k++) { + free(ul_report[k]); + } + free(ul_report); + free(full_ul_report); + goto error; + } + protocol__flex_ul_cqi__init(ul_report[j]); + //TODO: Set the type of the UL report. As an example set it to SRS UL report + ul_report[j]->type = PROTOCOL__FLEX_UL_CQI_TYPE__FLUCT_SRS; + ul_report[j]->has_type = 1; + //TODO:Set the number of SINR measurements based on the report type + ul_report[j]->n_sinr = 0; + uint32_t *sinr_meas; + sinr_meas = (uint32_t *) malloc(sizeof(uint32_t) * ul_report[j]->n_sinr); + if (sinr_meas == NULL) { + for (int k = 0; k < j; k++) { + free(ul_report[k]); + } + free(ul_report); + free(full_ul_report); + goto error; + } + //TODO:Set the SINR measurements for the specified type + for (int k = 0; k < ul_report[j]->n_sinr; k++) { + sinr_meas[k] = 10; + } + ul_report[j]->sinr = sinr_meas; + //TODO: Set the servCellIndex for this report + ul_report[j]->serv_cell_index = 0; + ul_report[j]->has_serv_cell_index = 1; + + //Set the list of UL reports of this UE to the full UL report + full_ul_report->cqi_meas = ul_report; + + full_ul_report->n_pucch_dbm = MAX_NUM_CCs; + full_ul_report->pucch_dbm = malloc(sizeof(Protocol__FlexPucchDbm *) * full_ul_report->n_pucch_dbm); + + for (int j = 0; j < MAX_NUM_CCs; j++) { + + full_ul_report->pucch_dbm[j] = malloc(sizeof(Protocol__FlexPucchDbm)); + protocol__flex_pucch_dbm__init(full_ul_report->pucch_dbm[j]); + full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1; + full_ul_report->pucch_dbm[j]->serv_cell_index = j; + + if (flexran_get_p0_pucch_dbm(mod_id, UE_id, j) != -1) { + full_ul_report->pucch_dbm[j]->p0_pucch_dbm = flexran_get_p0_pucch_dbm(mod_id, UE_id, j); + full_ul_report->pucch_dbm[j]->has_p0_pucch_dbm = 1; + } + } + + + } + // Add full UL CQI report to the UE report + ue_report[i]->ul_cqi_report = full_ul_report; + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI; + + } + if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_STATS) { + + Protocol__FlexMacStats *macstats; + macstats = malloc(sizeof(Protocol__FlexMacStats)); + if (macstats == NULL) + goto error; + protocol__flex_mac_stats__init(macstats); + macstats->total_bytes_sdus_dl = flexran_get_total_size_dl_mac_sdus(mod_id, UE_id, cc_id); + macstats->has_total_bytes_sdus_dl = 1; + macstats->total_bytes_sdus_ul = flexran_get_total_size_ul_mac_sdus(mod_id, UE_id, cc_id); + macstats->has_total_bytes_sdus_ul = 1; + macstats->tbs_dl = flexran_get_TBS_dl(mod_id, UE_id, cc_id); + macstats->has_tbs_dl = 1; + macstats->tbs_ul = flexran_get_TBS_ul(mod_id, UE_id, cc_id); + macstats->has_tbs_ul = 1; + macstats->prb_retx_dl = flexran_get_num_prb_retx_dl_per_ue(mod_id, UE_id, cc_id); + macstats->has_prb_retx_dl = 1; + macstats->prb_retx_ul = flexran_get_num_prb_retx_ul_per_ue(mod_id, UE_id, cc_id); + macstats->has_prb_retx_ul = 1; + macstats->prb_dl = flexran_get_num_prb_dl_tx_per_ue(mod_id, UE_id, cc_id); + macstats->has_prb_dl = 1; + macstats->prb_ul = flexran_get_num_prb_ul_rx_per_ue(mod_id, UE_id, cc_id); + macstats->has_prb_ul = 1; + macstats->mcs1_dl = flexran_get_mcs1_dl(mod_id, UE_id, cc_id); + macstats->has_mcs1_dl = 1; + macstats->mcs2_dl = flexran_get_mcs2_dl(mod_id, UE_id, cc_id); + macstats->has_mcs2_dl = 1; + macstats->mcs1_ul = flexran_get_mcs1_ul(mod_id, UE_id, cc_id); + macstats->has_mcs1_ul = 1; + macstats->mcs2_ul = flexran_get_mcs2_ul(mod_id, UE_id, cc_id); + macstats->has_mcs2_ul = 1; + macstats->total_prb_dl = flexran_get_total_prb_dl_tx_per_ue(mod_id, UE_id, cc_id); + macstats->has_total_prb_dl = 1; + macstats->total_prb_ul = flexran_get_total_prb_ul_rx_per_ue(mod_id, UE_id, cc_id); + macstats->has_total_prb_ul = 1; + macstats->total_pdu_dl = flexran_get_total_num_pdu_dl(mod_id, UE_id, cc_id); + macstats->has_total_pdu_dl = 1; + macstats->total_pdu_ul = flexran_get_total_num_pdu_ul(mod_id, UE_id, cc_id); + macstats->has_total_pdu_ul = 1; + macstats->total_tbs_dl = flexran_get_total_TBS_dl(mod_id, UE_id, cc_id); + macstats->has_total_tbs_dl = 1; + macstats->total_tbs_ul = flexran_get_total_TBS_ul(mod_id, UE_id, cc_id); + macstats->has_total_tbs_ul = 1; + macstats->harq_round = flexran_get_harq_round(mod_id, cc_id, UE_id); + macstats->has_harq_round = 1; + + Protocol__FlexMacSdusDl ** mac_sdus; + mac_sdus = malloc(sizeof(Protocol__FlexMacSdusDl) * flexran_get_num_mac_sdu_tx(mod_id, UE_id, cc_id)); + if (mac_sdus == NULL) { + free(macstats); + goto error; + } + + macstats->n_mac_sdus_dl = flexran_get_num_mac_sdu_tx(mod_id, UE_id, cc_id); + for (int j = 0; j < macstats->n_mac_sdus_dl; j++) { + mac_sdus[j] = malloc(sizeof(Protocol__FlexMacSdusDl)); + protocol__flex_mac_sdus_dl__init(mac_sdus[j]); + mac_sdus[j]->lcid = flexran_get_mac_sdu_lcid_index(mod_id, UE_id, cc_id, j); + mac_sdus[j]->has_lcid = 1; + mac_sdus[j]->sdu_length = flexran_get_mac_sdu_size(mod_id, UE_id, cc_id, mac_sdus[j]->lcid); + mac_sdus[j]->has_sdu_length = 1; + } + macstats->mac_sdus_dl = mac_sdus; + ue_report[i]->mac_stats = macstats; + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_STATS; + } } - return 0; - error: - - if (cell_report != NULL) { - if (n_cc > 0) { - for (i = 0; i < n_cc; i++) { - if (cell_report[i]->noise_inter_report != NULL) { - free(cell_report[i]->noise_inter_report); - cell_report[i]->noise_inter_report = NULL; - } - } - } - free(cell_report); - cell_report = NULL; - } - +error: if (ue_report != NULL) { if (n_ue > 0) { - for (i = 0; i < n_ue; i++) { + for (int i = 0; i < n_ue; i++) { if (ue_report[i]->bsr != NULL) { free(ue_report[i]->bsr); ue_report[i]->bsr = NULL; } if (ue_report[i]->rlc_report != NULL) { - for (j = 0; j < ue_report[i]->n_rlc_report; j++) { + for (int j = 0; j < ue_report[i]->n_rlc_report; j++) { if (ue_report[i]->rlc_report[j] != NULL) { free(ue_report[i]->rlc_report[j]); ue_report[i]->rlc_report[j] = NULL; @@ -742,7 +594,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, } if (ue_report[i]->dl_cqi_report != NULL) { if (ue_report[i]->dl_cqi_report->csi_report != NULL) { - for (j = 0; j < ue_report[i]->dl_cqi_report->n_csi_report; j++) { + for (int j = 0; j < ue_report[i]->dl_cqi_report->n_csi_report; j++) { if (ue_report[i]->dl_cqi_report->csi_report[j] != NULL) { if (ue_report[i]->dl_cqi_report->csi_report[j]->p10csi != NULL) { free(ue_report[i]->dl_cqi_report->csi_report[j]->p10csi); @@ -772,7 +624,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, } if (ue_report[i]->pbr != NULL) { if (ue_report[i]->pbr->paging_info != NULL) { - for (j = 0; j < ue_report[i]->pbr->n_paging_info; j++) { + for (int j = 0; j < ue_report[i]->pbr->n_paging_info; j++) { free(ue_report[i]->pbr->paging_info[j]); ue_report[i]->pbr->paging_info[j] = NULL; } @@ -784,7 +636,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, } if (ue_report[i]->ul_cqi_report != NULL) { if (ue_report[i]->ul_cqi_report->cqi_meas != NULL) { - for (j = 0; j < ue_report[i]->ul_cqi_report->n_cqi_meas; j++) { + for (int j = 0; j < ue_report[i]->ul_cqi_report->n_cqi_meas; j++) { if (ue_report[i]->ul_cqi_report->cqi_meas[j] != NULL) { if (ue_report[i]->ul_cqi_report->cqi_meas[j]->sinr != NULL) { free(ue_report[i]->ul_cqi_report->cqi_meas[j]->sinr); @@ -798,7 +650,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, ue_report[i]->ul_cqi_report->cqi_meas = NULL; } if (ue_report[i]->ul_cqi_report->pucch_dbm != NULL) { - for (j = 0; j < MAX_NUM_CCs; j++) { + for (int j = 0; j < MAX_NUM_CCs; j++) { if (ue_report[i]->ul_cqi_report->pucch_dbm[j] != NULL) { free(ue_report[i]->ul_cqi_report->pucch_dbm[j]); ue_report[i]->ul_cqi_report->pucch_dbm[j] = NULL; @@ -812,7 +664,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, } if (ue_report[i]->mac_stats != NULL) { if (ue_report[i]->mac_stats->mac_sdus_dl != NULL) { - for (j = 0; j < ue_report[i]->mac_stats->n_mac_sdus_dl; j++) { + for (int j = 0; j < ue_report[i]->mac_stats->n_mac_sdus_dl; j++) { if (ue_report[i]->mac_stats->mac_sdus_dl[j] != NULL) { free(ue_report[i]->mac_stats->mac_sdus_dl[j]); ue_report[i]->mac_stats->mac_sdus_dl[j] = NULL; @@ -828,7 +680,49 @@ int flexran_agent_mac_stats_reply(mid_t mod_id, } free(ue_report); } + return -1; +} +int flexran_agent_mac_stats_reply_cell(mid_t mod_id, + Protocol__FlexCellStatsReport **cell_report, + int n_cc, + uint32_t cc_flags) { + for (int i = 0; i < n_cc; i++) { + /* noise and interference report */ + if(cc_flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) { + // TODO: Fill in the actual noise and interference report for this cell + Protocol__FlexNoiseInterferenceReport *ni_report; + ni_report = malloc(sizeof(Protocol__FlexNoiseInterferenceReport)); + if(ni_report == NULL) + goto error; + protocol__flex_noise_interference_report__init(ni_report); + ni_report->sfn_sf = flexran_get_sfn_sf(mod_id); + ni_report->has_sfn_sf = 1; + ni_report->rip = 0; //TODO: Received interference power in dbm + ni_report->has_rip = 0; + ni_report->tnp = 0; //TODO: Thermal noise power in dbm + ni_report->has_tnp = 0; + ni_report->p0_nominal_pucch = flexran_get_p0_nominal_pucch(mod_id, 0); + ni_report->has_p0_nominal_pucch = 1; + cell_report[i]->noise_inter_report = ni_report; + cell_report[i]->flags |= PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE; + } + } + return 0; + + error: + if (cell_report != NULL) { + if (n_cc > 0) { + for (int i = 0; i < n_cc; i++) { + if (cell_report[i]->noise_inter_report != NULL) { + free(cell_report[i]->noise_inter_report); + cell_report[i]->noise_inter_report = NULL; + } + } + } + free(cell_report); + cell_report = NULL; + } return -1; } diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h index 68a572e2b2..2f9f99c740 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h @@ -51,14 +51,15 @@ int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg); int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int flexran_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg); -/* Statistics reply protocol message constructor and destructor */ -int flexran_agent_mac_stats_reply(mid_t mod_id, - Protocol__FlexUeStatsReport **ue_report, - int n_ue, - uint32_t ue_flags, - Protocol__FlexCellStatsReport **cell_report, - int n_cc, - uint32_t cc_flags); +/* Statistics reply protocol message constructors (for UE and cell stats) and destructor */ +int flexran_agent_mac_stats_reply_ue(mid_t mod_id, + Protocol__FlexUeStatsReport **ue_report, + int n_ue, + uint32_t ue_flags); +int flexran_agent_mac_stats_reply_cell(mid_t mod_id, + Protocol__FlexCellStatsReport **cell_report, + int n_cc, + uint32_t cc_flags); int flexran_agent_mac_destroy_stats_reply(Protocol__FlexStatsReply *reply); /* DL MAC scheduling decision protocol message constructor (empty command) and destructor */ diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index 1bae0776a3..7c251e9172 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -297,9 +297,8 @@ int flexran_agent_stats_reply(mid_t enb_id, /* MAC reply split */ if (flexran_agent_get_mac_xface(enb_id) - && flexran_agent_mac_stats_reply(enb_id, - ue_report, n_ue, ue_flags, - cell_report, n_cc, cell_flags) < 0) { + && (flexran_agent_mac_stats_reply_ue(enb_id, ue_report, n_ue, ue_flags) < 0 + || flexran_agent_mac_stats_reply_cell(enb_id, cell_report, n_cc, cell_flags) < 0)) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; goto error; } From a8b4a62b824c959b598b39b23c7cb1f2b6ce1a72 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 20 Sep 2019 19:34:00 +0200 Subject: [PATCH 09/32] Read RU config before FlexRAN to allow split identification --- openair2/ENB_APP/enb_config.c | 2 ++ targets/RT/USER/lte-ru.c | 8 +------- targets/RT/USER/lte-softmodem.c | 20 +++++++++++++++----- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index ef4c328691..c1918d4fee 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -3104,4 +3104,6 @@ void read_config_and_init(void) { memset((void *)RC.rrc[enb_id], 0, sizeof(eNB_RRC_INST)); RCconfig_RRC(enb_id, RC.rrc[enb_id],macrlc_has_f1[enb_id]); } + + RCconfig_flexran(); } diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 459732a30c..f88d98536d 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -2683,13 +2683,9 @@ void init_RU(char *rf_config_file, clock_source_t clock_source, clock_source_t t PHY_VARS_eNB *eNB0 = (PHY_VARS_eNB *)NULL; LTE_DL_FRAME_PARMS *fp = (LTE_DL_FRAME_PARMS *)NULL; // create status mask - RC.ru_mask = 0; + RC.ru_mask= (1 << RC.nb_RU) - 1; pthread_mutex_init(&RC.ru_mutex,NULL); pthread_cond_init(&RC.ru_cond,NULL); - // read in configuration file) - printf("configuring RU from file\n"); - RCconfig_RU(); - LOG_I(PHY,"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",RC.nb_L1_inst,RC.nb_RU,get_nprocs()); if (RC.nb_CC != 0) for (i=0; i 0) { RC.ru = (RU_t **)malloc(RC.nb_RU*sizeof(RU_t *)); - RC.ru_mask=(1< 0) { read_config_and_init(); - /* Start the agent. If it is turned off in the configuration, it won't start */ - RCconfig_flexran(); + } else { + printf("RC.nb_inst = 0, Initializing L1\n"); + RCconfig_L1(); + } + /* We need to read RU configuration before FlexRAN starts so it knows what + * splits to report. Actual RU start comes later. */ + if (RC.nb_RU > 0 && NFAPI_MODE != NFAPI_MODE_VNF) { + RCconfig_RU(); + LOG_I(PHY, + "number of L1 instances %d, number of RU %d, number of CPU cores %d\n", + RC.nb_L1_inst, RC.nb_RU, get_nprocs()); + } + + if (RC.nb_inst > 0) { + /* Start the agent. If it is turned off in the configuration, it won't start */ for (i = 0; i < RC.nb_inst; i++) { flexran_agent_start(i); } @@ -607,9 +620,6 @@ int main ( int argc, char **argv ) itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); } node_type = RC.rrc[0]->node_type; - } else { - printf("RC.nb_inst = 0, Initializing L1\n"); - RCconfig_L1(); } if (RC.nb_inst > 0 && NODE_IS_CU(node_type)) { From d2b1e6aa9ae5a6f62bb5f3beeec17247647da026 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 20 Sep 2019 17:57:27 +0200 Subject: [PATCH 10/32] FlexRAN: report employed splits to controller --- openair2/ENB_APP/MESSAGES/V2/flexran.proto | 9 +++++++ openair2/ENB_APP/flexran_agent_common.c | 2 ++ openair2/ENB_APP/flexran_agent_ran_api.c | 28 ++++++++++++++++++++++ openair2/ENB_APP/flexran_agent_ran_api.h | 6 +++++ 4 files changed, 45 insertions(+) diff --git a/openair2/ENB_APP/MESSAGES/V2/flexran.proto b/openair2/ENB_APP/MESSAGES/V2/flexran.proto index 86f2e9329f..1d87a52b97 100644 --- a/openair2/ENB_APP/MESSAGES/V2/flexran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/flexran.proto @@ -77,10 +77,19 @@ enum flex_bs_capability { RRC = 7; } +enum flex_bs_split { + F1 = 0; + nFAPI = 1; + IF4 = 2; + IF4p5 = 3; + IF5 = 4; +} + message flex_hello { optional flex_header header = 1; optional uint64 bs_id = 2; // Unique id to distinguish the eNB repeated flex_bs_capability capabilities = 3; + repeated flex_bs_split splits = 4; } message flex_echo_request { diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index 552c58555b..fe65315fe9 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -128,6 +128,7 @@ int flexran_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessa hello_msg->bs_id = flexran_get_bs_id(mod_id); hello_msg->has_bs_id = 1; hello_msg->n_capabilities = flexran_get_capabilities(mod_id, &hello_msg->capabilities); + hello_msg->n_splits = flexran_get_splits(mod_id, &hello_msg->splits); *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) @@ -161,6 +162,7 @@ int flexran_agent_destroy_hello(Protocol__FlexranMessage *msg) { free(msg->hello_msg->header); free(msg->hello_msg->capabilities); + free(msg->hello_msg->splits); free(msg->hello_msg); free(msg); return 0; diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index dfac1ae7a0..f479198895 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -3570,3 +3570,31 @@ uint16_t flexran_get_capabilities_mask(mid_t mod_id) { return mask; } + +size_t flexran_get_splits(mid_t mod_id, Protocol__FlexBsSplit **splits) { + size_t n_splits = 0; + *splits = NULL; + if (rrc_is_present(mod_id) && !NODE_IS_MONOLITHIC(RC.rrc[mod_id]->node_type)) + n_splits++; + if (NFAPI_MODE != NFAPI_MONOLITHIC) + n_splits++; + if (RC.ru && RC.ru[mod_id] && RC.ru[mod_id]->if_south != LOCAL_RF) + n_splits++; + if (n_splits == 0) + return 0; + + AssertFatal(n_splits < 3, "illegal number of splits (%lu)\n", n_splits); + *splits = calloc(n_splits, sizeof(Protocol__FlexBsSplit)); + AssertFatal(*splits, "could not allocate Protocol__FlexBsSplit array\n"); + int n = 0; + if (rrc_is_present(mod_id) && !NODE_IS_MONOLITHIC(RC.rrc[mod_id]->node_type)) + (*splits)[n++] = PROTOCOL__FLEX_BS_SPLIT__F1; + if (NFAPI_MODE != NFAPI_MONOLITHIC) + (*splits)[n++] = PROTOCOL__FLEX_BS_SPLIT__nFAPI; + if (RC.ru && RC.ru[mod_id] && RC.ru[mod_id]->if_south == REMOTE_IF4p5) + (*splits)[n++] = PROTOCOL__FLEX_BS_SPLIT__IF4p5; + if (RC.ru && RC.ru[mod_id] && RC.ru[mod_id]->if_south == REMOTE_IF5) + (*splits)[n++] = PROTOCOL__FLEX_BS_SPLIT__IF5; + DevAssert(n == n_splits); + return n_splits; +} diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h index f9d0d97405..6aef1c406b 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ b/openair2/ENB_APP/flexran_agent_ran_api.h @@ -44,6 +44,7 @@ #include "RRC/LTE/rrc_eNB_UE_context.h" #include "PHY/phy_extern.h" #include "common/utils/LOG/log.h" +#include "nfapi/oai_integration/vendor_ext.h" /**************************** * get generic info from RAN @@ -815,3 +816,8 @@ size_t flexran_get_capabilities(mid_t mod_id, Protocol__FlexBsCapability **caps) /* get the capabilities supported by the underlying network function as a bit * mask. */ uint16_t flexran_get_capabilities_mask(mid_t mod_id); + +/* get the splits used by the underlying network function, + * return the number and stores list of this length in splits. If there are + * zero capabilities, splits will be NULL */ +size_t flexran_get_splits(mid_t mod_id, Protocol__FlexBsSplit **splits); From 6a581d903bd156c344370887e7360fe53e0535b0 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sun, 24 Mar 2019 14:17:23 +0100 Subject: [PATCH 11/32] Add FlexRAN protobuf definition for S1AP --- .../ENB_APP/MESSAGES/V2/config_common.proto | 32 +++++++++++++++++++ .../ENB_APP/MESSAGES/V2/config_messages.proto | 12 +++++-- openair2/ENB_APP/MESSAGES/V2/flexran.proto | 1 + 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/config_common.proto b/openair2/ENB_APP/MESSAGES/V2/config_common.proto index 4958cdb27b..c87e589d89 100644 --- a/openair2/ENB_APP/MESSAGES/V2/config_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/config_common.proto @@ -336,3 +336,35 @@ message flex_a5_event { optional int64 time_to_trigger = 4; optional int64 max_report_cells = 5; } + +// +// S1AP cell configuration +// +message flex_gummei { + optional flex_plmn plmn = 1; + optional uint32 mme_group_id = 2; + optional uint32 mme_code = 3; +} + +message flex_s1ap_mme { + optional string s1_ip = 1; // S1-MME IP of MME + optional string name = 2; // S1-MME name of MME + optional flex_mme_state state = 3; // State of the MME + repeated flex_gummei served_gummeis = 4; // GUMMEIs served by the MME + repeated flex_plmn requested_plmns = 5; // PLMNs communicated to MME + optional uint32 rel_capacity = 6; // Relative MME capacity, TS23.401 +} + +message flex_s1ap_ue { + optional string mme_s1_ip = 1; // IP of MME to which UE is connected + optional uint32 enb_ue_s1ap_id = 2; // S1AP ID on eNodeB side for UE + optional uint32 mme_ue_s1ap_id = 3; // S1AP ID on MME side for UE + optional flex_plmn selected_plmn = 4; // UE-selected PLMN in RRC Conn Setup Cplt +} + +enum flex_mme_state { + FLMMES_DISCONNECTED = 0; + FLMMES_WAITING = 1; + FLMMES_CONNECTED = 2; + FLMMES_OVERLOAD = 3; +} diff --git a/openair2/ENB_APP/MESSAGES/V2/config_messages.proto b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto index 6d24e5a0ac..4d8c628c4f 100644 --- a/openair2/ENB_APP/MESSAGES/V2/config_messages.proto +++ b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto @@ -100,6 +100,7 @@ message flex_ue_config { optional uint32 ul_slice_id = 32; // Configuration about RRC measurements optional flex_measurement_info info = 33; + optional uint32 enb_ue_s1ap_id = 34; // S1AP ID on eNodeB side } message flex_lc_ue_config { @@ -107,6 +108,11 @@ message flex_lc_ue_config { repeated flex_lc_config lc_config = 2; // A list of LC configurations for the given UE } - - - +message flex_s1ap_config { + optional uint32 pending = 1; // number of pending (to be connected) MMEs + optional uint32 connected = 2; // number of connected MMEs + optional string enb_s1_ip = 3; // S1-MME IP of eNodeB + optional string enb_name = 4; // S1-MME name of eNodeB + repeated flex_s1ap_mme mme = 5; + repeated flex_s1ap_ue ue = 6; +} diff --git a/openair2/ENB_APP/MESSAGES/V2/flexran.proto b/openair2/ENB_APP/MESSAGES/V2/flexran.proto index 1d87a52b97..24a219a564 100644 --- a/openair2/ENB_APP/MESSAGES/V2/flexran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/flexran.proto @@ -156,6 +156,7 @@ message flex_enb_config_reply { optional flex_header header = 1; repeated flex_cell_config cell_config = 3; optional uint32 device_spec = 4; + optional flex_s1ap_config s1ap = 5; } message flex_ue_config_request { From 44fdb23f153543e6a5422f0c5cb19ea48972d1df Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sun, 24 Mar 2019 14:34:04 +0100 Subject: [PATCH 12/32] FlexRAN: fix RRC protobuf definition --- openair2/ENB_APP/MESSAGES/V2/stats_common.proto | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto index b56ad8eea1..20f0f60a9f 100644 --- a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto @@ -1,6 +1,8 @@ syntax = "proto2"; package protocol; +import "config_common.proto"; // for flex_plmn + // // UE related statistics // @@ -218,25 +220,16 @@ message flex_eutra_cgi_measurements { // Tracking area code of the neighbor cell. optional uint32 tracking_area_code = 2; // Public land mobile network identifiers of neighbor cell. - repeated flex_plmn_identity plmn_id = 3; + repeated flex_plmn plmn = 3; } message flex_cell_global_eutra_id { // Public land mobile network identifier of neighbor cell. - optional flex_plmn_identity plmn_id = 1; + optional flex_plmn plmn = 1; // Cell identifier of neighbor cell. optional uint32 cell_id = 2; } -message flex_plmn_identity { - // Mobile Network Code (MNC). - repeated uint32 mnc = 1; - // Mobile Country Code (MCC). - repeated uint32 mcc = 2; - // tracking area code - repeated uint32 tac = 3; -} - message flex_eutra_ref_signal_meas { // Neighboring Cell RSRP optional int32 rsrp = 1; From a87220d376123138761731f1825f7a4a3b4f2dfa Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sun, 24 Mar 2019 15:15:57 +0100 Subject: [PATCH 13/32] Add S1AP control module for FlexRAN with status monitoring support --- cmake_targets/CMakeLists.txt | 2 + .../CONTROL_MODULES/S1AP/flexran_agent_s1ap.c | 161 +++++++++++++ .../CONTROL_MODULES/S1AP/flexran_agent_s1ap.h | 69 ++++++ .../S1AP/flexran_agent_s1ap_defs.h | 32 +++ .../ENB_APP/MESSAGES/V2/config_common.proto | 7 - .../ENB_APP/MESSAGES/V2/config_messages.proto | 12 +- openair2/ENB_APP/MESSAGES/V2/flexran.proto | 1 + .../ENB_APP/MESSAGES/V2/stats_common.proto | 12 + .../ENB_APP/MESSAGES/V2/stats_messages.proto | 2 + openair2/ENB_APP/flexran_agent.c | 12 +- openair2/ENB_APP/flexran_agent.h | 1 + openair2/ENB_APP/flexran_agent_common.c | 11 +- openair2/ENB_APP/flexran_agent_defs.h | 1 + openair2/ENB_APP/flexran_agent_extern.h | 4 + openair2/ENB_APP/flexran_agent_handler.c | 11 + openair2/ENB_APP/flexran_agent_ran_api.c | 219 +++++++++++++++++- openair2/ENB_APP/flexran_agent_ran_api.h | 30 ++- openair3/S1AP/s1ap_eNB.c | 8 +- openair3/S1AP/s1ap_eNB_defs.h | 6 + openair3/S1AP/s1ap_eNB_nas_procedures.c | 2 +- 20 files changed, 573 insertions(+), 30 deletions(-) create mode 100644 openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap.c create mode 100644 openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap.h create mode 100644 openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap_defs.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index f5392acf5d..315510519c 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -923,6 +923,7 @@ include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PHY") include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC") include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC") include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PDCP") +include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/S1AP") include_directories("${OPENAIR2_DIR}/UTIL/OSA") include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc") include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc") @@ -1016,6 +1017,7 @@ add_library(FLEXRAN_AGENT ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_internal.c ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c + ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_task_manager.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_net_comm.c diff --git a/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap.c b/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap.c new file mode 100644 index 0000000000..04a47406e1 --- /dev/null +++ b/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap.c @@ -0,0 +1,161 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file flexran_agent_s1ap.c + * \brief FlexRAN agent Control Module S1AP + * \author Navid Nikaein + * \date 2019 + * \version 0.1 + */ + +#include "flexran_agent_s1ap.h" + + +/*Array containing the Agent-S1AP interfaces*/ +AGENT_S1AP_xface *agent_s1ap_xface[NUM_MAX_ENB]; + +void flexran_agent_fill_s1ap_cell_config(mid_t mod_id, + Protocol__FlexS1apConfig **s1ap_config) { + *s1ap_config = malloc(sizeof(Protocol__FlexS1apConfig)); + if (!*s1ap_config) return; + protocol__flex_s1ap_config__init(*s1ap_config); + LOG_D(FLEXRAN_AGENT, "flexran_agent_fill_s1ap_cell_config %d\n", mod_id); + + // S1AP status + (*s1ap_config)->has_pending = 1; + (*s1ap_config)->pending = flexran_get_s1ap_mme_pending(mod_id); + + (*s1ap_config)->has_connected = 1; + (*s1ap_config)->connected = flexran_get_s1ap_mme_connected(mod_id); + + (*s1ap_config)->enb_s1_ip = flexran_get_s1ap_enb_s1_ip(mod_id); + if (!(*s1ap_config)->enb_s1_ip) + (*s1ap_config)->enb_s1_ip = ""; + + (*s1ap_config)->enb_name = flexran_get_s1ap_enb_name(mod_id); + + (*s1ap_config)->mme = NULL; + (*s1ap_config)->n_mme = flexran_get_s1ap_nb_mme(mod_id); + if ((*s1ap_config)->n_mme > 0) { + Protocol__FlexS1apMme **mme_conf = calloc((*s1ap_config)->n_mme, + sizeof(Protocol__FlexS1apMme *)); + AssertFatal(mme_conf, "%s(): MME malloc failed\n", __func__); + for(int i = 0; i < (*s1ap_config)->n_mme; i++){ + mme_conf[i] = malloc(sizeof(Protocol__FlexS1apMme)); + AssertFatal(mme_conf[i], "%s(): MME malloc failed\n", __func__); + protocol__flex_s1ap_mme__init(mme_conf[i]); + if (flexran_get_s1ap_mme_conf(mod_id, i, mme_conf[i]) < 0) { + LOG_E(FLEXRAN_AGENT, + "error in flexran_get_s1ap_mme_conf(): cannot retrieve MME state\n"); + (*s1ap_config)->n_mme = 0; + break; + } + } + (*s1ap_config)->mme = mme_conf; + } +} + +int flexran_agent_s1ap_stats_reply(mid_t mod_id, + Protocol__FlexUeStatsReport **ue_report, + int n_ue, + uint32_t ue_flags) { + if (n_ue <= 0) + return 0; + if (!(ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_S1AP_STATS)) + return 0; + + for (int i = 0; i < n_ue; i++) { + const rnti_t rnti = ue_report[i]->rnti; + Protocol__FlexS1apUe *ue = malloc(sizeof(Protocol__FlexS1apUe)); + AssertFatal(ue, "%s(): MME malloc failed\n", __func__); + protocol__flex_s1ap_ue__init(ue); + if (flexran_get_s1ap_ue(mod_id, rnti, ue) < 0) { + LOG_E(FLEXRAN_AGENT, "error in %s(): cannot retrieve UE conf\n", __func__); + break; + } + ue_report[i]->s1ap_stats = ue; + ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_S1AP_STATS; + } + return 0; +} + +void flexran_agent_free_s1ap_cell_config(Protocol__FlexS1apConfig **s1ap) { + for (int i = 0; i < (*s1ap)->n_mme; i++) { + /* following structures allocated in the RAN API */ + for(int j = 0; j < (*s1ap)->mme[i]->n_served_gummeis; j++) { + free((*s1ap)->mme[i]->served_gummeis[j]->plmn); + free((*s1ap)->mme[i]->served_gummeis[j]); + } + free((*s1ap)->mme[i]->served_gummeis); + for (int j = 0; j < (*s1ap)->mme[i]->n_requested_plmns; j++) + free((*s1ap)->mme[i]->requested_plmns[j]); + free((*s1ap)->mme[i]->requested_plmns); + free((*s1ap)->mme[i]); + } + free((*s1ap)->mme); + free(*s1ap); + *s1ap = NULL; +} + +void flexran_agent_s1ap_destroy_stats_reply(Protocol__FlexStatsReply *reply) { + for (int i = 0; i < reply->n_ue_report; ++i) { + if (!reply->ue_report[i]->s1ap_stats) + continue; + free(reply->ue_report[i]->s1ap_stats->selected_plmn); + free(reply->ue_report[i]->s1ap_stats); + reply->ue_report[i]->s1ap_stats = NULL; + } +} + +int flexran_agent_register_s1ap_xface(mid_t mod_id) { + if (agent_s1ap_xface[mod_id]) { + LOG_E(FLEXRAN_AGENT, "S1AP agent CM for eNB %d is already registered\n", mod_id); + return -1; + } + + AGENT_S1AP_xface *xface = malloc(sizeof(AGENT_S1AP_xface)); + if (!xface) { + LOG_E(FLEXRAN_AGENT, "could not allocate memory for S1AP agent xface %d\n", mod_id); + return -1; + } + + // not implemented yet + xface->flexran_s1ap_notify_release_request=NULL; + + agent_s1ap_xface[mod_id] = xface; + + return 0; +} + +int flexran_agent_unregister_s1ap_xface(mid_t mod_id) { + if (!agent_s1ap_xface[mod_id]) { + LOG_E(FLEXRAN_AGENT, "S1AP agent for eNB %d is not registered\n", mod_id); + return -1; + } + agent_s1ap_xface[mod_id]->flexran_s1ap_notify_release_request=NULL; + free(agent_s1ap_xface[mod_id]); + agent_s1ap_xface[mod_id] = NULL; + return 0; +} + +AGENT_S1AP_xface *flexran_agent_get_s1ap_xface(mid_t mod_id) { + return agent_s1ap_xface[mod_id]; +} diff --git a/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap.h b/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap.h new file mode 100644 index 0000000000..1cca6ac9c1 --- /dev/null +++ b/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap.h @@ -0,0 +1,69 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file flexran_agent_s1ap.h + * \brief FlexRAN agent S1AP Control Module + * \author navid nikaein + * \date 2017 + * \version 0.1 + */ + +#ifndef FLEXRAN_AGENT_S1AP_H_ +#define FLEXRAN_AGENT_S1AP_H_ + +#include "header.pb-c.h" +#include "flexran.pb-c.h" +#include "stats_messages.pb-c.h" +#include "stats_common.pb-c.h" + + +#include "flexran_agent_common.h" +#include "flexran_agent_defs.h" +#include "flexran_agent_s1ap_defs.h" +#include "flexran_agent_ran_api.h" + +/*************************************** + * FlexRAN agent - technology S1AP API * + ***************************************/ + +/* Send to the controller all the S1AP configs */ +void flexran_agent_fill_s1ap_cell_config(mid_t mod_id, + Protocol__FlexS1apConfig **s1ap_config); + +/* Free allocated S1AP cell configs */ +void flexran_agent_free_s1ap_cell_config(Protocol__FlexS1apConfig **s1ap); + +/* Fill the stats message for S1AP */ +int flexran_agent_s1ap_stats_reply(mid_t mod_id, + Protocol__FlexUeStatsReport **ue_report, + int n_ue, + uint32_t ue_flags); + +/* Free allocated S1AP stats message */ +void flexran_agent_s1ap_destroy_stats_reply(Protocol__FlexStatsReply *reply); + +/* Register technology specific interface callbacks */ +int flexran_agent_register_s1ap_xface(mid_t mod_id); + +/* Unregister technology specific callbacks */ +int flexran_agent_unregister_s1ap_xface(mid_t mod_id); + +#endif diff --git a/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap_defs.h b/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap_defs.h new file mode 100644 index 0000000000..bbbc75160d --- /dev/null +++ b/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap_defs.h @@ -0,0 +1,32 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ +#ifndef __FLEXRAN_AGENT_S1AP_PRIMITIVES_H__ +#define __FLEXRAN_AGENT_S1AP_PRIMITIVES_H__ + +#include "flexran_agent_defs.h" + +/* FLEXRAN AGENT-S1AP Interface */ +typedef struct { + // S1AP statistics + void (*flexran_s1ap_notify_release_request)(mid_t mod_id); +} AGENT_S1AP_xface; + +#endif diff --git a/openair2/ENB_APP/MESSAGES/V2/config_common.proto b/openair2/ENB_APP/MESSAGES/V2/config_common.proto index c87e589d89..733d883c92 100644 --- a/openair2/ENB_APP/MESSAGES/V2/config_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/config_common.proto @@ -355,13 +355,6 @@ message flex_s1ap_mme { optional uint32 rel_capacity = 6; // Relative MME capacity, TS23.401 } -message flex_s1ap_ue { - optional string mme_s1_ip = 1; // IP of MME to which UE is connected - optional uint32 enb_ue_s1ap_id = 2; // S1AP ID on eNodeB side for UE - optional uint32 mme_ue_s1ap_id = 3; // S1AP ID on MME side for UE - optional flex_plmn selected_plmn = 4; // UE-selected PLMN in RRC Conn Setup Cplt -} - enum flex_mme_state { FLMMES_DISCONNECTED = 0; FLMMES_WAITING = 1; diff --git a/openair2/ENB_APP/MESSAGES/V2/config_messages.proto b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto index 4d8c628c4f..324153613d 100644 --- a/openair2/ENB_APP/MESSAGES/V2/config_messages.proto +++ b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto @@ -100,7 +100,6 @@ message flex_ue_config { optional uint32 ul_slice_id = 32; // Configuration about RRC measurements optional flex_measurement_info info = 33; - optional uint32 enb_ue_s1ap_id = 34; // S1AP ID on eNodeB side } message flex_lc_ue_config { @@ -109,10 +108,9 @@ message flex_lc_ue_config { } message flex_s1ap_config { - optional uint32 pending = 1; // number of pending (to be connected) MMEs - optional uint32 connected = 2; // number of connected MMEs - optional string enb_s1_ip = 3; // S1-MME IP of eNodeB - optional string enb_name = 4; // S1-MME name of eNodeB - repeated flex_s1ap_mme mme = 5; - repeated flex_s1ap_ue ue = 6; + optional uint32 pending = 1; // number of pending (to be connected) MMEs + optional uint32 connected = 2; // number of connected MMEs + optional string enb_s1_ip = 3; // S1-MME IP of eNodeB + optional string enb_name = 4; // S1-MME name of eNodeB + repeated flex_s1ap_mme mme = 5; } diff --git a/openair2/ENB_APP/MESSAGES/V2/flexran.proto b/openair2/ENB_APP/MESSAGES/V2/flexran.proto index 24a219a564..e2ced1dac7 100644 --- a/openair2/ENB_APP/MESSAGES/V2/flexran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/flexran.proto @@ -75,6 +75,7 @@ enum flex_bs_capability { PDCP = 5; SDAP = 6; RRC = 7; + S1AP = 8; } enum flex_bs_split { diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto index 20f0f60a9f..62bd06d707 100644 --- a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto @@ -310,3 +310,15 @@ message flex_gtp_stats { optional uint32 teid_sgw = 4; optional string addr_sgw = 5; } + +// +// S1AP stats +// + +message flex_s1ap_ue { + optional string mme_s1_ip = 1; // IP of MME to which UE is connected + optional uint32 enb_ue_s1ap_id = 2; // S1AP ID on eNodeB side for UE + optional uint32 mme_ue_s1ap_id = 3; // S1AP ID on MME side for UE + optional flex_plmn selected_plmn = 4; // UE-selected PLMN in RRC Conn Setup Cplt +} + diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto b/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto index 7cceb04a01..6f67648d82 100644 --- a/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto +++ b/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto @@ -51,6 +51,7 @@ message flex_ue_stats_report { optional flex_pdcp_stats pdcp_stats = 11; optional flex_mac_stats mac_stats = 12; repeated flex_gtp_stats gtp_stats = 13; + optional flex_s1ap_ue s1ap_stats = 14; } // @@ -91,6 +92,7 @@ enum flex_ue_stats_type { FLUST_PDCP_STATS = 1024; FLUST_GTP_STATS = 2048; + FLUST_S1AP_STATS = 4096; FLUST_RRC_MEASUREMENTS = 65536; // To be extended with more types of stats diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index a8ee9b98e8..519d2bef4b 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -177,8 +177,8 @@ int flexran_agent_start(mid_t mod_id) /* Register and initialize the control modules depending on capabilities. * After registering, calling flexran_agent_get_*_xface() tells whether a * control module is operational */ - uint16_t caps = flexran_get_capabilities_mask(mod_id); - LOG_I(FLEXRAN_AGENT, "Agent handles BS ID %ld, capabilities=0x%x => handling%s%s%s%s%s%s%s%s\n", + uint32_t caps = flexran_get_capabilities_mask(mod_id); + LOG_I(FLEXRAN_AGENT, "Agent handles BS ID %ld, capabilities=0x%x => handling%s%s%s%s%s%s%s%s%s\n", flexran_get_bs_id(mod_id), caps, FLEXRAN_CAP_LOPHY(caps) ? " LOPHY" : "", FLEXRAN_CAP_HIPHY(caps) ? " HIPHY" : "", @@ -187,7 +187,8 @@ int flexran_agent_start(mid_t mod_id) FLEXRAN_CAP_RLC(caps) ? " RLC" : "", FLEXRAN_CAP_PDCP(caps) ? " PDCP" : "", FLEXRAN_CAP_SDAP(caps) ? " SDAP" : "", - FLEXRAN_CAP_RRC(caps) ? " RRC" : ""); + FLEXRAN_CAP_RRC(caps) ? " RRC" : "", + FLEXRAN_CAP_S1AP(caps) ? " S1AP" : ""); if (FLEXRAN_CAP_LOPHY(caps) || FLEXRAN_CAP_HIPHY(caps)) { flexran_agent_register_phy_xface(mod_id); @@ -210,6 +211,11 @@ int flexran_agent_start(mid_t mod_id) LOG_I(FLEXRAN_AGENT, "registered PDCP interface/CM for eNB %d\n", mod_id); } + if (FLEXRAN_CAP_S1AP(caps)) { + flexran_agent_register_s1ap_xface(mod_id); + LOG_I(FLEXRAN_AGENT, "registered S1AP interface/CM for eNB %d\n", mod_id); + } + /* * initilize a timer */ diff --git a/openair2/ENB_APP/flexran_agent.h b/openair2/ENB_APP/flexran_agent.h index e50a2be4f6..42295fc111 100644 --- a/openair2/ENB_APP/flexran_agent.h +++ b/openair2/ENB_APP/flexran_agent.h @@ -40,6 +40,7 @@ #include "flexran_agent_mac.h" #include "flexran_agent_rrc.h" #include "flexran_agent_pdcp.h" +#include "flexran_agent_s1ap.h" #include "common/utils/LOG/log.h" #include "assertions.h" diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index fe65315fe9..ef428b7be5 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -21,7 +21,7 @@ /*! \file flexran_agent_common.c * \brief common primitives for all agents - * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein, shahab SHARIAT BAGHERI + * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2017 * \version 0.1 */ @@ -38,6 +38,7 @@ #include "flexran_agent_phy.h" #include "flexran_agent_mac.h" #include "flexran_agent_rrc.h" +#include "flexran_agent_s1ap.h" //#include "PHY/extern.h" #include "common/utils/LOG/log.h" #include "flexran_agent_mac_internal.h" @@ -339,6 +340,9 @@ int flexran_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg) { free(reply->cell_config[i]); } + + if (reply->s1ap) + flexran_agent_free_s1ap_cell_config(&reply->s1ap); free(reply->cell_config); free(reply); @@ -757,9 +761,12 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F cell_conf[i]->carrier_index = i; cell_conf[i]->has_carrier_index = 1; } - + enb_config_reply_msg->cell_config=cell_conf; } + + if (flexran_agent_get_s1ap_xface(mod_id)) + flexran_agent_fill_s1ap_cell_config(mod_id, &enb_config_reply_msg->s1ap); *msg = malloc(sizeof(Protocol__FlexranMessage)); diff --git a/openair2/ENB_APP/flexran_agent_defs.h b/openair2/ENB_APP/flexran_agent_defs.h index 20aac5f56e..bc1976abd9 100644 --- a/openair2/ENB_APP/flexran_agent_defs.h +++ b/openair2/ENB_APP/flexran_agent_defs.h @@ -116,6 +116,7 @@ typedef int32_t err_code_t; #define FLEXRAN_CAP_PDCP(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__PDCP)) > 0) #define FLEXRAN_CAP_SDAP(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__SDAP)) > 0) #define FLEXRAN_CAP_RRC(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__RRC)) > 0) +#define FLEXRAN_CAP_S1AP(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__S1AP)) > 0) typedef enum { ENB_NORMAL_OPERATION = 0x0, diff --git a/openair2/ENB_APP/flexran_agent_extern.h b/openair2/ENB_APP/flexran_agent_extern.h index e1dec8506c..119bc3d44c 100644 --- a/openair2/ENB_APP/flexran_agent_extern.h +++ b/openair2/ENB_APP/flexran_agent_extern.h @@ -35,6 +35,7 @@ #include "flexran_agent_mac_defs.h" #include "flexran_agent_rrc_defs.h" #include "flexran_agent_pdcp_defs.h" +#include "flexran_agent_s1ap_defs.h" /* Control module interface for the communication of the PHY control module with the agent */ AGENT_PHY_xface *flexran_agent_get_phy_xface(mid_t mod_id); @@ -48,6 +49,9 @@ AGENT_RRC_xface *flexran_agent_get_rrc_xface(mid_t mod_id); /* Control module interface for the communication of the RRC Control Module with the agent */ AGENT_PDCP_xface *flexran_agent_get_pdcp_xface(mid_t mod_id); +/* Control module interface for the communication of the S1AP Control Module with the agent */ +AGENT_S1AP_xface *flexran_agent_get_s1ap_xface(mid_t mod_id); + /* Requried to know which UEs had a harq updated over some subframe */ extern int harq_pid_updated[NUM_MAX_UE][8]; extern int harq_pid_round[NUM_MAX_UE][8]; diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index 7c251e9172..d991078cf7 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -31,6 +31,7 @@ #include "flexran_agent_mac.h" #include "flexran_agent_rrc.h" #include "flexran_agent_pdcp.h" +#include "flexran_agent_s1ap.h" #include "flexran_agent_timer.h" #include "flexran_agent_ran_api.h" #include "common/utils/LOG/log.h" @@ -324,6 +325,14 @@ int flexran_agent_stats_reply(mid_t enb_id, goto error; } + /* S1AP statistics, depends on RRC to find S1AP ID */ + if (flexran_agent_get_rrc_xface(enb_id) + && flexran_agent_get_s1ap_xface(enb_id) + && flexran_agent_s1ap_stats_reply(enb_id, ue_report, n_ue, ue_flags) < 0) { + err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; + goto error; + } + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) { goto error; } @@ -523,6 +532,8 @@ int flexran_agent_destroy_stats_reply(Protocol__FlexranMessage *msg) flexran_agent_mac_destroy_stats_reply(msg->stats_reply_msg); flexran_agent_rrc_destroy_stats_reply(msg->stats_reply_msg); flexran_agent_pdcp_destroy_stats_reply(msg->stats_reply_msg); + flexran_agent_rrc_gtp_destroy_stats_reply(msg->stats_reply_msg); + flexran_agent_s1ap_destroy_stats_reply(msg->stats_reply_msg); for (int i = 0; i < msg->stats_reply_msg->n_cell_report; ++i) free(msg->stats_reply_msg->cell_report[i]); for (int i = 0; i < msg->stats_reply_msg->n_ue_report; ++i) diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index f479198895..a66081d99f 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -28,6 +28,8 @@ #include #include "flexran_agent_ran_api.h" +#include "s1ap_eNB_ue_context.h" +#include "s1ap_eNB_management_procedures.h" static inline int phy_is_present(mid_t mod_id, uint8_t cc_id) { return RC.eNB && RC.eNB[mod_id] && RC.eNB[mod_id][cc_id]; @@ -3002,6 +3004,14 @@ int flexran_agent_rrc_gtp_get_teid_sgw(mid_t mod_id, rnti_t rnti, int index) { return ue_context_p->ue_context.e_rab[index].param.gtp_teid; } +uint32_t flexran_get_rrc_enb_ue_s1ap_id(mid_t mod_id, rnti_t rnti) +{ + if (!rrc_is_present(mod_id)) return 0; + struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); + if (!ue_context_p) return -1; + return ue_context_p->ue_context.eNB_ue_s1ap_id; +} + /**************************** SLICING ****************************/ int flexran_get_ue_dl_slice_id(mid_t mod_id, mid_t ue_id) { if (!mac_is_present(mod_id)) return -1; @@ -3470,6 +3480,195 @@ int flexran_set_ul_slice_scheduler(mid_t mod_id, int slice_idx, char *name) { return RC.mac[mod_id]->slice_info.ul[slice_idx].sched_cb != NULL; } +/************************** S1AP **************************/ +int flexran_get_s1ap_mme_pending(mid_t mod_id){ + if (!rrc_is_present(mod_id)) return -1; + s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); + if (!s1ap) return -1; + return s1ap->s1ap_mme_pending_nb; +} + +int flexran_get_s1ap_mme_connected(mid_t mod_id){ + if (!rrc_is_present(mod_id)) return -1; + s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); + if (!s1ap) return -1; + return s1ap->s1ap_mme_associated_nb; +} + +char* flexran_get_s1ap_enb_s1_ip(mid_t mod_id){ + if (!rrc_is_present(mod_id)) return NULL; + s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); + if (!s1ap) return NULL; + if (s1ap->eNB_s1_ip.ipv4) + return &s1ap->eNB_s1_ip.ipv4_address[0]; + if (s1ap->eNB_s1_ip.ipv6) + return &s1ap->eNB_s1_ip.ipv6_address[0]; + return NULL; +} + +char* flexran_get_s1ap_enb_name(mid_t mod_id){ + if (!rrc_is_present(mod_id)) return NULL; + s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); + if (!s1ap) return NULL; + return s1ap->eNB_name; +} + +int flexran_get_s1ap_nb_mme(mid_t mod_id) { + s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); + if (!s1ap) return 0; + struct s1ap_eNB_mme_data_s *mme = NULL; + int count = 0; + RB_FOREACH(mme, s1ap_mme_map, &s1ap->s1ap_mme_head) { + count++; + } + return count; +} + +int flexran_get_s1ap_nb_ue(mid_t mod_id) { + s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); + if (!s1ap) return 0; + struct s1ap_eNB_ue_context_s *ue = NULL; + int count = 0; + RB_FOREACH(ue, s1ap_ue_map, &s1ap->s1ap_ue_head) { + count++; + } + return count; +} + +int flexran_get_s1ap_mme_conf(mid_t mod_id, mid_t mme_index, Protocol__FlexS1apMme * mme_conf){ + if (!rrc_is_present(mod_id)) return -1; + s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); + if (!s1ap) return -1; + + struct served_gummei_s *gummei_p = NULL; + struct plmn_identity_s *served_plmn_p = NULL; + struct served_group_id_s *group_id_p = NULL; + struct mme_code_s *mme_code_p = NULL; + int i = 0; + Protocol__FlexGummei **served_gummeis; + Protocol__FlexPlmn **requested_plmns; + + struct s1ap_eNB_mme_data_s *mme = NULL; + + RB_FOREACH(mme, s1ap_mme_map, &s1ap->s1ap_mme_head){ + if (mme_index == 0) break; + mme_index--; + } + if (mme_index > 0) return -1; + + if (mme->mme_s1_ip.ipv4) { + mme_conf->s1_ip = (char*) &mme->mme_s1_ip.ipv4_address[0]; + } else if (mme->mme_s1_ip.ipv6) { + mme_conf->s1_ip = (char*) &mme->mme_s1_ip.ipv6_address[0]; + } + mme_conf->name = mme->mme_name; + mme_conf->has_state = 1; + mme_conf->state = mme->state; + + mme_conf->n_served_gummeis = 0; + STAILQ_FOREACH(gummei_p, &mme->served_gummei, next) { + mme_conf->n_served_gummeis++; + } + if (mme_conf->n_served_gummeis > 0) { + served_gummeis = calloc(mme_conf->n_served_gummeis, sizeof(Protocol__FlexGummei*)); + if(served_gummeis == NULL) return -1; + + STAILQ_FOREACH(gummei_p, &mme->served_gummei, next) { + served_plmn_p = STAILQ_FIRST(&gummei_p->served_plmns); + group_id_p = STAILQ_FIRST(&gummei_p->served_group_ids); + mme_code_p = STAILQ_FIRST(&gummei_p->mme_codes); + + served_gummeis[i] = malloc(sizeof(Protocol__FlexGummei)); + if (!served_gummeis[i]) return -1; + protocol__flex_gummei__init(served_gummeis[i]); + served_gummeis[i]->plmn = malloc(sizeof(Protocol__FlexPlmn)); + if (!served_gummeis[i]->plmn) return -1; + protocol__flex_plmn__init(served_gummeis[i]->plmn); + + if (served_plmn_p) { + served_gummeis[i]->plmn->has_mcc = 1; + served_gummeis[i]->plmn->mcc = served_plmn_p->mcc; + served_gummeis[i]->plmn->has_mnc = 1; + served_gummeis[i]->plmn->mnc = served_plmn_p->mnc; + served_gummeis[i]->plmn->has_mnc_length = 1; + served_gummeis[i]->plmn->mnc_length = served_plmn_p-> mnc_digit_length; + STAILQ_NEXT(served_plmn_p, next); + } + if (group_id_p) { + served_gummeis[i]->has_mme_group_id = 1; + served_gummeis[i]->mme_group_id = group_id_p->mme_group_id; + STAILQ_NEXT(group_id_p, next); + } + if (mme_code_p){ + served_gummeis[i]->has_mme_code = 1; + served_gummeis[i]->mme_code = mme_code_p->mme_code; + STAILQ_NEXT(mme_code_p, next); + } + i++; + } + + mme_conf->served_gummeis = served_gummeis; + } + + // requested PLMNS + mme_conf->n_requested_plmns = mme->broadcast_plmn_num; + if (mme_conf->n_requested_plmns > 0){ + requested_plmns = calloc(mme_conf->n_requested_plmns, sizeof(Protocol__FlexPlmn*)); + if(requested_plmns == NULL) return -1; + for(int i = 0; i < mme_conf->n_requested_plmns; i++) { + requested_plmns[i] = malloc(sizeof(Protocol__FlexPlmn)); + if (!requested_plmns[i]) return -1; + protocol__flex_plmn__init(requested_plmns[i]); + requested_plmns[i]->mcc = s1ap->mcc[mme->broadcast_plmn_index[i]]; + requested_plmns[i]->has_mcc = 1; + requested_plmns[i]->mnc = s1ap->mnc[mme->broadcast_plmn_index[i]]; + requested_plmns[i]->has_mnc = 1; + requested_plmns[i]->mnc_length = s1ap->mnc_digit_length[mme->broadcast_plmn_index[i]]; + requested_plmns[i]->has_mnc_length = 1; + } + mme_conf->requested_plmns = requested_plmns; + } + + mme_conf->has_rel_capacity = 1; + mme_conf->rel_capacity = mme->relative_mme_capacity; + return 0; +} + +int flexran_get_s1ap_ue(mid_t mod_id, rnti_t rnti, Protocol__FlexS1apUe * ue_conf){ + if (!rrc_is_present(mod_id)) return -1; + s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); + if (!s1ap) return -1; + + uint32_t enb_ue_s1ap_id = flexran_get_rrc_enb_ue_s1ap_id(mod_id, rnti); + struct s1ap_eNB_ue_context_s *ue = NULL; + RB_FOREACH(ue, s1ap_ue_map, &s1ap->s1ap_ue_head){ + if (ue->eNB_ue_s1ap_id == enb_ue_s1ap_id) break; + } + if (ue == NULL) return -1; + + if (ue->mme_ref->mme_s1_ip.ipv4) + ue_conf->mme_s1_ip = (char*) &ue->mme_ref->mme_s1_ip.ipv4_address[0]; + else if (ue->mme_ref->mme_s1_ip.ipv6) + ue_conf->mme_s1_ip = (char*) &ue->mme_ref->mme_s1_ip.ipv6_address[0]; + + ue_conf->has_enb_ue_s1ap_id = 1; + ue_conf->enb_ue_s1ap_id = ue->eNB_ue_s1ap_id; + ue_conf->has_mme_ue_s1ap_id = 1; + ue_conf->mme_ue_s1ap_id = ue->mme_ue_s1ap_id; + + ue_conf->selected_plmn = malloc(sizeof(Protocol__FlexPlmn)); + if (!ue_conf->selected_plmn) return -1; + protocol__flex_plmn__init(ue_conf->selected_plmn); + + ue_conf->selected_plmn->has_mcc = 1; + ue_conf->selected_plmn->mcc = s1ap->mcc[ue->selected_plmn_identity]; + ue_conf->selected_plmn->has_mnc = 1; + ue_conf->selected_plmn->mnc = s1ap->mnc[ue->selected_plmn_identity]; + ue_conf->selected_plmn->has_mnc_length = 1; + ue_conf->selected_plmn->mnc_length = s1ap->mnc_digit_length[ue->selected_plmn_identity]; + return 0; +} + /**************************** General BS info ****************************/ uint64_t flexran_get_bs_id(mid_t mod_id) { if (!rrc_is_present(mod_id)) return 0; @@ -3488,13 +3687,14 @@ size_t flexran_get_capabilities(mid_t mod_id, Protocol__FlexBsCapability **caps) case ngran_eNB_CU: case ngran_ng_eNB_CU: case ngran_gNB_CU: - n_caps = 3; + n_caps = 4; *caps = calloc(n_caps, sizeof(Protocol__FlexBsCapability)); AssertFatal(*caps, "could not allocate %zu bytes for Protocol__FlexBsCapability array\n", n_caps * sizeof(Protocol__FlexBsCapability)); (*caps)[0] = PROTOCOL__FLEX_BS_CAPABILITY__PDCP; (*caps)[1] = PROTOCOL__FLEX_BS_CAPABILITY__SDAP; (*caps)[2] = PROTOCOL__FLEX_BS_CAPABILITY__RRC; + (*caps)[3] = PROTOCOL__FLEX_BS_CAPABILITY__S1AP; break; case ngran_eNB_DU: case ngran_gNB_DU: @@ -3511,7 +3711,7 @@ size_t flexran_get_capabilities(mid_t mod_id, Protocol__FlexBsCapability **caps) case ngran_eNB: case ngran_ng_eNB: case ngran_gNB: - n_caps = 8; + n_caps = 9; *caps = calloc(n_caps, sizeof(Protocol__FlexBsCapability)); AssertFatal(*caps, "could not allocate %zu bytes for Protocol__FlexBsCapability array\n", n_caps * sizeof(Protocol__FlexBsCapability)); @@ -3523,26 +3723,27 @@ size_t flexran_get_capabilities(mid_t mod_id, Protocol__FlexBsCapability **caps) (*caps)[5] = PROTOCOL__FLEX_BS_CAPABILITY__PDCP; (*caps)[6] = PROTOCOL__FLEX_BS_CAPABILITY__SDAP; (*caps)[7] = PROTOCOL__FLEX_BS_CAPABILITY__RRC; + (*caps)[8] = PROTOCOL__FLEX_BS_CAPABILITY__S1AP; break; case ngran_eNB_MBMS_STA: + AssertFatal(0, "MBMS STA not supported by FlexRAN!\n"); break; } return n_caps; } -uint16_t flexran_get_capabilities_mask(mid_t mod_id) { +uint32_t flexran_get_capabilities_mask(mid_t mod_id) { if (!rrc_is_present(mod_id)) return 0; - - uint16_t mask = 0; - + uint32_t mask = 0; switch (RC.rrc[mod_id]->node_type) { case ngran_eNB_CU: case ngran_ng_eNB_CU: case ngran_gNB_CU: mask = (1 << PROTOCOL__FLEX_BS_CAPABILITY__PDCP) | (1 << PROTOCOL__FLEX_BS_CAPABILITY__SDAP) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RRC); + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RRC) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__S1AP); break; case ngran_eNB_DU: case ngran_gNB_DU: @@ -3562,9 +3763,11 @@ uint16_t flexran_get_capabilities_mask(mid_t mod_id) { | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RLC) | (1 << PROTOCOL__FLEX_BS_CAPABILITY__PDCP) | (1 << PROTOCOL__FLEX_BS_CAPABILITY__SDAP) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RRC); + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RRC) + | (1 << PROTOCOL__FLEX_BS_CAPABILITY__S1AP); break; case ngran_eNB_MBMS_STA: + AssertFatal(0, "MBMS STA not supported by FlexRAN!\n"); break; } diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h index 6aef1c406b..ce32883852 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ b/openair2/ENB_APP/flexran_agent_ran_api.h @@ -652,6 +652,9 @@ int flexran_agent_rrc_gtp_get_teid_enb(mid_t mod_id, rnti_t rnti, int index); /* Get the TEID at the SGW for UE */ int flexran_agent_rrc_gtp_get_teid_sgw(mid_t mod_id, rnti_t rnti, int index); +/* gets the UEs S1AP ID at eNodeB, stored in RRC */ +uint32_t flexran_get_rrc_enb_ue_s1ap_id(mid_t mod_id, rnti_t rnti); + /************************** Slice configuration **************************/ /* Get the DL slice ID for a UE */ @@ -804,6 +807,31 @@ char *flexran_get_ul_slice_scheduler(mid_t mod_id, int slice_idx); /* Set the scheduler name for a slice in UL */ int flexran_set_ul_slice_scheduler(mid_t mod_id, int slice_idx, char *name); +/************************** S1AP **************************/ +/* Get the number of MMEs to be connected */ +int flexran_get_s1ap_mme_pending(mid_t mod_id); + +/* Get the number of connected MMEs */ +int flexran_get_s1ap_mme_connected(mid_t mod_id); + +/* Get the eNB S1AP IP address */ +char* flexran_get_s1ap_enb_s1_ip(mid_t mod_id); + +/* Get the name of the eNB */ +char* flexran_get_s1ap_enb_name(mid_t mod_id); + +/* Get the number of connected MMEs to this eNB */ +int flexran_get_s1ap_nb_mme(mid_t mod_id); + +/* Get the number of connected UEs to this eNB */ +int flexran_get_s1ap_nb_ue(mid_t mod_id); + +/* Get the S1AP MME conf */ +int flexran_get_s1ap_mme_conf(mid_t mod_id, mid_t mme_index, Protocol__FlexS1apMme * mme_conf); + +/* Get the S1AP UE conf */ +int flexran_get_s1ap_ue(mid_t mod_id, rnti_t rnti, Protocol__FlexS1apUe * ue_conf); + /********************* general information *****************/ /* get an ID for this BS (or part of a BS) */ uint64_t flexran_get_bs_id(mid_t mod_id); @@ -815,7 +843,7 @@ size_t flexran_get_capabilities(mid_t mod_id, Protocol__FlexBsCapability **caps) /* get the capabilities supported by the underlying network function as a bit * mask. */ -uint16_t flexran_get_capabilities_mask(mid_t mod_id); +uint32_t flexran_get_capabilities_mask(mid_t mod_id); /* get the splits used by the underlying network function, * return the number and stores list of this length in splits. If there are diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index 03e6273d1b..3592cf80a1 100644 --- a/openair3/S1AP/s1ap_eNB.c +++ b/openair3/S1AP/s1ap_eNB.c @@ -124,7 +124,9 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id; s1ap_mme_data_p->assoc_id = -1; s1ap_mme_data_p->broadcast_plmn_num = broadcast_plmn_num; - + memcpy(&s1ap_mme_data_p->mme_s1_ip, + mme_ip_address, + sizeof(*mme_ip_address)); for (int i = 0; i < broadcast_plmn_num; ++i) s1ap_mme_data_p->broadcast_plmn_index[i] = broadcast_plmn_index[i]; @@ -193,6 +195,10 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * new_instance->eNB_id = s1ap_register_eNB->eNB_id; new_instance->cell_type = s1ap_register_eNB->cell_type; new_instance->tac = s1ap_register_eNB->tac; + + memcpy(&new_instance->eNB_s1_ip, + &s1ap_register_eNB->enb_ip_address, + sizeof(s1ap_register_eNB->enb_ip_address)); for (int i = 0; i < s1ap_register_eNB->num_plmn; i++) { new_instance->mcc[i] = s1ap_register_eNB->mcc[i]; diff --git a/openair3/S1AP/s1ap_eNB_defs.h b/openair3/S1AP/s1ap_eNB_defs.h index 5bffa0df0c..d4bc6cfc0f 100644 --- a/openair3/S1AP/s1ap_eNB_defs.h +++ b/openair3/S1AP/s1ap_eNB_defs.h @@ -124,6 +124,9 @@ typedef struct s1ap_eNB_mme_data_s { /* This is the optional name provided by the MME */ char *mme_name; + /* MME S1AP IP address */ + net_ip_address_t mme_s1_ip; + /* List of served GUMMEI per MME. There is one GUMMEI per RAT with a max * number of 8 RATs but in our case only one is used. The LTE related pool * configuration is included on the first place in the list. @@ -200,6 +203,9 @@ typedef struct s1ap_eNB_instance_s { /* Tracking area code */ uint16_t tac; + /* eNB S1AP IP address */ + net_ip_address_t eNB_s1_ip; + /* Mobile Country Code * Mobile Network Code */ diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.c b/openair3/S1AP/s1ap_eNB_nas_procedures.c index b87bd7144a..d271ddf6ba 100644 --- a/openair3/S1AP/s1ap_eNB_nas_procedures.c +++ b/openair3/S1AP/s1ap_eNB_nas_procedures.c @@ -1468,7 +1468,7 @@ int s1ap_eNB_path_switch_req(instance_t instance, break; } } while(1); - + ue_context_p->mme_ue_s1ap_id = path_switch_req_p->mme_ue_s1ap_id; /* Prepare the S1AP message to encode */ From c6e389ed4cb4a8b9db8ed6ead401ef798aa31823 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 19 Dec 2019 10:13:16 +0100 Subject: [PATCH 14/32] FlexRAN: assert if out of memory --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 1a8c2cefa8..c489f10dae 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -693,8 +693,7 @@ int flexran_agent_mac_stats_reply_cell(mid_t mod_id, // TODO: Fill in the actual noise and interference report for this cell Protocol__FlexNoiseInterferenceReport *ni_report; ni_report = malloc(sizeof(Protocol__FlexNoiseInterferenceReport)); - if(ni_report == NULL) - goto error; + AssertFatal(ni_report, "cannot malloc() ni_report\n"); protocol__flex_noise_interference_report__init(ni_report); ni_report->sfn_sf = flexran_get_sfn_sf(mod_id); ni_report->has_sfn_sf = 1; @@ -709,21 +708,6 @@ int flexran_agent_mac_stats_reply_cell(mid_t mod_id, } } return 0; - - error: - if (cell_report != NULL) { - if (n_cc > 0) { - for (int i = 0; i < n_cc; i++) { - if (cell_report[i]->noise_inter_report != NULL) { - free(cell_report[i]->noise_inter_report); - cell_report[i]->noise_inter_report = NULL; - } - } - } - free(cell_report); - cell_report = NULL; - } - return -1; } int flexran_agent_mac_destroy_stats_reply(Protocol__FlexStatsReply *reply) { From e33be3ccd3ec44b0cb20c6209fbc3bdb43e69b3c Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 18 Dec 2019 16:37:54 +0100 Subject: [PATCH 15/32] FlexRAN: Re-enable the soft-restart, it works --- openair2/ENB_APP/flexran_agent_common.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index ef428b7be5..50900d451d 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -905,8 +905,11 @@ int flexran_agent_handle_enb_config_reply(mid_t mod_id, const void *params, Prot if (flexran_agent_get_mac_xface(mod_id) && enb_config->cell_config[0]->slice_config) { prepare_update_slice_config(mod_id, enb_config->cell_config[0]->slice_config); - //} else { - // initiate_soft_restart(mod_id, enb_config->cell_config[0]); + } else if (enb_config->cell_config[0]->has_eutra_band + && enb_config->cell_config[0]->has_dl_freq + && enb_config->cell_config[0]->has_ul_freq + && enb_config->cell_config[0]->has_dl_bandwidth) { + initiate_soft_restart(mod_id, enb_config->cell_config[0]); } if (flexran_agent_get_rrc_xface(mod_id) && enb_config->cell_config[0]->has_x2_ho_net_control) { From 1c8c839f65adfd12ecd53d25d34f64c56a1d7440 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 19 Dec 2019 11:34:25 +0100 Subject: [PATCH 16/32] FlexRAN: Reformat code for X2 HO NetControl activation --- openair2/ENB_APP/flexran_agent_common.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index 50900d451d..dc320ef974 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -910,12 +910,14 @@ int flexran_agent_handle_enb_config_reply(mid_t mod_id, const void *params, Prot && enb_config->cell_config[0]->has_ul_freq && enb_config->cell_config[0]->has_dl_bandwidth) { initiate_soft_restart(mod_id, enb_config->cell_config[0]); - } - - if (flexran_agent_get_rrc_xface(mod_id) && enb_config->cell_config[0]->has_x2_ho_net_control) { - if (flexran_set_x2_ho_net_control(mod_id, enb_config->cell_config[0]->x2_ho_net_control) < 0) { + } else if (flexran_agent_get_rrc_xface(mod_id) + && enb_config->cell_config[0]->has_x2_ho_net_control) { + LOG_I(FLEXRAN_AGENT, + "setting X2 HO NetControl to %d\n", + enb_config->cell_config[0]->x2_ho_net_control); + const int rc = flexran_set_x2_ho_net_control(mod_id, enb_config->cell_config[0]->x2_ho_net_control); + if (rc < 0) LOG_E(FLEXRAN_AGENT, "Error in configuring X2 handover controlled by network"); - } } *msg = NULL; From dabe2ae7ab5e4939620a7dff15eb2dd102437b79 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 20 Jan 2020 14:02:55 +0100 Subject: [PATCH 17/32] FlexRAN: remove unused import in protocol def --- openair2/ENB_APP/MESSAGES/V2/flexran.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/flexran.proto b/openair2/ENB_APP/MESSAGES/V2/flexran.proto index e2ced1dac7..3b47ff263b 100644 --- a/openair2/ENB_APP/MESSAGES/V2/flexran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/flexran.proto @@ -6,7 +6,6 @@ import "header.proto"; import "time_common.proto"; import "config_messages.proto"; import "controller_commands.proto"; -import "control_delegation.proto"; import "config_common.proto"; message flexran_message { From 61f6af80ad20eaf811a38559eb79569ef2389992 Mon Sep 17 00:00:00 2001 From: frtabu Date: Mon, 20 Jan 2020 19:06:15 +0100 Subject: [PATCH 18/32] build improvements: allow build mode selection (-g -G options) allow all exec build in one pass, remove remaining USE_MME macros in nr code --- cmake_targets/CMakeLists.txt | 21 ++--- cmake_targets/build_oai | 136 ++++++++++++++++++------------- executables/nr-gnb.c | 11 +-- executables/nr-ru.c | 12 +-- executables/nr-softmodem.c | 4 +- executables/nr-ue.c | 2 +- openair2/GNB_APP/gnb_app.c | 46 +++-------- openair2/GNB_APP/gnb_config.c | 29 +++---- openair2/RRC/LTE/rrc_UE.c | 11 +-- targets/COMMON/create_nr_tasks.c | 20 ++--- 10 files changed, 136 insertions(+), 156 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index f5392acf5d..36feb99d2f 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -127,7 +127,7 @@ endfunction() #set(CMAKE_BUILD_TYPE "Debug") if (CMAKE_BUILD_TYPE STREQUAL "") - set(CMAKE_BUILD_TYPE "RelWithDebInfo") + set(CMAKE_BUILD_TYPE "Release") endif() message("CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}") add_list_string_option(CMAKE_BUILD_TYPE "RelWithDebInfo" "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." Debug Release RelWithDebInfo MinSizeRel) @@ -184,9 +184,9 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CU ######################### # set a flag for changes in the source code # these changes are related to hardcoded path to include .h files -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -DMALLOC_CHECK_=3") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g3 -DMALLOC_CHECK_=3 -O2") - +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3") set(GIT_BRANCH "UNKNOWN") set(GIT_COMMIT_HASH "UNKNOWN") @@ -244,14 +244,10 @@ add_boolean_option(TEST_OMG False "???") add_boolean_option(DEBUG_OMG False "???") add_boolean_option(PRINT_STATS False "This adds the possibility to see the status") add_boolean_option(T_TRACER True "Activate the T tracer, a debugging/monitoring framework" ) -add_boolean_option(ENABLE_VCD True "always true now, time measurements of proc calls and var displays") add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs") add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace") add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace") -add_boolean_option(DISABLE_LOG_X False "Deactivate all LOG_* macros") add_boolean_option(USRP_REC_PLAY False "Enable USRP record playback mode") -add_boolean_option(UE_NAS_USE_TUN False "Enable UE NAS TUN device instead of ue_ip.ko") -add_boolean_option(NOS1 False "Allows to run without a EPC") add_boolean_option(BASIC_SIMULATOR False "Has to be True when building the basic simulator, False otherwise") add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering") @@ -341,7 +337,6 @@ add_library(NR_RRC_LIB ${nr_rrc_h} ${nr_rrc_source} add_dependencies(NR_RRC_LIB nr_rrc_flag) include_directories ("${NR_RRC_FULL_DIR}") - # S1AP # Same limitation as described in RRC: unknown generated file list # so we generate it at cmake time @@ -635,10 +630,8 @@ add_library(F1AP add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4") add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4") -add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "OAI_USRP" "OAI_BLADERF" "CPRIGW" "OAI_LMSSDR" "OAI_SIMU") -if (NOT ${RF_BOARD} STREQUAL "None") - add_definitions(-DMANAGED_RF=1) -endif() +add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "OAI_USRP" "OAI_BLADERF" "OAI_LMSSDR" "OAI_SIMU") + add_list2_option(TRANSP_PRO "None" "Transport protocol type" "None" "ETHERNET") @@ -655,7 +648,6 @@ set (CONFIG_LIBCONFIG_SOURCES ${CONFIG_ROOTDIR}/libconfig/config_libconfig.c ) add_library(CONFIG_LIB ${CONFIG_SOURCES}) -set(CONFIG_LIBRARIES CONFIG_LIB) add_library(params_libconfig MODULE ${CONFIG_LIBCONFIG_SOURCES} ) target_link_libraries(params_libconfig config) # shared library loader @@ -737,7 +729,7 @@ Message("CPU_Affinity flag is ${CPU_AFFINITY}") ############################################################## # ???!!! TO BE DOCUMENTED OPTIONS !!!??? ############################################################## -add_boolean_option(ENABLE_USE_MME True "eNB connected to MME (INTERFACE S1-C), not standalone eNB") + add_boolean_option(NO_RRM True "DO WE HAVE A RADIO RESSOURCE MANAGER: NO") add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "set the RLC mode to AM for the default bearer") @@ -747,7 +739,6 @@ add_boolean_option(CPU_AFFINITY False "Enable CPU Affinity of threads (only vali add_boolean_option(NAS_NETLINK False "useless ??? Must be True to compile nasmesh driver without rtai ????") add_boolean_option(OAI_NW_DRIVER_USE_NETLINK True "????") -add_boolean_option(USE_MME False "this flag is used only one time in lte-softmodem.c") add_boolean_option(MESSAGE_CHART_GENERATOR False "For generating sequence diagrams") add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams") add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams") diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index e450a40da5..fb6dc78b90 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -88,8 +88,11 @@ Options -i | --install-system-files Install OpenAirInterface required files in Linux system This option will require root password --g | --run-with-gdb - Add debugging symbols to compilation directives. It also disables any compiler optimization. Only for debugging. Do not use in normal operation! +-g | --run-with-gdb $cmake_file echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file @@ -561,29 +589,30 @@ function main() { echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file cd $DIR/$build_dir/build eval $CMAKE_CMD - fi - if [ "$eNB" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" ] ; then - echo_info "Compiling $exec" - compilations \ - $build_dir $exec \ - $exec $dbin/$exec.$REL - -# if --eNB --UE are both provided together as build options - if [ "$eNB" = "1" -a "$UE" = "1" ] ; then - echo_info "Compiling lte-uesoftmodem" - compilations \ - $build_dir lte-uesoftmodem \ - lte-uesoftmodem $dbin/lte-uesoftmodem.$REL - fi - -# if --gNB --nrUE are both provided together as build options - if [ "$gNB" = "1" -a "$nrUE" = "1" ] ; then - echo_info "Compiling nr-uesoftmodem" - compilations \ - $build_dir nr-uesoftmodem \ - nr-uesoftmodem $dbin/nr-uesoftmodem.$REL - fi + execlist="" + if [ "$eNB" = "1" ] ; then + execlist="$execlist lte-softmodem" + fi + if [ "$gNB" = "1" ] ; then + execlist="$execlist nr-softmodem" + fi + if [ "$UE" = 1 ] ; then + execlist="$execlist lte-uesoftmodem" + fi + if [ "$nrUE" = 1 ] ; then + execlist="$execlist nr-uesoftmodem" + fi + + for f in $execlist ; do + echo_info "Compiling $f..." + compilations \ + $build_dir $f \ + $f $dbin/$f.$REL + done + + + # mandatory shared libraries common to UE and (e/g)NB @@ -603,10 +632,9 @@ function main() { $build_dir rb_tool \ rb_tool $dbin/rb_tool cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin - fi - + if [ "$UE" = 1 ] ; then - # ue_ip driver compilation + echo_info "Compiling UE specific part" compilations \ $build_dir ue_ip \ @@ -645,15 +673,12 @@ function main() { echo_warning "not generated UE NAS files: binaries not found" fi fi +fi + if [ "$SIMUS_PHY" = "1" -o "$SIMUS_CORE" = "1" ] ; then - cd $OPENAIR_DIR/cmake_targets/phy_simulators - [ "$CLEAN" = "1" ] && rm -rf build - mkdir -p build - cd build - rm -f *sim + cd $DIR/$build_dir/build eval $CMAKE_CMD - fi ################## # PHY simulators # @@ -674,7 +699,7 @@ function main() { # lte-simulators $config_libconfig_shlib \ # lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so fi - + fi ################### # Core simulators # ################### @@ -781,7 +806,6 @@ function main() { # Build RF device and transport protocol libraries # #################################################### if [ "$eNB" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HWLAT" = "1" ] ; then - # build RF device libraries if [ "$HW" != "None" ] ; then rm -f liboai_device.so diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 062cec07ab..b2dcc7f397 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -80,14 +80,9 @@ #include "UTIL/OTG/otg_extern.h" #endif -#if defined(ENABLE_ITTI) - #if defined(ENABLE_USE_MME) - #include "s1ap_eNB.h" - #ifdef PDCP_USE_NETLINK - #include "SIMULATION/ETH_TRANSPORT/proto.h" - #endif - #endif -#endif +#include "s1ap_eNB.h" +#include "SIMULATION/ETH_TRANSPORT/proto.h" + #include "T.h" diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 37e6b71d85..d0d1d10758 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -104,14 +104,10 @@ static int DEFBFW[] = {0x00007fff}; #include "UTIL/OTG/otg_extern.h" #endif -#if defined(ENABLE_ITTI) - #if defined(ENABLE_USE_MME) - #include "s1ap_eNB.h" - #ifdef PDCP_USE_NETLINK - #include "SIMULATION/ETH_TRANSPORT/proto.h" - #endif - #endif -#endif +#include "s1ap_eNB.h" +#include "SIMULATION/ETH_TRANSPORT/proto.h" + + #include "T.h" #include "nfapi_interface.h" diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index dac2fa6d19..5ff9618bf1 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -428,7 +428,7 @@ int create_gNB_tasks(uint32_t gnb_nb) { } /* - # if defined(ENABLE_USE_MME) + if (EPC_MODE_ENABLED) { if (gnb_nb > 0) { if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) { LOG_E(SCTP, "Create task for SCTP failed\n"); @@ -452,7 +452,7 @@ int create_gNB_tasks(uint32_t gnb_nb) { } } - # endif + } */ if (gnb_nb > 0) { diff --git a/executables/nr-ue.c b/executables/nr-ue.c index af5f503f2b..aa50c42263 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -18,7 +18,7 @@ * For more information about the OpenAirInterface (OAI) Software Alliance: * contact@openairinterface.org */ - +#include "executables/thread-common.h" #include "executables/nr-uesoftmodem.h" #include "LAYER2/NR_MAC_UE/mac.h" diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 5f30f69ee2..e6f84a8d13 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -37,27 +37,19 @@ #include "common/utils/LOG/log.h" -#if defined(ENABLE_ITTI) -# include "intertask_interface.h" -# if defined(ENABLE_USE_MME) -# include "s1ap_eNB.h" -# include "sctp_eNB_task.h" -# include "gtpv1u_eNB_task.h" -# endif - -# include "PHY/INIT/phy_init.h" +#include "intertask_interface.h" +#include "s1ap_eNB.h" +#include "sctp_eNB_task.h" +#include "gtpv1u_eNB_task.h" +#include "PHY/INIT/phy_init.h" extern unsigned char NB_gNB_INST; -#endif + extern RAN_CONTEXT_t RC; -#if defined(ENABLE_ITTI) +#define GNB_REGISTER_RETRY_DELAY 10 -/*------------------------------------------------------------------------------*/ -# if defined(ENABLE_USE_MME) -# define GNB_REGISTER_RETRY_DELAY 10 -# endif /*------------------------------------------------------------------------------*/ @@ -82,7 +74,6 @@ static void configure_nr_rrc(uint32_t gnb_id) /*------------------------------------------------------------------------------*/ /* -# if defined(ENABLE_USE_MME) static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, const Enb_properties_array_t *enb_properties) { uint32_t gnb_id; @@ -113,23 +104,15 @@ static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, return register_gnb_pending; } -# endif */ -#endif /*------------------------------------------------------------------------------*/ void *gNB_app_task(void *args_p) { -#if defined(ENABLE_ITTI) uint32_t gnb_nb = RC.nb_nr_inst; uint32_t gnb_id_start = 0; uint32_t gnb_id_end = gnb_id_start + gnb_nb; -# if defined(ENABLE_USE_MME) - //uint32_t register_gnb_pending; - //uint32_t registered_gnb; - //long gnb_register_retry_timer_id; -# endif uint32_t gnb_id; MessageDef *msg_p = NULL; const char *msg_name = NULL; @@ -166,15 +149,15 @@ void *gNB_app_task(void *args_p) configure_nr_rrc(gnb_id); } -# if defined(ENABLE_USE_MME) + if (EPC_MODE_ENABLED) { /* Try to register each gNB */ //registered_gnb = 0; //register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end);//, gnb_properties_p); -# else + } else { /* Start L2L1 task */ - msg_p = itti_alloc_new_message(TASK_GNB_APP, INITIALIZE_MESSAGE); - itti_send_msg_to_task(TASK_L2L1, INSTANCE_DEFAULT, msg_p); -# endif + msg_p = itti_alloc_new_message(TASK_GNB_APP, INITIALIZE_MESSAGE); + itti_send_msg_to_task(TASK_L2L1, INSTANCE_DEFAULT, msg_p); + } do { // Wait for a message @@ -193,7 +176,7 @@ void *gNB_app_task(void *args_p) LOG_I(GNB_APP, "Received %s\n", ITTI_MSG_NAME(msg_p)); break; -# if defined(ENABLE_USE_MME) + /* case S1AP_REGISTER_ENB_CNF: LOG_I(GNB_APP, "[gNB %d] Received %s: associated MME %d\n", instance, msg_name, @@ -254,7 +237,6 @@ void *gNB_app_task(void *args_p) //} break; -# endif default: LOG_E(GNB_APP, "Received unexpected message %s\n", msg_name); @@ -265,8 +247,6 @@ void *gNB_app_task(void *args_p) AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); } while (1); -#endif - return NULL; } diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index f4a7b1a74a..acf87ab538 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -36,13 +36,9 @@ #include "gnb_config.h" #include "UTIL/OTG/otg.h" #include "UTIL/OTG/otg_externs.h" -#if defined(ENABLE_ITTI) -# include "intertask_interface.h" -# if defined(ENABLE_USE_MME) -# include "s1ap_eNB.h" -# include "sctp_eNB_task.h" -# endif -#endif +#include "intertask_interface.h" +#include "s1ap_eNB.h" +#include "sctp_eNB_task.h" #include "sctp_default_values.h" // #include "SystemInformationBlockType2.h" // #include "LAYER2/MAC/extern.h" @@ -225,11 +221,10 @@ void RCconfig_nr_flexran() /* gNB ID from configuration, as read in by RCconfig_RRC() */ if (!GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr) { // Calculate a default gNB ID -# if defined(ENABLE_USE_MME) + if (EPC_MODE_ENABLED) gnb_id = i + (s1ap_generate_eNB_id () & 0xFFFF8); -# else + else gnb_id = i; -# endif } else { gnb_id = *(GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr); } @@ -648,7 +643,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { AssertFatal (i0) { @@ -671,13 +666,13 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { if (GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr == NULL) { // Calculate a default gNB ID - # if defined(ENABLE_USE_MME) + if (EPC_MODE_ENABLED) { uint32_t hash; hash = s1ap_generate_eNB_id (); gnb_id = i + (hash & 0xFFFF8); - # else + } else { gnb_id = i; - # endif + } } else { gnb_id = *(GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr); } @@ -2739,7 +2734,7 @@ int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) { config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL); /* -#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME) + if (EPC_MODE_ENABLED) { if (strcasecmp( *(GNBSParams[GNB_ASN1_VERBOSITY_IDX].strptr), GNB_CONFIG_STRING_ASN1_VERBOSITY_NONE) == 0) { asn_debug = 0; asn1_xer_print = 0; @@ -2753,7 +2748,7 @@ int RCconfig_NR_S1(MessageDef *msg_p, uint32_t i) { asn_debug = 0; asn1_xer_print = 0; } -#endif + } */ AssertFatal (imodule_id].Info[eNB_index].SIStatus_MBMS = 1; UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIB1systemInfoValueTag_MBMS = sib1_MBMS->systemInfoValueTag_r14; -#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME) + /* + if (EPC_MODE_ENABLED) { int cell_valid = 0; @@ -2781,8 +2782,8 @@ int decode_SIB1_MBMS( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_in LOG_E(RRC, "Synched with a cell, but PLMN doesn't match our SIM, the message PHY_FIND_NEXT_CELL_REQ is sent but lost in current UE implementation! \n"); } } + } */ -#endif VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SIB1, VCD_FUNCTION_OUT ); return 0; } @@ -2922,8 +2923,8 @@ int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, LOG_I(RRC,"Setting SIStatus bit 0 to 1\n"); UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus = 1; UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIB1systemInfoValueTag = sib1->systemInfoValueTag; -#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME) - { + + if (EPC_MODE_ENABLED) { int cell_valid = 0; if (sib1->cellAccessRelatedInfo.cellBarred == LTE_SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred) { @@ -2982,7 +2983,7 @@ int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, LOG_E(RRC, "Synched with a cell, but PLMN doesn't match our SIM, the message PHY_FIND_NEXT_CELL_REQ is sent but lost in current UE implementation! \n"); } } -#endif + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SIB1, VCD_FUNCTION_OUT ); return 0; } diff --git a/targets/COMMON/create_nr_tasks.c b/targets/COMMON/create_nr_tasks.c index 12532e0fd4..24c4115980 100644 --- a/targets/COMMON/create_nr_tasks.c +++ b/targets/COMMON/create_nr_tasks.c @@ -19,24 +19,22 @@ * contact@openairinterface.org */ -#if defined(ENABLE_ITTI) + # include "intertask_interface.h" # include "create_nr_tasks.h" # include "common/utils/LOG/log.h" # ifdef OPENAIR2 -# if defined(ENABLE_USE_MME) -# include "sctp_eNB_task.h" -# include "s1ap_eNB.h" -# include "nas_ue_task.h" -# include "udp_eNB_task.h" -# include "gtpv1u_eNB_task.h" -# endif +#include "sctp_eNB_task.h" +#include "s1ap_eNB.h" +#include "nas_ue_task.h" +#include "udp_eNB_task.h" +#include "gtpv1u_eNB_task.h" # if ENABLE_RAL # include "lteRALue.h" # include "lteRALenb.h" # endif -# include "RRC/NR/nr_rrc_defs.h" +#include "RRC/NR/nr_rrc_defs.h" # endif # include "gnb_app.h" @@ -61,7 +59,7 @@ int create_gNB_tasks(uint32_t gnb_nb) } /* -# if defined(ENABLE_USE_MME) + if (EPC_MODE_ENABLED) { if (gnb_nb > 0) { if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) { LOG_E(SCTP, "Create task for SCTP failed\n"); @@ -85,7 +83,7 @@ int create_gNB_tasks(uint32_t gnb_nb) } } -# endif + } */ if (gnb_nb > 0) { From 6cdac7e12f92a0a37c85479523a2c4999901a665 Mon Sep 17 00:00:00 2001 From: frtabu Date: Mon, 20 Jan 2020 19:45:21 +0100 Subject: [PATCH 19/32] fix config lib and config sources usage in CmakeList.txt --- cmake_targets/CMakeLists.txt | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 36feb99d2f..007f093437 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1587,11 +1587,8 @@ set(PHY_MEX_UE ${OPENAIR_DIR}/common/utils/LOG/log.c ${OPENAIR_DIR}/common/utils/T/T.c ${OPENAIR_DIR}/common/utils/T/local_tracer.c - ${OPENAIR_DIR}/common/config/config_cmdline.c - ${OPENAIR_DIR}/common/config/config_userapi.c - ${OPENAIR_DIR}/common/config/config_load_configmodule.c ) -add_library(PHY_MEX ${PHY_MEX_UE}) +add_library(PHY_MEX ${PHY_MEX_UE} ${CONFIG_LIB}) #Layer 2 library ##################### @@ -2414,13 +2411,10 @@ add_definitions(-DASN1_MINIMUM_VERSION=924) add_library(minimal_lib ${OPENAIR_DIR}/common/utils/backtrace.c ${OPENAIR_DIR}/common/utils/LOG/log.c - ${OPENAIR_DIR}/common/config/config_userapi.c - ${OPENAIR_DIR}/common/config/config_load_configmodule.c - ${OPENAIR_DIR}/common/config/config_cmdline.c ${OPENAIR_DIR}/common/utils/minimal_stub.c ${T_SOURCE} ) -target_link_libraries(minimal_lib pthread dl ${T_LIB}) +target_link_libraries(minimal_lib pthread dl ${T_LIB} ${CONFIG_LIB}) add_executable(nfapi_test ${OPENAIR_DIR}/openair2/NR_PHY_INTERFACE/nfapi_5g_test.c @@ -2474,7 +2468,7 @@ target_link_libraries (lte-softmodem -Wl,--end-group z dl) target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) -target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) +target_link_libraries (lte-softmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES}) target_link_libraries (lte-softmodem ${T_LIB}) @@ -2547,7 +2541,7 @@ target_link_libraries (lte-uesoftmodem -Wl,--end-group z dl) target_link_libraries (lte-uesoftmodem ${LIBXML2_LIBRARIES}) -target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) +target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) target_link_libraries (lte-uesoftmodem ${LIB_LMS_LIBRARIES}) target_link_libraries (lte-uesoftmodem ${T_LIB}) @@ -2586,7 +2580,7 @@ target_link_libraries (nr-softmodem -Wl,--end-group z dl) target_link_libraries (nr-softmodem ${LIBXML2_LIBRARIES}) -target_link_libraries (nr-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) +target_link_libraries (nr-softmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) target_link_libraries (nr-softmodem ${LIB_LMS_LIBRARIES}) target_link_libraries (nr-softmodem ${T_LIB}) @@ -2626,7 +2620,7 @@ target_link_libraries (nr-uesoftmodem -Wl,--end-group z dl) target_link_libraries (nr-uesoftmodem ${LIBXML2_LIBRARIES}) -target_link_libraries (nr-uesoftmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) +target_link_libraries (nr-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) target_link_libraries (nr-uesoftmodem ${LIB_LMS_LIBRARIES}) target_link_libraries (nr-uesoftmodem ${T_LIB}) @@ -2672,7 +2666,7 @@ add_executable(dlsim_tm4 ) target_link_libraries (dlsim_tm4 -Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB PHY LFDS ${ITTI_LIB} -Wl,--end-group - pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${T_LIB} + pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${T_LIB} ) add_executable(polartest @@ -2795,7 +2789,7 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr ) target_link_libraries (${myExe} -Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY PHY_UE PHY_RU LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group - pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl + pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl ) endforeach(myExe) @@ -2808,7 +2802,7 @@ add_executable(test_epc_generate_scenario ${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h ) target_link_libraries (test_epc_generate_scenario - -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} + -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIB} ) add_executable(test_epc_play_scenario @@ -2827,7 +2821,7 @@ add_executable(test_epc_play_scenario ) target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c) target_link_libraries (test_epc_play_scenario - -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} + -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIB} ) @@ -2847,7 +2841,7 @@ foreach(myExe s1ap ${OPENAIR3_DIR}/TEST/test_${myExe}.c ) target_link_libraries (test_${myExe} - -Wl,--start-group SECU_CN UTIL LFDS -Wl,--end-group m rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} + -Wl,--start-group SECU_CN UTIL LFDS -Wl,--end-group m rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIB} ) endforeach(myExe) From 22e45b8adf1bef50e111d3df883c339c18ecd84b Mon Sep 17 00:00:00 2001 From: frtabu Date: Tue, 21 Jan 2020 18:01:50 +0100 Subject: [PATCH 20/32] update doc/BUILD.md and doc/RUNMODEM.md to reflect develop/develop-nr merge and latest merge requests affecting the build procedure --- doc/BUILD.md | 59 ++++++++++++++++++++++++++++++------------------- doc/RUNMODEM.md | 9 ++++---- 2 files changed, 40 insertions(+), 28 deletions(-) diff --git a/doc/BUILD.md b/doc/BUILD.md index 388f9f2658..24c9de253e 100644 --- a/doc/BUILD.md +++ b/doc/BUILD.md @@ -18,22 +18,33 @@ This page is valid on tags starting from **`2019.w09`**. oai EPC is developed in a distinct project with it's own [documentation](https://github.com/OPENAIRINTERFACE/openair-cn/wiki) , it is not described here. -OAI UE and eNodeB sources can be downloaded from the Eurecom [gitlab repository](./GET_SOURCES.md). +OAI softmodem sources, which aim to implement 3GPP compliant UEs, eNodeB and gNodeB can be downloaded from the Eurecom [gitlab repository](./GET_SOURCES.md). Sources come with a build script [build_oai](../cmake_targets/build_oai) located at the root of the `openairinterface5g/cmake_targets` directory. This script is developed to build the oai binaries (executables,shared libraries) for different hardware platforms, and use cases. The main oai binaries, which are tested by the Continuous Integration process are: - The LTE UE: `lte-uesoftmodem` +- The 5G UE: `nr-uesoftmodem` - The LTE eNodeB: `lte-softmodem` -- The PHY simulators: `dlsim` and `ulsim` +- The 5G gNodeB: `nr-softmodem` +- The LTE PHY simulators: `dlsim` and `ulsim` +- The 5G PHY simulators: `nr_dlschsim` `nr_dlsim` `nr_pbchsim` `nr_pucchsim` `nr_ulschsim` `nr_ulsim` `polartest` `smallblocktest` + `ulsim` `ldpctest` + +Running the [build_oai](../cmake_targets/build_oai) script also generates some utilities required to build and/or run the oai softmodem binaries: + +- `con2uedata`: a binary used to build the UE data from a configuration file. The created file emulates the sim card of a 3GPP compliant phone. +- `nvram`: a binary used to build UE (IMEI...) and EMM (IMSI, registered PLMN) non volatile data. +- `rb_tool`: radio bearer utility +- `genids` T Tracer utility, used at build time to generate T_IDs.h include file. This binary is located in the [T Tracer source file directory](../common/utils/T) . The build system for OAI uses [cmake](https://cmake.org/) which is a tool to generate makefiles. The `build_oai` script is a wrapper using cmake, make and standard linux shell commands to ease the oai build and use . The file describing how to build the executables from source files is the [CMakeLists.txt](../cmake_targets/CMakeLists.txt), it is used as input by cmake to generate the makefiles. The oai softmodem supports many use cases, and new ones are regularly added. Most of them are accessible using the configuration file or the command line options and continuous effort is done to avoid introducing build options as it makes tests and usage more complicated than run-time options. The following functionalities, originally requiring a specific build are now accessible by configuration or command line options: - s1, noS1 -- all simulators, with exception of PHY simulators, which are distinct executables. +- all simulators as the rfsimulator, the L2 simulator, with exception of PHY simulators, which are distinct executables. Calling the `build_oai` script with the -h option gives the list of all available options, but a process to simplify and check the requirements of all these options is on-going. Check the [table](BUILD.md "# `build_oai` options") At the end of this page to know the status of `buid_oai` options which are not described hereafter. @@ -42,25 +53,27 @@ Calling the `build_oai` script with the -h option gives the list of all availabl Detailed information about these simulators can be found [in this dedicated page](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/OpenAirLTEPhySimul) -# Building UE and eNodeB Executables +# Building UEs, eNodeB and gNodeB Executables -After downloading the source files, a single build command can be used to get the binaries supporting all the oai softmodem use cases (UE and eNodeB): +After downloading the source files, a single build command can be used to get the binaries supporting all the oai softmodem use cases (UE and [eg]NodeB): ``` cd /openairinterface5g/ source oaienv cd cmake_targets/ -./build_oai -I -w USRP --eNB --UE +./build_oai -I -w USRP --eNB --UE --nrUE --gNB ``` - The `-I` option is to install pre-requisites, you only need it the first time you build the softmodem or when some oai dependencies have changed. -- The `-w` option is to select the radio head support you want to include in your build. Radio head support is provided via a shared library, which is called the "oai device" The build script creates a soft link from `liboai_device.so` to the true device which will be used at run-time (here the USRP one,`liboai_usrpdevif.so` . USRP is the only hardware tested today in the Continuous Integration process. The RF simulator[RF simulator](../targets/ARCH/rfsimulator/README.md) is implemented as a specific device replacing RF hardware, it can be build using `-w SIMU` option. +- The `-w` option is to select the radio head support you want to include in your build. Radio head support is provided via a shared library, which is called the "oai device" The build script creates a soft link from `liboai_device.so` to the true device which will be used at run-time (here the USRP one,`liboai_usrpdevif.so` . USRP is the only hardware tested today in the Continuous Integration process. The RF simulator[RF simulator](../targets/ARCH/rfsimulator/README.md) is implemented as a specific device replacing RF hardware, it can be specifically built using `-w SIMU` option, but is also built during any softmodem build. - `--eNB` is to build the `lte-softmodem` executable and all required shared libraries +- `--gNB` is to build the `nr-softmodem` executable and all required shared libraries - `--UE` is to build the `lte-uesoftmodem` executable and all required shared libraries +- `--nrUE` is to build the `nr-uesoftmodem` executable and all required shared libraries -You can build the eNodeB and the UE separately, you may not need both of them depending on your oai usage. +You can build any oai softmodem executable separately, you may not need all of them depending on your oai usage. -After completing the build, the binaries are available in the `cmake_targets/ran_build/build` directory. A copy is also available in the `target/bin` directory, with all binaries suffixed by the 3GPP release number, today .Rel14 by default. It must be noticed that the option for building for a specific 3GPP release number is not tested by the CI and may be removed in the future. +After completing the build, the binaries are available in the `cmake_targets/ran_build/build` directory. A copy is also available in the `target/bin` directory, with all binaries suffixed by the 3GPP release number, today .Rel15. ## Issue when building `nasmeh` module ## @@ -106,13 +119,13 @@ or You can get documentation about the telnet server [here](common/utils/telnetsrv/DOC/telnetsrv.md) -## USRP record player -The USRP record player today needs a specific build. Work to make it available as a run time option is under consideration ## Other optional libraries -Using the help option of the build script you can get the list of available optional libraries. Those which haven't been mentioned above are known to need more tests and documentation +Using the help option of the build script you can get the list of available optional libraries. Those which haven't been mentioned above are known to need more tests and documentation. + +`./build_oai --build-lib all` will build all available optional libraries. # `build_oai` options @@ -122,30 +135,30 @@ Using the help option of the build script you can get the list of available opti | -c | maintained | erase all previously built files for this target before starting the new build. | | -C | maintained, needs improvement | erase all previously built files for any target before starting the new build. | | --verbose-compile | maintained | get compilation messages, as when running `make` or `gcc` directly. | -| --cflags_processor | maintained | used to pass options to the compiler | +| --cflags_processor | maintained | used to pass options to the compiler. | | --clean-kernel | unknown | no code in the script corresponding to this option | | --install-system-files | maintained | install oai built binaries in linux system files repositories | | -w | maintained and tested in CI for USRP device | build corresponding oai device and create the soft link to enforce this device usage at run-time | -| --phy_simulators | maintained, tested in CI | build all PHY simulators, a set of executables allowing unitary tests of LTE channel implementation within oai. | +| --phy_simulators | maintained, tested in CI | build all PHY simulators, a set of executables allowing unitary tests of LTE and 5G channel implementation within oai. | | --core_simulators | | | | -s | | | | --run-group | | | | -I | maintained, tested in CI | install external dependencies before starting the build | -| --install-optional-packages | maintained | install optional packages, useful for developing and testing. look at the | -| | | check_install_additional_tools function in cmake_targets/tools/build_helper script to get the list | -| -g | maintained | build binaries with gdb support. | +| --install-optional-packages | maintained | install optional packages, useful for developing and testing. look at the check_install_additional_tools function in cmake_targets/tools/build_helper script to get the list | +| -g | maintained | Specifies the level of debugging options used to build the binaries. Available levels are `Release`, `RelWithDebInfo`, `MinSizeRe` and `Debug`. If -g is not specified, `Release` is used, if -g is used without any level, `Debug` is used. | +| -G | maintained | Display Cmake debugging messages | | --eNB | maintained and tested in CI | build `lte-softmodem` the LTE eNodeB | | --UE | maintained and tested in CI | build `lte-uesoftmodem` the LTE UE | -| --usrp-recplay | maintained | build with support for the record player. Implementation will be soon reviewed to switch to a run-time option. | -| --build-lib | maintained | build optional shared library(ies), which can then be loaded at run time via command line option. Use the --help option to get the list of supported optional libraries. | -| --UE-conf-nvram | | | -| --UE-gen-nvram | | | -| -r | unknown, to be removed | specifies which 3GPP release to build for. Only the default (today rel14) is tested in CI and it is likely that future oai release will remove this option | +| --gNB | maintained and tested in CI | build `nr-softmodem` the 5G gNodeB | +| --nrUE | maintained and tested in CI | build `nr-uesoftmodem` the 5G UE | +| --usrp-recplay | deprecated | use the USRP configuration parameters to use the record player. | +| --build-lib | maintained | build optional shared library(ies), which can then be loaded at run time via command line option. Use the --help option to get the list of supported optional libraries. `all` can be used to build all available optional libraries. | +| --UE-conf-nvram | maintained | Specifies the path to the input file used by the conf2uedata utility. defaults to [openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf](../openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf) | +| --UE-gen-nvram | maintained | Specifies the path where the output file created by the conf2uedata utility will be placed. Defaults to `target/bin` | | -V | deprecated | Used to build with support for synchronization diagram utility. This is now available via the T-Tracer and is included if T-Tracer is not disabled. | | --build-doxygen | unknown | build doxygen documentation, many oai source files do not include doxygen comments | | --disable-deadline --enable-deadline --disable-cpu-affinity | deprecated | These options were used to activate or de-activate specific code depending on the choice of a specific linux scheduling mode. This has not been tested for a while and should be implemented as configuration options | | --disable-T-Tracer | maintained, to be tested | Remove T_Tracer and console LOG messages except error messages. | -| --disable-hardware-dependency | | | | --ue-autotest-trace --ue-timing --ue-trace | deprecated | Were used to enable conditional code implementing debugging messages or debugging statistics. These functionalities are now either available from run-time options or not maintained. | | --build-eclipse | unknown | | | | | | diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index 71354e663a..0c66b58547 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -20,19 +20,18 @@ See the [dedicated page](BASIC_SIM.md). # RF Simulator -The rf simulator is a oai device replacing the radio heads (for example the USRP device). It allows connecting the oai UE and the oai eNodeB through a network interface carrying the time-domain samples, getting rid of over the air unpredictable perturbations. This is the ideal tool to check signal processing algorithms and protocols implementation. +The rf simulator is a oai device replacing the radio heads (for example the USRP device). It allows connecting the oai UE (LTE or 5G) and respectively the oai eNodeB or gNodeB through a network interface carrying the time-domain samples, getting rid of over the air unpredictable perturbations. This is the ideal tool to check signal processing algorithms and protocols implementation. The rf simulator has some preliminary support for channel modeling. It is planned to enhance this simulator with the following functionalities: -- Support for multiple UE connections,each UE being a `lte-uesoftmodem` instance. -- Support for multiple eNodeB for hand-over tests -- Support for channel modeling +- Support for multiple UE connections,each UE being a `lte-uesoftmodem` or `nr_uesoftmodem` instance. +- Support for multiple eNodeB's or gNodeB's for hand-over tests This is an easy use-case to setup and test, as no specific hardware is required. The [rfsimulator page](../targets/ARCH/rfsimulator/README.md ) contains the detailed documentation. # L2 nFAPI Simulator -This simulator connects a eNodeB and UEs through a nfapi interface, short-cutting the L1 layer. The objective of this simulator is to allow multi UEs simulation, with a large number of UEs (ideally up to 255 ) .Here to ease the platform setup, UEs are simulated via a single `lte-uesoftmodem` instance. Today the CI tests just with one UE and architecture has to be reviewed to allow a number of UE above about 16. This work is on-going. +This simulator connects a eNodeB and UEs through a nfapi interface, short-cutting the L1 layer. The objective of this simulator is to allow multi UEs simulation, with a large number of UEs (ideally up to 255 ) .Here to ease the platform setup, UEs are simulated via a single `lte-uesoftmodem` instance. Today the CI tests just with one UE and architecture has to be reviewed to allow a number of UE above about 16. This work is on-going. As for the rf simulator, no specific hardware is required. The [L2 nfapi simlator page](L2NFAPI.md) contains the detailed documentation. From b85731f4a9ece2caeb1d34c1223d889b100f0b16 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 22 Jan 2020 17:59:21 +0100 Subject: [PATCH 21/32] CI: Add LTE RF Simulator test (normal and with MBMS) Signed-off-by: Raphael Defosseux --- ci-scripts/reportTestLocally.sh | 222 +++++++++++++++++++++++++++++++- ci-scripts/runTestOnVM.sh | 212 +++++++++++++++++++++++++----- openair2/RRC/NAS/nas_config.c | 4 +- 3 files changed, 404 insertions(+), 34 deletions(-) diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh index ff92460e35..f8f9025004 100755 --- a/ci-scripts/reportTestLocally.sh +++ b/ci-scripts/reportTestLocally.sh @@ -403,11 +403,231 @@ function report_test { ARCHIVES_LOC=archives/rf_sim/test if [ -d $ARCHIVES_LOC ] then + echo "

4G LTE RF Simulator Check

" >> ./test_simulator_results.html + + if [ -f $ARCHIVES_LOC/test_final_status.log ] + then + if [ `egrep -c "LTE: TEST_OK" $ARCHIVES_LOC/test_final_status.log` -eq 1 ] + then + echo "
" >> ./test_simulator_results.html + echo " TEST was SUCCESSFUL " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + else + echo "
" >> ./test_simulator_results.html + echo " TEST was a FAILURE! " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + fi + else + echo "
" >> ./test_simulator_results.html + echo " COULD NOT DETERMINE TEST FINAL STATUS! " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + fi + + echo " " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + + EPC_CONFIGS=("wS1 noS1") + TRANS_MODES=("fdd") + BW_CASES=(05) + for CN_CONFIG in ${EPC_CONFIGS[@]} + do + for TMODE in ${TRANS_MODES[@]} + do + for BW in ${BW_CASES[@]} + do + echo " " >> ./test_simulator_results.html + if [[ $CN_CONFIG =~ .*wS1.* ]] + then + echo " " >> ./test_simulator_results.html + else + echo " " >> ./test_simulator_results.html + fi + echo " " >> ./test_simulator_results.html + ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_enb.log + UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"` + if [ -f $ENB_LOG ] && [ -f $UE_LOG ] + then + NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"` + NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"` + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG` + if [[ $CN_CONFIG =~ .*noS1.* ]] + then + NB_ENB_TUNNEL_UP=`egrep -c "Interface oaitun_enb1 successfully configured" $ENB_LOG` + fi + NB_UE_GOT_SYNC=`egrep -c "rfsimulator: Success" $UE_LOG` + NB_ENB_SYNCED_WITH_UE=`egrep -c "Generating RRCConnectionReconfigurationComplete" $UE_LOG` + if [[ $CN_CONFIG =~ .*noS1.* ]] + then + NB_UE_TUNNEL_UP=`egrep -c "Interface oaitun_ue1 successfully configured" $UE_LOG` + else + NB_UE_TUNNEL_UP=`egrep -c "executing ifconfig oaitun_ue1" $UE_LOG` + fi + if [ $NB_ENB_GOT_SYNC -gt 0 ] && [ $NB_UE_GOT_SYNC -gt 0 ] && [ $NB_ENB_SYNCED_WITH_UE -gt 0 ] + then + echo " " >> ./test_simulator_results.html + else + echo " " >> ./test_simulator_results.html + fi + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + fi + PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_ping*.log 2> /dev/null` + analyzePingFiles + + IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_dl*client*txt | grep -v mbms 2> /dev/null` + analyzeIperfFiles + + IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_ul*client*txt | grep -v mbms 2> /dev/null` + analyzeIperfFiles + done + done + done + + # MBMS Case + CN_CONFIG="noS1" + TMODE="fdd" + BW_CASES=(05) + for BW in ${BW_CASES[@]} + do + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_enb_mbms.log + UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"` + if [ -f $ENB_LOG ] && [ -f $UE_LOG ] + then + NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"` + NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"` + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG` + NB_ENB_TUNNEL_UP=`egrep -c "Interface oaitun_enb1 successfully configured" $ENB_LOG` + NB_ENB_MTUNNEL_UP=`egrep -c "Interface oaitun_enm1 successfully configured" $ENB_LOG` + NB_UE_GOT_SYNC=`egrep -c "rfsimulator: Success" $UE_LOG` + NB_ENB_SYNCED_WITH_UE=`egrep -c "Generating RRCConnectionReconfigurationComplete" $UE_LOG` + NB_UE_TUNNEL_UP=`egrep -c "Interface oaitun_ue1 successfully configured" $UE_LOG` + NB_UE_MTUNNEL_UP=`egrep -c "Interface oaitun_uem1 successfully configured" $UE_LOG` + NB_UE_MBMS_PUSH_MSG=`egrep -c "TRIED TO PUSH MBMS DATA TO" $UE_LOG` + if [ $NB_ENB_GOT_SYNC -gt 0 ] && [ $NB_UE_GOT_SYNC -gt 0 ] && [ $NB_ENB_SYNCED_WITH_UE -gt 0 ] && [ $NB_UE_MBMS_PUSH_MSG -gt 0 ] + then + echo " " >> ./test_simulator_results.html + else + echo " " >> ./test_simulator_results.html + fi + echo " " >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + fi + #PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_ping*.log 2> /dev/null` + #analyzePingFiles + + #IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_dl*client*txt | grep -v mbms 2> /dev/null` + #analyzeIperfFiles + + #IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_ul*client*txt | grep -v mbms 2> /dev/null` + #analyzeIperfFiles + done + echo "
Log File NameCommandStatusStatistics
Test with EPC (aka withS1): ${TMODE} -- ${BW}MHz Test without EPC (aka noS1): ${TMODE} -- ${BW}MHz
$NAME_ENB --- $NAME_UEN/AOKKO
" >> ./test_simulator_results.html
+                    if [ $NB_ENB_GOT_SYNC -gt 0 ]
+                    then
+                        echo "- eNB --> got sync" >> ./test_simulator_results.html
+                    else
+                        echo "- eNB NEVER got sync" >> ./test_simulator_results.html
+                    fi
+                    if [[ $CN_CONFIG =~ .*noS1.* ]]
+                    then
+                        if [ $NB_ENB_TUNNEL_UP -gt 0 ]
+                        then
+                            echo "- eNB mounted oaitun_enb1 interface" >> ./test_simulator_results.html
+                        else
+                            echo "- eNB NEVER mounted oaitun_enb1 interface" >> ./test_simulator_results.html
+                        fi
+                    fi
+                    if [ $NB_UE_GOT_SYNC -gt 0 ]
+                    then
+                        echo "- LTE UE --> got sync" >> ./test_simulator_results.html
+                    else
+                        echo "- LTE UE NEVER got sync" >> ./test_simulator_results.html
+                    fi
+                    if [ $NB_ENB_SYNCED_WITH_UE -gt 0 ]
+                    then
+                        echo "- LTE UE attached to eNB" >> ./test_simulator_results.html
+                    else
+                        echo "- LTE UE NEVER attached to eNB" >> ./test_simulator_results.html
+                    fi
+                    if [ $NB_UE_TUNNEL_UP -gt 0 ]
+                    then
+                        echo "- LTE UE mounted oaitun_ue1 interface" >> ./test_simulator_results.html
+                    else
+                        echo "- LTE UE NEVER mounted oaitun_ue1 interface" >> ./test_simulator_results.html
+                    fi
+                    echo "        
Test MBMS without EPC (aka noS1): ${TMODE} -- ${BW}MHz
$NAME_ENB --- $NAME_UEN/AOKKO
" >> ./test_simulator_results.html
+                if [ $NB_ENB_GOT_SYNC -gt 0 ]
+                then
+                    echo "- eNB --> got sync" >> ./test_simulator_results.html
+                else
+                    echo "- eNB NEVER got sync" >> ./test_simulator_results.html
+                fi
+                if [ $NB_ENB_TUNNEL_UP -gt 0 ]
+                then
+                    echo "- eNB mounted oaitun_enb1 interface" >> ./test_simulator_results.html
+                else
+                    echo "- eNB NEVER mounted oaitun_enb1 interface" >> ./test_simulator_results.html
+                fi
+                if [ $NB_ENB_MTUNNEL_UP -gt 0 ]
+                then
+                    echo "- eNB mounted oaitun_enm1 interface" >> ./test_simulator_results.html
+                else
+                    echo "- eNB NEVER mounted oaitun_enm1 interface" >> ./test_simulator_results.html
+                fi
+                if [ $NB_UE_GOT_SYNC -gt 0 ]
+                then
+                    echo "- LTE UE --> got sync" >> ./test_simulator_results.html
+                else
+                    echo "- LTE UE NEVER got sync" >> ./test_simulator_results.html
+                fi
+                if [ $NB_ENB_SYNCED_WITH_UE -gt 0 ]
+                then
+                    echo "- LTE UE attached to eNB" >> ./test_simulator_results.html
+                else
+                    echo "- LTE UE NEVER attached to eNB" >> ./test_simulator_results.html
+                fi
+                if [ $NB_UE_TUNNEL_UP -gt 0 ]
+                then
+                    echo "- LTE UE mounted oaitun_ue1 interface" >> ./test_simulator_results.html
+                else
+                    echo "- LTE UE NEVER mounted oaitun_ue1 interface" >> ./test_simulator_results.html
+                fi
+                if [ $NB_UE_MTUNNEL_UP -gt 0 ]
+                then
+                    echo "- LTE UE mounted oaitun_uem1 interface" >> ./test_simulator_results.html
+                else
+                    echo "- LTE UE NEVER mounted oaitun_uem1 interface" >> ./test_simulator_results.html
+                fi
+                if [ $NB_UE_MBMS_PUSH_MSG -gt 0 ]
+                then
+                    echo "- LTE UE tried to push ${NB_UE_MBMS_PUSH_MSG} MBMS DATA" >> ./test_simulator_results.html
+                else
+                    echo "- LTE UE NEVER pushed MBMS DATA" >> ./test_simulator_results.html
+                fi
+                echo "        
" >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html + echo "

5G NR RF Simulator Check

" >> ./test_simulator_results.html if [ -f $ARCHIVES_LOC/test_final_status.log ] then - if [ `grep -c TEST_OK $ARCHIVES_LOC/test_final_status.log` -eq 1 ] + if [ `egrep -c "5G-NR: TEST_OK" $ARCHIVES_LOC/test_final_status.log` -eq 1 ] then echo "
" >> ./test_simulator_results.html echo " TEST was SUCCESSFUL " >> ./test_simulator_results.html diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index 1f9d945a63..289f4500e6 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -169,6 +169,14 @@ function get_ue_ip_addr { rm $1 } +function get_ue_mbms_ip_addr { + local LOC_IF_ID=$3 + echo "ifconfig oaitun_uem${LOC_IF_ID} | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $1 + UE_IP_ADDR=`ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1` + echo "Test UE${LOC_IF_ID} MBMS IP Address is : $UE_IP_ADDR" + rm $1 +} + function get_enb_noS1_ip_addr { echo "ifconfig oaitun_enb1 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $1 ENB_IP_ADDR=`ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1` @@ -176,6 +184,13 @@ function get_enb_noS1_ip_addr { rm $1 } +function get_enb_mbms_noS1_ip_addr { + echo "ifconfig oaitun_enm1 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $1 + ENB_IP_ADDR=`ssh -T -o StrictHostKeyChecking=no ubuntu@$2 < $1` + echo "Test eNB MBMS IP Address is : $ENB_IP_ADDR" + rm $1 +} + function ping_ue_ip_addr { local LOC_FG_OR_BG=$5 echo "echo \"COMMAND IS: ping -c 20 $3\" > $4" > $1 @@ -957,9 +972,9 @@ function start_rf_sim_enb { echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 if [ $LOC_S1_CONFIGURATION -eq 0 ] then - echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --rfsim --log_config.global_log_options level,nocolor --noS1\" > ./my-lte-softmodem-run.sh " >> $1 + echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --rfsim --log_config.global_log_options level,nocolor --noS1 --eNBs.[0].rrc_inactivity_threshold 0\" > ./my-lte-softmodem-run.sh " >> $1 else - echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --rfsim --log_config.global_log_options level,nocolor \" > ./my-lte-softmodem-run.sh " >> $1 + echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --rfsim --log_config.global_log_options level,nocolor --eNBs.[0].rrc_inactivity_threshold 0 --eNBs.[0].plmn_list.[0].mnc 93\" > ./my-lte-softmodem-run.sh " >> $1 fi echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1 echo "cat ./my-lte-softmodem-run.sh" >> $1 @@ -1015,6 +1030,31 @@ function start_rf_sim_enb { else echo "RF-SIM eNB oaitun_enb1 is UP and CONFIGURED" fi + if [[ $LOC_CONF_FILE =~ .*mbms.* ]] + then + echo "ifconfig oaitun_enm1 | egrep -c \"inet addr\"" > $1 + # Checking oaitun_enm1 interface has now an IP address + i="0" + while [ $i -lt 10 ] + do + CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_ENB_VM_IP_ADDR < $1` + if [ $CONNECTED -eq 1 ] + then + i="100" + else + i=$[$i+1] + sleep 5 + fi + done + rm $1 + if [ $i -lt 50 ] + then + ENB_SYNC=0 + echo "RF-SIM eNB oaitun_enm1 is DOWN or NOT CONFIGURED" + else + echo "RF-SIM eNB oaitun_enm1 is UP and CONFIGURED" + fi + fi fi sleep 10 } @@ -1027,6 +1067,7 @@ function start_rf_sim_ue { local LOC_FREQUENCY=$6 # 1 is with S1 and 0 without S1 aka noS1 local LOC_S1_CONFIGURATION=$7 + local LOC_MBMS_CONFIGURATION=$8 echo "echo \"sudo apt-get --yes --quiet install daemon \"" > $1 echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1 echo "echo \"export RFSIMULATOR=${LOC_ENB_VM_IP_ADDR}\"" >> $1 @@ -1036,9 +1077,9 @@ function start_rf_sim_ue { echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1 if [ $LOC_S1_CONFIGURATION -eq 0 ] then - echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_PRB --nokrnmod 1 --rfsim --log_config.global_log_options level,nocolor --noS1\" > ./my-lte-softmodem-run.sh " >> $1 + echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_PRB --ue-rxgain 140 --ue-txgain 120 --nokrnmod 1 --rfsim --log_config.global_log_options level,nocolor --noS1\" > ./my-lte-softmodem-run.sh " >> $1 else - echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_PRB --nokrnmod 1 --rfsim --log_config.global_log_options level,nocolor\" > ./my-lte-softmodem-run.sh " >> $1 + echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_PRB --ue-rxgain 140 --ue-txgain 120 --nokrnmod 1 --rfsim --log_config.global_log_options level,nocolor\" > ./my-lte-softmodem-run.sh " >> $1 fi echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1 echo "cat ./my-lte-softmodem-run.sh" >> $1 @@ -1093,6 +1134,31 @@ function start_rf_sim_ue { else echo "RF-SIM UE oaitun_ue1 is UP and CONFIGURED" fi + if [ $LOC_MBMS_CONFIGURATION -eq 1 ] + then + # Checking oaitun_uem1 interface has now an IP address + i="0" + echo "ifconfig oaitun_uem1 | egrep -c \"inet addr\"" > $1 + while [ $i -lt 10 ] + do + sleep 5 + CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1` + if [ $CONNECTED -eq 1 ] + then + i="100" + else + i=$[$i+1] + fi + done + rm $1 + if [ $i -lt 50 ] + then + UE_SYNC=0 + echo "RF-SIM UE oaitun_uem1 is DOWN or NOT CONFIGURED" + else + echo "RF-SIM UE oaitun_uem1 is UP and CONFIGURED" + fi + fi sleep 10 } @@ -1668,7 +1734,7 @@ function run_test_on_vm { fi fi - if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-ru-sim.* ]] + if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf-sim.* ]] then PING_STATUS=0 IPERF_STATUS=0 @@ -1686,11 +1752,10 @@ function run_test_on_vm { install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME` fi - # withS1 configuration is not working #EPC_CONFIGS=("wS1" "noS1") #TRANS_MODES=("fdd" "tdd") #BW_CASES=(05 10 20) - EPC_CONFIGS=("noS1" "wS1") + EPC_CONFIGS=("wS1" "noS1") TRANS_MODES=("fdd") BW_CASES=(05) for CN_CONFIG in ${EPC_CONFIGS[@]} @@ -1754,7 +1819,7 @@ function run_test_on_vm { echo "${CN_CONFIG} : Starting the UE" echo "############################################################" CURRENT_UE_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_ue.log - start_rf_sim_ue $UE_VM_CMDS $UE_VM_IP_ADDR $ENB_VM_IP_ADDR $CURRENT_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG + start_rf_sim_ue $UE_VM_CMDS $UE_VM_IP_ADDR $ENB_VM_IP_ADDR $CURRENT_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 0 if [ $UE_SYNC -eq 0 ] then echo "Problem w/ eNB and UE not syncing" @@ -1762,13 +1827,13 @@ function run_test_on_vm { terminate_enb_ue_basic_sim $UE_VM_CMDS $UE_VM_IP_ADDR 2 scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC - if [ $S1_NOS1_CFG -eq 1 ] - then - terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR - fi - echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + #if [ $S1_NOS1_CFG -eq 1 ] + #then + # terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + #fi + # Now we keep running STATUS=-1 - return + break fi if [ $S1_NOS1_CFG -eq 1 ] @@ -1814,15 +1879,37 @@ function run_test_on_vm { check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 fi - if [ $S1_NOS1_CFG -eq 0 ] + if [ $S1_NOS1_CFG -eq 1 ] then - get_enb_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR echo "############################################################" - echo "${CN_CONFIG} : iperf DL -- UE is server and eNB is client" + echo "${CN_CONFIG} : iperf DL -- UE is server and EPC is client" echo "############################################################" IPERF_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_dl get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1 - THROUGHPUT=4 + THROUGHPUT=10 + generic_iperf $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $EPC_VM_CMDS $EPC_VM_IP_ADDR $REAL_EPC_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE 1 0 + scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC + check_iperf $ARCHIVES_LOC/$IPERF_LOG_FILE $THROUGHPUT + + echo "############################################################" + echo "${CN_CONFIG} : iperf UL -- EPC is server and UE is client" + echo "############################################################" + IPERF_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_ul + THROUGHPUT=2 + get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1 + generic_iperf $EPC_VM_CMDS $EPC_VM_IP_ADDR $REAL_EPC_IP_ADDR $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE 1 0 + scp -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC + check_iperf $ARCHIVES_LOC/$IPERF_LOG_FILE $THROUGHPUT + else + echo "############################################################" + echo "${CN_CONFIG} : iperf DL -- UE is server and eNB is client" + echo "############################################################" + get_enb_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR + IPERF_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_dl + get_ue_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1 + THROUGHPUT=10 generic_iperf $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $ENB_VM_CMDS $ENB_VM_IP_ADDR $ENB_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE 1 0 scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC @@ -1852,6 +1939,67 @@ function run_test_on_vm { done done + #################### + ## MSMS CASE noS1 ## + #################### + CONF_FILE=lte-fdd-mbms-basic-sim.conf + CN_CONFIG="noS1" + S1_NOS1_CFG=0 + LTEBOX=0 + TMODE="fdd" + FREQUENCY=2680 + BW_CASES=(05) + + for BW in ${BW_CASES[@]} + do + if [[ $BW =~ .*05.* ]]; then PRB=25; fi + if [[ $BW =~ .*10.* ]]; then PRB=50; fi + if [[ $BW =~ .*20.* ]]; then PRB=100; fi + + echo "############################################################" + echo "${CN_CONFIG} : Starting the eNB with MSMS in ${TMODE}-${BW}MHz mode" + echo "############################################################" + CURRENT_ENB_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_enb_mbms.log + start_rf_sim_enb $ENB_VM_CMDS "$ENB_VM_IP_ADDR" "$EPC_VM_IP_ADDR" $CURRENT_ENB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG + + echo "############################################################" + echo "${CN_CONFIG} : Starting the UE" + echo "############################################################" + CURRENT_UE_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_ue_mbms.log + start_rf_sim_ue $UE_VM_CMDS $UE_VM_IP_ADDR $ENB_VM_IP_ADDR $CURRENT_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 1 + if [ $UE_SYNC -eq 0 ] + then + echo "Problem w/ eNB and UE not syncing" + terminate_enb_ue_basic_sim $ENB_VM_CMDS $ENB_VM_IP_ADDR 1 + terminate_enb_ue_basic_sim $UE_VM_CMDS $UE_VM_IP_ADDR 2 + scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC + STATUS=-1 + break + fi + + echo "############################################################" + echo "${CN_CONFIG} : iperf DL -- UE is server and eNB is client" + echo "############################################################" + get_enb_mbms_noS1_ip_addr $ENB_VM_CMDS $ENB_VM_IP_ADDR + IPERF_LOG_FILE=${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_dl_mbms + get_ue_mbms_ip_addr $UE_VM_CMDS $UE_VM_IP_ADDR 1 + THROUGHPUT=2 + generic_iperf $UE_VM_CMDS $UE_VM_IP_ADDR $UE_IP_ADDR $ENB_VM_CMDS $ENB_VM_IP_ADDR $ENB_IP_ADDR $THROUGHPUT $IPERF_LOG_FILE 1 0 + scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_server.txt $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/${IPERF_LOG_FILE}_client.txt $ARCHIVES_LOC + #check_iperf $ARCHIVES_LOC/$IPERF_LOG_FILE $THROUGHPUT + + echo "############################################################" + echo "${CN_CONFIG} : Terminate enb/ue simulators" + echo "############################################################" + terminate_enb_ue_basic_sim $ENB_VM_CMDS $ENB_VM_IP_ADDR 1 + terminate_enb_ue_basic_sim $UE_VM_CMDS $UE_VM_IP_ADDR 2 + scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC + + done + full_l2_sim_destroy echo "############################################################" @@ -1862,21 +2010,19 @@ function run_test_on_vm { if [ $IPERF_STATUS -ne 0 ]; then STATUS=-1; fi if [ $STATUS -eq 0 ] then - echo "TEST_OK" > $ARCHIVES_LOC/test_final_status.log + echo "LTE RFSIM seems OK" + echo "LTE: TEST_OK" > $ARCHIVES_LOC/test_final_status.log else - echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + echo "LTE RFSIM seems to FAIL" + echo "LTE: TEST_KO" > $ARCHIVES_LOC/test_final_status.log fi fi if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf-sim.* ]] then + NR_STATUS=0 PING_STATUS=0 IPERF_STATUS=0 - if [ -d $ARCHIVES_LOC ] - then - rm -Rf $ARCHIVES_LOC - fi - mkdir --parents $ARCHIVES_LOC CN_CONFIG="noS1" CONF_FILE=gnb.band78.tm1.106PRB.usrpn300.conf @@ -1904,7 +2050,8 @@ function run_test_on_vm { terminate_enb_ue_basic_sim $GNB_VM_CMDS $GNB_VM_IP_ADDR 1 scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_NR_UE_LOG_FILE $ARCHIVES_LOC - echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + echo "5G-NR RFSIM seems to FAIL" + echo "5G-NR: TEST_KO" >> $ARCHIVES_LOC/test_final_status.log STATUS=-1 return fi @@ -1936,13 +2083,16 @@ function run_test_on_vm { echo "Checking run status" echo "############################################################" - if [ $PING_STATUS -ne 0 ]; then STATUS=-1; fi - if [ $IPERF_STATUS -ne 0 ]; then STATUS=-1; fi - if [ $STATUS -eq 0 ] + if [ $PING_STATUS -ne 0 ]; then NR_STATUS=-1; fi + if [ $IPERF_STATUS -ne 0 ]; then NR_STATUS=-1; fi + if [ $NR_STATUS -eq 0 ] then - echo "TEST_OK" > $ARCHIVES_LOC/test_final_status.log + echo "5G-NR RFSIM seems OK" + echo "5G-NR: TEST_OK" >> $ARCHIVES_LOC/test_final_status.log else - echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + echo "5G-NR RFSIM seems to FAIL" + echo "5G-NR: TEST_KO" >> $ARCHIVES_LOC/test_final_status.log + STATUS=-1 fi fi diff --git a/openair2/RRC/NAS/nas_config.c b/openair2/RRC/NAS/nas_config.c index c4bb52b1bb..2eb439b9e9 100644 --- a/openair2/RRC/NAS/nas_config.c +++ b/openair2/RRC/NAS/nas_config.c @@ -260,7 +260,7 @@ int nas_config_mbms(int interface_id, int thirdOctet, int fourthOctet, char *ifn bringInterfaceUp(interfaceName, 1); if(!returnValue) - LOG_I(OIP,"Interface %s successfuly configured, ip address %s, mask %s broadcast address %s\n", + LOG_I(OIP,"Interface %s successfully configured, ip address %s, mask %s broadcast address %s\n", interfaceName, ipAddress, netMask, broadcastAddress); else LOG_E(OIP,"Interface %s couldn't be configured (ip address %s, mask %s broadcast address %s)\n", @@ -301,7 +301,7 @@ int nas_config_mbms_s1(int interface_id, int thirdOctet, int fourthOctet, char * printf("returnValue %d\n",returnValue); if(!returnValue) - LOG_I(OIP,"Interface %s successfuly configured, ip address %s, mask %s broadcast address %s\n", + LOG_I(OIP,"Interface %s successfully configured, ip address %s, mask %s broadcast address %s\n", interfaceName, ipAddress, "255.255.255.0", broadcastAddress); else LOG_E(OIP,"Interface %s couldn't be configured (ip address %s, mask %s broadcast address %s)\n", From fb57ef2fd4b727d2b218f0e2596211495c653565 Mon Sep 17 00:00:00 2001 From: Javier Morgade Date: Wed, 22 Jan 2020 20:18:51 +0100 Subject: [PATCH 22/32] patch from Robert Schmidt -BUGFIX: CD/DU F1 split --- openair2/LAYER2/MAC/eNB_scheduler.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 3659933378..901043d8d9 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -897,10 +897,12 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, } // end for loop on UE_id #if (!defined(PRE_SCD_THREAD)) - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, subframeP, module_idP); - pdcp_run(&ctxt); - pdcp_mbms_run(&ctxt); - rrc_rx_tx(&ctxt, CC_id); + if (!NODE_IS_DU(RC.rrc[module_idP]->node_type)) { + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, subframeP, module_idP); + pdcp_run(&ctxt); + pdcp_mbms_run(&ctxt); + rrc_rx_tx(&ctxt, CC_id); + } #endif for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { From b723418c335a1e91734523d0179b79789b8850b7 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 22 Jan 2020 21:36:58 +0100 Subject: [PATCH 23/32] CI: fix RF simulator hyperlinks in HTML report Signed-off-by: Raphael Defosseux --- ci-scripts/reportTestLocally.sh | 14 +++++++------- cmake_targets/autotests/test_case_list.xml | 5 ++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh index f8f9025004..cd1e4e9546 100755 --- a/ci-scripts/reportTestLocally.sh +++ b/ci-scripts/reportTestLocally.sh @@ -253,7 +253,7 @@ function report_test { ARCHIVES_LOC=archives/basic_sim/test if [ -d $ARCHIVES_LOC ] then - echo "

Basic Simulator Check

" >> ./test_simulator_results.html + echo "

4G LTE Basic Simulator Check

" >> ./test_simulator_results.html if [ -f $ARCHIVES_LOC/test_final_status.log ] then @@ -373,7 +373,7 @@ function report_test { if [ -e $JENKINS_WKSP/flexran/flexran_build_complete.txt ] then - echo "

Basic Simulator + FlexRan Controller Check

" >> ./test_simulator_results.html + echo "

4G LTE Basic Simulator + FlexRan Controller Check

" >> ./test_simulator_results.html echo "
" >> ./test_simulator_results.html echo " TEST was SUCCESSFUL " >> ./test_simulator_results.html echo "
" >> ./test_simulator_results.html @@ -423,8 +423,8 @@ function report_test { echo "
" >> ./test_simulator_results.html fi - echo " " >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html echo " " >> ./test_simulator_results.html echo " " >> ./test_simulator_results.html echo " " >> ./test_simulator_results.html @@ -643,8 +643,8 @@ function report_test { echo " " >> ./test_simulator_results.html fi - echo " " >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + echo "
" >> ./test_simulator_results.html echo "
Log File Name
" >> ./test_simulator_results.html echo " " >> ./test_simulator_results.html echo " " >> ./test_simulator_results.html @@ -743,7 +743,7 @@ function report_test { ARCHIVES_LOC=archives/l2_sim/test if [ -d $ARCHIVES_LOC ] then - echo "

L2-NFAPI Simulator Check

" >> ./test_simulator_results.html + echo "

4G LTE L2-NFAPI Simulator Check

" >> ./test_simulator_results.html if [ -f $ARCHIVES_LOC/test_final_status.log ] then diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 6795f2d1fa..c4f15c3a16 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1045,7 +1045,7 @@ $OPENAIR_DIR/targets/bin/polartest.Rel15-q -s-10 -f0 -q -s-10 -f0 -m1 - polartest.test1 + polartest.test1 polartest.test2BLER= 0.000000segmentation fault|assertion|exiting|fatal3 @@ -1107,8 +1107,7 @@ -n100 -R217 -a80 -n100 -R217 -a110 -b100 -n100 -e28 - nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 - nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 + nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11PDSCH test OKsegmentation fault|assertion|exiting|fatal3 From 009c75d60b328687bece5a09e228134e6631b0bc Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 22 Jan 2020 21:15:39 +0100 Subject: [PATCH 24/32] CI: removed obsolete python obsolete options split the RRC inactivity scenarios Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-gitlab | 2 + ci-scripts/Jenkinsfile-tmp-full-ran | 12 +- ci-scripts/Jenkinsfile-tmp-multi-enb | 12 +- ci-scripts/Jenkinsfile-tmp-ran | 12 +- ci-scripts/Jenkinsfile-tmp-ue | 12 +- .../enb_usrp210_band7_test_05mhz_tm1.xml | 124 ---------------- ...st_05mhz_tm1_rrc_inactivity_no_flexran.xml | 125 ++++++++++++++++ ...est_05mhz_tm1_rrc_inactivity_w_flexran.xml | 138 ++++++++++++++++++ 8 files changed, 289 insertions(+), 148 deletions(-) create mode 100644 ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml create mode 100644 ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index 2792e3556a..fcfd56a4a2 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -55,6 +55,8 @@ pipeline { "Analysis with cppcheck", "Test phy-sim", "Test basic-sim", + "Test L1-sim", + "Test RF-sim", "Test L2-sim", "Test-Mono-FDD-Band7", "Test-Mono-TDD-Band40", diff --git a/ci-scripts/Jenkinsfile-tmp-full-ran b/ci-scripts/Jenkinsfile-tmp-full-ran index 7211a54bcf..096ff7f52d 100644 --- a/ci-scripts/Jenkinsfile-tmp-full-ran +++ b/ci-scripts/Jenkinsfile-tmp-full-ran @@ -51,7 +51,7 @@ termStatusArray[termOAIUE] = false def eNB_Repository def eNB_Branch def eNB_CommitID -def eNB_AllowMergeRequestProcess = false +def ranAllowMergeRequestProcess = false def eNB_TargetBranch def doEpcLogCollection = true @@ -130,8 +130,8 @@ pipeline { } echo "eNB_CommitID : ${eNB_CommitID}" if (params.eNB_mergeRequest != null) { - eNB_AllowMergeRequestProcess = params.eNB_mergeRequest - if (eNB_AllowMergeRequestProcess) { + ranAllowMergeRequestProcess = params.eNB_mergeRequest + if (ranAllowMergeRequestProcess) { if (params.eNB_TargetBranch != null) { eNB_TargetBranch = params.eNB_TargetBranch } else { @@ -168,7 +168,7 @@ pipeline { if (allParametersPresent) { echo "All parameters are present" - if (eNB_AllowMergeRequestProcess) { + if (ranAllowMergeRequestProcess) { sh "git fetch" sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest" } else { @@ -208,12 +208,12 @@ pipeline { [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] ]) { - sh "python3 main.py --mode=InitiateHtml --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") for (xmlFile in myXmlTestSuite) { if (fileExists(xmlFile)) { try { - sh "python3 main.py --mode=TesteNB --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + sh "python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --UEIPAddress=${params.UE_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" } catch (Exception e) { currentBuild.result = 'FAILURE' buildStageStatus = false diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb b/ci-scripts/Jenkinsfile-tmp-multi-enb index c3b825ec06..4df2006ed2 100644 --- a/ci-scripts/Jenkinsfile-tmp-multi-enb +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb @@ -41,7 +41,7 @@ def ciSmartPhoneResource = params.smartphonesResource def eNB_Repository def eNB_Branch def eNB_CommitID -def eNB_AllowMergeRequestProcess = false +def ranAllowMergeRequestProcess = false def eNB_TargetBranch pipeline { @@ -124,8 +124,8 @@ pipeline { } echo "eNB_CommitID : ${eNB_CommitID}" if (params.eNB_mergeRequest != null) { - eNB_AllowMergeRequestProcess = params.eNB_mergeRequest - if (eNB_AllowMergeRequestProcess) { + ranAllowMergeRequestProcess = params.eNB_mergeRequest + if (ranAllowMergeRequestProcess) { if (params.eNB_TargetBranch != null) { eNB_TargetBranch = params.eNB_TargetBranch } else { @@ -157,7 +157,7 @@ pipeline { if (allParametersPresent) { echo "All parameters are present" - if (eNB_AllowMergeRequestProcess) { + if (ranAllowMergeRequestProcess) { sh "git fetch" sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest" } else { @@ -198,12 +198,12 @@ pipeline { [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] ]) { - sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${ranAllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") for (xmlFile in myXmlTestSuite) { if (fileExists(xmlFile)) { try { - sh "python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNB1IPAddress=${params.eNB1_IPAddress} --eNB1UserName=${eNB1_Username} --eNB1Password=${eNB1_Password} --eNB1SourceCodePath=${params.eNB1_SourceCodePath} --eNB2IPAddress=${params.eNB2_IPAddress} --eNB2UserName=${eNB2_Username} --eNB2Password=${eNB2_Password} --eNB2SourceCodePath=${params.eNB2_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + sh "python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${ranAllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNB1IPAddress=${params.eNB1_IPAddress} --eNB1UserName=${eNB1_Username} --eNB1Password=${eNB1_Password} --eNB1SourceCodePath=${params.eNB1_SourceCodePath} --eNB2IPAddress=${params.eNB2_IPAddress} --eNB2UserName=${eNB2_Username} --eNB2Password=${eNB2_Password} --eNB2SourceCodePath=${params.eNB2_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" } catch (Exception e) { currentBuild.result = 'FAILURE' buildStageStatus = false diff --git a/ci-scripts/Jenkinsfile-tmp-ran b/ci-scripts/Jenkinsfile-tmp-ran index 5ffaefa89f..ad852b8e93 100644 --- a/ci-scripts/Jenkinsfile-tmp-ran +++ b/ci-scripts/Jenkinsfile-tmp-ran @@ -54,7 +54,7 @@ termStatusArray[termHSS] = false def eNB_Repository def eNB_Branch def eNB_CommitID -def eNB_AllowMergeRequestProcess = false +def ranAllowMergeRequestProcess = false def eNB_TargetBranch pipeline { @@ -145,8 +145,8 @@ pipeline { } echo "eNB_CommitID : ${eNB_CommitID}" if (params.eNB_mergeRequest != null) { - eNB_AllowMergeRequestProcess = params.eNB_mergeRequest - if (eNB_AllowMergeRequestProcess) { + ranAllowMergeRequestProcess = params.eNB_mergeRequest + if (ranAllowMergeRequestProcess) { if (params.eNB_TargetBranch != null) { eNB_TargetBranch = params.eNB_TargetBranch } else { @@ -178,7 +178,7 @@ pipeline { if (allParametersPresent) { echo "All parameters are present" - if (eNB_AllowMergeRequestProcess) { + if (ranAllowMergeRequestProcess) { sh "git fetch" sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest" } else { @@ -217,12 +217,12 @@ pipeline { [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] ]) { - sh "python3 main.py --mode=InitiateHtml --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") for (xmlFile in myXmlTestSuite) { if (fileExists(xmlFile)) { try { - sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" } catch (Exception e) { currentBuild.result = 'FAILURE' buildStageStatus = false diff --git a/ci-scripts/Jenkinsfile-tmp-ue b/ci-scripts/Jenkinsfile-tmp-ue index c2db977bcb..e22cd45615 100644 --- a/ci-scripts/Jenkinsfile-tmp-ue +++ b/ci-scripts/Jenkinsfile-tmp-ue @@ -54,7 +54,7 @@ termStatusArray[termHSS] = false def eNB_Repository def eNB_Branch def eNB_CommitID -def eNB_AllowMergeRequestProcess = false +def ranAllowMergeRequestProcess = false def eNB_TargetBranch pipeline { @@ -116,8 +116,8 @@ pipeline { } echo "eNB_CommitID : ${eNB_CommitID}" if (params.eNB_mergeRequest != null) { - eNB_AllowMergeRequestProcess = params.eNB_mergeRequest - if (eNB_AllowMergeRequestProcess) { + ranAllowMergeRequestProcess = params.eNB_mergeRequest + if (ranAllowMergeRequestProcess) { if (params.eNB_TargetBranch != null) { eNB_TargetBranch = params.eNB_TargetBranch } else { @@ -149,7 +149,7 @@ pipeline { if (allParametersPresent) { echo "All parameters are present" - if (eNB_AllowMergeRequestProcess) { + if (ranAllowMergeRequestProcess) { sh "git fetch" sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest" } else { @@ -187,12 +187,12 @@ pipeline { [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.UE_Credentials}", usernameVariable: 'UE_Username', passwordVariable: 'UE_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] ]) { - sh "python3 main.py --mode=InitiateHtml --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") for (xmlFile in myXmlTestSuite) { if (fileExists(xmlFile)) { try { - sh "python3 main.py --mode=TestUE --UEIPAddress=${params.UE_IPAddress} --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + sh "python3 main.py --mode=TestUE --UEIPAddress=${params.UE_IPAddress} --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --UEUserName=${UE_Username} --UEPassword=${UE_Password} --UESourceCodePath=${params.UE_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" } catch (Exception e) { currentBuild.result = 'FAILURE' buildStageStatus = false diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1.xml index 3b07ed4950..ec6090c00c 100644 --- a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1.xml +++ b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1.xml @@ -28,101 +28,15 @@ 030201 040101 030101 040301 040501 040603 040604 040605 040606 040607 040641 040642 040643 040644 040401 040201 030201 - 030102 000010 040301 040502 000011 040302 000001 000012 040303 000002 000013 040503 040401 040201 030201 - 050102 - 030103 000020 040301 040504 000021 040302 000001 000022 040303 000002 040504 000023 040401 040201 030201 - 050202 - - IdleSleep - Waiting for 35 seconds - 35 - - - - IdleSleep - Waiting for 10 seconds - 10 - - - - CheckStatusUE - Check UE(s) status before attachment - 0 - - - - CheckStatusUE - Check UE(s) status before data disabling - 2 - - - - CheckStatusUE - Check UE(s) status after data disabling - 0 - - - - CheckStatusUE - Check UE(s) status after data re-enabling - 2 - - - - CheckStatusUE - Check UE(s) status before attachment - 0 - - - - CheckStatusUE - Check UE(s) status before data disabling - 2 - - - - CheckStatusUE - Check UE(s) status after data disabling - 0 - - - - CheckStatusUE - Check UE(s) status after data re-enabling - 2 - - - - Initialize_FlexranCtrl - Starting Flexran Controller - - - - Terminate_FlexranCtrl - Stopping Flexran Controller - - Initialize_eNB Initialize eNB (FDD/Band7/5MHz) -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf - - Initialize_eNB - Initialize eNB (FDD/Band7/5MHz) for RRC Inactivity Timer testing -- no FlexRan Ctl - -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf - - - - Initialize_eNB - Initialize eNB (FDD/Band7/5MHz) for RRC Inactivity Timer testing -- with FlexRan Ctl - -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf - - Terminate_eNB Terminate eNB @@ -148,16 +62,6 @@ Detach UE - - DataDisable_UE - Disabling Data Service on UE - - - - DataEnable_UE - Enabling Data Service on UE - - Ping ping (5MHz - 20 sec) @@ -165,34 +69,6 @@ 5 - - Ping - ping (5MHz - 20 sec) - -c 20 - 5 - - - - Ping - ping (5MHz - 20 sec) - -c 20 - 5 - - - - Ping - ping (5MHz - 20 sec) - -c 20 - 5 - - - - Ping - ping (5MHz - 20 sec) - -c 20 - 5 - - Iperf iperf (5MHz - DL/15Mbps/UDP)(30 sec)(balanced profile) diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml new file mode 100644 index 0000000000..686e5b1b38 --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml @@ -0,0 +1,125 @@ + + + test-05-tm1 + Test-05MHz-TM1 + tasks + + 030201 + 040101 + 030102 000010 040301 040502 000011 040302 000001 000012 040303 000002 000013 040503 040401 040201 030201 + + + + + IdleSleep + Waiting for 35 seconds + 35 + + + + IdleSleep + Waiting for 10 seconds + 10 + + + + CheckStatusUE + Check UE(s) status before attachment + 0 + + + + CheckStatusUE + Check UE(s) status before data disabling + 2 + + + + CheckStatusUE + Check UE(s) status after data disabling + 0 + + + + CheckStatusUE + Check UE(s) status after data re-enabling + 2 + + + + Initialize_eNB + Initialize eNB (FDD/Band7/5MHz) for RRC Inactivity Timer testing -- no FlexRan Ctl + -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf + + + + Terminate_eNB + Terminate eNB + + + + Initialize_UE + Initialize UE + + + + Terminate_UE + Terminate UE + + + + Attach_UE + Attach UE + + + + Detach_UE + Detach UE + + + + DataDisable_UE + Disabling Data Service on UE + + + + DataEnable_UE + Enabling Data Service on UE + + + + Ping + ping (5MHz - 20 sec) + -c 20 + 5 + + + + Ping + ping (5MHz - 20 sec) + -c 20 + 5 + + + diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml new file mode 100644 index 0000000000..9e7227aa47 --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml @@ -0,0 +1,138 @@ + + + test-05-tm1 + Test-05MHz-TM1 + tasks + 2 + + 030201 + 040101 + 050102 + 030103 000020 040301 040504 000021 040302 000001 000022 040303 000002 040505 000023 040401 040201 030201 + 050202 + + + + + IdleSleep + Waiting for 35 seconds + 35 + + + + IdleSleep + Waiting for 10 seconds + 10 + + + + CheckStatusUE + Check UE(s) status before attachment + 0 + + + + CheckStatusUE + Check UE(s) status before data disabling + 2 + + + + CheckStatusUE + Check UE(s) status after data disabling + 0 + + + + CheckStatusUE + Check UE(s) status after data re-enabling + 2 + + + + Initialize_FlexranCtrl + Starting Flexran Controller + + + + Terminate_FlexranCtrl + Stopping Flexran Controller + + + + Initialize_eNB + Initialize eNB (FDD/Band7/5MHz) for RRC Inactivity Timer testing -- with FlexRan Ctl + -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf + + + + Terminate_eNB + Terminate eNB + + + + Initialize_UE + Initialize UE + + + + Terminate_UE + Terminate UE + + + + Attach_UE + Attach UE + + + + Detach_UE + Detach UE + + + + DataDisable_UE + Disabling Data Service on UE + + + + DataEnable_UE + Enabling Data Service on UE + + + + Ping + ping (5MHz - 20 sec) + -c 20 + 5 + + + + Ping + ping (5MHz - 20 sec) + -c 20 + 5 + + + From 9b920255b395c1c1031910014da50583333fd290 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 22 Jan 2020 22:53:34 +0100 Subject: [PATCH 25/32] DOC: added kernel headers install guidelines for CentOS / RHEL Signed-off-by: Raphael Defosseux --- doc/BUILD.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/BUILD.md b/doc/BUILD.md index 24c9de253e..9ada32e532 100644 --- a/doc/BUILD.md +++ b/doc/BUILD.md @@ -105,6 +105,20 @@ Install it: $ sudo apt-get install --yes linux-headers-your-version ``` +On CentOS or RedHat Entreprise Linux: + +```bash +$ uname -r +3.10.0-1062.9.1.rt56.1033.el7.x86_64 +$ yum list installed | grep kernel | grep devel +kernel-devel.x86_64 3.10.0-1062.9.1.el7 @rhel-7-server-rpms +kernel-rt-devel.x86_64 3.10.0-1062.9.1.rt56.1033.el7 +``` + +If your kernel is generic, install `kernel-devel` package: `sudo yum install kernel-devel` + +In most case, your kernel is real-time. Install `kernel-rt-devel` package: `sudo yum install kernel-rt-devel` + # Building Optional Binaries ## Telnet Server From 4a2abc03b59c52a7ed70d32261c8bde8c581b5b2 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 23 Jan 2020 11:05:08 +0100 Subject: [PATCH 26/32] CI: splitting build xml files into build and epc-start XML files Signed-off-by: Raphael Defosseux --- .../xml_files/enb_ue_usrp210_band7_build.xml | 38 +++++++++++ .../enb_ue_usrp210_band7_ue_build.xml | 38 +++++++++++ .../xml_files/enb_usrp210_band13_build.xml | 16 ----- .../enb_usrp210_band13_epc_start.xml | 48 ++++++++++++++ .../xml_files/enb_usrp210_band40_build.xml | 16 ----- .../enb_usrp210_band40_epc_start.xml | 47 ++++++++++++++ .../xml_files/enb_usrp210_band7_build.xml | 16 ----- .../xml_files/enb_usrp210_band7_epc_start.xml | 47 ++++++++++++++ ...st_05mhz_tm1_rrc_inactivity_no_flexran.xml | 4 +- ...est_05mhz_tm1_rrc_inactivity_w_flexran.xml | 8 +-- .../xml_files/enb_usrpB210_band7_50PRB.xml | 65 ------------------- .../xml_files/if4p5_usrp210_band40_build.xml | 16 ----- .../if4p5_usrp210_band40_epc_start.xml | 48 ++++++++++++++ .../xml_files/if4p5_usrp210_band7_build.xml | 16 ----- .../if4p5_usrp210_band7_epc_start.xml | 48 ++++++++++++++ .../x2ho_enb_usrp210_band13_build.xml | 16 ----- .../x2ho_enb_usrp210_band13_epc_start.xml | 48 ++++++++++++++ 17 files changed, 368 insertions(+), 167 deletions(-) create mode 100644 ci-scripts/xml_files/enb_ue_usrp210_band7_build.xml create mode 100644 ci-scripts/xml_files/enb_ue_usrp210_band7_ue_build.xml create mode 100644 ci-scripts/xml_files/enb_usrp210_band13_epc_start.xml create mode 100644 ci-scripts/xml_files/enb_usrp210_band40_epc_start.xml create mode 100644 ci-scripts/xml_files/enb_usrp210_band7_epc_start.xml delete mode 100644 ci-scripts/xml_files/enb_usrpB210_band7_50PRB.xml create mode 100644 ci-scripts/xml_files/if4p5_usrp210_band40_epc_start.xml create mode 100644 ci-scripts/xml_files/if4p5_usrp210_band7_epc_start.xml create mode 100644 ci-scripts/xml_files/x2ho_enb_usrp210_band13_epc_start.xml diff --git a/ci-scripts/xml_files/enb_ue_usrp210_band7_build.xml b/ci-scripts/xml_files/enb_ue_usrp210_band7_build.xml new file mode 100644 index 0000000000..64c3517166 --- /dev/null +++ b/ci-scripts/xml_files/enb_ue_usrp210_band7_build.xml @@ -0,0 +1,38 @@ + + + build-tab + Build + wrench + + 010101 + + + + + Build_eNB + Build eNB (USRP) + -w USRP -c --eNB + + + diff --git a/ci-scripts/xml_files/enb_ue_usrp210_band7_ue_build.xml b/ci-scripts/xml_files/enb_ue_usrp210_band7_ue_build.xml new file mode 100644 index 0000000000..7280a87fb8 --- /dev/null +++ b/ci-scripts/xml_files/enb_ue_usrp210_band7_ue_build.xml @@ -0,0 +1,38 @@ + + + oai-ue-build-tab + OAI-UE-Build + wrench + +090101 + + + + + Build_OAI_UE + Build OAI UE + -w USRP --UE + + + diff --git a/ci-scripts/xml_files/enb_usrp210_band13_build.xml b/ci-scripts/xml_files/enb_usrp210_band13_build.xml index 96ab517b34..888a1230ae 100644 --- a/ci-scripts/xml_files/enb_usrp210_band13_build.xml +++ b/ci-scripts/xml_files/enb_usrp210_band13_build.xml @@ -26,7 +26,6 @@ wrench 010101 - 050101 060101 070101 @@ -37,19 +36,4 @@ -w USRP -c --eNB - - Initialize_HSS - Initialize HSS - - - - Initialize_MME - Initialize MME - - - - Initialize_SPGW - Initialize SPGW - - diff --git a/ci-scripts/xml_files/enb_usrp210_band13_epc_start.xml b/ci-scripts/xml_files/enb_usrp210_band13_epc_start.xml new file mode 100644 index 0000000000..0a788cb614 --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band13_epc_start.xml @@ -0,0 +1,48 @@ + + + epc-start-tab + EPC-Start + log-in + + 050101 060101 070101 + + + + + + Initialize_HSS + Initialize HSS + + + + Initialize_MME + Initialize MME + + + + Initialize_SPGW + Initialize SPGW + + + diff --git a/ci-scripts/xml_files/enb_usrp210_band40_build.xml b/ci-scripts/xml_files/enb_usrp210_band40_build.xml index fd32019bb5..64c3517166 100644 --- a/ci-scripts/xml_files/enb_usrp210_band40_build.xml +++ b/ci-scripts/xml_files/enb_usrp210_band40_build.xml @@ -26,7 +26,6 @@ wrench 010101 - 050101 060101 070101 @@ -36,19 +35,4 @@ -w USRP -c --eNB - - Initialize_HSS - Initialize HSS - - - - Initialize_MME - Initialize MME - - - - Initialize_SPGW - Initialize SPGW - - diff --git a/ci-scripts/xml_files/enb_usrp210_band40_epc_start.xml b/ci-scripts/xml_files/enb_usrp210_band40_epc_start.xml new file mode 100644 index 0000000000..354cff346e --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band40_epc_start.xml @@ -0,0 +1,47 @@ + + + epc-start-tab + EPC-Start + log-in + + 050101 060101 070101 + + + + + Initialize_HSS + Initialize HSS + + + + Initialize_MME + Initialize MME + + + + Initialize_SPGW + Initialize SPGW + + + diff --git a/ci-scripts/xml_files/enb_usrp210_band7_build.xml b/ci-scripts/xml_files/enb_usrp210_band7_build.xml index fd32019bb5..64c3517166 100644 --- a/ci-scripts/xml_files/enb_usrp210_band7_build.xml +++ b/ci-scripts/xml_files/enb_usrp210_band7_build.xml @@ -26,7 +26,6 @@ wrench 010101 - 050101 060101 070101 @@ -36,19 +35,4 @@ -w USRP -c --eNB - - Initialize_HSS - Initialize HSS - - - - Initialize_MME - Initialize MME - - - - Initialize_SPGW - Initialize SPGW - - diff --git a/ci-scripts/xml_files/enb_usrp210_band7_epc_start.xml b/ci-scripts/xml_files/enb_usrp210_band7_epc_start.xml new file mode 100644 index 0000000000..354cff346e --- /dev/null +++ b/ci-scripts/xml_files/enb_usrp210_band7_epc_start.xml @@ -0,0 +1,47 @@ + + + epc-start-tab + EPC-Start + log-in + + 050101 060101 070101 + + + + + Initialize_HSS + Initialize HSS + + + + Initialize_MME + Initialize MME + + + + Initialize_SPGW + Initialize SPGW + + + diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml index 686e5b1b38..a28a81d970 100644 --- a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml +++ b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml @@ -21,8 +21,8 @@ --> - test-05-tm1 - Test-05MHz-TM1 + test-05-tm1-rrc-no-flex + Test-05MHz-TM1-RRC-Inactivity tasks 030201 diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml index 9e7227aa47..07cd8fbb30 100644 --- a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml +++ b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml @@ -21,8 +21,8 @@ --> - test-05-tm1 - Test-05MHz-TM1 + test-05-tm1-rrc-w-flex + Test-05MHz-TM1-RRC-Inactivity-FlexRan tasks 2 @@ -36,8 +36,8 @@ IdleSleep - Waiting for 35 seconds - 35 + Waiting for 45 seconds + 45 diff --git a/ci-scripts/xml_files/enb_usrpB210_band7_50PRB.xml b/ci-scripts/xml_files/enb_usrpB210_band7_50PRB.xml deleted file mode 100644 index 56dfe2be72..0000000000 --- a/ci-scripts/xml_files/enb_usrpB210_band7_50PRB.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - 030101 040101 040301 040501 040401 040201 030201 - - - - Initialize_eNB - Initialize eNB (FDD/Band1/5MHz/info) - -O ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf - - - - Terminate_eNB - Terminate eNB - - - - Initialize_UE - Initialize UE - - - - Terminate_UE - Terminate UE - - - - Attach_UE - Attach UE - - - - Detach_UE - Detach UE - - - - Ping - ping (20 sec) - -c 20 - 5 - - - diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_build.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_build.xml index 752049349f..ab221c918d 100644 --- a/ci-scripts/xml_files/if4p5_usrp210_band40_build.xml +++ b/ci-scripts/xml_files/if4p5_usrp210_band40_build.xml @@ -26,7 +26,6 @@ wrench 010101 - 050101 060101 070101 @@ -37,19 +36,4 @@ -w USRP -c --eNB - - Initialize_HSS - Initialize HSS - - - - Initialize_MME - Initialize MME - - - - Initialize_SPGW - Initialize SPGW - - diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_epc_start.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_epc_start.xml new file mode 100644 index 0000000000..0a788cb614 --- /dev/null +++ b/ci-scripts/xml_files/if4p5_usrp210_band40_epc_start.xml @@ -0,0 +1,48 @@ + + + epc-start-tab + EPC-Start + log-in + + 050101 060101 070101 + + + + + + Initialize_HSS + Initialize HSS + + + + Initialize_MME + Initialize MME + + + + Initialize_SPGW + Initialize SPGW + + + diff --git a/ci-scripts/xml_files/if4p5_usrp210_band7_build.xml b/ci-scripts/xml_files/if4p5_usrp210_band7_build.xml index 8cbd2d84c6..ab221c918d 100644 --- a/ci-scripts/xml_files/if4p5_usrp210_band7_build.xml +++ b/ci-scripts/xml_files/if4p5_usrp210_band7_build.xml @@ -26,7 +26,6 @@ wrench 010101 - 050101 060101 070101 040101 @@ -37,19 +36,4 @@ -w USRP -c --eNB - - Initialize_HSS - Initialize HSS - - - - Initialize_MME - Initialize MME - - - - Initialize_SPGW - Initialize SPGW - - diff --git a/ci-scripts/xml_files/if4p5_usrp210_band7_epc_start.xml b/ci-scripts/xml_files/if4p5_usrp210_band7_epc_start.xml new file mode 100644 index 0000000000..e8d08de507 --- /dev/null +++ b/ci-scripts/xml_files/if4p5_usrp210_band7_epc_start.xml @@ -0,0 +1,48 @@ + + + epc-start-tab + EPC-Start + log-in + + 050101 060101 070101 040101 + + + + + + Initialize_HSS + Initialize HSS + + + + Initialize_MME + Initialize MME + + + + Initialize_SPGW + Initialize SPGW + + + diff --git a/ci-scripts/xml_files/x2ho_enb_usrp210_band13_build.xml b/ci-scripts/xml_files/x2ho_enb_usrp210_band13_build.xml index 0d2a122537..c5a912a33d 100644 --- a/ci-scripts/xml_files/x2ho_enb_usrp210_band13_build.xml +++ b/ci-scripts/xml_files/x2ho_enb_usrp210_band13_build.xml @@ -27,7 +27,6 @@ 010101 010102 - 050101 060101 070101 @@ -48,19 +47,4 @@ 1 - - Initialize_HSS - Initialize HSS - - - - Initialize_MME - Initialize MME - - - - Initialize_SPGW - Initialize SPGW - - diff --git a/ci-scripts/xml_files/x2ho_enb_usrp210_band13_epc_start.xml b/ci-scripts/xml_files/x2ho_enb_usrp210_band13_epc_start.xml new file mode 100644 index 0000000000..0a788cb614 --- /dev/null +++ b/ci-scripts/xml_files/x2ho_enb_usrp210_band13_epc_start.xml @@ -0,0 +1,48 @@ + + + epc-start-tab + EPC-Start + log-in + + 050101 060101 070101 + + + + + + Initialize_HSS + Initialize HSS + + + + Initialize_MME + Initialize MME + + + + Initialize_SPGW + Initialize SPGW + + + From b7a027f905bd36d3de4e28b6373d21946805778d Mon Sep 17 00:00:00 2001 From: WANG Tsu-Han Date: Thu, 23 Jan 2020 14:52:30 +0100 Subject: [PATCH 27/32] fixes for mutex lock for wake up signal --- executables/nr-gnb.c | 15 +++++++++------ executables/nr-ru.c | 4 ++-- targets/RT/USER/lte-enb.c | 5 ++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 062cec07ab..374b5b8b2f 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -422,10 +422,14 @@ int wakeup_txfh(PHY_VARS_gNB *gNB,gNB_L1_rxtx_proc_t *proc,int frame_tx,int slot // note this should depend on the numerology used by the TX L1 thread, set here for 500us slot time - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL,1); - waitret=wait_on_condition(&proc->mutex_RUs_tx,&proc->cond_RUs,&proc->instance_cnt_RUs,"wakeup_txfh"); - AssertFatal(release_thread(&proc->mutex_RUs_tx,&proc->instance_cnt_RUs,"wakeup_txfh")==0, "error releaseing gNB lock on RUs\n"); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL,0); + AssertFatal((ret = pthread_mutex_lock(&proc->mutex_RUs_tx))==0,"mutex_lock returns %d\n",ret); + while (proc->instance_cnt_RUs < 0) { + pthread_cond_wait(&proc->cond_RUs,&proc->mutex_RUs_tx); // this unlocks mutex_rxtx while waiting and then locks it again + } + proc->instance_cnt_RUs = -1; + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,proc->instance_cnt_RUs); + AssertFatal((ret = pthread_mutex_unlock(&proc->mutex_RUs_tx))==0,"mutex_unlock returns %d\n",ret); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,proc->instance_cnt_RUs); @@ -451,7 +455,6 @@ int wakeup_txfh(PHY_VARS_gNB *gNB,gNB_L1_rxtx_proc_t *proc,int frame_tx,int slot ru = gNB->RU_list[i]; ru_proc = &ru->proc; - //AssertFatal((ret = pthread_mutex_lock(&ru_proc->mutex_gNBs))==0,"ERROR pthread_mutex_lock failed on mutex_gNBs L1_thread_tx with ret=%d\n",ret); if (ru_proc->instance_cnt_gNBs == 0) { VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST_UE, 1); @@ -459,11 +462,11 @@ int wakeup_txfh(PHY_VARS_gNB *gNB,gNB_L1_rxtx_proc_t *proc,int frame_tx,int slot AssertFatal((ret=pthread_mutex_lock(&gNB->proc.mutex_RU_tx))==0,"mutex_lock returns %d\n",ret); gNB->proc.RU_mask_tx = 0; AssertFatal((ret=pthread_mutex_unlock(&gNB->proc.mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret); - //AssertFatal((ret=pthread_mutex_unlock( &ru_proc->mutex_gNBs ))==0,"mutex_unlock return %d\n",ret); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST_UE, 0); return(-1); } + AssertFatal((ret = pthread_mutex_lock(&ru_proc->mutex_gNBs))==0,"ERROR pthread_mutex_lock failed on mutex_gNBs L1_thread_tx with ret=%d\n",ret); ru_proc->instance_cnt_gNBs = 0; ru_proc->timestamp_tx = timestamp_tx; diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 37e6b71d85..ad418e73ab 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1354,11 +1354,11 @@ static void *ru_thread_tx( void *param ) { ret = pthread_mutex_lock(&L1_proc->mutex_RUs_tx); AssertFatal(ret == 0,"mutex_lock returns %d\n",ret); // the thread can now be woken up - //if (L1_proc->instance_cnt_RUs == -1) { + if (L1_proc->instance_cnt_RUs == -1) { L1_proc->instance_cnt_RUs = 0; AssertFatal(pthread_cond_signal(&L1_proc->cond_RUs) == 0, "ERROR pthread_cond_signal for gNB_L1_thread\n"); - //} //else AssertFatal(1==0,"gNB TX thread is not ready\n"); + } //else AssertFatal(1==0,"gNB TX thread is not ready\n"); ret = pthread_mutex_unlock(&L1_proc->mutex_RUs_tx); AssertFatal(ret == 0,"mutex_unlock returns %d\n",ret); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,L1_proc->instance_cnt_RUs); diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index c718d9251a..8c5c50836f 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -512,17 +512,16 @@ int wakeup_txfh(PHY_VARS_eNB *eNB, continue;//hacking only works when all RU_tx works on the same subframe #TODO: adding mask stuff } - AssertFatal((ret = pthread_mutex_lock(&ru_proc->mutex_eNBs))==0,"ERROR pthread_mutex_lock failed on mutex_eNBs L1_thread_tx with ret=%d\n",ret); - if (ru_proc->instance_cnt_eNBs == 0) { LOG_E(PHY,"Frame %d, subframe %d: TX FH thread busy, dropping Frame %d, subframe %d\n", ru_proc->frame_tx, ru_proc->tti_tx, proc->frame_rx, proc->subframe_rx); AssertFatal((ret=pthread_mutex_lock(&eNB->proc.mutex_RU_tx))==0,"mutex_lock returns %d\n",ret); eNB->proc.RU_mask_tx = 0; AssertFatal((ret=pthread_mutex_unlock(&eNB->proc.mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret); - AssertFatal((ret=pthread_mutex_unlock( &ru_proc->mutex_eNBs ))==0,"mutex_unlock return %d\n",ret); return(-1); } + AssertFatal((ret = pthread_mutex_lock(&ru_proc->mutex_eNBs))==0,"ERROR pthread_mutex_lock failed on mutex_eNBs L1_thread_tx with ret=%d\n",ret); + ru_proc->instance_cnt_eNBs = 0; ru_proc->timestamp_tx = timestamp_tx; ru_proc->tti_tx = subframe_tx; From d3b19823f0aea8f30cdc7e3df34935bca5b7ee65 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Thu, 23 Jan 2020 15:54:19 +0100 Subject: [PATCH 28/32] CI: count ULSCH received ok messages --- ci-scripts/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index e4618919ee..6854520c8f 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -3079,6 +3079,7 @@ class SSHConnection(): uciStatMsgCount = 0 pdcpFailure = 0 ulschFailure = 0 + ulschOK = 0 cdrxActivationMessageCount = 0 dropNotEnoughRBs = 0 mbmsRequestMsg = 0 @@ -3191,6 +3192,9 @@ class SSHConnection(): result = re.search('ULSCH in error in round', str(line)) if result is not None: ulschFailure += 1 + result = re.search('ULSCH received ok', str(line)) + if result is not None: + ulschOK += 1 result = re.search('BAD all_segments_received', str(line)) if result is not None: rlcDiscardBuffer += 1 @@ -3223,6 +3227,10 @@ class SSHConnection(): statMsg = nodeB_prefix + 'NB showed ' + str(ulschFailure) + ' "ULSCH in error in round" message(s)' logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') self.htmleNBFailureMsg += statMsg + '\n' + if ulschOK > 0: + statMsg = nodeB_prefix + 'NB showed ' + str(ulschOK) + ' "ULSCH received ok" message(s)' + logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') + self.htmleNBFailureMsg += statMsg + '\n' if dropNotEnoughRBs > 0: statMsg = 'eNB showed ' + str(dropNotEnoughRBs) + ' "dropping, not enough RBs" message(s)' logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') From fd865ea06d02ada99cdbe547dad6f453cd00e5f6 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 24 Jan 2020 12:05:58 +0100 Subject: [PATCH 29/32] CI: doing the check only in NR Signed-off-by: Raphael Defosseux --- ci-scripts/main.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 6854520c8f..4c5a10c1eb 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -3192,9 +3192,10 @@ class SSHConnection(): result = re.search('ULSCH in error in round', str(line)) if result is not None: ulschFailure += 1 - result = re.search('ULSCH received ok', str(line)) - if result is not None: - ulschOK += 1 + if self.air_interface == 'nr': + result = re.search('ULSCH received ok', str(line)) + if result is not None: + ulschOK += 1 result = re.search('BAD all_segments_received', str(line)) if result is not None: rlcDiscardBuffer += 1 @@ -3227,10 +3228,11 @@ class SSHConnection(): statMsg = nodeB_prefix + 'NB showed ' + str(ulschFailure) + ' "ULSCH in error in round" message(s)' logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') self.htmleNBFailureMsg += statMsg + '\n' - if ulschOK > 0: - statMsg = nodeB_prefix + 'NB showed ' + str(ulschOK) + ' "ULSCH received ok" message(s)' - logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') - self.htmleNBFailureMsg += statMsg + '\n' + if self.air_interface == 'nr': + if ulschOK > 0: + statMsg = nodeB_prefix + 'NB showed ' + str(ulschOK) + ' "ULSCH received ok" message(s)' + logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') + self.htmleNBFailureMsg += statMsg + '\n' if dropNotEnoughRBs > 0: statMsg = 'eNB showed ' + str(dropNotEnoughRBs) + ' "dropping, not enough RBs" message(s)' logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') From 9078a01e35ce7027838ab41d995de917a1699685 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 24 Jan 2020 16:03:42 +0100 Subject: [PATCH 30/32] CI: adding FDD-10MHz to RFSIM Signed-off-by: Raphael Defosseux --- ci-scripts/reportTestLocally.sh | 2 +- ci-scripts/runTestOnVM.sh | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh index cd1e4e9546..c4236a4e0e 100755 --- a/ci-scripts/reportTestLocally.sh +++ b/ci-scripts/reportTestLocally.sh @@ -435,7 +435,7 @@ function report_test { EPC_CONFIGS=("wS1 noS1") TRANS_MODES=("fdd") - BW_CASES=(05) + BW_CASES=(05 10) for CN_CONFIG in ${EPC_CONFIGS[@]} do for TMODE in ${TRANS_MODES[@]} diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index 289f4500e6..e6440ffef9 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -1757,7 +1757,7 @@ function run_test_on_vm { #BW_CASES=(05 10 20) EPC_CONFIGS=("wS1" "noS1") TRANS_MODES=("fdd") - BW_CASES=(05) + BW_CASES=(05 10) for CN_CONFIG in ${EPC_CONFIGS[@]} do if [[ $CN_CONFIG =~ .*wS1.* ]] @@ -1949,6 +1949,7 @@ function run_test_on_vm { TMODE="fdd" FREQUENCY=2680 BW_CASES=(05) + MBMS_STATUS=0 for BW in ${BW_CASES[@]} do @@ -1997,6 +1998,8 @@ function run_test_on_vm { terminate_enb_ue_basic_sim $UE_VM_CMDS $UE_VM_IP_ADDR 2 scp -o StrictHostKeyChecking=no ubuntu@$ENB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC + NB_UE_MBMS_MESSAGES=`egrep -c "TRIED TO PUSH MBMS DATA TO" $ARCHIVES_LOC/$CURRENT_UE_LOG_FILE` + if [ $NB_UE_MBMS_MESSAGES -eq 0 ]; then MBMS_STATUS=-1; fi done @@ -2008,6 +2011,13 @@ function run_test_on_vm { if [ $PING_STATUS -ne 0 ]; then STATUS=-1; fi if [ $IPERF_STATUS -ne 0 ]; then STATUS=-1; fi + if [ $MBMS_STATUS -eq 0 ] + then + echo "LTE MBMS RFSIM seems OK" + else + echo "LTE MBMS RFSIM seems to FAIL" + STATUS=-1 + fi if [ $STATUS -eq 0 ] then echo "LTE RFSIM seems OK" From 44cfdab5b7a21208c3c51eeee509e1ed03a8c0af Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 24 Jan 2020 11:22:14 +0100 Subject: [PATCH 31/32] CI: fix the missing 5G-NR UE build report Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-gitlab | 6 +++++- ci-scripts/reportBuildLocally.sh | 36 ++++++++++++++++---------------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index fcfd56a4a2..8dfa5c4ec4 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -342,7 +342,11 @@ pipeline { always { script { dir ('archives') { - sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck enb_eth ue_eth gnb_usrp nrue_usrp red_hat" + if (fileExists('red_hat')) { + sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck enb_eth ue_eth gnb_usrp nr_ue_usrp red_hat" + } else { + sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck enb_eth ue_eth gnb_usrp nr_ue_usrp" + } } if(fileExists('archives/vm_build_logs.zip')) { archiveArtifacts artifacts: 'archives/vm_build_logs.zip' diff --git a/ci-scripts/reportBuildLocally.sh b/ci-scripts/reportBuildLocally.sh index b6c2ca104a..54372ac6ba 100755 --- a/ci-scripts/reportBuildLocally.sh +++ b/ci-scripts/reportBuildLocally.sh @@ -509,7 +509,7 @@ function report_build { sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Expression depends on order of evaluation of side effects" unknownEvaluationOrder sca_summary_table_footer ./archives/cppcheck/cppcheck.xml - summary_table_header "OAI Build eNB -- USRP option" ./archives/enb_usrp + summary_table_header "OAI Build: 4G LTE eNB -- USRP option" ./archives/enb_usrp summary_table_row "LTE SoftModem - Release 15" ./archives/enb_usrp/lte-softmodem.Rel15.txt "Built target lte-softmodem" ./enb_usrp_row1.html summary_table_row "Coding - Release 15" ./archives/enb_usrp/coding.Rel15.txt "Built target coding" ./enb_usrp_row2.html summary_table_row "OAI USRP device if - Release 15" ./archives/enb_usrp/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./enb_usrp_row3.html @@ -521,7 +521,7 @@ function report_build { summary_table_row "TCP Bridge - Release 15" ./archives/enb_usrp/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./enb_usrp_row9.html summary_table_footer - summary_table_header "OAI Build basic simulator option" ./archives/basic_sim + summary_table_header "OAI Build: 4G LTE basic simulator option" ./archives/basic_sim summary_table_row "LTE SoftModem - Release 15" ./archives/basic_sim/lte-softmodem.Rel15.txt "Built target lte-softmodem" ./basic_sim_row1.html summary_table_row "LTE UE SoftModem - Release 15" ./archives/basic_sim/lte-uesoftmodem.Rel15.txt "Built target lte-uesoftmodem" ./basic_sim_row2.htm summary_table_row "Coding - Release 15" ./archives/basic_sim/coding.Rel15.txt "Built target coding" ./basic_sim_row3.html @@ -537,7 +537,7 @@ function report_build { summary_table_row "NVRAM - Release 15" ./archives/basic_sim/nvram.Rel15.txt "Built target nvram" ./basic_sim_row13.html summary_table_footer - summary_table_header "OAI Build Physical simulators option" ./archives/phy_sim + summary_table_header "OAI Build: 4G LTE / 5G NR Physical simulators option" ./archives/phy_sim summary_table_row "LTE DL Simulator - Release 15" ./archives/phy_sim/dlsim.Rel15.txt "Built target dlsim" ./phy_sim_row1.html summary_table_row "LTE UL Simulator - Release 15" ./archives/phy_sim/ulsim.Rel15.txt "Built target ulsim" ./phy_sim_row2.html summary_table_row "Coding - Release 15" ./archives/phy_sim/coding.Rel15.txt "Built target coding" ./phy_sim_row3.html @@ -581,7 +581,7 @@ function report_build { if [ -f archives/gnb_usrp/nr-softmodem.Rel15.txt ] then - summary_table_header "OAI Build gNB -- USRP option" ./archives/gnb_usrp + summary_table_header "OAI Build: 5G NR gNB -- USRP option" ./archives/gnb_usrp summary_table_row "5G NR SoftModem - Release 15" ./archives/gnb_usrp/nr-softmodem.Rel15.txt "Built target nr-softmodem" ./gnb_usrp_row1.html summary_table_row "Coding - Release 15" ./archives/gnb_usrp/coding.Rel15.txt "Built target coding" ./gnb_usrp_row2.html summary_table_row "OAI USRP device if - Release 15" ./archives/gnb_usrp/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./gnb_usrp_row3.html @@ -592,20 +592,20 @@ function report_build { summary_table_footer fi - if [ -f archives/nrue_usrp/nr-uesoftmodem.Rel15.txt ] + if [ -f archives/nr_ue_usrp/nr-uesoftmodem.Rel15.txt ] then - summary_table_header "OAI Build 5G NR UE -- USRP option" ./archives/nrue_usrp - summary_table_row "5G NR UE SoftModem - Release 15" ./archives/nrue_usrp/nr-uesoftmodem.Rel15.txt "Built target nr-uesoftmodem" ./nrue_usrp_row1.html - summary_table_row "Coding - Release 15" ./archives/nrue_usrp/coding.Rel15.txt "Built target coding" ./nrue_usrp_row2.html - summary_table_row "OAI USRP device if - Release 15" ./archives/nrue_usrp/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./nrue_usrp_row3.html - summary_table_row "OAI ETHERNET transport - Release 15" ./archives/nrue_usrp/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./nrue_usrp_row4.html - summary_table_row "NASMESH - Release 15" ./archives/nrue_usrp/nasmesh.Rel15.txt "Built target nasmesh" ./nrue_usrp_row5.html - summary_table_row "Parameters Lib Config - Release 15" ./archives/nrue_usrp/params_libconfig.Rel15.txt "Built target params_libconfig" ./nrue_usrp_row6.html - summary_table_row "RB Tool - Release 15" ./archives/nrue_usrp/rb_tool.Rel15.txt "Built target rb_tool" ./nrue_usrp_row7.html + summary_table_header "OAI Build: 5G NR UE -- USRP option" ./archives/nr_ue_usrp + summary_table_row "5G NR UE SoftModem - Release 15" ./archives/nr_ue_usrp/nr-uesoftmodem.Rel15.txt "Built target nr-uesoftmodem" ./nr_ue_usrp_row1.html + summary_table_row "Coding - Release 15" ./archives/nr_ue_usrp/coding.Rel15.txt "Built target coding" ./nr_ue_usrp_row2.html + summary_table_row "OAI USRP device if - Release 15" ./archives/nr_ue_usrp/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./nr_ue_usrp_row3.html + summary_table_row "OAI ETHERNET transport - Release 15" ./archives/nr_ue_usrp/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./nr_ue_usrp_row4.html + summary_table_row "NASMESH - Release 15" ./archives/nr_ue_usrp/nasmesh.Rel15.txt "Built target nasmesh" ./nr_ue_usrp_row5.html + summary_table_row "Parameters Lib Config - Release 15" ./archives/nr_ue_usrp/params_libconfig.Rel15.txt "Built target params_libconfig" ./nr_ue_usrp_row6.html + summary_table_row "RB Tool - Release 15" ./archives/nr_ue_usrp/rb_tool.Rel15.txt "Built target rb_tool" ./nr_ue_usrp_row7.html summary_table_footer fi - summary_table_header "OAI Build eNB -- ETHERNET transport option" ./archives/enb_eth + summary_table_header "OAI Build: 4G LTE eNB -- ETHERNET transport option" ./archives/enb_eth summary_table_row "LTE SoftModem - Release 15" ./archives/enb_eth/lte-softmodem.Rel15.txt "Built target lte-softmodem" ./enb_eth_row1.html summary_table_row "Coding - Release 15" ./archives/enb_eth/coding.Rel15.txt "Built target coding" ./enb_eth_row2.html summary_table_row "OAI ETHERNET transport - Release 15" ./archives/enb_eth/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./enb_eth_row3.html @@ -614,7 +614,7 @@ function report_build { summary_table_row "TCP OAI Bridge - Release 15" ./archives/enb_eth/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./enb_eth_row6.html summary_table_footer - summary_table_header "OAI Build UE -- ETHERNET transport option" ./archives/ue_eth + summary_table_header "OAI Build: 4G LTE UE -- ETHERNET transport option" ./archives/ue_eth summary_table_row "LTE UE SoftModem - Release 15" ./archives/ue_eth/lte-uesoftmodem.Rel15.txt "Built target lte-uesoftmodem" ./ue_eth_row1.html summary_table_row "Coding - Release 15" ./archives/ue_eth/coding.Rel15.txt "Built target coding" ./ue_eth_row2.html summary_table_row "OAI ETHERNET transport - Release 15" ./archives/ue_eth/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./ue_eth_row3.html @@ -631,7 +631,7 @@ function report_build { then echo "

Red Hat Enterprise Linux Server release 7.6) -- Summary

" >> ./build_results.html - summary_table_header "Red Hat -- OAI Build eNB -- USRP option" ./archives/red_hat + summary_table_header "OAI Build: 4G LTE eNB -- USRP option (RHEL)" ./archives/red_hat summary_table_row "LTE SoftModem - Release 15" ./archives/red_hat/lte-softmodem.Rel15.txt "Built target lte-softmodem" ./enb_usrp_rh_row1.html summary_table_row "Coding - Release 15" ./archives/red_hat/coding.Rel15.txt "Built target coding" ./enb_usrp_rh_row2.html summary_table_row "OAI USRP device if - Release 15" ./archives/red_hat/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./enb_usrp_rh_row3.html @@ -671,9 +671,9 @@ function report_build { cat $DETAILS_TABLE >> ./build_results.html done fi - if [ -f ./nrue_usrp_row1.html ] || [ -f ./nrue_usrp_row2.html ] || [ -f ./nrue_usrp_row3.html ] || [ -f ./nrue_usrp_row4.html ] + if [ -f ./nr_ue_usrp_row1.html ] || [ -f ./nr_ue_usrp_row2.html ] || [ -f ./nr_ue_usrp_row3.html ] || [ -f ./nr_ue_usrp_row4.html ] then - for DETAILS_TABLE in `ls ./nrue_usrp_row*.html` + for DETAILS_TABLE in `ls ./nr_ue_usrp_row*.html` do cat $DETAILS_TABLE >> ./build_results.html done From 4eaadf8d8219fb6e598435ae906abf9759c00781 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Sun, 26 Jan 2020 13:41:36 +0100 Subject: [PATCH 32/32] CI: fixing slave pipelines Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-tmp-full-ran | 8 ++++---- ci-scripts/Jenkinsfile-tmp-multi-enb | 12 ++++++------ ci-scripts/Jenkinsfile-tmp-ran | 8 ++++---- ci-scripts/Jenkinsfile-tmp-ue | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ci-scripts/Jenkinsfile-tmp-full-ran b/ci-scripts/Jenkinsfile-tmp-full-ran index 096ff7f52d..15ad0379af 100644 --- a/ci-scripts/Jenkinsfile-tmp-full-ran +++ b/ci-scripts/Jenkinsfile-tmp-full-ran @@ -51,7 +51,7 @@ termStatusArray[termOAIUE] = false def eNB_Repository def eNB_Branch def eNB_CommitID -def ranAllowMergeRequestProcess = false +def eNB_AllowMergeRequestProcess = false def eNB_TargetBranch def doEpcLogCollection = true @@ -130,8 +130,8 @@ pipeline { } echo "eNB_CommitID : ${eNB_CommitID}" if (params.eNB_mergeRequest != null) { - ranAllowMergeRequestProcess = params.eNB_mergeRequest - if (ranAllowMergeRequestProcess) { + eNB_AllowMergeRequestProcess = params.eNB_mergeRequest + if (eNB_AllowMergeRequestProcess) { if (params.eNB_TargetBranch != null) { eNB_TargetBranch = params.eNB_TargetBranch } else { @@ -168,7 +168,7 @@ pipeline { if (allParametersPresent) { echo "All parameters are present" - if (ranAllowMergeRequestProcess) { + if (eNB_AllowMergeRequestProcess) { sh "git fetch" sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest" } else { diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb b/ci-scripts/Jenkinsfile-tmp-multi-enb index 4df2006ed2..c3b825ec06 100644 --- a/ci-scripts/Jenkinsfile-tmp-multi-enb +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb @@ -41,7 +41,7 @@ def ciSmartPhoneResource = params.smartphonesResource def eNB_Repository def eNB_Branch def eNB_CommitID -def ranAllowMergeRequestProcess = false +def eNB_AllowMergeRequestProcess = false def eNB_TargetBranch pipeline { @@ -124,8 +124,8 @@ pipeline { } echo "eNB_CommitID : ${eNB_CommitID}" if (params.eNB_mergeRequest != null) { - ranAllowMergeRequestProcess = params.eNB_mergeRequest - if (ranAllowMergeRequestProcess) { + eNB_AllowMergeRequestProcess = params.eNB_mergeRequest + if (eNB_AllowMergeRequestProcess) { if (params.eNB_TargetBranch != null) { eNB_TargetBranch = params.eNB_TargetBranch } else { @@ -157,7 +157,7 @@ pipeline { if (allParametersPresent) { echo "All parameters are present" - if (ranAllowMergeRequestProcess) { + if (eNB_AllowMergeRequestProcess) { sh "git fetch" sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest" } else { @@ -198,12 +198,12 @@ pipeline { [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] ]) { - sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${ranAllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") for (xmlFile in myXmlTestSuite) { if (fileExists(xmlFile)) { try { - sh "python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${ranAllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNB1IPAddress=${params.eNB1_IPAddress} --eNB1UserName=${eNB1_Username} --eNB1Password=${eNB1_Password} --eNB1SourceCodePath=${params.eNB1_SourceCodePath} --eNB2IPAddress=${params.eNB2_IPAddress} --eNB2UserName=${eNB2_Username} --eNB2Password=${eNB2_Password} --eNB2SourceCodePath=${params.eNB2_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + sh "python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNB1IPAddress=${params.eNB1_IPAddress} --eNB1UserName=${eNB1_Username} --eNB1Password=${eNB1_Password} --eNB1SourceCodePath=${params.eNB1_SourceCodePath} --eNB2IPAddress=${params.eNB2_IPAddress} --eNB2UserName=${eNB2_Username} --eNB2Password=${eNB2_Password} --eNB2SourceCodePath=${params.eNB2_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" } catch (Exception e) { currentBuild.result = 'FAILURE' buildStageStatus = false diff --git a/ci-scripts/Jenkinsfile-tmp-ran b/ci-scripts/Jenkinsfile-tmp-ran index ad852b8e93..a93a3a3758 100644 --- a/ci-scripts/Jenkinsfile-tmp-ran +++ b/ci-scripts/Jenkinsfile-tmp-ran @@ -54,7 +54,7 @@ termStatusArray[termHSS] = false def eNB_Repository def eNB_Branch def eNB_CommitID -def ranAllowMergeRequestProcess = false +def eNB_AllowMergeRequestProcess = false def eNB_TargetBranch pipeline { @@ -145,8 +145,8 @@ pipeline { } echo "eNB_CommitID : ${eNB_CommitID}" if (params.eNB_mergeRequest != null) { - ranAllowMergeRequestProcess = params.eNB_mergeRequest - if (ranAllowMergeRequestProcess) { + eNB_AllowMergeRequestProcess = params.eNB_mergeRequest + if (eNB_AllowMergeRequestProcess) { if (params.eNB_TargetBranch != null) { eNB_TargetBranch = params.eNB_TargetBranch } else { @@ -178,7 +178,7 @@ pipeline { if (allParametersPresent) { echo "All parameters are present" - if (ranAllowMergeRequestProcess) { + if (eNB_AllowMergeRequestProcess) { sh "git fetch" sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest" } else { diff --git a/ci-scripts/Jenkinsfile-tmp-ue b/ci-scripts/Jenkinsfile-tmp-ue index e22cd45615..e5e456cf7f 100644 --- a/ci-scripts/Jenkinsfile-tmp-ue +++ b/ci-scripts/Jenkinsfile-tmp-ue @@ -54,7 +54,7 @@ termStatusArray[termHSS] = false def eNB_Repository def eNB_Branch def eNB_CommitID -def ranAllowMergeRequestProcess = false +def eNB_AllowMergeRequestProcess = false def eNB_TargetBranch pipeline { @@ -116,8 +116,8 @@ pipeline { } echo "eNB_CommitID : ${eNB_CommitID}" if (params.eNB_mergeRequest != null) { - ranAllowMergeRequestProcess = params.eNB_mergeRequest - if (ranAllowMergeRequestProcess) { + eNB_AllowMergeRequestProcess = params.eNB_mergeRequest + if (eNB_AllowMergeRequestProcess) { if (params.eNB_TargetBranch != null) { eNB_TargetBranch = params.eNB_TargetBranch } else { @@ -149,7 +149,7 @@ pipeline { if (allParametersPresent) { echo "All parameters are present" - if (ranAllowMergeRequestProcess) { + if (eNB_AllowMergeRequestProcess) { sh "git fetch" sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest" } else {
Log File Name