diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 4a56cd7eaa8ea7c0513fdc3a52b76c866c0a2ac8..82228698775e59dfddcab98e2b4157f3ff15773c 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -833,17 +833,22 @@ void pdcp_run ( #if defined(USER_MODE) && defined(OAI_EMU) pdcp_t *pdcp_p = NULL; - int drb_id=0 ; - // add other rb_ids - for (drb_id=0; drb_id < DTCH; drb_id++) { - if (enb_flagP == ENB_FLAG_NO) { - pdcp_p = &pdcp_array_drb_ue[ue_mod_idP][drb_id]; - } else { - pdcp_p = &pdcp_array_drb_eNB[enb_mod_idP][ue_mod_idP][drb_id]; + int drb_id=1 ; + int ue_id=0; + int read_otg=1; + // add check for other rb_ids later + if (enb_flagP == ENB_FLAG_NO) { + if (pdcp_array_drb_ue[ue_mod_idP][drb_id-1].instanciated_instance != TRUE ) + read_otg=0; + } else { + for (ue_id=0; ue_id < NB_UE_INST; ue_id++) + if (pdcp_array_drb_eNB[enb_mod_idP][ue_id][drb_id-1].instanciated_instance != TRUE ){ + read_otg =0; + break; } - if (pdcp_p->instanciated_instance == TRUE ) - pdcp_fifo_read_input_sdus_from_otg(frameP, enb_flagP, ue_mod_idP, enb_mod_idP); - } + } + if (read_otg == 1 ) + pdcp_fifo_read_input_sdus_from_otg(frameP, enb_flagP, ue_mod_idP, enb_mod_idP); #endif // IP/NAS -> PDCP traffic : TX, read the pkt from the upper layer buffer diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 721b16175074d940cc2f86b3a135d9546c191b62..40e83d0446608962bc8f5085db32c301f4b0c84c 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -848,7 +848,8 @@ void pdcp_fifo_read_input_sdus_from_otg (frame_t frameP, eNB_flag_t enb_flagP, m module_id_t src_id, module_id; // src for otg module_id_t dst_id; // dst for otg rb_id_t rb_id; - signed long pkt_size=0, pkt_cnt=0; + signed long pkt_size=0; + static unsigned int pkt_cnt_enb=0, pkt_cnt_ue=0; uint8_t pdcp_mode, is_ue=0; Packet_otg_elt_t *otg_pkt_info=NULL; int result; @@ -878,23 +879,23 @@ void pdcp_fifo_read_input_sdus_from_otg (frame_t frameP, eNB_flag_t enb_flagP, m pkt_size = (otg_pkt_info->otg_pkt).sdu_buffer_size; if (otg_pkt != NULL) { if (is_ue == 0 ) { - rlc_util_print_hex_octets(PDCP, + /*rlc_util_print_hex_octets(PDCP, otg_pkt, pkt_size); - + */ //rb_id = (/*NB_eNB_INST +*/ dst_id -1 ) * MAX_NUM_RB + DTCH; LOG_D(OTG,"[eNB %d] Frame %d sending packet %d from module %d on rab id %d (src %d, dst %d) pkt size %d for pdcp mode %d\n", - enb_mod_idP, frameP, pkt_cnt++, module_id, rb_id, module_id, dst_id, pkt_size, pdcp_mode); - result = pdcp_data_req(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, pkt_size, otg_pkt,pdcp_mode); + enb_mod_idP, frameP, pkt_cnt_enb++, module_id, rb_id, module_id, dst_id, pkt_size, pdcp_mode); + result = pdcp_data_req(enb_mod_idP, dst_id, frameP, enb_flagP, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, pkt_size, otg_pkt,pdcp_mode); AssertFatal (result == TRUE, "PDCP data request failed!\n"); } else { //rb_id= eNB_index * MAX_NUM_RB + DTCH; - LOG_D(OTG,"[UE %d] sending packet from module %d on rab id %d (src %d, dst %d) pkt size %d\n", - ue_mod_idP, src_id, rb_id, src_id, dst_id, pkt_size); - result = pdcp_data_req( enb_mod_idP, + LOG_D(OTG,"[UE %d] Frame %d: sending packet %d from module %d on rab id %d (src %d, dst %d) pkt size %d\n", + ue_mod_idP, frameP, pkt_cnt_ue++, src_id, rb_id, src_id, dst_id, pkt_size); + result = pdcp_data_req( dst_id, ue_mod_idP, frameP, enb_flagP, diff --git a/openair2/UTIL/OTG/otg_kpi.c b/openair2/UTIL/OTG/otg_kpi.c index 990f76d1f57e0be46a3569f6daf6fc439374062e..09ac34422e7164ad4856c0f4443afaf45dcf9c05 100644 --- a/openair2/UTIL/OTG/otg_kpi.c +++ b/openair2/UTIL/OTG/otg_kpi.c @@ -211,6 +211,8 @@ void kpi_gen() { int num_active_source=0; + + int dl_ok=0,ul_ok; char traffic_type[12]; char traffic[30]; @@ -686,7 +688,9 @@ if ((g_otg->background_stats==1)&&(otg_info->tx_num_bytes_background[i][j]>0)){ LOG_I(OTG,"[DATA] TX throughput = %.7f(Kbit/s) \n", ((double)tx_total_bytes_dl*1000*8)/(otg_info->ctime*1024)); LOG_I(OTG,"[DATA] RX throughput = %.7f(Kbit/s) \n", ((double)rx_total_bytes_dl*1000*8)/(otg_info->ctime*1024)); LOG_I(OTG,"[DATA] NB lost packet = %d \n", tx_total_pkts_dl - rx_total_pkts_dl ); - if ((g_otg->background_stats==1)&&(tx_total_pkts_dl_background>0)){ + if (tx_total_pkts_dl - rx_total_pkts_dl < (int) (tx_total_pkts_dl / 10) ) // below 10% of loss + dl_ok=1; + if ((g_otg->background_stats==1)&&(tx_total_pkts_dl_background>0)){ LOG_I(OTG,"[BACKGROUND] Total packets(TX)= %d \n", tx_total_pkts_dl_background); LOG_I(OTG,"[BACKGROUND] Total bytes(TX)= %d \n", tx_total_bytes_dl_background); LOG_I(OTG,"[BACKGROUND] Total packets(RX)= %d \n", rx_total_pkts_dl_background); @@ -747,6 +751,10 @@ if ((g_otg->background_stats==1)&&(otg_info->tx_num_bytes_background[i][j]>0)){ LOG_I(OTG,"[DATA] JITTER AVG ms= %lf \n", otg_info->average_jitter_ul/(float)num_active_source); LOG_I(OTG,"[DATA] TX throughput = %.7f(Kbit/s) \n", ((double)tx_total_bytes_ul*1000*8)/(otg_info->ctime*1024)); LOG_I(OTG,"[DATA] RX throughput = %.7f(Kbit/s) \n", ((double)rx_total_bytes_ul*1000*8)/(otg_info->ctime*1024)); + LOG_I(OTG,"[DATA] NB lost packet = %d \n", tx_total_pkts_ul - rx_total_pkts_ul ); + if ((tx_total_pkts_ul - rx_total_pkts_ul) < (int)(tx_total_pkts_ul / 10) ) + ul_ok=1; + if ((g_otg->background_stats==1)&&(tx_total_pkts_ul_background>0)){ LOG_I(OTG,"[BACKGROUND] Total packets(TX)= %d \n", tx_total_pkts_ul_background); LOG_I(OTG,"[BACKGROUND] Total bytes(TX)= %d \n", tx_total_bytes_ul_background); @@ -767,6 +775,7 @@ if ((g_otg->background_stats==1)&&(otg_info->tx_num_bytes_background[i][j]>0)){ LOG_F(OTG,"[DATA] JITTER AVG ms= %lf \n", otg_info->average_jitter_ul/(float)num_active_source); LOG_F(OTG,"[DATA] TX throughput = %.7f(Kbit/s) \n", ((double)tx_total_bytes_ul*1000*8)/(otg_info->ctime*1024)); LOG_F(OTG,"[DATA] RX throughput = %.7f(Kbit/s) \n", ((double)rx_total_bytes_ul*1000*8)/(otg_info->ctime*1024)); + LOG_F(OTG,"[DATA] NB lost packet = %d \n", tx_total_pkts_ul - rx_total_pkts_ul ); if ((g_otg->background_stats==1)&&(tx_total_pkts_ul_background>0)){ LOG_F(OTG,"[BACKGROUND] Total packets(TX)= %d \n", tx_total_pkts_ul_background); LOG_F(OTG,"[BACKGROUND] Total bytes(TX)= %d \n", tx_total_bytes_ul_background); @@ -777,6 +786,10 @@ if ((g_otg->background_stats==1)&&(otg_info->tx_num_bytes_background[i][j]>0)){ } + if ((dl_ok == 1 ) && (ul_ok ==1)) + LOG_I(OTG,"************ DL and UL loss rate below 10% *************\n"); + else + LOG_I(OTG,"************ DL and UL loss rate above 10% *************\n"); #endif } diff --git a/targets/SIMU/USER/oaisim_config.c b/targets/SIMU/USER/oaisim_config.c index 2a60c4eca9ad14a98690edd6c5888416d8f5a4ce..5b36b680a32e5ce91ff18c98bdcdafdf0f2183b1 100644 --- a/targets/SIMU/USER/oaisim_config.c +++ b/targets/SIMU/USER/oaisim_config.c @@ -1108,8 +1108,8 @@ g_otg->application_idx[source_id_index][destination_id_index]+=1; g_otg->background[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] =map_str_to_int(switch_names,oai_emulation.application_config.customized_traffic.background[customized_traffic_config_index]); g_otg->m2m[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] =map_str_to_int(switch_names,oai_emulation.application_config.customized_traffic.m2m[customized_traffic_config_index]); - LOG_I(OTG, "[src %d][dst %d][ %d]test_m2m %d \n",source_id_index, destination_id_index , g_otg->application_idx[source_id_index][destination_id_index] , g_otg->m2m[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] ); - + /* LOG_I(OTG, "[src %d][dst %d][app %d]test_m2m %d \n",source_id_index, destination_id_index , g_otg->application_idx[source_id_index][destination_id_index] , g_otg->m2m[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] ); + */ g_otg->trans_proto[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_transport_protocol_names, oai_emulation.application_config.customized_traffic.transport_protocol[customized_traffic_config_index]); g_otg->ip_v[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]] = map_str_to_int(otg_ip_version_names, oai_emulation.application_config.customized_traffic.ip_version[customized_traffic_config_index]); @@ -1148,7 +1148,10 @@ g_otg->application_idx[source_id_index][destination_id_index]+=1; g_otg->holding_time_pe_off[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]=oai_emulation.application_config.customized_traffic.holding_time_pe_off[customized_traffic_config_index]; LOG_I(OTG,"OCG_config_OTG (single node config): source = %d, dest = %d\n", source_id_index, destination_id_index); - LOG_I(OTG,"customized:: OCG_config_OTG:(3) FORMAT (%d:%d) source = %d, dest = %d, Application = %d\n", did_start, did_end, source_id_index, destination_id_index, g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]]); + LOG_I(OTG,"customized:: OCG_config_OTG:(3) FORMAT (%d:%d) source = %d, dest = %d, Application = %d, IDT dist %d \n", + did_start, did_end, source_id_index, destination_id_index, + g_otg->application_type[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]], + g_otg->idt_dist[source_id_index][destination_id_index][g_otg->application_idx[source_id_index][destination_id_index]][state]); g_otg->application_idx[source_id_index][destination_id_index]+=1; } diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index b1c5c06c2ea8bd7ea49aff56df3ac643e8a164e9..39c450d2ba047d488db7977da9a14100e23133e0 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -1096,10 +1096,10 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime) { for_times += 1; // generate traffic if the ue is rrc reconfigured state if (mac_get_rrc_status(enb_module_idP, ENB_FLAG_YES, dst_id) > 2 /*RRC_CONNECTED*/ ) { - + if_times += 1; for (app_id=0; app_id<MAX_NUM_APPLICATION; app_id++){ otg_pkt = malloc (sizeof(Packet_otg_elt_t)); - if_times += 1; + (otg_pkt->otg_pkt).sdu_buffer = (uint8_t*) packet_gen(enb_module_idP, dst_id + NB_eNB_INST, app_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size)); diff --git a/targets/TEST/OAI/case02.py b/targets/TEST/OAI/case02.py index 437eba6f7777cb054be278daf9132abf7e4fc3a0..717cda3a5452f06cf5ebbb5fef00c9423f8823cc 100644 --- a/targets/TEST/OAI/case02.py +++ b/targets/TEST/OAI/case02.py @@ -76,7 +76,7 @@ def execute(oai, user, pw, logfile,logdir): conf = '-a -A AWGN -n 100 -l7' trace = logdir + '/log_' + case + test + '_3.txt;' tee = ' 2>&1 | tee ' + trace - diag = 'Error(s) found in the execution, check the execution logs' + diag = '[E] Error(s) found during the execution, check the execution logs' oai.send_expect_false('./oaisim.rel8 ' + conf, '[E]', 30) except log.err, e: @@ -187,3 +187,15 @@ def execute(oai, user, pw, logfile,logdir): log.ok(case, test, name, conf, '', logfile) + try: + test='07' + name = 'Run oai.rel8.abs.ocg.otg' + diag = 'Check the scenario if the tests 0202 and 0203 are passed.' + conf = '-a -c26' + trace = logdir + '/log_' + case + test + '.txt' + tee = ' 2>&1 | tee ' + trace + oai.send_expect('./oaisim.rel8 ' + conf + tee, ' DL and UL loss rate below 10% ', 500) + 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/openair.py b/targets/TEST/OAI/openair.py index 040c02bad307c09a73a746bff824b17808478352..fddf6915b849e42518d067fd1dc0c470b16bcd31 100644 --- a/targets/TEST/OAI/openair.py +++ b/targets/TEST/OAI/openair.py @@ -92,11 +92,12 @@ class openair(core): return (stdout, stderr) def connect(self, username, password, prompt): - self.prompt1 = self.shell_prompt + self.prompt2 = self.shell_prompt if not prompt : - self.prompt2 = self.prompt1 + self.prompt1 = self.prompt2 else : - self.prompt2 = prompt + self.prompt1 = prompt + while 1: try: if not username: diff --git a/targets/TEST/OAI/test01.py b/targets/TEST/OAI/test01.py index 16626ab3aa738428b2a0153e351f158a2f3ff883..a95003b2e6c912833af354ec9bcc849f42f9303f 100644 --- a/targets/TEST/OAI/test01.py +++ b/targets/TEST/OAI/test01.py @@ -53,7 +53,7 @@ import case05 from openair import * debug = 0 -prompt = '$' +prompt2 = '$' pw ='' i = 0 dlsim=0 @@ -64,7 +64,7 @@ for arg in sys.argv: elif arg == '-dd': debug = 2 elif arg == '-p' : - prompt = sys.argv[i+1] + prompt2 = sys.argv[i+1] elif arg == '-w' : pw = sys.argv[i+1] elif arg == '-P' : @@ -84,6 +84,7 @@ 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' + print '******* Make sure that the prompt is correct *******\n' if not pw : print "username: " + user @@ -91,7 +92,9 @@ try: else : print "username: " + user #print "password: " + pw - print "prompt: " + prompt + + prompt = os.getenv("PS1")[-2] + print "your prompt: " + prompt oai.connect(user,pw,prompt) #oai.get_shell()