Add following functionnalities to OAI UE autotest framework

- add progess bar report
- reduce ssh max_tries to 10
- cleanOldPrograms -> change kill cmd line to be able to run autotest on same machine than lte-softmodem (thanks Rohit & Gabriel)
- Cleanning output prints
- add --skip-machine-preparation on cmd line
- add --skip-sanity-check on cmd line
- add HTML REPORT (no-S1 only)
- add XML detailled report (no-S1 only)
This commit is contained in:
ROBERT Benoit
2016-11-18 18:31:57 +01:00
parent 9648d1f245
commit 0b1050c149
15 changed files with 4082 additions and 889 deletions
+1
View File
@@ -235,6 +235,7 @@ add_boolean_option(DEBUG_OMG False "???")
add_boolean_option(XFORMS False "This adds the possibility to see the signal oscilloscope") add_boolean_option(XFORMS False "This adds the possibility to see the signal oscilloscope")
add_boolean_option(PRINT_STATS False "This adds the possibility to see the status") add_boolean_option(PRINT_STATS False "This adds the possibility to see the status")
add_boolean_option(T_TRACER False "Activate the T tracer, a debugging/monitoring framework" ) add_boolean_option(T_TRACER False "Activate the T tracer, a debugging/monitoring framework" )
add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs")
add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering") add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering")
+5 -5
View File
@@ -75,7 +75,7 @@ class openair(core):
return (stdout, stderr) return (stdout, stderr)
def connect(self, username, password, prompt='PEXPECT_OAI'): def connect(self, username, password, prompt='PEXPECT_OAI'):
max_retries=100 max_retries=10
i=0 i=0
while i <= max_retries: while i <= max_retries:
self.prompt1 = prompt self.prompt1 = prompt
@@ -97,9 +97,9 @@ class openair(core):
# need to look for twice the string of the prompt # need to look for twice the string of the prompt
self.oai.prompt() self.oai.prompt()
self.oai.prompt() self.oai.prompt()
self.oai.sendline('uptime') # self.oai.sendline('uptime')
self.oai.prompt() # self.oai.prompt()
print self.oai.before # print self.oai.before
break break
except Exception, e: except Exception, e:
error='' error=''
@@ -171,7 +171,7 @@ class openair(core):
sys.exit(1) sys.exit(1)
def disconnect(self): def disconnect(self):
print 'disconnecting the ssh connection to ' + self.address + '\n' # print 'disconnecting the ssh connection to ' + self.address + '\n'
self.oai.send('exit') self.oai.send('exit')
# self.cancel() # self.cancel()
@@ -1,25 +0,0 @@
diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
index d2c7ac6..0853373 100644
--- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
+++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
@@ -493,7 +493,7 @@ void compute_beta8(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sho
#endif
- if (frame_length > 6143) {
+ if (frame_length > 6144) {
LOG_E(PHY,"compute_beta: frame_length %d\n",frame_length);
return;
}
@@ -979,6 +979,11 @@ unsigned char phy_threegpplte_turbo_decoder8(short *y,
} else
n2 = n;
+ if(n2<256)
+ {
+ printf("phy_threegpplte_turbo_decoder8 : frame length < 256\n");
+ return 255;
+ }
for (iind=0; iind < 188 && f1f2mat[iind].nb_bits != n; iind++);
@@ -1,17 +1,19 @@
diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c
index 71372d9..763397b 100644 index 661fe96..782305d 100644
--- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c --- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c
+++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c
@@ -477,6 +477,13 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) @@ -469,6 +469,15 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
//#endif //#endif
if (ue->UE_scan_carrier == 0) { if (ue->UE_scan_carrier == 0) {
+ +
+ /* SYRTEM */ + #if UE_AUTOTEST_TRACE
+ printf("AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %d \n", + LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %d \n",
+ ue->Mod_id,
+ ue->proc.proc_rxtx[0].frame_rx, + ue->proc.proc_rxtx[0].frame_rx,
+ ue->rx_offset, + ue->rx_offset,
+ ue->common_vars.freq_offset ); + ue->common_vars.freq_offset );
+ #endif
+ +
if (ue->mac_enabled==1) { if (ue->mac_enabled==1) {
LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id); LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
@@ -1,17 +0,0 @@
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 96645f8..a7f1dfb 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -1602,6 +1602,11 @@ int main( int argc, char **argv )
PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,abstraction_flag);
PHY_vars_eNB_g[0][CC_id]->CC_id = CC_id;
+ PHY_vars_eNB_g[0][CC_id]->ue_dl_rb_alloc=0x1fff;
+ PHY_vars_eNB_g[0][CC_id]->target_ue_dl_mcs=target_dl_mcs;
+ PHY_vars_eNB_g[0][CC_id]->ue_ul_nb_rb=6;
+ PHY_vars_eNB_g[0][CC_id]->target_ue_ul_mcs=target_ul_mcs;
+
if (phy_test==1) PHY_vars_eNB_g[0][CC_id]->mac_enabled = 0;
else PHY_vars_eNB_g[0][CC_id]->mac_enabled = 1;
@@ -20,10 +20,14 @@
# * contact@openairinterface.org # * contact@openairinterface.org
# */ # */
# \author Rohit Gupta # \author Rohit Gupta - Benoit ROBERT (benoit.robert@syrtem.com)
# \version 0.1 # \version 0.1
# @ingroup _test # @ingroup _test
# \Changelog
# 2016-11-18 :
# - Add progess bar during test execution update_progress()
import tempfile import tempfile
import threading import threading
import sys import sys
@@ -37,6 +41,8 @@ import math #from time import clock
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
import re import re
#from dict2xml import dict2xml as xmlify
from colorama import Fore, Back, Style from colorama import Fore, Back, Style
import numpy as np import numpy as np
@@ -57,6 +63,36 @@ import ssh
from ssh import SSHSession from ssh import SSHSession
import argparse import argparse
# update_progress() : Displays or updates a console progress bar
## Accepts a float between 0 and 1. Any int will be converted to a float.
## A value under 0 represents a 'halt'.
## A value at 1 or bigger represents 100%
def update_progress(progress, prefix_string):
barLength = 20 # Modify this to change the length of the progress bar
status = ""
#print "progress = "+ str(progress)
if isinstance(progress, int):
progress = float(progress)
if not isinstance(progress, float):
progress = 0
status = "error: progress var must be float\r\n"
if progress < 0:
progress = 0
status = "Halt...\r\n"
if progress >= 1:
progress = 1
status = "Done...\r\n"
block = int(round(barLength*progress))
text = "\r"+prefix_string+" [{0}] {1}% {2}".format( "="*block + " "*(barLength-block), progress*100, status)
sys.stdout.write(text)
sys.stdout.flush()
def exit_prog(exit_val):
print(Style.RESET_ALL),
sys.exit(exit_val)
# \brief write a string to a file # \brief write a string to a file
# \param filename name of file # \param filename name of file
# \param string string to write # \param string string to write
@@ -271,7 +307,7 @@ def update_config_file(oai, config_string, logdirRepo, python_script):
# \param logdir_local_base local directory # \param logdir_local_base local directory
# \param operation operation to perform (get_all, put_all) transfers recursively for directories # \param operation operation to perform (get_all, put_all) transfers recursively for directories
def SSHSessionWrapper(machine, username, key_file, password, logdir_remote, logdir_local_base, operation): def SSHSessionWrapper(machine, username, key_file, password, logdir_remote, logdir_local_base, operation):
max_tries = 100 max_tries = 10
i=0 i=0
while i <= max_tries: while i <= max_tries:
i = i +1 i = i +1
@@ -306,30 +342,50 @@ def SSHSessionWrapper(machine, username, key_file, password, logdir_remote, logd
# \param CleanUpAluLteBox program to terminate AlU Bell Labs LTE Box # \param CleanUpAluLteBox program to terminate AlU Bell Labs LTE Box
# \param ExmimoRfStop String to stop EXMIMO card (specified in test_case_list.xml) # \param ExmimoRfStop String to stop EXMIMO card (specified in test_case_list.xml)
def cleanOldPrograms(oai, programList, CleanUpAluLteBox, ExmimoRfStop, logdir, logdirOAI5GRepo): def cleanOldPrograms(oai, programList, CleanUpAluLteBox, ExmimoRfStop, logdir, logdirOAI5GRepo):
cmd = 'sudo -E killall -s INT -q -r ' + programList + ' ; sleep 5 ; sudo -E killall -9 -q -r ' + programList cmd = 'killall -9 ' + programList
result = oai.send(cmd, True) result = oai.send(cmd, True)
print "Killing old programs..." + result # print "\t\t > "+cmd
# print "\t\t < "+result
# print "Killing old programs on ..." + result
programArray = programList.split() programArray = programList.split()
programListJoin = '|'.join(programArray) programListJoin = '|'.join(programArray)
cmd = " ( date ;echo \"Starting cleaning old programs.. \" ; dmesg|tail ; echo \"Current disk space.. \" ; df -h )>& " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync" cmd = " ( date ;echo \"Starting cleaning old programs.. \" ; dmesg|tail ; echo \"Current disk space.. \" ; df -h )>& " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync"
result=oai.send_recv(cmd) result=oai.send_recv(cmd)
# print "\t\t > "+cmd
# print "\t\t < "+result
cmd = cleanupOldProgramsScript + ' ' + '\''+programListJoin+'\'' cmd = cleanupOldProgramsScript + ' ' + '\''+programListJoin+'\''
#result = oai.send_recv(cmd) #result = oai.send_recv(cmd)
#print result #print result
result = oai.send_expect_false(cmd, 'Match found', False) result = oai.send_expect_false(cmd, 'Match found', False)
print "Looking for old programs..." + result # print "\t\t > "+cmd
# print "\t\t < "+result
# print "Looking for old programs..." + result
res=oai.send_recv(CleanUpAluLteBox, True) res=oai.send_recv(CleanUpAluLteBox, True)
# print "\t\t > "+CleanUpAluLteBox
# print "\t\t < "+res
cmd= " echo \"Starting EXmimoRF Stop... \" >> " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync "; cmd= " echo \"Starting EXmimoRF Stop... \" >> " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync ";
oai.send_recv(cmd) result = oai.send_recv(cmd)
# print "\t\t > "+cmd
# print "\t\t < "+result
cmd = "( " + "cd " + logdirOAI5GRepo + " ; source oaienv ; " + ExmimoRfStop + " ) >> " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync " cmd = "( " + "cd " + logdirOAI5GRepo + " ; source oaienv ; " + ExmimoRfStop + " ) >> " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync "
print "cleanoldprograms cmd = " + cmd # print "cleanoldprograms cmd = " + cmd
res=oai.send_recv(cmd, False, timeout=600) res=oai.send_recv(cmd, False, timeout=600)
# print "\t\t > "+cmd
# print "\t\t < "+res
cmd= " echo \"Stopping EXmimoRF Stop... \" >> " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync "; cmd= " echo \"Stopping EXmimoRF Stop... \" >> " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync ";
oai.send_recv(cmd) result = oai.send_recv(cmd)
# print "\t\t > "+cmd
# print "\t\t < "+result
#res = oai.send_recv(ExmimoRfStop, False) #res = oai.send_recv(ExmimoRfStop, False)
cmd = " ( date ;echo \"Finished cleaning old programs.. \" ; dmesg | tail)>> $HOME/.oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync" cmd = " ( date ;echo \"Finished cleaning old programs.. \" ; dmesg | tail)>> $HOME/.oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync"
res=oai.send_recv(cmd) res=oai.send_recv(cmd)
# print "\t\t > "+cmd
# print "\t\t < "+res
# \brief Class thread to launch a generic command on remote machine # \brief Class thread to launch a generic command on remote machine
# \param threadID number of thread (for book keeping) # \param threadID number of thread (for book keeping)
@@ -355,10 +411,10 @@ class oaiThread (threading.Thread):
try: try:
oai = openair('localdomain',self.machine) oai = openair('localdomain',self.machine)
oai.connect(self.username, self.password) oai.connect(self.username, self.password)
print "Starting " + self.threadname + " on machine " + self.machine # print "Starting " + self.threadname + " on machine " + self.machine
result = oai.send_recv(self.cmd, self.sudo, self.timeout) result = oai.send_recv(self.cmd, self.sudo, self.timeout)
print "result = " + result #print "result = " + result
print "Exiting " + self.threadname #print "Exiting " + self.threadname
oai.disconnect() oai.disconnect()
except Exception, e: except Exception, e:
error='' error=''
@@ -1262,6 +1318,8 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe
if testcase_verdict != 'PASS': # if something went wrong to not run test cases if testcase_verdict != 'PASS': # if something went wrong to not run test cases
max_ntries=0 max_ntries=0
indent="\t\t"
runs_results = [] runs_results = []
nb_runs = 0 nb_runs = 0
nb_run_pass = 0 nb_run_pass = 0
@@ -1281,9 +1339,11 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe
# #
# RUN initialization # RUN initialization
# ---------------------------------------------------- # ----------------------------------------------------
print (Fore.WHITE + indent + "> RUN_"+str(run).zfill(2)+" : " ),
sys.stdout.flush() prefix_string = Fore.WHITE + indent + "> RUN_"+str(run).zfill(2)+" :"
# print (Fore.WHITE + indent + "> RUN_"+str(run).zfill(2)+" : " ),
# sys.stdout.flush()
run_start_time=datetime.datetime.now() run_start_time=datetime.datetime.now()
@@ -1399,9 +1459,35 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe
threads.append(thread_UE) threads.append(thread_UE)
thread_eNB.start() thread_eNB.start()
thread_UE.start() thread_UE.start()
run_work_inprogress_flag = True
progress_step = timeout_thread/20
progress_count = 0
while (run_work_inprogress_flag):
update_progress(float(progress_count)/float(timeout_thread),prefix_string)
time.sleep(progress_step)
progress_count += progress_step
# sys.stdout.write ('#')
# sys.stdout.flush()
run_work_inprogress_flag = False
for t in threads:
if t.isAlive():
run_work_inprogress_flag = True
update_progress(1,prefix_string)
for t in threads: for t in threads:
t.join() t.join()
# #
# #
#----------------------------------------------------- #-----------------------------------------------------
@@ -1415,10 +1501,12 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe
fname = logdir_local_run+ '/UE_exec' + '_' + str(run) + '_.log' fname = logdir_local_run+ '/UE_exec' + '_' + str(run) + '_.log'
cell_synch_status = analyser.check_cell_synchro(fname) cell_synch_status = analyser.check_cell_synchro(fname)
print (Fore.WHITE + indent + "> Check Cell synchro :"),
if cell_synch_status == 'CELL_SYNCH': if cell_synch_status == 'CELL_SYNCH':
print '!!!!!!!!!!!!!! Cell synchronized !!!!!!!!!!!' print ( Fore.GREEN + cell_synch_status)
else : else :
print '!!!!!!!!!!!!!! Cell NOT NOT synchronized !!!!!!!!!!!' print ( Fore.RED + cell_synch_status)
metric_checks_flag = 0 metric_checks_flag = 0
ue_seg_fault_status = analyser.check_exec_seg_fault(fname) ue_seg_fault_status = analyser.check_exec_seg_fault(fname)
@@ -1437,6 +1525,9 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe
# UE side metrics # UE side metrics
metricList=testcase.findall('UE_metric') metricList=testcase.findall('UE_metric')
for metric in metricList: for metric in metricList:
metric_verdict = 'PASS'
metric_def = {} metric_def = {}
metric_def['id'] = metric.get('id') metric_def['id'] = metric.get('id')
metric_def['description'] = metric.get('description') metric_def['description'] = metric.get('description')
@@ -1457,15 +1548,19 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe
metric_extracted = analyser.do_extract_metrics(args) metric_extracted = analyser.do_extract_metrics(args)
print "\t > Metric "+metric_def['id']+" :" print (Fore.WHITE + indent + "> Metric : "+metric_def['id']),
print "\t\t> min = "+ str( metric_extracted['metric_min'] ) print ("(min="+str( metric_extracted['metric_min'])+", max="+str( metric_extracted['metric_max'])+", mean="+str( metric_extracted['metric_mean'])+", median="+str( metric_extracted['metric_median'])+")")
print "\t\t> min_index = "+ str( metric_extracted['metric_min_index'] )
print "\t\t> max = "+ str( metric_extracted['metric_max'] )
print "\t\t> max_index = "+ str( metric_extracted['metric_max_index'] )
print "\t\t> mean = "+ str( metric_extracted['metric_mean'] )
print "\t\t> median = "+ str( metric_extracted['metric_median'] )
verdict = analyser.do_check_verdict(metric_def, metric_extracted) # print "\t > Metric "+metric_def['id']+" :"
# print "\t\t> min = "+ str( metric_extracted['metric_min'] )
# print "\t\t> min_index = "+ str( metric_extracted['metric_min_index'] )
# print "\t\t> max = "+ str( metric_extracted['metric_max'] )
# print "\t\t> max_index = "+ str( metric_extracted['metric_max_index'] )
# print "\t\t> mean = "+ str( metric_extracted['metric_mean'] )
# print "\t\t> median = "+ str( metric_extracted['metric_median'] )
if metric_def['pass_fail_stat'] :
metric_verdict = analyser.do_check_verdict(metric_def, metric_extracted)
metric_fig = logdir_local_run+ '/UE_metric_'+ metric_def['id']+'_' + str(run) + '_.png' metric_fig = logdir_local_run+ '/UE_metric_'+ metric_def['id']+'_' + str(run) + '_.png'
analyser.do_img_metrics(metric_def, metric_extracted, metric_fig) analyser.do_img_metrics(metric_def, metric_extracted, metric_fig)
@@ -1493,6 +1588,13 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe
runs_metrics.append(run_metrics) runs_metrics.append(run_metrics)
if metric_verdict != 'PASS':
verdict = metric_verdict
# End Metrics LOOP
# ---------------------
# Traffic analysis # Traffic analysis
if UE_traffic_exec != "": if UE_traffic_exec != "":
@@ -1578,6 +1680,8 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe
# END RUN LOOP # END RUN LOOP
#---------------------------------------------------- #----------------------------------------------------
indent="\t"
# Test case duration # Test case duration
# ---------------------------------- # ----------------------------------
testcase_time_stop = datetime.datetime.now() testcase_time_stop = datetime.datetime.now()
@@ -1617,11 +1721,9 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe
else: else:
print (Fore.YELLOW+'INCONCLUSIVE') print (Fore.YELLOW+'INCONCLUSIVE')
duration= testcase_time_stop - testcase_time_start print(Style.RESET_ALL)
xmlFile = logdir_local_testcase + '/test.' + testcasename + '.xml'
xml="\n<testcase classname=\'"+ testcaseclass + "\' name=\'" + testcasename + "."+tags + "\' Run_result=\'" + test_result_string + "\' time=\'" + str(duration) + " s \' RESULT=\'" + testcase_verdict + "\'></testcase> \n"
write_file(xmlFile, xml, mode="w")
duration= testcase_time_stop - testcase_time_start
test_result = dict(testcase_name=testcasename, test_result = dict(testcase_name=testcasename,
testcaseclass=testcaseclass, testcaseclass=testcaseclass,
@@ -1640,7 +1742,17 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe
testcase_eNBMachine =eNBMachine, testcase_eNBMachine =eNBMachine,
testcase_UEMachine =UEMachine, testcase_UEMachine =UEMachine,
runs_results = runs_results) runs_results = runs_results)
#test_results.append(test_result) test_results.append(test_result)
xmlFile = logdir_local_testcase + '/test.' + testcasename + '.xml'
xml="\n<testcase classname=\'"+ testcaseclass + "\' name=\'" + testcasename + "."+tags + "\' Run_result=\'" + test_result_string + "\' time=\'" + str(duration) + " s \' RESULT=\'" + testcase_verdict + "\'></testcase> \n"
write_file(xmlFile, xml, mode="w")
# xmlFile_ng = logdir_local_testcase + '/test.' + testcasename + '_ng.xml'
# xml_ng = xmlify(test_result, wrap=testcasename, indent=" ")
# write_file(xmlFile_ng, xml_ng, mode="w")
return testcase_verdict return testcase_verdict
@@ -1659,12 +1771,12 @@ def search_test_case_group(testcasename, testcasegroup, test_case_exclude):
if entry.find('+') >=0: if entry.find('+') >=0:
match = re.search(entry, testcasename) match = re.search(entry, testcasename)
if match: if match:
print "\nSkipping test case as it is found in black list: " + testcasename #print "\nSkipping test case as it is found in black list: " + testcasename
return False return False
else: else:
match = entry.find(testcasename) match = entry.find(testcasename)
if match >=0: if match >=0:
print "\nSkipping test case as it is found in black list: " + testcasename #print "\nSkipping test case as it is found in black list: " + testcasename
return False return False
if testcasegroup == '': if testcasegroup == '':
return True return True
@@ -1752,6 +1864,7 @@ if openairdir_local is None:
print "Environment variable OPENAIR_DIR not set correctly" print "Environment variable OPENAIR_DIR not set correctly"
sys.exit() sys.exit()
locallogdir = openairdir_local + '/cmake_targets/autotests/log' locallogdir = openairdir_local + '/cmake_targets/autotests/log'
reportdir = openairdir_local + '/cmake_targets/autotests/report'
MachineList = '' MachineList = ''
MachineListGeneric='' MachineListGeneric=''
MachineDescDic={} MachineDescDic={}
@@ -1760,12 +1873,19 @@ flag_start_testcase=False
nruns_lte_softmodem='' nruns_lte_softmodem=''
flag_skip_git_head_check=False flag_skip_git_head_check=False
flag_skip_oai_install=False flag_skip_oai_install=False
flag_skip_machine_preparation=False
flag_skip_sanity_check=False
flag_generate_html_report = False
Timeout_cmd='' Timeout_cmd=''
xmlInputFile='' xmlInputFile=''
print "Number of arguments argc = " + str(len(sys.argv))
#print "Number of arguments argc = " + str(len(sys.argv))
#for index in range(1,len(sys.argv) ): #for index in range(1,len(sys.argv) ):
# print "argv_" + str(index) + " : " + sys.argv[index] # print "argv_" + str(index) + " : " + sys.argv[index]
oai_list = []
i=1 i=1
while i < len (sys.argv): while i < len (sys.argv):
arg=sys.argv[i] arg=sys.argv[i]
@@ -1825,9 +1945,15 @@ while i < len (sys.argv):
i = i +1 i = i +1
elif arg == '--skip-oai-install': elif arg == '--skip-oai-install':
flag_skip_oai_install=True flag_skip_oai_install=True
elif arg == '--skip-machine-preparation':
flag_skip_machine_preparation=True
elif arg == '--skip-sanity-check':
flag_skip_sanity_check=True
elif arg == '--test-suite' : elif arg == '--test-suite' :
xmlInputFile = sys.argv[i+1] xmlInputFile = sys.argv[i+1]
i = i +1 i = i +1
elif arg == '--generate-html-report':
flag_generate_html_report=True
elif arg == '-h' : elif arg == '-h' :
print "-s: This flag *MUST* be set to start the test cases" print "-s: This flag *MUST* be set to start the test cases"
print "-r: Remove the log directory in autotests" print "-r: Remove the log directory in autotests"
@@ -1845,90 +1971,65 @@ while i < len (sys.argv):
print "--skip-git-head-check: skip checking of GitHead remote/local branch (only for debugging)" print "--skip-git-head-check: skip checking of GitHead remote/local branch (only for debugging)"
print "--timeout_cmd: Override the default parameter (timeout_cmd) in test_case_list.xml. This parameter is in seconds and should be > 120" print "--timeout_cmd: Override the default parameter (timeout_cmd) in test_case_list.xml. This parameter is in seconds and should be > 120"
print "--skip-oai-install: Skips the openairinterface5g installer" print "--skip-oai-install: Skips the openairinterface5g installer"
print "--skip-machine-preparation: skipp the whole system preparation -> direct to test cases"
print "--skip-sanity-check: skipp the machine sanity checks"
print "--test-suite: Select a XML test-suite file" print "--test-suite: Select a XML test-suite file"
print "--generate-html-report: Generate an HTML report of the test campaign (supported only for noS1 testsuite !!)"
sys.exit() sys.exit()
else : else :
print "Unrecongnized Option: <" + arg + ">. Use -h to see valid options" print "Unrecongnized Option: <" + arg + ">. Use -h to see valid options"
sys.exit() sys.exit()
i= i + 1 i= i + 1
try:
os.environ["OPENAIR1_DIR"]
except KeyError:
print "Please set the environment variable OPENAIR1_DIR in the .bashrc"
sys.exit(1)
try:
os.environ["OPENAIR2_DIR"]
except KeyError:
print "Please set the environment variable OPENAIR2_DIR in the .bashrc"
sys.exit(1)
try:
os.environ["OPENAIR_TARGETS"]
except KeyError:
print "Please set the environment variable OPENAIR_TARGETS in the .bashrc"
sys.exit(1)
print "Killing zombie ssh sessions from earlier sessions..."
cmd='ps aux |grep \"/usr/bin/ssh -q -l guptar\"| awk \'{print $2}\' | sudo xargs kill -9 '
os.system(cmd)
try:
analyser = __import__("lib_autotest_analyser")
except ImportError as err:
print('Import error: ' + str(err))
exit(0)
if flag_start_testcase == False:
print "You need to start the testcase by passing option -s. Use -h to see all options. Aborting now..."
sys.exit(1)
# get the oai object
host = os.uname()[1]
#oai = openair('localdomain','calisson')
oai_list = []
#start_time = time.time() # datetime.datetime.now()
if user=='':
user = getpass.getuser()
if pw=='':
pw = getpass.getpass()
print "Killing zombie ssh sessions from earlier sessions..."
cmd='ps aux |grep \"/usr/bin/ssh -q -l guptar\"|tr -s \" \" :|cut -f 2 -d :|xargs kill -9 '
cmd = cmd + '; ps aux |grep \"/usr/bin/ssh -q -l ' + user + '\"|tr -s \" \" :|cut -f 2 -d :|xargs kill -9 '
os.system(cmd)
print "host = " + host
print "user = " + user
if xmlInputFile == '':
xmlInputFile=os.environ.get('OPENAIR_DIR')+"/cmake_targets/autotests/test_case_list.xml"
NFSResultsDir = '/mnt/sradio'
cleanupOldProgramsScript = '$OPENAIR_DIR/cmake_targets/autotests/tools/remove_old_programs.bash'
logdir = '/tmp/' + 'OAITestFrameWork-' + user + '/' logdir = '/tmp/' + 'OAITestFrameWork-' + user + '/'
logdirOAI5GRepo = logdir + 'openairinterface5g/' logdirOAI5GRepo = logdir + 'openairinterface5g/'
logdirOpenaircnRepo = logdir + 'openair-cn/' logdirOpenaircnRepo = logdir + 'openair-cn/'
patchdir = logdirOAI5GRepo + 'cmake_targets/autotests/patches/' patchdir = logdirOAI5GRepo + 'cmake_targets/autotests/patches/'
NFSResultsDir = '/mnt/sradio'
if flag_remove_logdir == True: cleanupOldProgramsScript = '$OPENAIR_DIR/cmake_targets/autotests/tools/remove_old_programs.bash'
print "Removing directory: " + locallogdir
os.system(' rm -fr ' + locallogdir + '; mkdir -p ' + locallogdir )
else:
os.system('mkdir -p ' + locallogdir)
paramiko_logfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/log/paramiko.log')
res=os.system(' echo > ' + paramiko_logfile)
paramiko.util.log_to_file(paramiko_logfile)
#pw=getpass.getpass()
#Now we parse the xml file for basic configuration #Now we parse the xml file for basic configuration
if xmlInputFile == '':
xmlInputFile=os.environ.get('OPENAIR_DIR')+"/cmake_targets/autotests/test_case_list.xml"
xmlTree = ET.parse(xmlInputFile) xmlTree = ET.parse(xmlInputFile)
xmlRoot = xmlTree.getroot() xmlRoot = xmlTree.getroot()
#
# Read test session configuration
# ---------------------------------------------------------------------------------
print (Fore.YELLOW + '\nStep 0.1 - Read test session configuration')
print (Fore.YELLOW + '-------------------------------------------------')
test_session_start_time = datetime.datetime.now()
print (Fore.WHITE + ' - start time : '+ str(test_session_start_time))
host = os.uname()[1]
print (Fore.WHITE + ' - MTC host : '+host)
if user=='':
user = getpass.getuser()
print (Fore.WHITE + ' - user : '+user)
if pw=='':
pw = getpass.getpass()
print (Fore.WHITE + ' - password : '+pw)
print (Fore.WHITE + ' - cmd line flags : ')
print (Fore.WHITE + ' + -s : '+str(flag_start_testcase))
print (Fore.WHITE + ' + -r : '+str(flag_remove_logdir))
print (Fore.WHITE + ' + -c : '+str(cleanUpRemoteMachines))
print (Fore.WHITE + ' + --skip-git-head-check : '+str(flag_skip_git_head_check))
print (Fore.WHITE + ' + --skip-oai-install : '+str(flag_skip_oai_install))
print (Fore.WHITE + ' + --skip-machine-preparation : '+str(flag_skip_machine_preparation))
print (Fore.WHITE + ' + --skip-sanity-check : '+str(flag_skip_sanity_check))
print (Fore.WHITE + ' - Test setup basic config : (* -> overwrite by cmd line parameter)')
print (Fore.WHITE + ' + test setup config file : '+str(xmlInputFile))
print (Fore.WHITE + ' + remote setup dir : '+str(logdir))
print (Fore.WHITE + ' + remote OAI5G repo : '+str(logdirOAI5GRepo))
print (Fore.WHITE + ' + remote OpenAirCN repo : '+str(logdirOpenaircnRepo))
if MachineList =='': if MachineList =='':
@@ -1941,6 +2042,8 @@ if GitOAI5GRepo == '':
if GitOAI5GRepoBranch == '': if GitOAI5GRepoBranch == '':
GitOAI5GRepoBranch = xmlRoot.findtext('GitOAI5GRepoBranch',default='') GitOAI5GRepoBranch = xmlRoot.findtext('GitOAI5GRepoBranch',default='')
if GitOAI5GHeadVersion == '':
GitOAI5GHeadVersion = xmlRoot.findtext('GitOAI5GHeadVersion',default='')
GitOpenaircnRepoBranch = xmlRoot.findtext('GitOpenair-cnRepoBranch',default='') GitOpenaircnRepoBranch = xmlRoot.findtext('GitOpenair-cnRepoBranch',default='')
CleanUpOldProgs = xmlRoot.findtext('CleanUpOldProgs',default='') CleanUpOldProgs = xmlRoot.findtext('CleanUpOldProgs',default='')
@@ -1953,25 +2056,27 @@ ExmimoRfStop = xmlRoot.findtext('ExmimoRfStop',default='')
if nruns_lte_softmodem == '': if nruns_lte_softmodem == '':
nruns_lte_softmodem = xmlRoot.findtext('nruns_lte-softmodem',default='') nruns_lte_softmodem = xmlRoot.findtext('nruns_lte-softmodem',default='')
OAI5GpatchFileList=xmlRoot.findall('OAI5GPatchFile') print (Fore.WHITE + ' + MachineList : '+ MachineList)
print (Fore.WHITE + ' + GitOpenair-cnRepo : '+ GitOpenaircnRepo)
print (Fore.WHITE + ' + GitOAI5GRepo : '+ GitOAI5GRepo)
print (Fore.WHITE + ' + GitOAI5GBranch : '+ GitOAI5GRepoBranch)
print (Fore.WHITE + ' + GitOpenaircnRepoBranch : '+ GitOpenaircnRepoBranch)
print (Fore.WHITE + ' + NFSResultsShare : '+ NFSResultsShare)
print (Fore.WHITE + ' + nruns_lte_softmodem : '+ nruns_lte_softmodem)
print (Fore.WHITE + ' + Timeout_cmd : '+ Timeout_cmd)
print "MachineList = " + MachineList
print "GitOpenair-cnRepo = " + GitOpenaircnRepo
print "GitOAI5GRepo = " + GitOAI5GRepo
print "GitOAI5GBranch = " + GitOAI5GRepoBranch
print "GitOpenaircnRepoBranch = " + GitOpenaircnRepoBranch
print "NFSResultsShare = " + NFSResultsShare
print "nruns_lte_softmodem = " + nruns_lte_softmodem
print "Timeout_cmd = " + Timeout_cmd
if GitOAI5GHeadVersion == '': if GitOAI5GHeadVersion == '':
cmd = "git show-ref --heads -s "+ GitOAI5GRepoBranch cmd = "git log --pretty=format:\'%H\' -n 1" # origin/"+ GitOAI5GRepoBranch
# cmd = "git show-ref --heads -s "+ GitOAI5GRepoBranch
GitOAI5GHeadVersion = subprocess.check_output ([cmd], shell=True) GitOAI5GHeadVersion = subprocess.check_output ([cmd], shell=True)
GitOAI5GHeadVersion=GitOAI5GHeadVersion.replace("\n","") GitOAI5GHeadVersion=GitOAI5GHeadVersion.replace("\n","")
print "GitOAI5GHeadVersion = " + GitOAI5GHeadVersion # Print commiter and date : git log -1 --pretty=format:"%an %ad"
print "CleanUpOldProgs = " + CleanUpOldProgs
print "Timeout_execution = " + str(Timeout_execution) print (Fore.WHITE + ' + GitOAI5GHeadVersion : '+ GitOAI5GHeadVersion)
#print "CleanUpOldProgs = " + CleanUpOldProgs
print (Fore.WHITE + ' + Timeout_execution (s) : '+ str(Timeout_execution))
if GitOAI5GHeadVersion == '': if GitOAI5GHeadVersion == '':
print "Error getting the OAI5GBranch Head version...Exiting" print "Error getting the OAI5GBranch Head version...Exiting"
@@ -1979,40 +2084,115 @@ if GitOAI5GHeadVersion == '':
NFSTestsResultsDir = NFSResultsShare + '/'+ GitOAI5GRepoBranch + '/' + GitOAI5GHeadVersion NFSTestsResultsDir = NFSResultsShare + '/'+ GitOAI5GRepoBranch + '/' + GitOAI5GHeadVersion
print "NFSTestsResultsDir = " + NFSTestsResultsDir #print "NFSTestsResultsDir = " + NFSTestsResultsDir
OAI5GpatchFileList=xmlRoot.findall('OAI5GPatchFile')
MachineList = MachineList.split() MachineList = MachineList.split()
MachineListGeneric = MachineListGeneric.split() MachineListGeneric = MachineListGeneric.split()
#index=0
MachineDescDic
#
# 'Check Mater Test Controller sanity (MTC)'
# ---------------------------------------------------------------------------------
print (Fore.YELLOW + '\nStep 0.2 - Check Mater Test Controller sanity (MTC)')
print (Fore.YELLOW + '-------------------------------------------------')
try:
print (Fore.WHITE + ' - check OpenAirInterface environment variable OPENAIR1_DIR... '),
os.environ["OPENAIR1_DIR"]
except KeyError:
print (Fore.RED + 'FAILED')
print "Please set the environment variable OPENAIR1_DIR in the .bashrc or run 'source oaienv' "
exit_prog(1)
print (Fore.GREEN + 'OK')
try:
print (Fore.WHITE + ' - check OpenAirInterface environment variable OPENAIR2_DIR... '),
os.environ["OPENAIR2_DIR"]
except KeyError:
print (Fore.RED + 'FAILED')
print "Please set the environment variable OPENAIR2_DIR in the .bashrc or run 'source oaienv' "
exit_prog(1)
print (Fore.GREEN + 'OK')
try:
os.environ["OPENAIR_TARGETS"]
except KeyError:
print "Please set the environment variable OPENAIR_TARGETS in the .bashrc or run 'source oaienv' "
sexit_prog(1)
print (Fore.WHITE + ' - kill zombie ssh sessions from earlier sessions... '),
cmd='ps aux |grep \"/usr/bin/ssh -q -l ' + user + '\"| tr -s \" \" :| cut -f 2 -d :| xargs kill -9 '
os.system(cmd)
print (Fore.GREEN + 'DONE')
if flag_start_testcase == False:
print "You need to start the testcase by passing option -s. Use -h to see all options. Aborting now..."
exit_prog(1)
#print "Killing zombie ssh sessions from earlier sessions..."
#cmd='ps aux |grep \"/usr/bin/ssh -q -l guptar\"|tr -s \" \" :|cut -f 2 -d :|xargs kill -9 '
#cmd = cmd + '; ps aux |grep \"/usr/bin/ssh -q -l ' + user + '\"| tr -s \" \" :| cut -f 2 -d :| xargs kill -9 '
#os.system(cmd)
#print cmd
try:
analyser = __import__("lib_autotest_analyser")
except ImportError as err:
print('Import error: ' + str(err))
exit(0)
if flag_remove_logdir == True:
print "Removing directory: " + locallogdir
os.system(' rm -fr ' + locallogdir + '; mkdir -p ' + locallogdir )
if not os.path.exists(locallogdir):
os.system('mkdir -p ' + locallogdir )
paramiko_logfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/log/paramiko.log')
res=os.system(' echo > ' + paramiko_logfile)
paramiko.util.log_to_file(paramiko_logfile)
#
# 'REMOTE MACHINE SANITY CHEKS'
# ---------------------------------------------------------------------------------
print (Fore.YELLOW + '\nStep 0.3 - REMOTE MACHINE SANITY CHEKS')
print (Fore.YELLOW + '-------------------------------------------------')
for machine in MachineList: for machine in MachineList:
oai_list.append( openair('localdomain',machine)) oai_list.append( openair('localdomain',machine))
MachineDescDic[machine]={} MachineDescDic[machine]={}
#index = index + 1
print "\nTesting the sanity of machines used for testing..." if not flag_skip_sanity_check:
if localshell == 0:
if localshell == 0:
try: try:
index=0 index=0
for machine in MachineList: for machine in MachineList:
print '\n******* Note that the user <'+user+'> should be a sudoer *******\n' print (Fore.WHITE + " - Check sanity for remote machine "+machine)
print '******* Connecting to the machine <'+machine+'> to perform the test *******\n'
if not pw :
print "username: " + user
#pw = getpass.getpass()
#print "password: " + pw
else :
print "username: " + user
#print "password: " + pw
# issues in ubuntu 12.04
oai_list[index].connect(user,pw)
print '\nChecking for sudo permissions on machine <'+machine+'>...'
result = oai_list[index].send_expect_false('sudo -S -v','may not run sudo',True)
print "Sudo permissions..." + result
print '\nCleaning Older running programs : ' + CleanUpOldProgs oai_list[index].connect(user,pw)
print (Fore.WHITE + " > Checking for sudo permissions for user "+user+ " : "),
result = oai_list[index].send_expect_false('sudo -S -v','may not run sudo',True)
if (result == 'OK'):
print (Fore.GREEN + result )
else:
print (Fore.RED + result )
print (Fore.WHITE + " > Cleaning Older running programs : "),
cleanOldPrograms(oai_list[index], CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop, '$HOME', '/tmp') cleanOldPrograms(oai_list[index], CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop, '$HOME', '/tmp')
print (Fore.WHITE + " Done")
#result = oai_list[index].send('mount ' + NFSResultsDir, True) #result = oai_list[index].send('mount ' + NFSResultsDir, True)
#print "Mounting NFS Share " + NFSResultsDir + "..." + result #print "Mounting NFS Share " + NFSResultsDir + "..." + result
@@ -2032,14 +2212,22 @@ if localshell == 0:
except : except :
print 'Fail to connect to the machine: '+ machine print 'Fail to connect to the machine: '+ machine
sys.exit(1) sys.exit(1)
else: else:
pw = '' pw = ''
oai_list[0].connect_localshell() oai_list[0].connect_localshell()
else:
print (Fore.RED + " Skipping Machine sanity check...")
#We now prepare the machines for testing #
index=0 # 'REMOTE MACHINE TEST SETUP CONFIGURATION'
threads_init_setup=[] # ---------------------------------------------------------------------------------
for oai in oai_list: print (Fore.YELLOW + '\nStep 0.4 - REMOTE MACHINE PREPARATION')
print (Fore.YELLOW + '-------------------------------------------------')
if not flag_skip_machine_preparation:
index=0
threads_init_setup=[]
for oai in oai_list:
try: try:
print "setting up machine: " + MachineList[index] print "setting up machine: " + MachineList[index]
#print oai_list[oai].send_recv('echo \''+pw+'\' |sudo -S -v') #print oai_list[oai].send_recv('echo \''+pw+'\' |sudo -S -v')
@@ -2048,6 +2236,7 @@ for oai in oai_list:
#cleanUpPrograms(oai_list[oai] #cleanUpPrograms(oai_list[oai]
cmd = 'sudo -S -E rm -fr ' + logdir + ' ; mkdir -p ' + logdir cmd = 'sudo -S -E rm -fr ' + logdir + ' ; mkdir -p ' + logdir
result = oai.send_recv(cmd) result = oai.send_recv(cmd)
print cmd
setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt' setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt'
setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt' setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt'
@@ -2061,7 +2250,6 @@ for oai in oai_list:
sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log')
sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) sftp_module (user, pw, MachineList[index], port, paramList, sftp_log)
cmd = ' ( \n' cmd = ' ( \n'
#cmd = cmd + 'rm -fR ' + logdir + '\n' #cmd = cmd + 'rm -fR ' + logdir + '\n'
#cmd = cmd + 'mkdir -p ' + logdir + '\n' #cmd = cmd + 'mkdir -p ' + logdir + '\n'
@@ -2072,7 +2260,8 @@ for oai in oai_list:
cmd = cmd + logdir + '/git-retry.sh clone '+ GitOpenaircnRepo + ' \n' cmd = cmd + logdir + '/git-retry.sh clone '+ GitOpenaircnRepo + ' \n'
cmd = cmd + 'cd ' + logdirOAI5GRepo + '\n' cmd = cmd + 'cd ' + logdirOAI5GRepo + '\n'
cmd = cmd + 'git checkout ' + GitOAI5GRepoBranch + '\n' cmd = cmd + 'git checkout ' + GitOAI5GRepoBranch + '\n'
#cmd = cmd + 'git checkout ' + GitOAI5GHeadVersion + '\n' if GitOAI5GHeadVersion :
cmd = cmd + 'git checkout ' + GitOAI5GHeadVersion + '\n'
cmd = cmd + 'git_head=`git ls-remote |grep \'' + GitOAI5GRepoBranch + '\'` \n' cmd = cmd + 'git_head=`git ls-remote |grep \'' + GitOAI5GRepoBranch + '\'` \n'
cmd = cmd + 'git_head=($git_head) \n' cmd = cmd + 'git_head=($git_head) \n'
cmd = cmd + 'git_head=${git_head[0]} \n' cmd = cmd + 'git_head=${git_head[0]} \n'
@@ -2115,29 +2304,29 @@ for oai in oai_list:
print error print error
sys.exit(1) sys.exit(1)
#Now we wait for all the threads to complete #Now we wait for all the threads to complete
index = 0 index = 0
for t in threads_init_setup: for t in threads_init_setup:
t.join() t.join()
setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt'
setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt'
localfile = locallogdir + '/setup_log_' + MachineList[index] + '_.txt'
remotefile = logdir + '/setup_log_' + MachineList[index] + '_.txt'
port = 22 port = 22
paramList=[]
sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log')
#Now we copy patch files and apply them #Now we copy patch files and apply them
print "Installating patch files on machine " + MachineList[index] print( Fore.WHITE + " - Installating patch files on machine " + MachineList[index])
for patchFile in OAI5GpatchFileList: for patchFile in OAI5GpatchFileList:
localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/patches/')+patchFile.get('name') localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/patches/')+patchFile.get('name')
remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/patches/'+patchFile.get('name') remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/patches/'+patchFile.get('name')
if patchFile.get('machine') == MachineList[index] or patchFile.get('machine') == None: if patchFile.get('machine') == MachineList[index] or patchFile.get('machine') == None:
if os.path.isfile(localfile): if os.path.isfile(localfile):
print "\t> PATCH FILE :"+localfile print( Fore.WHITE + "\t> PATCH FILE :"+localfile)
paramList=[] paramList=[]
paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} ) paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} )
sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) sftp_module (user, pw, MachineList[index], port, paramList, sftp_log)
cmd = ' cd ' + logdirOAI5GRepo + ' ;git apply cmake_targets/autotests/patches/'+patchFile.get('name') cmd = ' cd ' + logdirOAI5GRepo + ' ;git apply cmake_targets/autotests/patches/'+patchFile.get('name')
res = oai_list[index].send_recv(cmd) res = oai_list[index].send_recv(cmd)
#print res
paramList=[] paramList=[]
@@ -2152,10 +2341,12 @@ for t in threads_init_setup:
#Now we copy test_case_list.xml on the remote machines #Now we copy test_case_list.xml on the remote machines
localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/test_case_list.xml') localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/test_case_list.xml')
remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/test_case_list.xml' remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/test_case_list.xml'
paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} ) # paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} )
sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') # sftp_module (user, pw, MachineList[index], port, paramList, sftp_log)
sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) sftp_module (user, pw, MachineList[index], port, paramList, sftp_log)
cmd = ' cd ' + logdirOAI5GRepo + ' ; source oaienv ; env|grep OPENAIR \n' cmd = ' cd ' + logdirOAI5GRepo + ' ; source oaienv ; env|grep OPENAIR \n'
res = oai_list[index].send_recv(cmd) res = oai_list[index].send_recv(cmd)
index = index +1 index = index +1
@@ -2163,30 +2354,131 @@ for t in threads_init_setup:
print "Setup log file <" + localfile + "> missing for machine <" + MachineList[index] + ">. Please check the setup log files. Exiting now" print "Setup log file <" + localfile + "> missing for machine <" + MachineList[index] + ">. Please check the setup log files. Exiting now"
sys.exit(1) sys.exit(1)
#Now we process all the test cases #Now we process all the test cases
#Now we check if there was error in setup files #Now we check if there was error in setup files
status, out = commands.getstatusoutput('grep ' + ' -il \'error\' ' + locallogdir + '/setup_log*') status, out = commands.getstatusoutput('grep ' + ' -il \'error\' ' + locallogdir + '/setup_log*')
if (out != '') : if (out != '') :
print "There is error in setup of machines" print "There is error in setup of machines"
print "status = " + str(status) + "\n Check files for error = " + out print "status = " + str(status) + "\n Check files for error = " + out
print "Exiting now..." print "Exiting now..."
sys.exit(1) sys.exit(1)
cleanOldProgramsAllMachines(oai_list, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop, '$HOME' , logdirOAI5GRepo) cleanOldProgramsAllMachines(oai_list, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop, '$HOME' , logdirOAI5GRepo)
if cleanUpRemoteMachines == True: if cleanUpRemoteMachines == True:
print "Error while cleaning Remote machines"
print "Exiting now..."
sys.exit(0) sys.exit(0)
threadListGlobal=[]
else:
print (Fore.RED + " Skipping Machine preparation...")
# **************************************************************************
# **************************************************************************
# STEP 2 - TEST SELECTION AND PARAMETRIZATION
# **************************************************************************
# **************************************************************************
print (Fore.YELLOW + '\nStep 2 - TEST SELECTION')
print (Fore.YELLOW + '-------------------------------------------------')
print (Fore.WHITE + " Parsing test case list for test selection...")
print (Fore.WHITE + " - TestCaseExclusionList : "+TestCaseExclusionList)
print (Fore.WHITE + " - testcasegroup : "+testcasegroup)
testcaseList=xmlRoot.findall('testCase') testcaseList=xmlRoot.findall('testCase')
#print testcaseList
nb_total_testcases = 0
nb_total_testcases_softmodem = 0
nb_total_testcases_softmodem_noS1 = 0
nb_total_testcases_compilation = 0
nb_total_testcases_execution = 0
nb_run_testcases = 0
nb_run_testcases_softmodem = 0
nb_run_testcases_softmodem_noS1 = 0
nb_run_testcases_compilation = 0
nb_run_testcases_execution = 0
for testcase in testcaseList:
try:
testcasename = testcase.get('id')
testcaseclass = testcase.findtext('class',default='')
desc = testcase.findtext('desc',default='')
nb_total_testcases+=1
run_flag = search_test_case_group(testcasename, testcasegroup, TestCaseExclusionList)
if (run_flag):
nb_run_testcases+=1
if testcaseclass == 'lte-softmodem' :
nb_total_testcases_softmodem+=1
if (run_flag): nb_run_testcases_softmodem+=1
elif testcaseclass == 'lte-softmodem-noS1':
nb_total_testcases_softmodem_noS1+=1
if (run_flag): nb_run_testcases_softmodem_noS1+=1
elif testcaseclass == 'compilation':
nb_total_testcases_compilation+=1
if (run_flag): nb_run_testcases_compilation+=1
elif testcaseclass == 'execution':
nb_total_testcases_execution+=1
if (run_flag): nb_run_testcases_execution+=1
else :
print "Unknown test case class: " + testcaseclass
sys.exit()
except Exception, e:
error=''
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
error = error + '\n testcasename = ' + testcasename + '\n testcaseclass = ' + testcaseclass + '\n desc = ' + 'desc' + '\n'
error = error + traceback.format_exc()
print error
print "Continuing to next test case..."
print (Fore.WHITE + " Parsing done...")
print (Fore.WHITE + " - Total number of test cases : "+str(nb_total_testcases))
print (Fore.WHITE + " - Total number class softmodem : "+str(nb_total_testcases_softmodem))
print (Fore.WHITE + " - Total number class softmodem-noS1 : "+str(nb_total_testcases_softmodem_noS1))
print (Fore.WHITE + " - Total number class compilation : "+str(nb_total_testcases_compilation))
print (Fore.WHITE + " - Total number class execution : "+str(nb_total_testcases_execution))
print
print (Fore.WHITE + " - Selected number of test cases : "+str(nb_run_testcases))
print (Fore.WHITE + " - Selected class softmodem : "+str(nb_run_testcases_softmodem))
print (Fore.WHITE + " - Selected class softmodem_noS1 : "+str(nb_run_testcases_softmodem_noS1))
print (Fore.WHITE + " - Selected class compilation : "+str(nb_run_testcases_compilation))
print (Fore.WHITE + " - Selected class execution : "+str(nb_run_testcases_execution))
# **************************************************************************
# **************************************************************************
# STEP 3 - TEST CAMPAIGNS
# **************************************************************************
# **************************************************************************
test_results = []
print (Fore.YELLOW + '\nStep 3 - TEST CAMPAIGNS')
print (Fore.YELLOW + '-------------------------------------------------')
print (Fore.WHITE + " Start test campaign...")
threadListGlobal=[]
run_count = 0
for testcase in testcaseList: for testcase in testcaseList:
try: try:
testcasename = testcase.get('id') testcasename = testcase.get('id')
testcaseclass = testcase.findtext('class',default='') testcaseclass = testcase.findtext('class',default='')
desc = testcase.findtext('desc',default='') desc = testcase.findtext('desc',default='')
#print "Machine list top level = " + ','.join(MachineList) #print "Machine list top level = " + ','.join(MachineList)
if search_test_case_group(testcasename, testcasegroup, TestCaseExclusionList) == True: if search_test_case_group(testcasename, testcasegroup, TestCaseExclusionList) == True:
run_count+=1
print (Fore.WHITE + " ("+str(run_count).zfill(3)+"/"+str(nb_run_testcases).zfill(3)+") - test case "+testcasename+" : "),
if testcaseclass == 'lte-softmodem' : if testcaseclass == 'lte-softmodem' :
eNBMachine = testcase.findtext('eNB',default='') eNBMachine = testcase.findtext('eNB',default='')
UEMachine = testcase.findtext('UE',default='') UEMachine = testcase.findtext('UE',default='')
@@ -2258,6 +2550,22 @@ for param in threadListGlobal:
thread_id = param["thread_id"] thread_id = param["thread_id"]
thread_id.join() thread_id.join()
# **************************************************************************
# **************************************************************************
# STEP 4 - TEST REPORT PRODUCTION
# **************************************************************************
# **************************************************************************
test_session_stop_time = datetime.datetime.now()
print (Fore.YELLOW + '\nStep 4 - TEST REPORT PRODUCTION')
print (Fore.YELLOW + '-------------------------------------------------')
# XML test report
# --------------------------------------------------------------------
print "Creating xml file for overall results..." print "Creating xml file for overall results..."
cmd = "cat $OPENAIR_DIR/cmake_targets/autotests/log/*/*.xml > $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml " cmd = "cat $OPENAIR_DIR/cmake_targets/autotests/log/*/*.xml > $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml "
res=os.system(cmd) res=os.system(cmd)
@@ -2276,4 +2584,43 @@ res = oai_localhost.send_recv(cmd)
oai_localhost.disconnect() oai_localhost.disconnect()
# HTML test report
# --------------------------------------------------------------------
if flag_generate_html_report:
print "Creating html test report..."
report_dir = reportdir + '/'+ test_session_start_time.strftime("%Y-%m-%d_%H-%M")+"_"+host
cmd = 'mkdir -p ' + report_dir
result = os.system(cmd)
cmd = 'cp -r '+locallogdir+' '+report_dir
result = os.system(cmd)
context = {
'report_path' : report_dir,
'test_session_start_time' : test_session_start_time,
'test_session_stop_time' : test_session_stop_time,
'test_session_duration' : test_session_stop_time-test_session_start_time,
'mtc_host' : host,
'user' : user,
'password' : pw,
'test_results' : test_results,
}
for test_result in test_results:
cmd = 'mkdir -p ' + report_dir + '/'+ test_result['testcase_name']
result = os.system(cmd)
report_file = report_dir + '/'+ test_result['testcase_name'] + '/'+ test_result['testcase_name']+ '_report.html'
analyser.create_test_report_detailed_html(test_result, report_file )
# print test_result
analyser.create_report_html(context)
sys.exit() sys.exit()
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -35,12 +35,15 @@ import getopt
import sys import sys
from subprocess import call from subprocess import call
import encoder
sys.path.append(os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/tools/'))
#test_cases = ('030001', '030901', '031001', '031601', '031701', '031801', '031901', '032001', '032101', '032201', '032301', '032501', '032601', '032801') #test_cases = ('030001', '030901', '031001', '031601', '031701', '031801', '031901', '032001', '032101', '032201', '032301', '032501', '032601', '032801')
test_cases = ('030030' , '030030' ) test_cases = ('032800' , '032730' )
nb_run = 3 nb_run = 2
def error_opt(msg): def error_opt(msg):
print("Option error: " + msg) print("Option error: " + msg)
@@ -58,14 +61,27 @@ def main(args):
# metric = {}
# metric['id'] = 'UE_DLSCH_BITRATE'
# metric['description'] = 'UE downlink physical throughput'
# metric['regex'] = '(UE_DLSCH_BITRATE) =\s+(\d+\.\d+) kbps.+frame = (\d+)\)'
# metric['unit_of_meas'] = 'kbps'
# metric['min_limit'] = 14668.8
#AUTOTEST Metric : RRC Measurments RSRP[0]=-97.60 dBm/RE, RSSI=-72.83 dBm, RSRQ[0] 9.03 dB, N0 -125 dBm/RE, NF 7.2 dB (frame = 4490)
metric = {} metric = {}
metric['id'] = 'UE_DLSCH_BITRATE' metric['id'] = 'UE_DL_RRC_MEAS'
metric['description'] = 'UE downlink physical throughput' metric['description'] = 'UE downlink RRC Measurments'
metric['regex'] = '(UE_DLSCH_BITRATE) =\s+(\d+\.\d+) kbps.+frame = (\d+)\)' metric['nb_metric'] = 5
# metric['regex'] = 'AUTOTEST Metric : RRC Measurments (RSRP\[0\])=(-?\d+\.?\d*)\s+(.+),\s+(RSRQ\[0\])=(-?\d+\.?\d*)\s+(.+),,\s+(N0)=(-?\d+\.?\d*)\s+(.+),,\s+(NF)=(-?\d+\.?\d*)\s+(.+)\s+\(frame = (\d+)\) '
metric['regex'] = 'AUTOTEST Metric : RRC Measurments (RSRP\[0\])=(-?\d+\.?\d*)\s+(.+)\,\s+(RSSI)=(-?\d+\.?\d*)\s+(.+)\,\s+(RSRQ\[0\])=(-?\d+\.?\d*)\s+(.+)\,\s+(N0)=(-?\d+\.?\d*)\s+(.+)\,\s+(NF)=(-?\d+\.?\d*)\s+(.+)\s+\(frame = (\d+)\)'
metric['unit_of_meas'] = 'kbps' metric['unit_of_meas'] = 'kbps'
metric['min_limit'] = 14668.8 metric['min_limit'] = 14668.8
#report_path = log_path+'/report/' #report_path = log_path+'/report/'
#os.system(' mkdir -p ' + report_path) #os.system(' mkdir -p ' + report_path)
@@ -74,58 +90,44 @@ def main(args):
#return(0) #return(0)
test_results = []
for test_case in test_cases: for test_case in test_cases:
# print test_case
if test_case == '030001':
metric['min_limit'] = 500.0
if test_case == '030901':
metric['min_limit'] = 640.0
if test_case == '031001':
metric['min_limit'] = 3200.0
if test_case == '031601':
metric['min_limit'] = 5920.0
if test_case == '031701':
metric['min_limit'] = 6000.0
if test_case == '031801':
metric['min_limit'] = 6200.0
if test_case == '031901':
metric['min_limit'] = 7000.0
if test_case == '032001':
metric['min_limit'] = 7800.0
if test_case == '032101':
metric['min_limit'] = 8000.0
if test_case == '032201':
metric['min_limit'] = 9000.0
if test_case == '032301':
metric['min_limit'] = 10000.0
if test_case == '032501':
metric['min_limit'] = 11000.0
if test_case == '032601':
metric['min_limit'] = 12000.0
if test_case == '032801':
metric['min_limit'] = 12500.0
if test_case == '035201':
metric['min_limit'] = 14668.8
if test_case == '036001':
metric['min_limit'] = 25363.2
for i in range(0, nb_run): for i in range(0, nb_run):
fname = 'log//'+test_case+'/run_'+str(i)+'/UE_exec_'+str(i)+'_.log' fname = '..//log//'+test_case+'/run_'+str(i)+'/UE_exec_'+str(i)+'_.log'
args = {'metric' : metric, args = {'metric' : metric,
'file' : fname } 'file' : fname }
cell_synch_status = analyser.check_cell_synchro(fname) # cell_synch_status = analyser.check_cell_synchro(fname)
if cell_synch_status == 'CELL_SYNCH': # if cell_synch_status == 'CELL_SYNCH':
print '!!!!!!!!!!!!!! Cell synchronized !!!!!!!!!!!' # print '!!!!!!!!!!!!!! Cell synchronized !!!!!!!!!!!'
metric_checks_flag = 0 # metric_checks_flag = 0
else : # else :
print '!!!!!!!!!!!!!! Cell NOT NOT synchronized !!!!!!!!!!!' # print '!!!!!!!!!!!!!! Cell NOT NOT synchronized !!!!!!!!!!!'
# metrics_extracted = analyser.do_extract_metrics_new(args)
# de-xmlfy test report
xml_file = '..//log//'+test_case+'/test.'+test_case+'_ng.xml'
print xml_file
# test_result =
# test_results.append(test_result)
# xmlFile = logdir_local_testcase + '/test.' + testcasename + '.xml'
# xml="\n<testcase classname=\'"+ testcaseclass + "\' name=\'" + testcasename + "."+tags + "\' Run_result=\'" + test_result_string + "\' time=\'" + str(duration) + " s \' RESULT=\'" + testcase_verdict + "\'></testcase> \n"
# write_file(xmlFile, xml, mode="w")
# xmlFile_ng = logdir_local_testcase + '/test.' + testcasename + '_ng.xml'
# xml_ng = xmlify(test_result, wrap=testcasename, indent=" ")
# write_file(xmlFile_ng, xml_ng, mode="w")
# metric_extracted = analyser.do_extract_metrics(args)
# print "min = "+ str( metric_extracted['metric_min'] ) # print "min = "+ str( metric_extracted['metric_min'] )
# print "min_index = "+ str( metric_extracted['metric_min_index'] ) # print "min_index = "+ str( metric_extracted['metric_min_index'] )
@@ -143,16 +145,27 @@ def main(args):
# print fname # print fname
# analyser.do_img_metrics(metric, metric_extracted, fname) # analyser.do_img_metrics(metric, metric_extracted, fname)
# fname = 'log//'+test_case+'/run_'+str(i)+'/UE_traffic_'+str(i)+'_.log' # fname = 'log//'+test_case+'/run_'+str(i)+'/UE_traffic_'+str(i)+'_.log'
# args = {'file' : fname } # args = {'file' : fname }
# traffic_metrics = analyser.do_extract_traffic_metrics(args) # traffic_metrics = analyser.do_extract_traffic_metrics(args)
# fname= 'report/iperf_'+test_case+'_'+str(i)+'.png' # fname= 'report/iperf_'+test_case+'_'+str(i)+'.png'
# print fname # print fname
# analyser.do_img_traffic(traffic_metrics, fname) # analyser.do_img_traffic(traffic_metrics, fname)
for test_result in test_results:
cmd = 'mkdir -p ' + report_dir + '/'+ test_result['testcase_name']
result = os.system(cmd)
report_file = report_dir + '/'+ test_result['testcase_name'] + '/'+ test_result['testcase_name']+ '_report.html'
analyser.create_test_report_detailed_html(test_result, report_file )
print test_result
@@ -41,7 +41,7 @@ from jinja2 import Environment, FileSystemLoader
PATH = os.path.dirname(os.path.abspath(__file__)) PATH = os.path.dirname(os.path.abspath(__file__))
TEMPLATE_ENVIRONMENT = Environment( TEMPLATE_ENVIRONMENT = Environment(
autoescape=False, autoescape=False,
loader=FileSystemLoader(os.path.join(PATH, 'templates')), loader=FileSystemLoader(os.path.join(PATH, '../templates')),
trim_blocks=False) trim_blocks=False)
@@ -103,6 +103,129 @@ def do_extract_metrics(args):
} }
return(ret) return(ret)
def do_extract_metrics_new(args):
# print ""
# print "do_extract_metrics ... "
fname = args['file']
metric = args['metric']
print(fname)
print 'metric id = ' + metric['id']
print 'metric regex = ' + metric['regex']
count = 0
mmin = 0
mmin_index = 0
mmax = 0
mmax_index = 0
mean = 0
median = 0
toto = [('id', 'S20'), ('metric', np.float), ('frame', np.int)]
print toto
np_format = []
for x in range(0, metric['nb_metric']):
np_format.append( ('id'+str(x), 'S20') )
np_format.append( ('metric'+str(x), np.float) )
np_format.append( ('uom'+str(x), 'S20') )
np_format.append( ('frame', np.int))
print np_format
output = np.fromregex(fname,metric['regex'], np_format)
print output
count = output['frame'].size
print count
if count > 0:
fontP = FontProperties()
fontP.set_size('small')
fig = plt.figure(1)
plt.figure(figsize=(10,10))
plot_xmax = np.amax(output['frame'])+np.amin(output['frame'])
for x in range(0, metric['nb_metric']):
metric_name = output['id'+str(x)][0]
metric_uom = output['uom'+str(x)][0]
mmin = np.amin(output['metric'+str(x)])
mmax = np.amax(output['metric'+str(x)])
mmean = np.mean(output['metric'+str(x)])
mmedian = np.median(output['metric'+str(x)])
plot_loc = 100*metric['nb_metric']+10+x+1
sbplt = plt.subplot(plot_loc)
sbplt.plot(output['frame'], output['metric'+str(x)], color='b' )
sbplt.set_title( metric_name+' ('+metric_uom+')')
if mmin < 0:
sbplot_ymin=mmin+mmin/10
else:
sbplot_ymin=0
sbplt.set_ylim(ymin=sbplot_ymin)
if mmax > 0:
sbplot_ymax=mmax+mmax/10
else:
sbplot_ymax=0
sbplt.set_ylim(ymax=sbplot_ymax)
sbplt.set_xlim(xmax=plot_xmax)
sbplt.set_xlim(xmin=0)
text='min: '+str(mmin)+'\nmax: '+str(mmax)+'\nmean: '+str(mmean)+'\nmedian: '+str(mmedian)
sbplt.text( plot_xmax+10,sbplot_ymin,text)
sbplt.set_xlabel('frame')
sbplt.set_ylabel(metric_name)
plt.tight_layout()
fname = "toto.png"
# lgd = plt.legend(prop=fontP, bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
mng = plt.get_current_fig_manager()
plt.savefig(fname, bbox_inches='tight')
plt.close()
mmin = np.amin(output['metric']);
mmin_index = np.argmin(output['metric']);
mmax = np.amax(output['metric']);
mmax_index = np.argmax(output['metric']);
mean = np.mean(output['metric']);
median = np.median(output['metric']);
# print ( ( (metric['min_limit'] > output['metric']).sum() / float(output['metric'].size) ) * 100 )
ret = { 'metric_count' : count,
'metric_buf' : output,
'metric_min' : mmin,
'metric_min_index' : mmin_index,
'metric_max' : mmax,
'metric_max_index' : mmax_index,
'metric_mean' : mean,
'metric_median' : median,
}
return(ret)
# #
# #
# #
@@ -182,24 +305,30 @@ def do_img_metrics(metric_def, metric_data, fname):
# print output['metric'].size # print output['metric'].size
plt.scatter(output['frame'], output['metric'], color='b', alpha=0.33, s = 1 , label=metric_def['id']) plt.scatter(output['frame'], output['metric'], color='b', alpha=0.33, s = 1 , label=metric_def['id'])
if 'min_limit' in metric_def:
plt.plot([0, output['frame'][metric_data['metric_count']-1]],[ metric_def['min_limit'],metric_def['min_limit']], 'r-', lw=2, label='min limit') # Red straight line plt.plot([0, output['frame'][metric_data['metric_count']-1]],[ metric_def['min_limit'],metric_def['min_limit']], 'r-', lw=2, label='min limit') # Red straight line
plt.title('Physical throughput ('+metric_def['unit_of_meas']+')') plt.title(metric_def['id'] +' ('+metric_def['unit_of_meas']+')')
plt.xlabel('frame') plt.xlabel('frame')
plt.ylabel(metric_def['id']) plt.ylabel(metric_def['id'])
# Set graphic minimum Y axis # Set graphic minimum Y axis
# ------------------------- # -------------------------
if metric_data['metric_min'] == 0 : if metric_data['metric_min'] < 0:
plt.ylim(ymin=-metric_def['min_limit']/10) plt.ylim(ymin=metric_data['metric_min']+metric_data['metric_min']/10)
else : else :
plt.ylim(ymin=0) plt.ylim(ymin=0)
y_axis_max = 0 y_axis_max = 0
if 'min_limit' in metric_def:
if metric_data['metric_max'] > metric_def['min_limit']: if metric_data['metric_max'] > metric_def['min_limit']:
y_axis_max =metric_data['metric_max']+metric_data['metric_max']/10 y_axis_max =metric_data['metric_max']+metric_data['metric_max']/10
else: else:
y_axis_max =metric_def['min_limit']+metric_def['min_limit']/10 y_axis_max =metric_def['min_limit']+metric_def['min_limit']/10
else:
y_axis_max =metric_data['metric_max']+metric_data['metric_max']/10
plt.ylim(ymax=y_axis_max) plt.ylim(ymax=y_axis_max)
@@ -219,9 +348,6 @@ def do_img_metrics(metric_def, metric_data, fname):
def do_extract_traffic_metrics(args): def do_extract_traffic_metrics(args):
print ""
print "do_extract_traffic_metrics ... "
fname = args['file'] fname = args['file']
# print(fname) # print(fname)
@@ -325,7 +451,8 @@ def do_img_traffic(traffic_data, fname):
ax1.set_xlim(xmax=np.amax(output['interval_stop'])) ax1.set_xlim(xmax=np.amax(output['interval_stop']))
text='min: '+str(traffic_data['bw_min'])+'\nmax: '+str(traffic_data['bw_max'])+'\nmean: '+str(traffic_data['bw_mean'])+'\nmedian: '+str(traffic_data['bw_median']) text='min: '+str(traffic_data['bw_min'])+'\nmax: '+str(traffic_data['bw_max'])+'\nmean: '+str(traffic_data['bw_mean'])+'\nmedian: '+str(traffic_data['bw_median'])
ax1.text( np.amax(output['interval_stop'])+10,0,text) ax1.text( np.amax(output['interval_stop'])+10,0,text)
ax1.set_xlabel('time (s)')
ax1.set_ylabel(' ')
ax2=plt.subplot(312) ax2=plt.subplot(312)
plt.plot(output['interval_stop'], output['jitter'], color='b' ) plt.plot(output['interval_stop'], output['jitter'], color='b' )
@@ -334,6 +461,8 @@ def do_img_traffic(traffic_data, fname):
ax2.set_ylim(ymin=-1) ax2.set_ylim(ymin=-1)
text='min: '+str(traffic_data['jitter_min'])+'\nmax: '+str(traffic_data['jitter_max'])+'\nmean: '+str(traffic_data['jitter_mean'])+'\nmedian: '+str(traffic_data['jitter_median']) text='min: '+str(traffic_data['jitter_min'])+'\nmax: '+str(traffic_data['jitter_max'])+'\nmean: '+str(traffic_data['jitter_mean'])+'\nmedian: '+str(traffic_data['jitter_median'])
ax2.text( np.amax(output['interval_stop'])+10,0,text) ax2.text( np.amax(output['interval_stop'])+10,0,text)
ax2.set_xlabel('time (s)')
ax2.set_ylabel(' ')
ax3=plt.subplot(313) ax3=plt.subplot(313)
plt.plot(output['interval_stop'], output['rate_lost'], color='b') plt.plot(output['interval_stop'], output['rate_lost'], color='b')
@@ -342,10 +471,11 @@ def do_img_traffic(traffic_data, fname):
ax3.set_ylim(ymin=-1) ax3.set_ylim(ymin=-1)
text='min: '+str(traffic_data['rl_min'])+'\nmax: '+str(traffic_data['rl_max'])+'\nmean: '+str(traffic_data['rl_mean'])+'\nmedian: '+str(traffic_data['rl_median']) text='min: '+str(traffic_data['rl_min'])+'\nmax: '+str(traffic_data['rl_max'])+'\nmean: '+str(traffic_data['rl_mean'])+'\nmedian: '+str(traffic_data['rl_median'])
ax3.text( np.amax(output['interval_stop'])+10,0,text) ax3.text( np.amax(output['interval_stop'])+10,0,text)
ax3.set_xlabel('time (s)')
ax3.set_ylabel(' ')
# plt.title('Physical throughput ('+metric_def['unit_of_meas']+')') # plt.title('Physical throughput ('+metric_def['unit_of_meas']+')')
plt.xlabel('time (s)') # plt.xlabel('time (s)')
# plt.ylabel(metric_def['id']) # plt.ylabel(metric_def['id'])
# Set graphic minimum Y axis # Set graphic minimum Y axis
@@ -365,7 +495,7 @@ def do_img_traffic(traffic_data, fname):
plt.tight_layout() plt.tight_layout()
lgd = plt.legend(prop=fontP, bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.) # lgd = plt.legend(prop=fontP, bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
mng = plt.get_current_fig_manager() mng = plt.get_current_fig_manager()
plt.savefig(fname, bbox_inches='tight') plt.savefig(fname, bbox_inches='tight')
plt.close() plt.close()
@@ -395,7 +525,7 @@ def check_cell_synchro(fname):
m = re.search('AUTOTEST Cell Sync \:', line) m = re.search('AUTOTEST Cell Sync \:', line)
if m : if m :
print line #print line
return 'CELL_SYNCH' return 'CELL_SYNCH'
return 'CELL_NOT_SYNCH' return 'CELL_NOT_SYNCH'
@@ -407,7 +537,7 @@ def check_exec_seg_fault(fname):
for line in f: for line in f:
m = re.search('Segmentation fault', line) m = re.search('Segmentation fault', line)
if m : if m :
print line #print line
return 'SEG_FAULT' return 'SEG_FAULT'
return 'NO_SEG_FAULT' return 'NO_SEG_FAULT'
+8
View File
@@ -53,6 +53,7 @@ BUILD_DOXYGEN=0
T_TRACER="False" T_TRACER="False"
DISABLE_HARDWARE_DEPENDENCY="False" DISABLE_HARDWARE_DEPENDENCY="False"
CMAKE_BUILD_TYPE="" CMAKE_BUILD_TYPE=""
UE_AUTOTEST_TRACE="False"
trap handle_ctrl_c INT trap handle_ctrl_c INT
function print_help() { function print_help() {
@@ -127,6 +128,8 @@ Options
Enables the T tracer. Enables the T tracer.
--disable-hardware-dependency --disable-hardware-dependency
Disable HW dependency during installation Disable HW dependency during installation
--ue-autotest-trace
Enable specific traces for UE autotest framework
Usage (first build): Usage (first build):
oaisim (eNB + UE): ./build_oai -I --oaisim -x --install-system-files oaisim (eNB + UE): ./build_oai -I --oaisim -x --install-system-files
Eurecom EXMIMO + COTS UE : ./build_oai -I --eNB -x --install-system-files Eurecom EXMIMO + COTS UE : ./build_oai -I --eNB -x --install-system-files
@@ -278,6 +281,10 @@ function main() {
echo_info "Disabling hardware dependency for compiling software" echo_info "Disabling hardware dependency for compiling software"
DISABLE_HARDWARE_DEPENDENCY="True" DISABLE_HARDWARE_DEPENDENCY="True"
shift 1;; shift 1;;
--ue-autotest-trace)
UE_AUTOTEST_TRACE="True"
echo_info "Enabling autotest specific trace for UE"
shift 1;;
-h | --help) -h | --help)
print_help print_help
exit 1;; exit 1;;
@@ -447,6 +454,7 @@ function main() {
echo "set (DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )" >>$cmake_file echo "set (DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )" >>$cmake_file
echo "set (CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )" >>$cmake_file echo "set (CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )" >>$cmake_file
echo "set ( T_TRACER $T_TRACER )" >> $cmake_file echo "set ( T_TRACER $T_TRACER )" >> $cmake_file
echo "set (UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE)" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
cd $DIR/$lte_build_dir/build cd $DIR/$lte_build_dir/build
cmake .. cmake ..
@@ -486,7 +486,7 @@ void compute_beta8(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sho
#endif #endif
if (frame_length > 6143) { if (frame_length > 6144) {
LOG_E(PHY,"compute_beta: frame_length %d\n",frame_length); LOG_E(PHY,"compute_beta: frame_length %d\n",frame_length);
return; return;
} }
@@ -972,6 +972,11 @@ unsigned char phy_threegpplte_turbo_decoder8(short *y,
} else } else
n2 = n; n2 = n;
if(n2<256)
{
printf("phy_threegpplte_turbo_decoder8 : frame length < 256\n");
return 255;
}
for (iind=0; iind < 188 && f1f2mat[iind].nb_bits != n; iind++); for (iind=0; iind < 188 && f1f2mat[iind].nb_bits != n; iind++);
@@ -469,6 +469,15 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
//#endif //#endif
if (ue->UE_scan_carrier == 0) { if (ue->UE_scan_carrier == 0) {
#if UE_AUTOTEST_TRACE
LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %d \n",
ue->Mod_id,
ue->proc.proc_rxtx[0].frame_rx,
ue->rx_offset,
ue->common_vars.freq_offset );
#endif
if (ue->mac_enabled==1) { if (ue->mac_enabled==1) {
LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id); LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
//mac_resynch(); //mac_resynch();
+7
View File
@@ -2944,6 +2944,13 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
LOG_D(PHY,"[UE %d] Calculating bitrate Frame %d: total_TBS = %d, total_TBS_last = %d, bitrate %f kbits\n", LOG_D(PHY,"[UE %d] Calculating bitrate Frame %d: total_TBS = %d, total_TBS_last = %d, bitrate %f kbits\n",
ue->Mod_id,frame_rx,ue->total_TBS[eNB_id], ue->Mod_id,frame_rx,ue->total_TBS[eNB_id],
ue->total_TBS_last[eNB_id],(float) ue->bitrate[eNB_id]/1000.0); ue->total_TBS_last[eNB_id],(float) ue->bitrate[eNB_id]/1000.0);
#if UE_AUTOTEST_TRACE
if ((frame_rx % 100 == 0)) {
LOG_I(PHY,"[UE %d] AUTOTEST Metric : UE_DLSCH_BITRATE = %5.2f kbps (frame = %d) \n", ue->Mod_id, (float) ue->bitrate[eNB_id]/1000.0, frame_rx);
}
#endif
} }
+5
View File
@@ -1601,6 +1601,11 @@ int main( int argc, char **argv )
PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,abstraction_flag); PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,abstraction_flag);
PHY_vars_eNB_g[0][CC_id]->CC_id = CC_id; PHY_vars_eNB_g[0][CC_id]->CC_id = CC_id;
PHY_vars_eNB_g[0][CC_id]->ue_dl_rb_alloc=0x1fff;
PHY_vars_eNB_g[0][CC_id]->target_ue_dl_mcs=target_dl_mcs;
PHY_vars_eNB_g[0][CC_id]->ue_ul_nb_rb=6;
PHY_vars_eNB_g[0][CC_id]->target_ue_ul_mcs=target_ul_mcs;
if (phy_test==1) PHY_vars_eNB_g[0][CC_id]->mac_enabled = 0; if (phy_test==1) PHY_vars_eNB_g[0][CC_id]->mac_enabled = 0;
else PHY_vars_eNB_g[0][CC_id]->mac_enabled = 1; else PHY_vars_eNB_g[0][CC_id]->mac_enabled = 1;