From 388ad20553457151289423dffcbbbba6479a30f3 Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Wed, 12 Mar 2014 16:33:33 +0000 Subject: [PATCH] *update dlsim to capture overall timing *add performance measurment test cases *update the start_one_eNB_multi_UE_nas script git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5151 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openair1/PHY/LTE_TRANSPORT/pmch.c | 2 +- openair1/PHY/TOOLS/time_meas.c | 12 + openair1/PHY/TOOLS/time_meas.h | 1 + openair1/PHY/defs.h | 1 + openair1/SIMULATION/LTE_PHY/dlsim.c | 270 ++++++++++++++---- openair1/SIMULATION/LTE_PHY/ulsim.c | 40 +++ openair2/LAYER2/MAC/ue_procedures.c | 12 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 6 + .../VIRT_EMUL_1eNB/start_one_eNB_multi_UE_nas | 4 +- targets/TEST/OAI/case04.py | 191 +++++++++++++ targets/TEST/OAI/case05.py | 185 ++++++++++++ targets/TEST/OAI/case11.py | 84 ++++++ targets/TEST/OAI/case12.py | 128 +++++++++ targets/TEST/OAI/core.py | 12 +- targets/TEST/OAI/openair.py | 35 ++- targets/TEST/OAI/test01.py | 9 + targets/TEST/OAI/test02.py | 129 +++++++++ 17 files changed, 1044 insertions(+), 77 deletions(-) create mode 100644 targets/TEST/OAI/case04.py create mode 100644 targets/TEST/OAI/case05.py create mode 100644 targets/TEST/OAI/case11.py create mode 100644 targets/TEST/OAI/case12.py create mode 100644 targets/TEST/OAI/test02.py diff --git a/openair1/PHY/LTE_TRANSPORT/pmch.c b/openair1/PHY/LTE_TRANSPORT/pmch.c index b3c80ce49ec..9a7f75cd94f 100644 --- a/openair1/PHY/LTE_TRANSPORT/pmch.c +++ b/openair1/PHY/LTE_TRANSPORT/pmch.c @@ -233,7 +233,7 @@ void fill_UE_dlsch_MCH(PHY_VARS_UE *phy_vars_ue,int mcs,int ndi,int rvidx,int eN memcpy(phy_vars_eNB->dlsch_eNB_MCH->harq_processes[0]->b, a, phy_vars_eNB->dlsch_eNB_MCH->harq_processes[0]->TBS>>3); - LOG_D(PHY, "eNB %d dlsch_encoding_emul pmch , tbs is %d \n", + LOG_D(PHY, "[eNB %d] dlsch_encoding_emul pmch , tbs is %d \n", phy_vars_eNB->Mod_id, phy_vars_eNB->dlsch_eNB_MCH->harq_processes[0]->TBS>>3); diff --git a/openair1/PHY/TOOLS/time_meas.c b/openair1/PHY/TOOLS/time_meas.c index 0e7b4800350..66cbcf68f6b 100644 --- a/openair1/PHY/TOOLS/time_meas.c +++ b/openair1/PHY/TOOLS/time_meas.c @@ -32,3 +32,15 @@ void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_ti } } + +double get_time_meas_us(time_stats_t *ts){ + + static double cpu_freq_GHz = 0.0; + + if (cpu_freq_GHz == 0.0) + cpu_freq_GHz = get_cpu_freq_GHz(); + + if (ts->trials>0) + return (ts->diff/ts->trials/cpu_freq_GHz/1000.0); + +} diff --git a/openair1/PHY/TOOLS/time_meas.h b/openair1/PHY/TOOLS/time_meas.h index 203a8b95240..6d31ec3dfb2 100644 --- a/openair1/PHY/TOOLS/time_meas.h +++ b/openair1/PHY/TOOLS/time_meas.h @@ -17,6 +17,7 @@ static inline void start_meas(time_stats_t *ts) __attribute__((always_inline)); static inline void stop_meas(time_stats_t *ts) __attribute__((always_inline)); void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_time, time_stats_t * sf_exec_time); +double get_time_meas_us(time_stats_t *ts); #if defined(__i386__) static inline unsigned long long rdtsc_oai(void) __attribute__((always_inline)); diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h index 0bad02cf91d..974efd45b0c 100755 --- a/openair1/PHY/defs.h +++ b/openair1/PHY/defs.h @@ -512,6 +512,7 @@ typedef struct time_stats_t ulsch_multiplexing_stats; time_stats_t ofdm_demod_stats; + time_stats_t dlsch_rx_pdcch_stats; time_stats_t rx_dft_stats; time_stats_t dlsch_channel_estimation_stats; time_stats_t dlsch_freq_offset_estimation_stats; diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 771b441dd86..b47a23a473c 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -1,3 +1,43 @@ +/******************************************************************************* + + Eurecom OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + This program is free software; you can redistribute it and/or modify it + under the terms and conditions of the GNU General Public License, + version 2, as published by the Free Software Foundation. + + This program is distributed in the hope it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + + The full GNU General Public License is included in this distribution in + the file called "COPYING". + + Contact Information + Openair Admin: openair_admin@eurecom.fr + Openair Tech : openair_tech@eurecom.fr + Forums : http://forums.eurecom.fsr/openairinterface + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France + +*******************************************************************************/ + +/*! \file dlsim.c + \brief Top-level DL simulator + \author R. Knopp + \date 2011 + \version 0.1 + \company Eurecom + \email: knopp@eurecom.fr + \note + \warning +*/ + #include <string.h> #include <math.h> #include <unistd.h> @@ -217,6 +257,8 @@ int main(int argc, char **argv) { int re_allocated; FILE *bler_fd; char bler_fname[256]; + FILE *time_meas_fd; + char time_meas_fname[256]; FILE *tikz_fd; char tikz_fname[256]; @@ -274,12 +316,16 @@ int main(int argc, char **argv) { int common_flag=0,TPC=0; double cpu_freq_GHz; - time_stats_t ts,sts,usts; + time_stats_t ts;//,sts,usts; int avg_iter,iter_trials; int rballocset=0; int print_perf=0; + int test_perf=0; + int llr8_flag=0; + double effective_rate=0.0; + char channel_model_input[10]; opp_enabled=1; // to enable the time meas cpu_freq_GHz = (double)get_cpu_freq_GHz(); @@ -296,7 +342,7 @@ int main(int argc, char **argv) { snr0 = 0; num_layers = 1; - while ((c = getopt (argc, argv, "hadpDe:m:n:o:s:f:t:c:g:r:F:x:y:z:MN:I:i:R:S:C:T:b:u:v:w:B:PLl:")) != -1) { + while ((c = getopt (argc, argv, "hadpDe:m:n:o:s:f:t:c:g:r:F:x:y:z:MN:I:i:O:R:S:C:T:b:u:v:w:B:PLl:")) != -1) { switch (c) { case 'a': @@ -360,6 +406,7 @@ int main(int argc, char **argv) { num_pdcch_symbols=atoi(optarg); break; case 'g': + sprintf(channel_model_input,optarg,10); switch((char)*optarg) { case 'A': channel_model=SCM_A; @@ -481,7 +528,6 @@ int main(int argc, char **argv) { break; case 'P': print_perf=1; - break; case 'L': llr8_flag=1; @@ -489,6 +535,10 @@ int main(int argc, char **argv) { case 'l': offset_mumimo_llr_drange_fix=atoi(optarg); break; + case 'O': + test_perf=atoi(optarg); + //print_perf =1; + break; case 'h': default: printf("%s -h(elp) -a(wgn on) -d(ci decoding on) -p(extended prefix on) -m mcs -n n_frames -s snr0 -x transmission mode (1,2,5,6) -y TXant -z RXant -I trch_file\n",argv[0]); @@ -512,6 +562,7 @@ int main(int argc, char **argv) { printf("-R Number of HARQ rounds (fixed)\n"); printf("-M Turns on calibration mode for abstraction.\n"); printf("-N Determines the number of Channel Realizations in Abstraction mode. Default value is 1. \n"); + printf("-O Set the percenatge of effective rate to testbench the modem performance (typically 30 and 70, range 1-100) \n"); printf("-I Input filename for TrCH data (binary)\n"); printf("-u Determines if the 2 streams at the UE are decoded or not. 0-->U2 is interference only and 1-->U2 is detected\n"); exit(1); @@ -598,7 +649,7 @@ int main(int argc, char **argv) { nsymb = (PHY_vars_eNB->lte_frame_parms.Ncp == 0) ? 14 : 12; - printf("Channel Model=%d\n",channel_model); + printf("Channel Model= (%s,%d)\n",channel_model_input, channel_model); printf("SCM-A=%d, SCM-B=%d, SCM-C=%d, SCM-D=%d, EPA=%d, EVA=%d, ETU=%d, Rayleigh8=%d, Rayleigh1=%d, Rayleigh1_corr=%d, Rayleigh1_anticorr=%d, Rice1=%d, Rice8=%d\n", SCM_A, SCM_B, SCM_C, SCM_D, EPA, EVA, ETU, Rayleigh8, Rayleigh1, Rayleigh1_corr, Rayleigh1_anticorr, Rice1, Rice8); @@ -610,6 +661,12 @@ int main(int argc, char **argv) { bler_fd = fopen(bler_fname,"w"); fprintf(bler_fd,"SNR; MCS; TBS; rate; err0; trials0; err1; trials1; err2; trials2; err3; trials3; dci_err\n"); + if (test_perf != 0) { + sprintf(time_meas_fname,"%s/TEST/OAI/PERF/time_meas_prb%d_mcs%d_anttx%d_antrx%d_pdcch%d_channel%s_tx%d.csv", + getenv("OPENAIR_TARGETS"), + N_RB_DL,mcs,n_tx,n_rx,num_pdcch_symbols,channel_model_input,transmission_mode); + time_meas_fd = fopen(time_meas_fname,"w"); + } if(abstx){ // CSV file @@ -1231,14 +1288,17 @@ int main(int argc, char **argv) { round=0; avg_iter = 0; iter_trials=0; - reset_meas(&sts); - reset_meas(&usts); + reset_meas(&PHY_vars_eNB->phy_proc_tx); // total eNB tx + reset_meas(&PHY_vars_eNB->dlsch_scrambling_stats); + reset_meas(&PHY_vars_UE->dlsch_unscrambling_stats); reset_meas(&PHY_vars_eNB->ofdm_mod_stats); reset_meas(&PHY_vars_eNB->dlsch_modulation_stats); reset_meas(&PHY_vars_eNB->dlsch_encoding_stats); reset_meas(&PHY_vars_eNB->dlsch_interleaving_stats); reset_meas(&PHY_vars_eNB->dlsch_rate_matching_stats); reset_meas(&PHY_vars_eNB->dlsch_turbo_encoding_stats); + + reset_meas(&PHY_vars_UE->phy_proc_rx); // total UE rx reset_meas(&PHY_vars_UE->ofdm_demod_stats); reset_meas(&PHY_vars_UE->dlsch_channel_estimation_stats); reset_meas(&PHY_vars_UE->dlsch_freq_offset_estimation_stats); @@ -1288,6 +1348,8 @@ int main(int argc, char **argv) { if (input_fd==NULL) { + start_meas(&PHY_vars_eNB->phy_proc_tx); + // Simulate HARQ procedures!!! if (common_flag == 0) { @@ -1511,14 +1573,14 @@ int main(int argc, char **argv) { stop_meas(&PHY_vars_eNB->dlsch_encoding_stats); PHY_vars_eNB->dlsch_eNB[k][0]->rnti = (common_flag==0) ? n_rnti+k : SI_RNTI; - start_meas(&sts); + start_meas(&PHY_vars_eNB->dlsch_scrambling_stats); dlsch_scrambling(&PHY_vars_eNB->lte_frame_parms, 0, PHY_vars_eNB->dlsch_eNB[k][0], coded_bits_per_codeword, 0, subframe<<1); - stop_meas(&sts); + stop_meas(&PHY_vars_eNB->dlsch_scrambling_stats); if (n_frames==1) { for (s=0;s<PHY_vars_eNB->dlsch_eNB[k][0]->harq_processes[0]->C;s++) { if (s<PHY_vars_eNB->dlsch_eNB[k][0]->harq_processes[0]->Cminus) @@ -1571,9 +1633,10 @@ int main(int argc, char **argv) { PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id], (subframe*2)+1, &PHY_vars_eNB->lte_frame_parms); - + stop_meas(&PHY_vars_eNB->ofdm_mod_stats); - + stop_meas(&PHY_vars_eNB->phy_proc_tx); + do_OFDM_mod(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id], PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id], (subframe*2)+2, @@ -1773,6 +1836,7 @@ int main(int argc, char **argv) { pilot3 = 9; } + start_meas(&PHY_vars_UE->phy_proc_rx); // Inner receiver scheduling for 3 slots for (Ns=(2*subframe);Ns<((2*subframe)+3);Ns++) { for (l=0;l<pilot2;l++) { @@ -1790,6 +1854,7 @@ int main(int argc, char **argv) { no_prefix if 1 prefix is removed by HW */ + start_meas(&PHY_vars_UE->ofdm_demod_stats); slot_fep(PHY_vars_UE, l, @@ -1876,7 +1941,7 @@ int main(int argc, char **argv) { if (dci_flag == 1) { PHY_vars_UE->UE_mode[0] = PUSCH; - + start_meas(&PHY_vars_UE->dlsch_rx_pdcch_stats); rx_pdcch(&PHY_vars_UE->lte_ue_common_vars, PHY_vars_UE->lte_ue_pdcch_vars, &PHY_vars_UE->lte_frame_parms, @@ -1884,7 +1949,7 @@ int main(int argc, char **argv) { 0, (PHY_vars_UE->lte_frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI, 0); - + stop_meas(&PHY_vars_UE->dlsch_rx_pdcch_stats); // overwrite number of pdcch symbols PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols = num_pdcch_symbols; @@ -2076,50 +2141,50 @@ int main(int argc, char **argv) { } stop_meas(&PHY_vars_UE->dlsch_llr_stats); } - - if ((n_frames==1) && (Ns==(2+(2*subframe))) && (l==0)) { - write_output("ch0.m","ch0",eNB2UE[0]->ch[0],eNB2UE[0]->channel_length,1,8); - if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1) - write_output("ch1.m","ch1",eNB2UE[0]->ch[PHY_vars_eNB->lte_frame_parms.nb_antennas_rx],eNB2UE[0]->channel_length,1,8); - - //common vars - write_output("rxsig0.m","rxs0", &PHY_vars_UE->lte_ue_common_vars.rxdata[0][0],10*PHY_vars_UE->lte_frame_parms.samples_per_tti,1,1); - write_output("rxsigF0.m","rxsF0", &PHY_vars_UE->lte_ue_common_vars.rxdataF[0][0],PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); - if (PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) { - write_output("rxsig1.m","rxs1", PHY_vars_UE->lte_ue_common_vars.rxdata[1],PHY_vars_UE->lte_frame_parms.samples_per_tti,1,1); - write_output("rxsigF1.m","rxsF1", PHY_vars_UE->lte_ue_common_vars.rxdataF[1],PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); - } + if (test_perf ==0 ) { + if ((n_frames==1) && (Ns==(2+(2*subframe))) && (l==0)) { + write_output("ch0.m","ch0",eNB2UE[0]->ch[0],eNB2UE[0]->channel_length,1,8); + if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1) + write_output("ch1.m","ch1",eNB2UE[0]->ch[PHY_vars_eNB->lte_frame_parms.nb_antennas_rx],eNB2UE[0]->channel_length,1,8); + + //common vars + write_output("rxsig0.m","rxs0", &PHY_vars_UE->lte_ue_common_vars.rxdata[0][0],10*PHY_vars_UE->lte_frame_parms.samples_per_tti,1,1); + write_output("rxsigF0.m","rxsF0", &PHY_vars_UE->lte_ue_common_vars.rxdataF[0][0],PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); + if (PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) { + write_output("rxsig1.m","rxs1", PHY_vars_UE->lte_ue_common_vars.rxdata[1],PHY_vars_UE->lte_frame_parms.samples_per_tti,1,1); + write_output("rxsigF1.m","rxsF1", PHY_vars_UE->lte_ue_common_vars.rxdataF[1],PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); + } - write_output("dlsch00_ch0.m","dl00_ch0", - &(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][0][0]), - PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); - if (PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) - write_output("dlsch01_ch0.m","dl01_ch0", - &(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][1][0]), - PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); - if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1) - write_output("dlsch10_ch0.m","dl10_ch0", - &(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][2][0]), + write_output("dlsch00_ch0.m","dl00_ch0", + &(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][0][0]), PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); - if ((PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) && (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1)) - write_output("dlsch11_ch0.m","dl11_ch0", - &(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][3][0]), - PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb/2,1,1); + if (PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) + write_output("dlsch01_ch0.m","dl01_ch0", + &(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][1][0]), + PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); + if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1) + write_output("dlsch10_ch0.m","dl10_ch0", + &(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][2][0]), + PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); + if ((PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) && (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1)) + write_output("dlsch11_ch0.m","dl11_ch0", + &(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[eNB_id][3][0]), + PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb/2,1,1); - //pdsch_vars - dump_dlsch2(PHY_vars_UE,eNB_id,coded_bits_per_codeword); - dump_dlsch2(PHY_vars_UE,eNB_id_i,coded_bits_per_codeword); - write_output("dlsch_e.m","e",PHY_vars_eNB->dlsch_eNB[0][0]->e,coded_bits_per_codeword,1,4); + //pdsch_vars + dump_dlsch2(PHY_vars_UE,eNB_id,coded_bits_per_codeword); + dump_dlsch2(PHY_vars_UE,eNB_id_i,coded_bits_per_codeword); + write_output("dlsch_e.m","e",PHY_vars_eNB->dlsch_eNB[0][0]->e,coded_bits_per_codeword,1,4); - //pdcch_vars - write_output("pdcchF0_ext.m","pdcchF_ext", PHY_vars_UE->lte_ue_pdcch_vars[eNB_id]->rxdataF_ext[0],2*3*PHY_vars_UE->lte_frame_parms.ofdm_symbol_size,1,1); - write_output("pdcch00_ch0_ext.m","pdcch00_ch0_ext",PHY_vars_UE->lte_ue_pdcch_vars[eNB_id]->dl_ch_estimates_ext[0],300*3,1,1); + //pdcch_vars + write_output("pdcchF0_ext.m","pdcchF_ext", PHY_vars_UE->lte_ue_pdcch_vars[eNB_id]->rxdataF_ext[0],2*3*PHY_vars_UE->lte_frame_parms.ofdm_symbol_size,1,1); + write_output("pdcch00_ch0_ext.m","pdcch00_ch0_ext",PHY_vars_UE->lte_ue_pdcch_vars[eNB_id]->dl_ch_estimates_ext[0],300*3,1,1); - write_output("pdcch_rxF_comp0.m","pdcch0_rxF_comp0",PHY_vars_UE->lte_ue_pdcch_vars[eNB_id]->rxdataF_comp[0],4*300,1,1); - write_output("pdcch_rxF_llr.m","pdcch_llr",PHY_vars_UE->lte_ue_pdcch_vars[eNB_id]->llr,2400,1,4); + write_output("pdcch_rxF_comp0.m","pdcch0_rxF_comp0",PHY_vars_UE->lte_ue_pdcch_vars[eNB_id]->rxdataF_comp[0],4*300,1,1); + write_output("pdcch_rxF_llr.m","pdcch_llr",PHY_vars_UE->lte_ue_pdcch_vars[eNB_id]->llr,2400,1,4); + } } - } } } @@ -2163,7 +2228,7 @@ int main(int argc, char **argv) { write_output("uncoded_ber_bit.m","uncoded_ber_bit",uncoded_ber_bit,coded_bits_per_codeword,1,0); - start_meas(&usts); + start_meas(&PHY_vars_UE->dlsch_unscrambling_stats); dlsch_unscrambling(&PHY_vars_UE->lte_frame_parms, 0, PHY_vars_UE->dlsch_ue[0][0], @@ -2171,7 +2236,7 @@ int main(int argc, char **argv) { PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->llr[0], 0, subframe<<1); - stop_meas(&usts); + stop_meas(&PHY_vars_UE->dlsch_unscrambling_stats); start_meas(&PHY_vars_UE->dlsch_decoding_stats); ret = dlsch_decoding(PHY_vars_UE, @@ -2183,6 +2248,8 @@ int main(int argc, char **argv) { PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid, 1,llr8_flag); stop_meas(&PHY_vars_UE->dlsch_decoding_stats); + + stop_meas(&PHY_vars_UE->phy_proc_rx); if (ret <= PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations) { @@ -2285,12 +2352,15 @@ int main(int argc, char **argv) { PHY_vars_UE->frame++; } //trials + + effective_rate = ((double)(round_trials[0]-dci_errors)/((double)round_trials[0] + round_trials[1] + round_trials[2] + round_trials[3])); + printf("\n**********************SNR = %f dB (tx_lev %f, sigma2_dB %f)**************************\n", SNR, (double)tx_lev_dB+10*log10(PHY_vars_UE->lte_frame_parms.ofdm_symbol_size/(NB_RB*12)), sigma2_dB); - - printf("Errors (%d/%d %d/%d %d/%d %d/%d), Pe = (%e,%e,%e,%e), dci_errors %d/%d, Pe = %e => effective rate %f (%2.1f%%,%f), normalized delay %f (%f)\n", + + printf("Errors (%d/%d %d/%d %d/%d %d/%d), Pe = (%e,%e,%e,%e), dci_errors %d/%d, Pe = %e => effective rate %f (%2.1f%%,%f), normalized delay %f (%f)\n", errs[0], round_trials[0], errs[1], @@ -2306,28 +2376,32 @@ int main(int argc, char **argv) { dci_errors, round_trials[0], (double)dci_errors/(round_trials[0]), - rate*((double)(round_trials[0]-dci_errors)/((double)round_trials[0] + round_trials[1] + round_trials[2] + round_trials[3])), - 100*((double)(round_trials[0]-dci_errors)/((double)round_trials[0] + round_trials[1] + round_trials[2] + round_trials[3])), + rate*effective_rate, + 100*effective_rate, rate, (1.0*(round_trials[0]-errs[0])+2.0*(round_trials[1]-errs[1])+3.0*(round_trials[2]-errs[2])+4.0*(round_trials[3]-errs[3]))/((double)round_trials[0])/(double)PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS, (1.0*(round_trials[0]-errs[0])+2.0*(round_trials[1]-errs[1])+3.0*(round_trials[2]-errs[2])+4.0*(round_trials[3]-errs[3]))/((double)round_trials[0])); - + if (print_perf==1) { printf("eNB TX function statistics (per 1ms subframe)\n\n"); + printf("Total PHY proc tx :%f us (%d trials)\n",(double)PHY_vars_eNB->phy_proc_tx.diff/PHY_vars_eNB->phy_proc_tx.trials/cpu_freq_GHz/1000.0,PHY_vars_eNB->phy_proc_tx.trials); printf("OFDM_mod time :%f us (%d trials)\n",(double)PHY_vars_eNB->ofdm_mod_stats.diff/PHY_vars_eNB->ofdm_mod_stats.trials/cpu_freq_GHz/1000.0,PHY_vars_eNB->ofdm_mod_stats.trials); printf("DLSCH modulation time :%f us (%d trials)\n",(double)PHY_vars_eNB->dlsch_modulation_stats.diff/PHY_vars_eNB->dlsch_modulation_stats.trials/cpu_freq_GHz/1000.0,PHY_vars_eNB->dlsch_modulation_stats.trials); - printf("DLSCH scrambling time :%f us (%d trials)\n",(double)sts.diff/sts.trials/cpu_freq_GHz/1000.0,sts.trials); + printf("DLSCH scrambling time :%f us (%d trials)\n",(double)PHY_vars_eNB->dlsch_scrambling_stats.diff/PHY_vars_eNB->dlsch_scrambling_stats.trials/cpu_freq_GHz/1000.0,PHY_vars_eNB->dlsch_scrambling_stats.trials); printf("DLSCH encoding time :%f us (%d trials)\n",(double)PHY_vars_eNB->dlsch_encoding_stats.diff/PHY_vars_eNB->dlsch_encoding_stats.trials/cpu_freq_GHz/1000.0,PHY_vars_eNB->dlsch_modulation_stats.trials); printf("|__ DLSCH turbo encoding time :%f us (%d trials)\n",((double)PHY_vars_eNB->dlsch_turbo_encoding_stats.trials/PHY_vars_eNB->dlsch_encoding_stats.trials)*(double)PHY_vars_eNB->dlsch_turbo_encoding_stats.diff/PHY_vars_eNB->dlsch_turbo_encoding_stats.trials/cpu_freq_GHz/1000.0,PHY_vars_eNB->dlsch_turbo_encoding_stats.trials); printf("|__ DLSCH rate-matching time :%f us (%d trials)\n",((double)PHY_vars_eNB->dlsch_rate_matching_stats.trials/PHY_vars_eNB->dlsch_encoding_stats.trials)*(double)PHY_vars_eNB->dlsch_rate_matching_stats.diff/PHY_vars_eNB->dlsch_rate_matching_stats.trials/cpu_freq_GHz/1000.0,PHY_vars_eNB->dlsch_rate_matching_stats.trials); printf("|__ DLSCH sub-block interleaving time :%f us (%d trials)\n",((double)PHY_vars_eNB->dlsch_interleaving_stats.trials/PHY_vars_eNB->dlsch_encoding_stats.trials)*(double)PHY_vars_eNB->dlsch_interleaving_stats.diff/PHY_vars_eNB->dlsch_interleaving_stats.trials/cpu_freq_GHz/1000.0,PHY_vars_eNB->dlsch_interleaving_stats.trials); + printf("\n\nUE RX function statistics (per 1ms subframe)\n\n"); + printf("Total PHY proc rx :%f us (%d trials)\n",(double)PHY_vars_UE->phy_proc_rx.diff/PHY_vars_UE->phy_proc_rx.trials/cpu_freq_GHz/1000.0,PHY_vars_UE->phy_proc_rx.trials*2/3); printf("DLSCH OFDM demodulation and channel_estimation time :%f us (%d trials)\n",(nsymb)*(double)PHY_vars_UE->ofdm_demod_stats.diff/PHY_vars_UE->ofdm_demod_stats.trials/cpu_freq_GHz/1000.0,PHY_vars_UE->ofdm_demod_stats.trials*2/3); printf("|__ DLSCH rx dft :%f us (%d trials)\n",(nsymb*PHY_vars_UE->lte_frame_parms.nb_antennas_rx)*(double)PHY_vars_UE->rx_dft_stats.diff/PHY_vars_UE->rx_dft_stats.trials/cpu_freq_GHz/1000.0,PHY_vars_UE->rx_dft_stats.trials*2/3); printf("|__ DLSCH channel estimation time :%f us (%d trials)\n",(4.0)*(double)PHY_vars_UE->dlsch_channel_estimation_stats.diff/PHY_vars_UE->dlsch_channel_estimation_stats.trials/cpu_freq_GHz/1000.0,PHY_vars_UE->dlsch_channel_estimation_stats.trials*2/3); printf("|__ DLSCH frequency offset estimation time :%f us (%d trials)\n",(4.0)*(double)PHY_vars_UE->dlsch_freq_offset_estimation_stats.diff/PHY_vars_UE->dlsch_freq_offset_estimation_stats.trials/cpu_freq_GHz/1000.0,PHY_vars_UE->dlsch_freq_offset_estimation_stats.trials*2/3); + printf("DLSCH rx pdcch :%f us (%d trials)\n",(double)PHY_vars_UE->dlsch_rx_pdcch_stats.diff/PHY_vars_UE->dlsch_rx_pdcch_stats.trials/cpu_freq_GHz/1000.0,PHY_vars_UE->dlsch_rx_pdcch_stats.trials); printf("DLSCH Channel Compensation and LLR generation time :%f us (%d trials)\n",(3)*(double)PHY_vars_UE->dlsch_llr_stats.diff/PHY_vars_UE->dlsch_llr_stats.trials/cpu_freq_GHz/1000.0,PHY_vars_UE->dlsch_llr_stats.trials/3); - printf("DLSCH unscrambling time :%f us (%d trials)\n",(double)usts.diff/usts.trials/cpu_freq_GHz/1000.0,usts.trials); + printf("DLSCH unscrambling time :%f us (%d trials)\n",(double)PHY_vars_UE->dlsch_unscrambling_stats.diff/PHY_vars_UE->dlsch_unscrambling_stats.trials/cpu_freq_GHz/1000.0,PHY_vars_UE->dlsch_unscrambling_stats.trials); printf("DLSCH Decoding time (%02.2f Mbit/s, avg iter %1.2f) :%f us (%d trials, max %f)\n", PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS/1000.0,(double)avg_iter/iter_trials, (double)PHY_vars_UE->dlsch_decoding_stats.diff/PHY_vars_UE->dlsch_decoding_stats.trials/cpu_freq_GHz/1000.0,PHY_vars_UE->dlsch_decoding_stats.trials, @@ -2364,8 +2438,6 @@ int main(int argc, char **argv) { PHY_vars_UE->dlsch_tc_intl2_stats.trials); } - - fprintf(bler_fd,"%f;%d;%d;%f;%d;%d;%d;%d;%d;%d;%d;%d;%d\n", SNR, mcs, @@ -2394,7 +2466,81 @@ int main(int argc, char **argv) { fprintf(csv_fd,"%e;\n",blerr[0]); } } //ABStraction - + + if ( (test_perf != 0) && (100 * effective_rate > test_perf )) { + fprintf(time_meas_fd,"SNR; MCS; TBS; rate; DL_DECOD_ITER; err0; trials0; err1; trials1; err2; trials2; err3; trials3; PE; dci_err;PE;ND;\n"); + fprintf(time_meas_fd,"%f;%d;%d;%f(%2.1f%%,%f);%f;%d;%d;%d;%d;%d;%d;%d;%d;(%e,%e,%e,%e);%d/%d;%e;%f(%f);\n", + SNR, + mcs, + PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS, + rate*effective_rate, + 100*effective_rate, + rate, + (double)avg_iter/iter_trials, + errs[0], + round_trials[0], + errs[1], + round_trials[1], + errs[2], + round_trials[2], + errs[3], + round_trials[3], + (double)errs[0]/(round_trials[0]), + (double)errs[1]/(round_trials[0]), + (double)errs[2]/(round_trials[0]), + (double)errs[3]/(round_trials[0]), + dci_errors, + round_trials[0], + (double)dci_errors/(round_trials[0]), + (1.0*(round_trials[0]-errs[0])+2.0*(round_trials[1]-errs[1])+3.0*(round_trials[2]-errs[2])+4.0*(round_trials[3]-errs[3]))/((double)round_trials[0])/(double)PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS, + (1.0*(round_trials[0]-errs[0])+2.0*(round_trials[1]-errs[1])+3.0*(round_trials[2]-errs[2])+4.0*(round_trials[3]-errs[3]))/((double)round_trials[0])); + + fprintf(time_meas_fd,"eNB_PROC_TX(%d); OFDM_MOD(%d); DL_MOD(%d); DL_SCR(%d); DL_ENC(%d); UE_PROC_RX(%d); OFDM_DEMOD_CH_EST(%d); RX_PDCCH(%d); CH_COMP_LLR(%d); DL_DECOD(%d);\n", + PHY_vars_eNB->phy_proc_tx.trials, + PHY_vars_eNB->ofdm_mod_stats.trials, + PHY_vars_eNB->dlsch_modulation_stats.trials, + PHY_vars_eNB->dlsch_scrambling_stats.trials, + PHY_vars_eNB->dlsch_encoding_stats.trials, + PHY_vars_UE->phy_proc_rx.trials, + PHY_vars_UE->ofdm_demod_stats.trials, + PHY_vars_UE->dlsch_rx_pdcch_stats.trials, + PHY_vars_UE->dlsch_llr_stats.trials, + PHY_vars_UE->dlsch_unscrambling_stats.trials, + PHY_vars_UE->dlsch_decoding_stats.trials + ); + fprintf(time_meas_fd,"%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;", + get_time_meas_us(&PHY_vars_eNB->phy_proc_tx), + get_time_meas_us(&PHY_vars_eNB->ofdm_mod_stats), + get_time_meas_us(&PHY_vars_eNB->dlsch_modulation_stats), + get_time_meas_us(&PHY_vars_eNB->dlsch_scrambling_stats), + get_time_meas_us(&PHY_vars_eNB->dlsch_encoding_stats), + get_time_meas_us(&PHY_vars_UE->phy_proc_rx), + nsymb*get_time_meas_us(&PHY_vars_UE->ofdm_demod_stats), + get_time_meas_us(&PHY_vars_UE->dlsch_rx_pdcch_stats), + 3*get_time_meas_us(&PHY_vars_UE->dlsch_llr_stats), + get_time_meas_us(&PHY_vars_UE->dlsch_unscrambling_stats), + get_time_meas_us(&PHY_vars_UE->dlsch_decoding_stats) + ); + /* + fprintf(time_meas_fd,"%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;", + PHY_vars_eNB->phy_proc_tx.trials, + PHY_vars_eNB->ofdm_mod_stats.trials, + PHY_vars_eNB->dlsch_modulation_stats.trials, + PHY_vars_eNB->dlsch_scrambling_stats.trials, + PHY_vars_eNB->dlsch_encoding_stats.trials, + PHY_vars_UE->phy_proc_rx.trials, + PHY_vars_UE->ofdm_demod_stats.trials, + PHY_vars_UE->dlsch_rx_pdcch_stats.trials, + PHY_vars_UE->dlsch_llr_stats.trials, + PHY_vars_UE->dlsch_unscrambling_stats.trials, + PHY_vars_UE->dlsch_decoding_stats.trials); + */ + printf("[passed] effective rate : %f (%2.1f%%,%f)): log and break \n",rate*effective_rate, 100*effective_rate, rate ); + break; + } else if (test_perf !=0 ){ + printf("[continue] effective rate : %f (%2.1f%%,%f)): increase snr \n",rate*effective_rate, 100*effective_rate, rate); + } + if (((double)errs[0]/(round_trials[0]))<1e-2) break; }// SNR @@ -2404,6 +2550,8 @@ int main(int argc, char **argv) { fclose(bler_fd); + if (test_perf !=0) + fclose (time_meas_fd); //fprintf(tikz_fd,"};\n"); //fclose(tikz_fd); diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index 893f2dd9188..81cc5377b45 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -1,3 +1,43 @@ +/******************************************************************************* + + Eurecom OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + This program is free software; you can redistribute it and/or modify it + under the terms and conditions of the GNU General Public License, + version 2, as published by the Free Software Foundation. + + This program is distributed in the hope it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + + The full GNU General Public License is included in this distribution in + the file called "COPYING". + + Contact Information + Openair Admin: openair_admin@eurecom.fr + Openair Tech : openair_tech@eurecom.fr + Forums : http://forums.eurecom.fsr/openairinterface + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France + +*******************************************************************************/ + +/*! \file ulsim.c + \brief Top-level DL simulator + \author R. Knopp + \date 2011 + \version 0.1 + \company Eurecom + \email: knopp@eurecom.fr + \note + \warning +*/ + #include <string.h> #include <math.h> #include <unistd.h> diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index e52adee9e28..13987dcb51b 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -1053,7 +1053,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint start_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_IN); - + #ifdef CBA if (*access_mode==CBA_ACCESS){ LOG_D(MAC,"[UE %d] frameP %d subframe %d try CBA transmission\n", @@ -1087,8 +1087,13 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint bsr_len = bsr_ce_len + bsr_header_len; LOG_D(MAC,"[UE %d] header size info: dcch %d, dcch1 %d, dtch %d, bsr (ce%d,hdr%d) buff_len %d\n", module_idP, dcch_header_len,dcch1_header_len,dtch_header_len, bsr_ce_len, bsr_header_len, buflen); - } else - bsr_len = 0; + } else { + bsr_len=0; + //LOG_D(MAC,"[UE %d] Empty buffers, send a long BSR to reset the bsr at eNB \n ",Mod_id); + // bsr_ce_len = sizeof(BSR_LONG); + //bsr_len = bsr_ce_len + bsr_header_len; + } + // check for UL bandwidth requests and add SR control element // check for UL bandwidth requests and add SR control element @@ -1259,6 +1264,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint bsr_s, // short bsr bsr_l, post_padding); // long_bsr + LOG_I(MAC,"[UE %d] Generate header :bufflen %d sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d, dcch_header_len %d, dtch_header_len %d, padding %d,post_padding %d, bsr len %d, phr len %d, reminder %d \n", module_idP,buflen, sdu_length_total,num_sdus,sdu_lengths[0],sdu_lcids[0],payload_offset, dcch_header_len, dtch_header_len, short_padding,post_padding, bsr_len, phr_len,buflen-sdu_length_total-payload_offset); diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 9b924c88aad..5560f782752 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -157,6 +157,12 @@ boolean_t pdcp_data_req( rlc_status = rlc_data_req(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, MBMS_FLAG_YES, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p); } else { rlc_status = RLC_OP_STATUS_OUT_OF_RESSOURCES; + LOG_W(PDCP,"[FRAME %5u][%s][PDCP][MOD %u/%u][RB %u] PDCP_DATA_REQ SDU DROPPED, OUT OF MEMORY \n", + frameP, + (enb_flagP) ? "eNB" : "UE", + enb_mod_idP, + ue_mod_idP, + rb_idP); #if defined(STOP_ON_IP_TRAFFIC_OVERLOAD) AssertFatal(0, "[FRAME %5u][%s][PDCP][MOD %u/%u][RB %u] PDCP_DATA_REQ SDU DROPPED, OUT OF MEMORY \n", frameP, diff --git a/targets/SIMU/EXAMPLES/VIRT_EMUL_1eNB/start_one_eNB_multi_UE_nas b/targets/SIMU/EXAMPLES/VIRT_EMUL_1eNB/start_one_eNB_multi_UE_nas index cd5a8adbb4d..eb7f9903dd6 100755 --- a/targets/SIMU/EXAMPLES/VIRT_EMUL_1eNB/start_one_eNB_multi_UE_nas +++ b/targets/SIMU/EXAMPLES/VIRT_EMUL_1eNB/start_one_eNB_multi_UE_nas @@ -24,7 +24,7 @@ if [ $1 -ge 2 ]; then sudo ifconfig oai2 10.0.3.3 netmask 255.255.255.0 broadcast 10.0.3.255 # enb -> ue2 - $OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c1 -i0 -z0 -s 10.0.1.1 -t 10.0.1.3 -r 14 + $OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c1 -i0 -z0 -s 10.0.1.1 -t 10.0.1.3 -r 17 # ue2 -> enb $OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c1 -i2 -z0 -s 10.0.3.3 -t 10.0.3.1 -r 3 fi @@ -34,7 +34,7 @@ if [ $1 -ge 3 ]; then sudo ifconfig oai3 10.0.4.4 netmask 255.255.255.0 broadcast 10.0.4.255 # enb -> ue2 - $OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c2 -i0 -z0 -s 10.0.1.1 -t 10.0.1.4 -r 25 + $OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c2 -i0 -z0 -s 10.0.1.1 -t 10.0.1.4 -r 31 # ue2 -> enb $OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c2 -i3 -z0 -s 10.0.4.4 -t 10.0.4.1 -r 3 fi diff --git a/targets/TEST/OAI/case04.py b/targets/TEST/OAI/case04.py new file mode 100644 index 00000000000..c4b40abd770 --- /dev/null +++ b/targets/TEST/OAI/case04.py @@ -0,0 +1,191 @@ +#****************************************************************************** + +# Eurecom OpenAirInterface +# Copyright(c) 1999 - 2013 Eurecom + +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. + +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + +# The full GNU General Public License is included in this distribution in +# the file called "COPYING". + +# Contact Information +# Openair Admin: openair_admin@eurecom.fr +# Openair Tech : openair_tech@eurecom.fr +# Forums : http://forums.eurecom.fsr/openairinterface +# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France + +#***************************************************************************** + +# \file case02.py +# \brief test case 02 for OAI: executions +# \author Navid Nikaein +# \date 2013 +# \version 0.1 +# @ingroup _test + +import time +import random +import log +import openair +import core + +NUM_UE=2 +NUM_eNB=1 +NUM_TRIALS=3 + +def execute(oai, user, pw, logfile,logdir): + + case = '04' + oai.send('cd $OPENAIR1_DIR;') + oai.send('cd SIMULATION/LTE_PHY;') + + try: + test = '00' + name = 'Run oai.dlsim.sanity' + conf = '-a -A AWGN -n 100' + diag = 'dlsim is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed' + trace = logdir + '/log_' + case + test + '_1.txt;' + tee = ' 2>&1 | tee ' + trace + oai.send_expect_false('./dlsim.rel8 ' + conf + tee, 'Segmentation fault', 30) + trace = logdir + '/log_' + case + test + '_2.txt;' + tee = ' 2>&1 | tee ' + trace + oai.send_expect_false('./dlsim.rel8 ' + conf + tee, 'Exiting', 30) + trace = logdir + '/log_' + case + test + '_3.txt;' + tee = ' 2>&1 | tee ' + trace + oai.send_expect_false('./dlsim.rel8 ' + conf + tee, 'FATAL', 30) + + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '01' + name = 'Run oai.dlsim.test1' + diag = 'Test 1, 10 MHz, R2.FDD (MCS 5), EVA5, -1dB' + conf = '-m5 -gF -s-3.2 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70' + trace = logdir + '/log_' + case + test +'.txt' + tee = ' 2>&1 | tee ' + trace + oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '06' + name = 'Run oai.dlsim.test5' + diag = 'Test 5, 1.4 MHz, R4.FDD (MCS 4), EVA5, 0dB (70%)' + conf = '-m4 -gF -s-2 -w1.0 -f.2 -n500 -B6 -c4 -z2 -O70' + trace = logdir + '/log_' + case + test + '.txt' + tee = ' 2>&1 | tee ' + trace + oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '06' + name = 'Run oai.dlsim.test6' + diag = 'Test 6, 10 MHz, R3.FDD (MCS 15), EVA5, 6.7dB (70%)' + conf = '-m15 -gF -s4 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70' + trace = logdir + '/log_' + case + test + '.txt' + tee = ' 2>&1 | tee ' + trace + oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '06b' + name = 'Run oai.dlsim.test6b' + diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (70%)' + conf = '-m14 -gF -s4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70' + trace = logdir + '/log_' + case + test + '.txt' + tee = ' 2>&1 | tee ' + trace + oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '07' + name = 'Run oai.dlsim.test7' + diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (30%)' + conf = '-m15 -gG -s-1 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O30' + trace = logdir + '/log_' + case + test + '.txt' + tee = ' 2>&1 | tee ' + trace + oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + + try: + test = '07b' + name = 'Run oai.dlsim.test7b' + diag = 'Test 7b, 5 MHz, R3-1.FDD (MCS 15), ETU70, 1.4 dB (30%)' + conf = '-m14 -gG -s-1 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O30' + trace = logdir + '/log_' + case + test + '.txt' + tee = ' 2>&1 | tee ' + trace + oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '10' + name = 'Run oai.dlsim.test10' + diag = 'Test 10, 5 MHz, R6.FDD (MCS 25), EVA5, 17.4 dB (70%)' + conf = '-m25 -gF -s13 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70' + trace = logdir + '/log_' + case + test + '.txt' + tee = ' 2>&1 | tee ' + trace + oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '10b' + name = 'Run oai.dlsim.test10b' + diag = 'Test 10b, 5 MHz, R6-1.FDD (MCS 24,18 PRB), EVA5, 17.5dB (70%)' + conf = '-m25 -gF -s15.2 -w1.0 -f.2 -n500 -B25 -c3 -z2 -r1022 -O70' + trace = logdir + '/log_' + case + test + '.txt' + tee = ' 2>&1 | tee ' + trace + oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '11' + name = 'Run oai.dlsim.test11' + diag = 'Test 11, 10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%)' + conf = '-m26 -gF -s14.2 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70' + trace = logdir + '/log_' + case + test + '.txt' + tee = ' 2>&1 | tee ' + trace + oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + diff --git a/targets/TEST/OAI/case05.py b/targets/TEST/OAI/case05.py new file mode 100644 index 00000000000..9852fbd3500 --- /dev/null +++ b/targets/TEST/OAI/case05.py @@ -0,0 +1,185 @@ +#****************************************************************************** + +# Eurecom OpenAirInterface +# Copyright(c) 1999 - 2013 Eurecom + +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. + +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + +# The full GNU General Public License is included in this distribution in +# the file called "COPYING". + +# Contact Information +# Openair Admin: openair_admin@eurecom.fr +# Openair Tech : openair_tech@eurecom.fr +# Forums : http://forums.eurecom.fsr/openairinterface +# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France + +#***************************************************************************** + +# \file case02.py +# \brief test case 02 for OAI: executions +# \author Navid Nikaein +# \date 2013 +# \version 0.1 +# @ingroup _test + +import time +import random +import log +import openair +import core + +NUM_UE=2 +NUM_eNB=1 +NUM_TRIALS=3 + +def execute(oai, user, pw, logfile,logdir): + + case = '04' + oai.send('cd $OPENAIR1_DIR;') + oai.send('cd SIMULATION/LTE_PHY;') + + try: + test = '00' + name = 'Run oai.dlsim.sanity' + conf = '-a -A AWGN -n 100' + diag = 'ulsim is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed' + trace = logdir + '/log_' + case + test + '_1.txt;' + tee = ' 2>&1 | tee ' + trace + oai.send_expect_false('./ulsim.rel8 ' + conf + tee, 'Segmentation fault', 30) + trace = logdir + '/log_' + case + test + '_2.txt;' + tee = ' 2>&1 | tee ' + trace + oai.send_expect_false('./ulsim.rel8 ' + conf + tee, 'Exiting', 30) + trace = logdir + '/log_' + case + test + '_3.txt;' + tee = ' 2>&1 | tee ' + trace + oai.send_expect_false('./ulsim.rel8 ' + conf + tee, 'FATAL', 30) + + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '01' + name = 'Run oai.ulsim.test1' + diag = 'Test 1, 10 MHz, R2.FDD (MCS 5), EVA5, -1dB' + conf = '-m5 -gF -s-3.2 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70' + trace = logdir + '/log_' + case + test +'.txt' + tee = ' 2>&1 | tee ' + trace + print test + 'not performed' + #oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '06' + name = 'Run oai.ulsim.test5' + diag = 'Test 5, 1.4 MHz, R4.FDD (MCS 4), EVA5, 0dB (70%)' + conf = '-m4 -gF -s-2 -w1.0 -f.2 -n500 -B6 -c4 -z2 -O70' + trace = logdir + '/log_' + case + test + '.txt' + tee = ' 2>&1 | tee ' + trace + print test + 'not performed' + #oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '06' + name = 'Run oai.ulsim.test6' + diag = 'Test 6, 10 MHz, R3.FDD (MCS 15), EVA5, 6.7dB (70%)' + conf = '-m15 -gF -s4 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70' + trace = logdir + '/log_' + case + test + '.txt' + tee = ' 2>&1 | tee ' + trace + print test + 'not performed' + #oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '06b' + name = 'Run oai.ulsim.test6b' + diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (70%)' + conf = '-m14 -gF -s4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70' + trace = logdir + '/log_' + case + test + '.txt' + tee = ' 2>&1 | tee ' + trace + print test + 'not performed' + #oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '07' + name = 'Run oai.ulsim.test7' + diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (30%)' + conf = '-m15 -gG -s-1 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O30' + trace = logdir + '/log_' + case + test + '.txt' + tee = ' 2>&1 | tee ' + trace + print test + 'not performed' + #oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '10' + name = 'Run oai.ulsim.test10' + diag = 'Test 10, 5 MHz, R6.FDD (MCS 25), EVA5, 17.4 dB (70%)' + conf = '-m25 -gF -s13 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70' + trace = logdir + '/log_' + case + test + '.txt' + tee = ' 2>&1 | tee ' + trace + print test + 'not performed' + #oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '10b' + name = 'Run oai.ulsim.test10b' + diag = 'Test 10b, 5 MHz, R6-1.FDD (MCS 24,18 PRB), EVA5, 17.5dB (70%)' + conf = '-m25 -gF -s15.2 -w1.0 -f.2 -n500 -B25 -c3 -z2 -r1022 -O70' + trace = logdir + '/log_' + case + test + '.txt' + tee = ' 2>&1 | tee ' + trace + print test + 'not performed' + #oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '11' + name = 'Run oai.ulsim.test11' + diag = 'Test 11, 10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%)' + conf = '-m26 -gF -s14.2 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70' + trace = logdir + '/log_' + case + test + '.txt' + tee = ' 2>&1 | tee ' + trace + print test + 'not performed' + #oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150) + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + diff --git a/targets/TEST/OAI/case11.py b/targets/TEST/OAI/case11.py new file mode 100644 index 00000000000..6145fc6004c --- /dev/null +++ b/targets/TEST/OAI/case11.py @@ -0,0 +1,84 @@ +#****************************************************************************** + +# Eurecom OpenAirInterface +# Copyright(c) 1999 - 2013 Eurecom + +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. + +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + +# The full GNU General Public License is included in this distribution in +# the file called "COPYING". + +# Contact Information +# Openair Admin: openair_admin@eurecom.fr +# Openair Tech : openair_tech@eurecom.fr +# Forums : http://forums.eurecom.fsr/openairinterface +# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France + +#***************************************************************************** + +# \file case01.py +# \brief test case 01 for OAI: compilations +# \author Navid Nikaein +# \date 2014 +# \version 0.1 +# @ingroup _test + +import log +import openair +import core + +makerr1 = '***' +makerr2 = 'Error 1' + + +def execute(oai, user, pw, logfile,logdir): + + case = '101' + + oai.send('cd $OPENAIR1_DIR;') + oai.send('cd SIMULATION/LTE_PHY;') + + try: + test = '01' + name = 'Compile oai.rel8.phy.dlsim.make' + conf = 'make dlsim' + trace = logdir + '/log_' + case + test + '.txt;' + tee = ' 2>&1 | tee ' + trace + diag = 'check the compilation errors for dlsim in $OPENAIR1_DIR/SIMULATION/LTE_PHY' + oai.send('make clean;') + oai.send('rm -f ./dlsim.rel8;') + oai.send_expect_false('make dlsim -j4' + tee, makerr1, 1500) + oai.send('cp ./dlsim ./dlsim.rel8;') + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = '02' + name = 'Compile oai.rel8.phy.ulsim.make' + conf = 'make ulsim' + trace = logdir + '/log_' + case + test + '.txt;' + tee = ' 2>&1 | tee ' + trace + diag = 'check the compilation errors for ulsim in $OPENAIR1_DIR/SIMULATION/LTE_PHY' + oai.send('make clean;') + oai.send('rm -f ./ulsim.rel8;') + oai.send_expect_false('make ulsim -j4' + tee, makerr1, 1500) + oai.send('cp ./ulsim ./ulsim.rel8;') + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + diff --git a/targets/TEST/OAI/case12.py b/targets/TEST/OAI/case12.py new file mode 100644 index 00000000000..5ae9f79e8ee --- /dev/null +++ b/targets/TEST/OAI/case12.py @@ -0,0 +1,128 @@ +#****************************************************************************** + +# Eurecom OpenAirInterface +# Copyright(c) 1999 - 2013 Eurecom + +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. + +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + +# The full GNU General Public License is included in this distribution in +# the file called "COPYING". + +# Contact Information +# Openair Admin: openair_admin@eurecom.fr +# Openair Tech : openair_tech@eurecom.fr +# Forums : http://forums.eurecom.fsr/openairinterface +# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France + +#***************************************************************************** + +# \file case02.py +# \brief test case 02 for OAI: executions +# \author Navid Nikaein +# \date 2013 +# \version 0.1 +# @ingroup _test + +import time +import random +import log +import openair +import core +import os + + +import shutil # copy file + +NUM_UE=2 +NUM_eNB=1 +NUM_TRIALS=3 + +PRB=[25,50,75,100] +MCS=[4,5,7,9,12,15,18,21,24,27] +ANT_TX=2 # 2 +ANT_RX=2 # 2 +PDCCH=2 #, 2, 3, 4 +CHANNEL=["N"] # A,B,C,D,E,F, +TX_MODE=2 # 2, +MIN_SNR=2 +MAX_SNR=18 + +#OPT="-L -d" # 8bit decoder , activate dci decoding at UE + + + +def execute(oai, user, pw, logfile,logdir): + + case = '102' + oai.send('cd $OPENAIR1_DIR;') + oai.send('cd SIMULATION/LTE_PHY;') + + try: + test = '0' + name = 'Run oai.dlsim.sanity' + conf = '-a -n 100' + diag = 'dlsim is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed' + trace = logdir + '/log_' + case + test + '_1.txt;' + tee = ' 2>&1 | tee ' + trace + oai.send_expect_false('./dlsim.rel8 ' + conf + tee, 'Segmentation fault', 30) + trace = logdir + '/log_' + case + test + '_2.txt;' + tee = ' 2>&1 | tee ' + trace + oai.send_expect_false('./dlsim.rel8 ' + conf + tee, 'Exiting', 30) + trace = logdir + '/log_' + case + test + '_3.txt;' + tee = ' 2>&1 | tee ' + trace + oai.send_expect_false('./dlsim.rel8 ' + conf + tee, 'FATAL', 30) + + except log.err, e: + log.fail(case, test, name, conf, e.value, diag, logfile,trace) + else: + log.ok(case, test, name, conf, '', logfile) + + try: + test = 1 + MIN_SNR = 2 + name = 'Run oai.dlsim.perf.70%' + diag = 'no diagnostic is available, check the log file' + for i in range(len(PRB)): + for j in range(len(MCS)): + for k in range(1,ANT_TX): + for m in range (1,ANT_RX): + for n in range(1,PDCCH): + for o in range(len(CHANNEL)): + for p in range(1,TX_MODE): + for q in range(MIN_SNR,MAX_SNR): + #if if PRB[i] : + + conf = '-B' + str(PRB[i]) + ' -m'+str(MCS[j]) + ' -y'+str(k) + ' -z'+str(m) +' -c'+str(n) + ' -g'+str(CHANNEL[o]) + ' -x'+str(p) + ' -s'+str(q) + ' -w1.0 -f.1 -n500 -P -O80' #+ OPT + trace = logdir + '/time_meas' + '_prb'+str(PRB[i])+'_mcs'+ str(MCS[j])+ '_anttx' + str(k)+ '_antrx' + str(m) + '_pdcch' + str(n) + '_channel' +str(CHANNEL[o]) + '_tx' +str(p) + '_snr' +str(q)+'.'+case+str(test)+ '.log' + tee = ' 2>&1 | tee ' + trace + match = oai.send_expect_re('./dlsim.rel8 ' + conf + tee, 'passed', 0, 1000) + #print conf + if match : + log.ok(case, str(test), name, conf, '', logfile) + MIN_SNR = q # just to speed up the test + test+=1 + break; # found smallest snr + else : + try: + if os.path.isfile(trace) : + os.remove(trace) + + except OSError, e: ## if failed, report it back to the user ## + print ("Error: %s - %s." % (e.filename,e.strerror)) + + except log.err, e: + log.fail(case, str(test), name, conf, e.value, diag, logfile,trace) + #else: + # log.ok(case, test, name, conf, '', logfile) + diff --git a/targets/TEST/OAI/core.py b/targets/TEST/OAI/core.py index d416ba93f8d..f6792c519f5 100644 --- a/targets/TEST/OAI/core.py +++ b/targets/TEST/OAI/core.py @@ -201,17 +201,19 @@ class core: # **************************send_expect_re************************* # 1) send a command, and optionally specify a the time to wait # 2) search for an expected pattern defined by a regular expression in the response - # 3) return a error if not found + # 3) return a error if raise_err flag is set and re not found, otherwise return 'Ok' # ***************************************************************** - def send_expect_re(self, command, expect, delay = 5, rsp1=None, rsp2=None,debug=0): + def send_expect_re(self, command, expect, raise_err=1, delay = 50, rsp1=None, rsp2=None,debug=0): rsp = self.send_recv(command, delay, rsp1, rsp2) # print rsp match = re.compile(expect).search(rsp) if match: return match - - raise log.err(self.failed(command, expect,debug)) - + if raise_err: + raise log.err(self.failed(command, expect,debug)) + else : + return None + # **************************send_expect************************* # 1) send a command, and optionally specify a the time to wait # 2) search for an expected pattern defined by a re in the response diff --git a/targets/TEST/OAI/openair.py b/targets/TEST/OAI/openair.py index be76eb9697a..8713aefcae3 100644 --- a/targets/TEST/OAI/openair.py +++ b/targets/TEST/OAI/openair.py @@ -50,6 +50,7 @@ class openair(core): self.error = '% ' self.hostname = hostname self.address = address + self.localhost = None self.shell_prompt = '$' core.__init__(self) @@ -66,6 +67,30 @@ class openair(core): except Exception, val: print "Error:", val + @property + def localhost(self): + if self.localhost : + return self.localhost + elif self.hostname in ['localhost', '127.0.0.7', '::1'] : + self.localhost = self.hostname + return self.localhost + + @localhost.setter + def localhost(self,localhost): + self.localhost = localhost + + def shcmd(self,cmd,sudo=False): + + if sudo: + cmd = "sudo %s" % command + + proc = subprocess.Popen(command, shell=True, + stdout = subprocess.PIPE, + stderr = subprocess.PIPE) + + stdout, stderr = proc.communicate() + return (stdout, stderr) + def connect(self, username, password, prompt): self.prompt1 = self.shell_prompt if not prompt : @@ -78,12 +103,12 @@ class openair(core): username = root if not password: password = username - + self.oai = pexpect.spawn('ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -o "ConnectionAttempts=1" ' \ + username + '@' + self.address) - index = self.oai.expect([re.escape(self.prompt1), re.escape(self.prompt2), pexpect.TIMEOUT], timeout=40) - if index == 0 : + index = self.oai.expect([re.escape(self.prompt1), re.escape(self.prompt2), pexpect.TIMEOUT], timeout=40) + if index == 0 : return 'Ok' else : index = self.oai.expect(['password:', pexpect.TIMEOUT], timeout=40) @@ -95,11 +120,11 @@ class openair(core): print 'Expected ' + self.prompt1 + ', received >>>>' + self.oai.before + '<<<<' sys.exit(1) return 'Ok' - + except Exception, val: time.sleep(5) print "Error:", val - + def disconnect(self): print 'disconnecting the ssh connection to ' + self.address + '\n' diff --git a/targets/TEST/OAI/test01.py b/targets/TEST/OAI/test01.py index a9f10244838..16626ab3aa7 100644 --- a/targets/TEST/OAI/test01.py +++ b/targets/TEST/OAI/test01.py @@ -47,6 +47,8 @@ import log import case01 import case02 import case03 +import case04 +import case05 from openair import * @@ -54,6 +56,8 @@ debug = 0 prompt = '$' pw ='' i = 0 +dlsim=0 + for arg in sys.argv: if arg == '-d': debug = 1 @@ -63,6 +67,8 @@ for arg in sys.argv: prompt = sys.argv[i+1] elif arg == '-w' : pw = sys.argv[i+1] + elif arg == '-P' : + dlsim = 1 elif arg == '-h' : print "-d: low debug level" print "-dd: high debug level" @@ -112,6 +118,9 @@ oai.rm_driver(oai,user,pw) case01.execute(oai, user, pw, logfile,logdir) case02.execute(oai, user, pw, logfile,logdir) case03.execute(oai, user, pw, logfile,logdir) +if dlsim != 0 : + case04.execute(oai, user, pw, logfile,logdir) + case05.execute(oai, user, pw, logfile,logdir) oai.kill(user, pw) oai.rm_driver(oai,user,pw) diff --git a/targets/TEST/OAI/test02.py b/targets/TEST/OAI/test02.py new file mode 100644 index 00000000000..35a8650d22d --- /dev/null +++ b/targets/TEST/OAI/test02.py @@ -0,0 +1,129 @@ +#****************************************************************************** + +# Eurecom OpenAirInterface +# Copyright(c) 1999 - 2013 Eurecom + +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. + +# This program is distributed in the hope it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + +# The full GNU General Public License is included in this distribution in +# the file called "COPYING". + +# Contact Information +# Openair Admin: openair_admin@eurecom.fr +# Openair Tech : openair_tech@eurecom.fr +# Forums : http://forums.eurecom.fsr/openairinterface +# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France + +#***************************************************************************** + +# \file test01.py +# \brief test 02 for OAI: downlink and uplink performance and profiler +# \author Navid Nikaein +# \date 2014 +# \version 0.1 +# @ingroup _test + + +import sys +import wave +import os +import time +import datetime +import getpass +import math #from time import clock + +import log +import case11 +import case12 + + +from openair import * + +debug = 0 +prompt = '$' +pw ='' +i = 0 +for arg in sys.argv: + if arg == '-d': + debug = 1 + elif arg == '-dd': + debug = 2 + elif arg == '-p' : + prompt = sys.argv[i+1] + elif arg == '-w' : + pw = sys.argv[i+1] + elif arg == '-h' : + print "-d: low debug level" + print "-dd: high debug level" + print "-p: set the prompt" + print "-w: set the password for ssh to localhost" + sys.exit() + i= i + 1 + +# get the oai object +oai = openair('localdomain','localhost') +#start_time = time.time() # datetime.datetime.now() +try: + user = getpass.getuser() + print '\n******* Note that the user <'+user+'> should be a sudoer *******\n' + print '******* Connecting to the localhost to perform the test *******\n' + + if not pw : + print "username: " + user + pw = getpass.getpass() + else : + print "username: " + user + #print "password: " + pw + print "prompt: " + prompt + + oai.connect(user,pw,prompt) + #oai.get_shell() +except : + print 'Fail to connect to the local host' + sys.exit(1) + + +test = 'test02' +ctime=datetime.datetime.utcnow().strftime("%Y-%m-%d.%Hh%M") +logdir = os.getcwd() + '/PERF'; +logfile = logdir+'/'+user+'.'+test+'.'+ctime+'.txt' +oai.send_nowait('mkdir -p -m 755' + logdir + ';') + +#print '=================start the ' + test + ' at ' + ctime + '=================\n' +#print 'Results will be reported in log file : ' + logfile +log.writefile(logfile,'====================start'+test+' at ' + ctime + '=======================\n') +log.set_debug_level(debug) + +oai.kill(user, pw) +#oai.rm_driver(oai,user,pw) + +# start te test cases +case11.execute(oai, user, pw, logfile,logdir) +case12.execute(oai, user, pw, logfile,logdir) + +oai.kill(user, pw) +#oai.rm_driver(oai,user,pw) + +# perform the stats +log.statistics(logfile) + + +oai.disconnect() + +ctime=datetime.datetime.utcnow().strftime("%Y-%m-%d_%Hh%M") +log.writefile(logfile,'====================end the '+ test + ' at ' + ctime +'====================') +print 'Test results can be found in : ' + logfile +#print '\nThis test took %f minutes\n' % math.ceil((time.time() - start_time)/60) + +#print '\n=====================end the '+ test + ' at ' + ctime + '=====================' -- GitLab