diff --git a/cmake_targets/autotests/README.txt b/cmake_targets/autotests/README.txt index c983933125cd8717cd1edc5e1b99fc45f3b5b608..25f0c499bbef75334da9c03cc74fb9a34943db11 100644 --- a/cmake_targets/autotests/README.txt +++ b/cmake_targets/autotests/README.txt @@ -88,7 +88,22 @@ Obj.# Case# Test# Description 01 51 06 mbmssim (TBD) -01 55 lte-softmodem tests +01 55 lte-softmodem tests with ALU EPC w/ Bandrich COTS UE +01 55 00 FDD 5MHz UL Throughput for 60 sec +01 55 00 FDD 10MHz UL Throughput for 60 sec +01 55 00 FDD 20MHz UL Throughput for 60 sec +01 55 00 FDD 5MHz DL Throughput for 60 sec +01 55 00 FDD 10MHz DL Throughput for 60 sec +01 55 00 FDD 20MHz DL Throughput for 60 sec + + +01 56 lte-softmodem tests with OAI EPC (eNB and EPC are on same machines) w/ Bandrich COTS UE + + +01 57 lte-softmodem tests with OAI EPC (eNB and EPC are on different machines) w/ Bandrich COTS UE + + +01 58 lte-softmodem-noS1 tests 02 Functional test case diff --git a/cmake_targets/autotests/run_exec_autotests.bash b/cmake_targets/autotests/run_exec_autotests.bash index c4d11b7ba4d744ce7eeba90395bac691bb192dee..7bde09d863f1eadbfd21b53099eebdfd463bdc9b 100755 --- a/cmake_targets/autotests/run_exec_autotests.bash +++ b/cmake_targets/autotests/run_exec_autotests.bash @@ -7,12 +7,15 @@ else exit 1 fi +trap handle_ctrl_c INT + source $OPENAIR_DIR/cmake_targets/tools/test_helper + #SUDO="sudo -E " tdir=$OPENAIR_DIR/cmake_targets/autotests -rm -fr $tdir/bin $tdir/log -mkdir -p $tdir/bin $tdir/log +rm -fr $tdir/bin +mkdir -p $tdir/bin results_file="$tdir/log/results_autotests.xml" updated=$(svn st -q $OPENAIR_DIR) @@ -36,7 +39,7 @@ cd $tdir #\param $12 -> class of the test case (compilation, execution) #\param $13 -> output of compilation program that needs to be found for test case to pass #\param $14 -> tags to help identify the test case for readability in output xml file -test_compile() { +function test_compile() { xUnit_start test_case_name=$1 @@ -130,8 +133,9 @@ test_compile() { #\param $12 -> class of the test case (compilation, execution) #\param $13 -> output of compilation program that needs to be found for test case to pass #\param $14 -> tags to help identify the test case for readability in output xml file +#\param $15 => password for the user to run certain commands as sudo -test_compile_and_run() { +function test_compile_and_run() { xUnit_start test_case_name=$1 log_dir=$tdir/log @@ -149,16 +153,13 @@ test_compile_and_run() { class=${12} compile_prog_out=${13} tags=${14} + mypassword=${15} build_dir=$tdir/$1/build exec_file=$build_dir/$6 #Temporary log file where execution log is stored. temp_exec_log=$log_dir/temp_log.txt - - - - #echo "log_dir = $log_dir" #echo "log_file = $log_file" #echo "exec_file = $exec_file" @@ -217,7 +218,8 @@ test_compile_and_run() { echo "<EXECUTION LOG Run = $run_index >" >> $log_file 2>&1 if [ -n "$pre_exec_file" ]; then - { eval "source $pre_exec_file $pre_exec_args"; } >> $log_file 2>&1 + { eval " echo '$mypassword' |sudo -S -E $pre_exec_file $pre_exec_args " ; }>> $log_file 2>&1 + fi echo "Executing $exec_file $main_exec_args_array_index " echo "Executing $exec_file $main_exec_args_array_index " >> $log_file @@ -275,34 +277,14 @@ test_compile_and_run() { let "tags_array_index++" done # End of for loop (nindex) fi + rm -fr $build_dir } dbin=$OPENAIR_DIR/cmake_targets/autotests/bin dlog=$OPENAIR_DIR/cmake_targets/autotests/log -run_test() { -case=case$1; shift -cmd=$1; shift -expected=$3; shift -echo "expected = $expected" -exit -$cmd > $dlog/$case.txt 2>&1 -if [ $expected = "true" ] ; then - if $* $dlog/$case.txt; then - echo_success "test $case, command: $cmd ok" - else - echo_error "test $case, command: $cmd Failed" - fi -else - if $* $dlog/$case.txt; then - echo_error "test $case, command: $cmd Failed" - else - echo_success "test $case, command: $cmd ok" - fi -fi -} -print_help() { +function print_help() { echo_info ' This program runs automated test case system for OpenAirInterface You should have ubuntu 14.xx, updated, and the Linux kernel >= 3.14 @@ -314,11 +296,13 @@ Options ' } -main () { +function main () { RUN_GROUP=0 test_case_group="" test_case_group_array=() test_case_array=() +echo_info "Note that the user should be sudoer for executing certain commands, for example loading kernel modules" +read -s -p "Enter Password: " mypassword until [ -z "$1" ] do @@ -421,9 +405,9 @@ for search_expr in "${test_case_array[@]}" if [ "$class" == "compilation" ]; then test_compile "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags" elif [ "$class" == "execution" ]; then - test_compile_and_run "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags" + test_compile_and_run "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags" "$mypassword" else - echo "Unexpected class of test case...Exiting...." + echo "Unexpected class of test case...Skipping the test case $name ...." fi done diff --git a/cmake_targets/autotests/run_exec_lte-softmodem_tests.py b/cmake_targets/autotests/run_exec_lte-softmodem_tests.py new file mode 100644 index 0000000000000000000000000000000000000000..f66f8206c0f1b410d68ae28f71cdbfcdae1eebd0 --- /dev/null +++ b/cmake_targets/autotests/run_exec_lte-softmodem_tests.py @@ -0,0 +1,1013 @@ +#! /usr/bin/python +#****************************************************************************** + +# OpenAirInterface +# Copyright(c) 1999 - 2014 Eurecom + +# OpenAirInterface is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + + +# OpenAirInterface is distributed in the hope that 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 OpenAirInterface.The full GNU General Public License is +# included in this distribution in the file called "COPYING". If not, +# see <http://www.gnu.org/licenses/>. + +# Contact Information +# OpenAirInterface Admin: openair_admin@eurecom.fr +# OpenAirInterface Tech : openair_tech@eurecom.fr +# OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + +# Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +# *******************************************************************************/ + +# \file test01.py +# \brief test 01 for OAI +# \author Navid Nikaein +# \date 2013 - 2015 +# \version 0.1 +# @ingroup _test + +import tempfile +import threading +import sys +import traceback +import wave +import os +import time +import datetime +import getpass +import math #from time import clock +import xml.etree.ElementTree as ET +import re + +import log +import case01 +import case02 +import case03 +import case04 +import case05 + +from openair import * + +import paramiko +import ssh +from ssh import SSHSession + + +def write_file(filename, string, mode="w"): + text_file = open(filename, mode) + text_file.write(string) + text_file.close() + + +def sftp_module (username, password, hostname, ports, paramList,logfile): + #localD = localfile + #remoteD = remotefile + #fd, paramiko_logfile = tempfile.mkstemp() + #res = os.close(fd ) + #paramiko logfile path should not be changed with multiple calls. The logs seem to in first file regardless + error = "" + #The lines below are outside exception loop to be sure to terminate the test case if the network connectivity goes down or there is authentication failure + + + + transport = paramiko.Transport(hostname, ports) + transport.connect(username = username, password = password) + sftp = paramiko.SFTPClient.from_transport(transport) + + + # index =0 + for param in paramList: + try: + operation = param["operation"] + localD = param["localfile"] + remoteD = param["remotefile"] + if operation == "put": + sftp.put(remotepath=remoteD, localpath=localD) + elif operation == "get": + sftp.get(remotepath=remoteD, localpath=localD) + else : + print "sftp_module: unidentified operation:<" + operation + "> Exiting now" + print "hostname = " + hostname + print "ports = " + ports + print "localfile = " + localD + print "remotefile = " + remoteD + print "operation = " + operation + sys.exit() + except Exception, e: + error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) + error = error + '\n username = ' + username + '\n hostname = ' + hostname + '\n localfile = ' + localD + '\n remotefile = ' + remoteD + '\n operation = ' + operation + '\nlogfile = ' + logfile + '\n ports = ' + str(ports) + '\n' + error = error + traceback.format_exc() + + sftp.close() + transport.close() + res = os.system('\n echo \'SFTP Module Log for Machine: <' + hostname + '> starts...\' >> ' + logfile + ' 2>&1 ') + res = os.system('cat ' + paramiko_logfile + ' >> ' + logfile + ' 2>&1 \n') + write_file(logfile, error, "a") + res = os.system('\n echo \'SFTP Module Log for Machine: <' + hostname + '> ends...\' >> ' + logfile + ' 2>&1 \n') + +def finalize_deploy_script (timeout_cmd, terminate_missing_procs='True'): + cmd = 'declare -i timeout_cmd='+str(timeout_cmd) + '\n' + if terminate_missing_procs == 'True': + cmd = cmd + """ + #The code below checks if one the processes launched in background has crashed. + #If it does, then the code below terminates all the child processes created by this script + declare -i wakeup_interval=1 + declare -i step=0 + echo \"Array pid = ${array_exec_pid[@]}\" + while [ "$step" -lt "$timeout_cmd" ] + do + declare -i break_while_loop=0 + #Iterate over each process ID in array_exec_pid + for i in "${array_exec_pid[@]}" + do + numchild=`pstree -p $i | perl -ne 's/\((\d+)\)/print " $1"/ge' |wc -w` + echo "PID = $i, numchild = $numchild" + if [ "$numchild" -eq "0" ] ; then + echo "Process ID $i has finished unexpectedly. Now preparing to kill all the processes " + break_while_loop=1 + break + fi + done + if [ "$break_while_loop" -eq "1" ] ; then + break + fi + step=$(( step + wakeup_interval )) + sleep $wakeup_interval + done + echo "Final time step (Duration of test case) = $step " + """ + else: + #We do not terminate the script if one of the processes has existed prematurely + cmd = cmd + 'sleep ' + str(timeout_cmd) + '\n' + + return cmd + +def update_config_file(oai, config_string, logdirRepo, python_script): + if config_string : + stringArray = config_string.splitlines() + cmd="" + #python_script = '$OPENAIR_DIR/targets/autotests/tools/search_repl.py' + for string in stringArray: + #split the string based on space now + string1=string.split() + cmd = cmd + 'python ' + python_script + ' ' + logdirRepo+'/'+string1[0] + ' ' + string1[1] + ' '+ string1[2] + '\n' + #cmd = cmd + 'perl -p -i -e \'s/'+ string1[1] + '\\s*=\\s*"\\S*"\\s*/' + string1[1] + ' = "' + string1[2] +'"' + '/g\' ' + logdirRepo + '/' +string1[0] + '\n' + return cmd + #result = oai.send_recv(cmd) + + + +#Function to clean old programs that might be running from earlier execution +#oai - parameter for making connection to machine +#programList - list of programs that must be terminated before execution of any test case +def cleanOldPrograms(oai, programList, CleanUpAluLteBox): + cmd = 'killall -q -r ' + programList + result = oai.send(cmd, True) + print "Killing old programs..." + result + programArray = programList.split() + programListJoin = '|'.join(programArray) + cmd = cleanupOldProgramsScript + ' ' + '\''+programListJoin+'\'' + #result = oai.send_recv(cmd) + #print result + result = oai.send_expect_false(cmd, 'Match found', False) + print result + res=oai.send_recv(CleanUpAluLteBox, True) + + +class myThread (threading.Thread): + def __init__(self, threadID, name, counter): + threading.Thread.__init__(self) + self.threadID = threadID + self.name = name + self.counter = counter + def run(self): + print "Starting " + self.name + + +class oaiThread (threading.Thread): + def __init__(self, threadID, name, oai, cmd, sudo, timeout): + threading.Thread.__init__(self) + self.threadID = threadID + self.name = name + #self.counter = counter + self.oai = oai + self.cmd = cmd + self.sudo = sudo + self.timeout = timeout + self.machineName = machineName + def run(self): + print "Starting " + self.name + result = self.oai.send_recv(self.cmd, self.sudo, self.timeout) + print "result = " + result + print "Exiting " + self.name + +#This class runs test cases with class oaisim_noS1, compilatation +class testCaseThread_generic(threading.thread): + def __init__(self, threadID, name, oai, machine, logdirOAI5GRepo, oai5GRepoDirRemote, testcasename,oldprogramList, CleanupAluLteBox, username, password, timeout): + threading.Thread.__init__(self) + self.threaID = threadID + self.name = name + self.oai = oai + self.testcasename = testcasename + self.timeout = timeout + self.machine = machine + self.oai5GRepoDirRemote = oai5GRepoDirRemote + self.logdirOAI5GRepo = logdirOAI5GRepo + self.username = username + self.password = password + def run(self): + try: + mypassword='' + #addsudo = 'echo \'' + mypassword + '\' | sudo -S -E ' + addpass = 'echo \'' + mypassword + '\' | ' + user = getpass.getuser() + print "Starting test case : " + self.testcasename + " On machine " + machineName + cleanOldPrograms(oai, oldprogramList, CleanUpAluLteBox) + logdir_local_testcase = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + logdir_local_base = logdirOAI5GRepo+'/cmake_targets/autotests/log/' + logdir_remote_testcase = oai5GRepoDirRemote + '/cmake_targets/autotests/log' + self.testcasename + os.removedirs(logdir_testcase) + os.mkdir (logdir_testcase) + cmd = "( cd " + self.oai5GRepoDirRemote + " \n " + cmd = cmd + "source oaienv \n" + cmd = cmd + "python run_test_case_generic -d " + self.oai5GRepoDirRemote + " -g " + "\"" + self.testcasename + "\"" + cmd = cmd + " ) " + + #Now we copy all the remote + ssh = SSHSession(self.machine , username=username, key_file=None, passsword=password) + ssh.get_all(logdir_remote_testcase , logdir_local_base) + print "Finishing test case : " + self.testcasename + " On machine " + machineName + + +def addsudo (cmd, password=""): + cmd = 'echo \'' + password + '\' | sudo -S -E bash -c \' ' + cmd + '\' ' + return cmd + +#Function to handle test case class : lte-softmodem +def handle_testcaseclass_softmodem (testcase, oldprogramList, oai_list, logdirOAI5GRepo , logdirOpenaircnRepo, MachineList, password, CleanUpAluLteBox): + #We ignore the password sent to this function for secuirity reasons for password present in log files + #It is recommended to add a line in /etc/sudoers that looks something like below. The line below will run sudo without password prompt + # your_user_name ALL=(ALL:ALL) NOPASSWD: ALL + mypassword='' + #addsudo = 'echo \'' + mypassword + '\' | sudo -S -E ' + addpass = 'echo \'' + mypassword + '\' | ' + user = getpass.getuser() + testcasename = testcase.get('id') + timeout_cmd = testcase.findtext('TimeOut_cmd',default='') + timeout_cmd = int(float(timeout_cmd)) + #Timeout_thread is more than that of cmd to have room for compilation time, etc + timeout_thread = timeout_cmd + 300 + nruns = testcase.findtext('nruns',default='') + nruns = int(float(nruns)) + + eNBMachine = testcase.findtext('eNB',default='') + eNB_config_file = testcase.findtext('eNB_config_file',default='') + eNB_compile_prog = testcase.findtext('eNB_compile_prog',default='') + eNB_compile_prog_args = testcase.findtext('eNB_compile_prog_args',default='') + eNB_pre_exec = testcase.findtext('eNB_pre_exec',default='') + eNB_pre_exec_args = testcase.findtext('eNB_pre_exec_args',default='') + eNB_main_exec = testcase.findtext('eNB_main_exec',default='') + eNB_main_exec_args = testcase.findtext('eNB_main_exec_args',default='') + eNB_traffic_exec = testcase.findtext('eNB_traffic_exec',default='') + eNB_traffic_exec_args = testcase.findtext('eNB_traffic_exec_args',default='') + eNB_terminate_missing_procs = testcase.findtext('eNB_terminate_missing_procs',default='True') + + UEMachine = testcase.findtext('UE',default='') + UE_config_file = testcase.findtext('UE_config_file',default='') + UE_compile_prog = testcase.findtext('UE_compile_prog',default='') + UE_compile_prog_args = testcase.findtext('UE_compile_prog_args',default='') + UE_pre_exec = testcase.findtext('UE_pre_exec',default='') + UE_pre_exec_args = testcase.findtext('UE_pre_exec_args',default='') + UE_main_exec = testcase.findtext('UE_main_exec',default='') + UE_main_exec_args = testcase.findtext('UE_main_exec_args',default='') + UE_traffic_exec = testcase.findtext('UE_traffic_exec',default='') + UE_traffic_exec_args = testcase.findtext('UE_traffic_exec_args',default='') + UE_terminate_missing_procs = testcase.findtext('UE_terminate_missing_procs',default='True') + + EPCMachine = testcase.findtext('EPC',default='') + EPC_config_file = testcase.findtext('EPC_config_file',default='') + EPC_compile_prog = testcase.findtext('EPC_compile_prog',default='') + EPC_compile_prog_args = testcase.findtext('EPC_compile_prog_args',default='') + HSS_compile_prog = testcase.findtext('HSS_compile_prog',default='') + HSS_compile_prog_args = testcase.findtext('HSS_compile_prog_args',default='') + + EPC_pre_exec= testcase.findtext('EPC_pre_exec',default='') + EPC_pre_exec_args = testcase.findtext('EPC_pre_exec_args',default='') + EPC_main_exec= testcase.findtext('EPC_main_exec',default='') + EPC_main_exec_args = testcase.findtext('EPC_main_exec_args',default='') + HSS_main_exec= testcase.findtext('HSS_main_exec',default='') + HSS_main_exec_args = testcase.findtext('HSS_main_exec_args',default='') + EPC_traffic_exec = testcase.findtext('EPC_traffic_exec',default='') + EPC_traffic_exec_args = testcase.findtext('EPC_traffic_exec_args',default='') + EPC_terminate_missing_procs = testcase.findtext('EPC_terminate_missing_procs',default='True') + + index_eNBMachine = MachineList.index(eNBMachine) + index_UEMachine = MachineList.index(UEMachine) + index_EPCMachine = MachineList.index(EPCMachine) + oai_eNB = oai_list[index_eNBMachine] + oai_UE = oai_list[index_UEMachine] + + #We need to create two ssh sessions to avoid race conditions + if index_eNBMachine == index_EPCMachine: + oai_EPC = openair('localdomain', EPCMachine) + oai_EPC.connect(user,password) + else: + oai_EPC = oai_list[index_EPCMachine] + cleanOldPrograms(oai_eNB, oldprogramList, CleanUpAluLteBox) + cleanOldPrograms(oai_UE, oldprogramList, CleanUpAluLteBox) + cleanOldPrograms(oai_EPC, oldprogramList, CleanUpAluLteBox) + logdir_eNB = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + logdir_UE = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + logdir_EPC = logdirOpenaircnRepo+'/TEST/autotests/log/'+ testcasename + logdir_local = os.environ.get('OPENAIR_DIR') + if logdir_local is None: + print "Environment variable OPENAIR_DIR not set correctly" + sys.exit() + + #Make the log directory of test case + #cmd = 'mkdir -p ' + logdir_eNB + #result = oai_eNB.send_recv(cmd) + #cmd = 'mkdir -p ' + logdir_UE + #result = oai_UE.send_recv(cmd) + #cmd = 'mkdir -p ' + logdir_EPC + #result = oai_EPC.send_recv(cmd) + + print "Updating the config files for ENB/UE/EPC..." + #updating the eNB/UE/EPC configuration file from the test case + #update_config_file(oai_eNB, eNB_config_file, logdirOAI5GRepo) + #update_config_file(oai_UE, UE_config_file, logdirOAI5GRepo) + #update_config_file(oai_EPC, EPC_config_file, logdirOpenaircnRepo) + + for run in range(0,nruns): + logdir_eNB = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) + logdir_UE = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) + logdir_EPC = logdirOpenaircnRepo+'/TEST/autotests/log/'+ testcasename + '/run_' + str(run) + logdir_local_testcase = logdir_local + '/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) + #Make the log directory of test case + cmd = 'rm -fr ' + logdir_eNB + ' ; mkdir -p ' + logdir_eNB + result = oai_eNB.send_recv(cmd) + cmd = 'rm -fr ' + logdir_UE + ' ; mkdir -p ' + logdir_UE + result = oai_UE.send_recv(cmd) + cmd = 'rm -fr ' + logdir_EPC + '; mkdir -p ' + logdir_EPC + result = oai_EPC.send_recv(cmd) + cmd = ' rm -fr ' + logdir_local_testcase + ' ; mkdir -p ' + logdir_local_testcase + result = os.system(cmd) + + logfile_compile_eNB = logdir_eNB + '/eNB_compile' + '_' + str(run) + '_.log' + logfile_exec_eNB = logdir_eNB + '/eNB_exec' + '_' + str(run) + '_.log' + logfile_pre_exec_eNB = logdir_eNB + '/eNB_pre_exec' + '_' + str(run) + '_.log' + logfile_traffic_eNB = logdir_eNB + '/eNB_traffic' + '_' + str(run) + '_.log' + logfile_task_eNB_out = logdir_eNB + '/eNB_task_out' + '_' + str(run) + '_.log' + logfile_task_eNB = logdir_local_testcase + '/eNB_task' + '_' + str(run) + '_.log' + task_eNB = ' ( \n' + task_eNB = task_eNB + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' + task_eNB = task_eNB + 'env |grep OPENAIR \n' + task_eNB = task_eNB + update_config_file(oai_eNB, eNB_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' + if eNB_compile_prog != "": + task_eNB = task_eNB + ' ( ' + eNB_compile_prog + ' '+ eNB_compile_prog_args + ' ) > ' + logfile_compile_eNB + ' 2>&1 \n' + if eNB_pre_exec != "": + task_eNB = task_eNB + ' ( ' + eNB_pre_exec + ' '+ eNB_pre_exec_args + ' ) > ' + logfile_pre_exec_eNB + ' 2>&1 \n' + if eNB_main_exec != "": + task_eNB = task_eNB + ' ( ' + addsudo(eNB_main_exec + ' ' + eNB_main_exec_args, mypassword) + ' ) > ' + logfile_exec_eNB + ' 2>&1 & \n' + task_eNB = task_eNB + 'array_exec_pid+=($!) \n' + task_eNB = task_eNB + 'echo eNB_main_exec PID = $! \n' + if eNB_traffic_exec != "": + task_eNB = task_eNB + ' ( ' + eNB_traffic_exec + ' ' + eNB_traffic_exec_args + ' ) > ' + logfile_traffic_eNB + ' 2>&1 & \n ' + task_eNB = task_eNB + 'array_exec_pid+=($!) \n' + task_eNB = task_eNB + 'echo eNB_traffic_exec PID = $! \n' + #terminate the eNB test case after timeout_cmd seconds + task_eNB = task_eNB + finalize_deploy_script (timeout_cmd, eNB_terminate_missing_procs) + ' \n' + #task_eNB = task_eNB + 'sleep ' + str(timeout_cmd) + ' \n' + task_eNB = task_eNB + 'handle_ctrl_c' + '\n' + task_eNB = task_eNB + ' ) > ' + logfile_task_eNB_out + ' 2>&1 ' + write_file(logfile_task_eNB, task_eNB, mode="w") + + #task_eNB = 'echo \" ' + task_eNB + '\" > ' + logfile_script_eNB + ' 2>&1 ; ' + task_eNB + logfile_compile_UE = logdir_UE + '/UE_compile' + '_' + str(run) + '_.log' + logfile_exec_UE = logdir_UE + '/UE_exec' + '_' + str(run) + '_.log' + logfile_pre_exec_UE = logdir_UE + '/UE_pre_exec' + '_' + str(run) + '_.log' + logfile_traffic_UE = logdir_UE + '/UE_traffic' + '_' + str(run) + '_.log' + logfile_task_UE_out = logdir_UE + '/UE_task_out' + '_' + str(run) + '_.log' + logfile_task_UE = logdir_local_testcase + '/UE_task' + '_' + str(run) + '_.log' + task_UE = ' ( \n' + task_UE = task_UE + 'array_exec_pid=()' + '\n' + task_UE = task_UE + 'cd ' + logdirOAI5GRepo + '\n' + task_UE = task_UE + 'source oaienv \n' + task_UE = task_UE + 'source cmake_targets/tools/build_helper \n' + task_UE = task_UE + 'env |grep OPENAIR \n' + task_UE = task_UE + update_config_file(oai_UE, UE_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' + if UE_compile_prog != "": + task_UE = task_UE + ' ( ' + UE_compile_prog + ' '+ UE_compile_prog_args + ' ) > ' + logfile_compile_UE + ' 2>&1 \n' + if UE_pre_exec != "": + task_UE = task_UE + ' ( ' + UE_pre_exec + ' '+ UE_pre_exec_args + ' ) > ' + logfile_pre_exec_UE + ' 2>&1 \n' + if UE_main_exec != "": + task_UE = task_UE + ' ( ' + addsudo(UE_main_exec + ' ' + UE_main_exec_args, mypassword) + ' ) > ' + logfile_exec_UE + ' 2>&1 & \n' + task_UE = task_UE + 'array_exec_pid+=($!) \n' + task_UE = task_UE + 'echo UE_main_exec PID = $! \n' + if UE_traffic_exec != "": + task_UE = task_UE + ' ( ' + UE_traffic_exec + ' ' + UE_traffic_exec_args + ' ) >' + logfile_traffic_UE + ' 2>&1 & \n' + task_UE = task_UE + 'array_exec_pid+=($!) \n' + task_UE = task_UE + 'echo UE_traffic_exec PID = $! \n' + #terminate the UE test case after timeout_cmd seconds + task_UE = task_UE + finalize_deploy_script (timeout_cmd, UE_terminate_missing_procs) + ' \n' + #task_UE = task_UE + 'sleep ' + str(timeout_cmd) + ' \n' + task_UE = task_UE + 'handle_ctrl_c' + '\n' + task_UE = task_UE + ' ) > ' + logfile_task_UE_out + ' 2>&1 ' + write_file(logfile_task_UE, task_UE, mode="w") + #task_UE = 'echo \" ' + task_UE + '\" > ' + logfile_script_UE + ' 2>&1 ; ' + task_UE + + logfile_compile_EPC = logdir_EPC + '/EPC_compile' + '_' + str(run) + '_.log' + logfile_compile_HSS = logdir_EPC + '/HSS_compile' + '_' + str(run) + '_.log' + logfile_exec_EPC = logdir_EPC + '/EPC_exec' + '_' + str(run) + '_.log' + logfile_pre_exec_EPC = logdir_EPC + '/EPC_pre_exec' + '_' + str(run) + '_.log' + logfile_exec_HSS = logdir_EPC + '/HSS_exec' + '_' + str(run) + '_.log' + logfile_traffic_EPC = logdir_EPC + '/EPC_traffic' + '_' + str(run) + '_.log' + logfile_task_EPC_out = logdir_EPC + '/EPC_task_out' + '_' + str(run) + '_.log' + logfile_task_EPC = logdir_local_testcase + '/EPC_task' + '_' + str(run) + '_.log' + task_EPC = ' ( \n' + task_EPC = task_EPC + 'array_exec_pid=()' + '\n' + task_EPC = task_EPC + 'cd ' + logdirOpenaircnRepo + '\n' + task_EPC = task_EPC + update_config_file(oai_EPC, EPC_config_file, logdirOpenaircnRepo, logdirOpenaircnRepo+'/TEST/autotests/tools/search_repl.py') + '\n' + task_EPC = task_EPC + 'source BUILD/TOOLS/build_helper \n' + if EPC_compile_prog != "": + task_EPC = task_EPC + '(' + EPC_compile_prog + ' ' + EPC_compile_prog_args + ' ) > ' + logfile_compile_EPC + ' 2>&1 \n' + if HSS_compile_prog != "": + task_EPC = task_EPC + '(' + HSS_compile_prog + ' ' + HSS_compile_prog_args + ' ) > ' + logfile_compile_HSS + ' 2>&1 \n' + if EPC_pre_exec != "": + task_EPC = task_EPC + ' ( ' + EPC_pre_exec + ' '+ EPC_pre_exec_args + ' ) > ' + logfile_pre_exec_EPC + ' 2>&1 \n' + if EPC_main_exec != "": + task_EPC = task_EPC + '(' + addsudo (EPC_main_exec + ' ' + EPC_main_exec_args, mypassword) + ' ) > ' + logfile_exec_EPC + ' 2>&1 & \n' + task_EPC = task_EPC + 'array_exec_pid+=($!) \n' + task_EPC = task_EPC + 'echo EPC_main_exec PID = $! \n' + if HSS_main_exec != "": + task_EPC = task_EPC + '(' + addsudo (HSS_main_exec + ' ' + HSS_main_exec_args, mypassword) + ' ) > ' + logfile_exec_HSS + ' 2>&1 & \n' + task_EPC = task_EPC + 'array_exec_pid+=($!) \n' + task_EPC = task_EPC + 'echo HSS_main_exec PID = $! \n' + if EPC_traffic_exec != "": + task_EPC = task_EPC + '(' + EPC_traffic_exec + ' ' + EPC_traffic_exec_args + ' ) > ' + logfile_traffic_EPC + ' 2>&1 & \n' + task_EPC = task_EPC + 'array_exec_pid+=($!) \n' + task_EPC = task_EPC + 'echo EPC_traffic_exec PID = $! \n' + #terminate the EPC test case after timeout_cmd seconds + task_EPC = task_EPC + finalize_deploy_script (timeout_cmd, EPC_terminate_missing_procs) + '\n' + #task_EPC = task_EPC + 'sleep ' + str(timeout_cmd) + '\n' + task_EPC = task_EPC + 'handle_ctrl_c' '\n' + task_EPC = task_EPC + ' ) > ' + logfile_task_EPC_out + ' 2>&1 ' + write_file(logfile_task_EPC, task_EPC, mode="w") + + thread_EPC = oaiThread(1, "EPC_thread", oai_EPC , task_EPC, False, timeout_thread) + thread_eNB = oaiThread(2, "eNB_thread", oai_eNB , task_eNB, False, timeout_thread) + thread_UE = oaiThread(3, "UE_thread", oai_UE , task_UE, False, timeout_thread) + + threads=[] + threads.append(thread_eNB) + threads.append(thread_UE) + threads.append(thread_EPC) + # Start new Threads + + thread_eNB.start() + thread_UE.start() + thread_EPC.start() + + #Wait for all the compile threads to complete + for t in threads: + t.join() + #Now we get the log files from remote machines on the local machine + + cleanOldPrograms(oai_eNB, oldprogramList, CleanUpAluLteBox) + cleanOldPrograms(oai_UE, oldprogramList, CleanUpAluLteBox) + cleanOldPrograms(oai_EPC, oldprogramList, CleanUpAluLteBox) + + localfile = logdir_local_testcase + '/eNB_compile' + '_' + str(run) + '_.log' + remotefile = logdir_eNB + '/eNB_compile' + '_' + str(run) + '_.log' + sftp_log = os.path.expandvars(logdir_local_testcase + '/sftp_module.log') + ports = 22 + paramList = [] + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, password, eNBMachine, ports, localfile, remotefile, sftp_log, "get") + + localfile = logdir_local_testcase + '/eNB_exec' + '_' + str(run) + '_.log' + remotefile = logdir_eNB + '/eNB_exec' + '_' + str(run) + '_.log' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, password, eNBMachine, ports, localfile, remotefile, sftp_log, "get") + + localfile = logdir_local_testcase + '/eNB_pre_exec' + '_' + str(run) + '_.log' + remotefile = logdir_eNB + '/eNB_pre_exec' + '_' + str(run) + '_.log' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, password, eNBMachine, ports, localfile, remotefile, sftp_log, "get") + + localfile = logdir_local_testcase + '/eNB_traffic' + '_' + str(run) + '_.log' + remotefile = logdir_eNB + '/eNB_traffic' + '_' + str(run) + '_.log' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, password, eNBMachine, ports, localfile, remotefile, sftp_log, "get") + + localfile = logdir_local_testcase + '/eNB_task_out' + '_' + str(run) + '_.log' + remotefile = logdir_eNB + '/eNB_task_out' + '_' + str(run) + '_.log' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + + localfile = logdir_local_testcase + '/test_case_list.xml' + remotefile = logdirOAI5GRepo+'/cmake_targets/autotests/test_case_list.xml' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + sftp_module (user, password, eNBMachine, ports, paramList, sftp_log) + + paramList=[] + localfile = logdir_local_testcase + '/UE_compile' + '_' + str(run) + '_.log' + remotefile = logdir_UE + '/UE_compile' + '_' + str(run) + '_.log' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, password, UEMachine, ports, localfile, remotefile, sftp_log, "get") + + localfile = logdir_local_testcase + '/UE_exec' + '_' + str(run) + '_.log' + remotefile = logdir_UE + '/UE_exec' + '_' + str(run) + '_.log' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, password, UEMachine, ports, localfile, remotefile, sftp_log, "get") + + localfile = logdir_local_testcase + '/UE_pre_exec' + '_' + str(run) + '_.log' + remotefile = logdir_UE + '/UE_pre_exec' + '_' + str(run) + '_.log' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, password, UEMachine, ports, localfile, remotefile, sftp_log, "get") + + localfile = logdir_local_testcase + '/UE_traffic' + '_' + str(run) + '_.log' + remotefile = logdir_UE + '/UE_traffic' + '_' + str(run) + '_.log' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, password, UEMachine, ports, localfile, remotefile, sftp_log, "get") + + localfile = logdir_local_testcase + '/UE_task_out' + '_' + str(run) + '_.log' + remotefile = logdir_UE + '/UE_task_out' + '_' + str(run) + '_.log' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + sftp_module (user, password, UEMachine, ports, paramList, sftp_log) + + paramList=[] + localfile = logdir_local_testcase + '/EPC_compile' + '_' + str(run) + '_.log' + remotefile = logdir_EPC + '/EPC_compile' + '_' + str(run) + '_.log' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, password, EPCMachine, ports, localfile, remotefile, sftp_log, "get") + + localfile = logdir_local_testcase + '/EPC_exec' + '_' + str(run) + '_.log' + remotefile = logdir_EPC + '/EPC_exec' + '_' + str(run) + '_.log' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, password, EPCMachine, ports, localfile, remotefile, sftp_log, "get") + + localfile = logdir_local_testcase + '/HSS_compile' + '_' + str(run) + '_.log' + remotefile = logdir_EPC + '/HSS_compile' + '_' + str(run) + '_.log' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, password, EPCMachine, ports, localfile, remotefile, sftp_log, "get") + + localfile = logdir_local_testcase + '/HSS_exec' + '_' + str(run) + '_.log' + remotefile = logdir_EPC + '/HSS_exec' + '_' + str(run) + '_.log' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, password, EPCMachine, ports, localfile, remotefile, sftp_log, "get") + + localfile = logdir_local_testcase + '/EPC_pre_exec' + '_' + str(run) + '_.log' + remotefile = logdir_EPC + '/EPC_pre_exec' + '_' + str(run) + '_.log' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, password, EPCMachine, ports, localfile, remotefile, sftp_log, "get") + + localfile = logdir_local_testcase + '/EPC_traffic' + '_' + str(run) + '_.log' + remotefile = logdir_EPC + '/EPC_traffic' + '_' + str(run) + '_.log' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, password, EPCMachine, ports, localfile, remotefile, sftp_log, "get") + + localfile = logdir_local_testcase + '/EPC_task_out' + '_' + str(run) + '_.log' + remotefile = logdir_EPC + '/EPC_task_out' + '_' + str(run) + '_.log' + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + sftp_module (user, password, EPCMachine, ports, paramList, sftp_log) + #We need to close the new ssh session that was created + if index_eNBMachine == index_EPCMachine: + oai_EPC.disconnect() + +#This function searches if test case is present in list of test cases that need to be executed by user +def search_test_case_group(testcasename, testcasegroup): + if testcasegroup == '': + return True + testcaselist = testcasegroup.split() + for entry in testcaselist: + if entry.find('+') >=0: + match = re.search(entry, testcasename) + if match: + return True + else: + match = testcasename.find(entry) + if match >=0: + return True + return False + + + +#thread1 = myThread(1, "Thread-1", 1) +debug = 0 +pw ='' +i = 0 +dlsim=0 +localshell=0 +is_compiled = 0 +timeout=2000 +xmlInputFile="./test_case_list.xml" +NFSResultsDir = '/mnt/sradio' +cleanupOldProgramsScript = '$OPENAIR_DIR/cmake_targets/autotests/tools/remove_old_programs.bash' +testcasegroup='' + +logdir = '/tmp/' + 'OAITestFrameWork-' + getpass.getuser() + '/' +logdirOAI5GRepo = logdir + 'openairinterface5g/' +logdirOpenaircnRepo = logdir + 'openair-cn/' + +openairdir_local = os.environ.get('OPENAIR_DIR') +if openairdir_local is None: + print "Environment variable OPENAIR_DIR not set correctly" + sys.exit() +locallogdir = openairdir_local + '/cmake_targets/autotests/log/' +#Remove the contents of local log directory +os.system(' rm -fr ' + locallogdir + '; mkdir -p ' + locallogdir ) + +i=1 +while i < len (sys.argv): + arg=sys.argv[i] + if arg == '-d': + debug = 1 + elif arg == '-dd': + debug = 2 + elif arg == '-p' : + prompt2 = sys.argv[i+1] + i = i +1 + elif arg == '-w' : + pw = sys.argv[i+1] + i = i +1 + elif arg == '-P' : + dlsim = 1 + elif arg == '-l' : + localshell = 1 + elif arg == '-c' : + is_compiled = 1 + elif arg == '-t' : + timeout = sys.argv[i+1] + i = i +1 + elif arg == '-g' : + testcasegroup = sys.argv[i+1].replace("\"","") + i = 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" + print "-l: use local shell instead of ssh connection" + print "-t: set the time out in second for commands" + sys.exit() + else : + print "Unrecongnized Option: <" + arg + ">. Use -h to see valid options" + sys.exit() + 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) + +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) + +# get the oai object +host = os.uname()[1] +#oai = openair('localdomain','calisson') +oai_list = {} + + +#start_time = time.time() # datetime.datetime.now() +user = getpass.getuser() +print "host = " + host +print "user = " + user +pw=getpass.getpass() + +#Now we parse the xml file for basic configuration +xmlTree = ET.parse(xmlInputFile) +xmlRoot = xmlTree.getroot() + + + + +MachineList = xmlRoot.findtext('MachineList',default='') +NFSResultsShare = xmlRoot.findtext('NFSResultsShare',default='') +GitOpenaircnRepo = xmlRoot.findtext('GitOpenair-cnRepo',default='') +GitOAI5GRepo = xmlRoot.findtext('GitOAI5GRepo',default='') +GitOAI5GRepoBranch = xmlRoot.findtext('GitOAI5GRepoBranch',default='') +GitOpenaircnRepoBranch = xmlRoot.findtext('GitOpenair-cnRepoBranch',default='') +CleanUpOldProgs = xmlRoot.findtext('CleanUpOldProgs',default='') +CleanUpAluLteBox = xmlRoot.findtext('CleanUpAluLteBox',default='') + +print "MachineList = " + MachineList +print "GitOpenair-cnRepo = " + GitOpenaircnRepo +print "GitOAI5GRepo = " + GitOAI5GRepo +print "GitOAI5GBranch = " + GitOAI5GRepoBranch +print "GitOpenaircnRepoBranch = " + GitOpenaircnRepoBranch +print "NFSResultsShare = " + NFSResultsShare +cmd = "git show-ref --heads -s "+ GitOAI5GRepoBranch +GitOAI5GHeadVersion = subprocess.check_output ([cmd], shell=True) +print "GitOAI5GHeadVersion = " + GitOAI5GHeadVersion +print "CleanUpOldProgs = " + CleanUpOldProgs + + +MachineList = MachineList.split() + +index=0 +for machine in MachineList: + oai_list[index] = openair('localdomain',machine) + index = index + 1 + + +#myThread (1,"sddsf", 1) + + +#thread1 = oaiThread1(1, "Thread-1", 1) +#def __init__(self, threadID, name, counter, oai, cmd, sudo, timeout): + +#sys.exit() + + + + + + + +print "\nTesting the sanity of machines used for testing..." +if localshell == 0: + try: + index=0 + for machine in MachineList: + print '\n******* Note that the user <'+user+'> should be a sudoer *******\n' + 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 "result = " + result + + + #print '\nCleaning Older running programs : ' + CleanUpOldProgs + #cleanOldPrograms(oai_list[index], CleanUpOldProgs) + + + + 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 + cleanOldPrograms(oai_list[index], CleanUpOldProgs, CleanUpAluLteBox) + + result = oai_list[index].send('mount ' + NFSResultsDir, True) + print "Mounting NFS Share " + NFSResultsDir + "..." + result + + # Check if NFS share is mounted correctly. + print 'Checking if NFS Share<' + NFSResultsDir + '> is mounted correctly...' + #result = oai_list[index].send_expect('mount | grep ' + NFSResultsDir, NFSResultsDir ) + cmd = 'if grep -qs '+NFSResultsDir+ ' /proc/mounts; then echo \'' + NFSResultsDir + ' is mounted\' ; fi' + search_expr = NFSResultsDir + ' is mounted' + print "cmd = " + cmd + print "search_expr = " + search_expr + result = oai_list[index].send_expect(cmd, search_expr) + print "Mount NFS_Results_Dir..." + result + index = index + 1 + + #oai.connect2(user,pw) + #oai.get_shell() + except : + print 'Fail to connect to the machine: '+ machine + sys.exit(1) +else: + pw = '' + oai_list[0].connect_localshell() + + + + + +cpu_freq = int(oai_list[0].cpu_freq()) +if timeout == 2000 : + if cpu_freq <= 2000 : + timeout = 3000 + elif cpu_freq < 2700 : + timeout = 2000 + elif cpu_freq < 3300 : + timeout = 1500 +print "cpu freq(MHz): " + str(cpu_freq) + "timeout(s): " + str(timeout) + +# The log files are stored in branch/version/ + + + +#result = oai_list[0].send('uname -a ' ) +#print result + +#We now prepare the machines for testing +#index=0 +threads_init_setup=[] +for index in oai_list: + try: + print "setting up machine: " + MachineList[index] + #print oai_list[oai].send_recv('echo \''+pw+'\' |sudo -S -v') + #print oai_list[oai].send_recv('sudo su') + #print oai_list[oai].send_recv('who am i') + #cleanUpPrograms(oai_list[oai] + cmd = 'mkdir -p ' + logdir + ' ; rm -fr ' + logdir + '/*' + result = oai_list[index].send_recv(cmd) + + setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt' + setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt' + cmd = ' ( \n' + #cmd = cmd + 'rm -fR ' + logdir + '\n' + #cmd = cmd + 'mkdir -p ' + logdir + '\n' + cmd = cmd + 'cd '+ logdir + '\n' + cmd = cmd + 'git clone '+ GitOAI5GRepo + '\n' + cmd = cmd + 'git clone '+ GitOpenaircnRepo + '\n' + cmd = cmd + 'cd ' + logdirOAI5GRepo + '\n' + cmd = cmd + 'git checkout ' + GitOAI5GHeadVersion + '\n' + cmd = cmd + 'source oaienv' + '\n' + cmd = cmd + 'cd ' + logdirOpenaircnRepo + '\n' + cmd = cmd + 'git checkout ' + GitOpenaircnRepoBranch + '\n' + cmd = cmd + 'env |grep OPENAIR' + '\n' + cmd = cmd + ' cd ' + logdir + '\n' + cmd = cmd + ' ) > ' + setuplogfile + ' 2>&1 ' + #cmd = cmd + 'echo \' ' + cmd + '\' > ' + setup_script + ' 2>&1 \n ' + #result = oai_list[index].send_recv(cmd, False, 300 ) + write_file(setup_script, cmd, mode="w") + tempThread = oaiThread(index, 'thread_'+str(index), oai_list[index] , cmd, False, 300) + threads_init_setup.append(tempThread ) + tempThread.start() + + #localfile = locallogdir + '/setup_log_' + MachineList[index] + '_.txt' + #remotefile = logdir + '/setup_log_' + MachineList[index] + '_.txt' + + #sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') + #sftp_module (user, pw, MachineList[index], 22, localfile, remotefile, sftp_log, "get") + + + #Now we copy test_case_list.xml on the remote machines + #localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/test_case_list.xml') + #remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/test_case_list.xml' + + #sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') + #sftp_module (user, pw, MachineList[index], 22, localfile, remotefile, sftp_log, "put") + + + #print oai_list[index].send('rm -fR ' + logdir) + #print oai_list[index].send('mkdir -p ' + logdir) + #print oai_list[index].send('cd '+ logdir) + #print oai_list[index].send('git clone '+ GitOAI5GRepo ) + #print oai_list[index].send('git clone '+ GitOpenaircnRepo) + #print oai_list[index].send('cd ' + logdirOAI5GRepo) + #print oai_list[index].send('git checkout ' + GitOAI5GHeadVersion) + #print oai_list[index].send('source oaienv') + #print oai_list[index].send('cd ' + logdirOpenaircnRepo) + #print oai_list[index].send('git checkout ' + GitOpenaircnRepoBranch) + #print oai_list[index].send_recv('cd ' + logdirOAI5GRepo) + #print oai_list[index].send_recv('source oaienv') + #print oai_list[index].send_recv('env |grep OPENAIR') + + #print '\nCleaning Older running programs : ' + CleanUpOldProgs + #cleanOldPrograms(oai_list[index], CleanUpOldProgs) + + except : + print 'There is error in one of the commands to setup the machine '+ MachineList[index] + sys.exit(1) + + +#Now we wait for all the threads to complete +index = 0 +for t in threads_init_setup: + 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 + + paramList=[] + sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, pw, MachineList[index], port, localfile, remotefile, sftp_log, "get") + + #Now we copy test_case_list.xml on the remote machines + localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/test_case_list.xml') + remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/test_case_list.xml' + 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) + index = index+1 + +#Now we process all the test cases + + +testcaseList=xmlRoot.findall('testCase') +#print testcaseList +for testcase in testcaseList: + testcasename = testcase.get('id') + testcaseclass = testcase.findtext('class',default='') + desc = testcase.findtext('desc',default='') + if search_test_case_group(testcasename, testcasegroup) == True: + if testcaseclass == 'lte-softmodem' : + eNBMachine = testcase.findtext('eNB',default='') + UEMachine = testcase.findtext('UE',default='') + EPCMachine = testcase.findtext('EPC',default='') + index_eNBMachine = MachineList.index(eNBMachine) + index_UEMachine = MachineList.index(UEMachine) + index_EPCMachine = MachineList.index(EPCMachine) + print "testcasename = " + testcasename + " class = " + testcaseclass + handle_testcaseclass_softmodem (testcase, CleanUpOldProgs, oai_list, logdirOAI5GRepo, logdirOpenaircnRepo, MachineList, pw, CleanUpAluLteBox ) + + elif testcaseclass == 'compilation' : + continue + handle_testcaseclass_compilation (testcase) + elif testcaseclass == 'execution' : + continue + handle_testcaseclass_oaisim (testcase) + else : + print "Unknown test case class: " + testcaseclass + sys.exit() + +print "Exiting the test cases execution now..." + +sys.exit() + + + #+ "class = "+ classx + + + + #index = index +1 + +test = 'test01' +ctime=datetime.datetime.utcnow().strftime("%Y-%m-%d.%Hh%M") +logfile = user+'.'+test+'.'+ctime+'.txt' +logdir = os.getcwd() + '/pre-ci-logs-'+host; +oai.create_dir(logdir,debug) +print 'log dir: ' + logdir +print 'log file: ' + logfile +pwd = oai.send_recv('pwd') +print "pwd = " + pwd +result = oai.send('echo linux | sudo -S ls -al;sleep 5') +print "result =" + result +sys.exit() + +#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 +if is_compiled == 0 : + is_compiled=case01.execute(oai, user, pw, host,logfile,logdir,debug,timeout) + +if is_compiled != 0 : + case02.execute(oai, user, pw, host, logfile,logdir,debug) + case03.execute(oai, user, pw, host, logfile,logdir,debug) + case04.execute(oai, user, pw, host, logfile,logdir,debug) + case05.execute(oai, user, pw, host, logfile,logdir,debug) +else : + print 'Compilation error: skip test case 02,03,04,05' + +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 + '=====================' diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 1425eb56a993895bed1910237be9367ee467883d..f402b38f265d6eff1eb2c8196f763b2c63fe2133 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1,12 +1,13 @@ <testCaseList> -<MachineList>mozart stevens calisson nano amerique</MachineList> +<MachineList>amerique stevens calisson nano</MachineList> <NFSResultsShare>/mnt/sradio/TEST_RESULTS</NFSResultsShare> <GitOAI5GRepo>https://gitlab.eurecom.fr/oai/openairinterface5g.git</GitOAI5GRepo> <GitOpenair-cnRepo>https://gitlab.eurecom.fr/oai/openair-cn.git</GitOpenair-cnRepo> <GitOAI5GRepoBranch>feature-34-test_framework</GitOAI5GRepoBranch> - <GitOpenair-cnRepoBranch>develop</GitOpenair-cnRepoBranch> - <CleanUpOldProgs>oaisim* oaisim_nos1* lte-softmodem* lte-softmodem-nos1* mme_gw* run_epc* run_hss* iperf* ltebox* </CleanUpOldProgs> + <GitOpenair-cnRepoBranch>feature-17-test_framework</GitOpenair-cnRepoBranch> + <CleanUpOldProgs>oaisim* oaisim_nos1* lte-softmodem* lte-softmodem-nos1* mme_gw* run_epc* run_hss* iperf* hss hss_sim configure_cots_bandrich_ue* wvdial* </CleanUpOldProgs> + <CleanUpAluLteBox>/opt/ltebox/tools/stop_ltebox</CleanUpAluLteBox> <testCase id="010101" > <class>compilation</class> @@ -25,7 +26,7 @@ <testCase id="010102" > <class>compilation</class> - <desc>Build oaisim.Rel8 + network device driver(nasmesh_fix)</desc> + <desc>Build oaisim.Rel8 + network device driver(nasmesh_fix)</desc> <pre_compile_prog></pre_compile_prog> <compile_prog>oaisim_nos1</compile_prog> <compile_prog_args></compile_prog_args> @@ -750,62 +751,231 @@ <desc></desc> <eNB>calisson</eNB> <UE>stevens</UE> - <EPC>nano</EPC> + <EPC>amerique</EPC> <cleanupScript>oaisim* oaisim_nos1* lte-softmodem* lte-softmodem-nos1* mme_gw* run_epc* run_hss* iperf* ltebox*</cleanupScript> - <TimeOut_cmd>300</TimeOut_cmd> + <TimeOut_cmd>60</TimeOut_cmd> + <eNB_working_dir>/tmp</eNB_working_dir> + <eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf mobile_network_code \"92\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf mobile_network_code \"92\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf N_RB_DL 50 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";"</eNB_config_file> + <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog> + <eNB_compile_prog_args>--eNB -w USRP</eNB_compile_prog_args> + <eNB_pre_exec></eNB_pre_exec> + <eNB_pre_exec_args></eNB_pre_exec_args> + <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec> + <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf </eNB_main_exec_args> + <eNB_traffic_exec>iperf -s</eNB_traffic_exec> + <eNB_traffic_exec_args></eNB_traffic_exec_args> + <eNB_search_expr_true></eNB_search_expr_true> + <eNB_search_expr_false></eNB_search_expr_false> + <eNB_terminate_missing_procs>True</eNB_terminate_missing_procs> + + <UE_working_dir>/tmp</UE_working_dir> + <UE_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf tracking_area_code \"4\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf mobile_country_code \"5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf mobile_network_code \"6\"</UE_config_file> + <UE_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</UE_compile_prog> + <UE_compile_prog_args>--eNB -w USRP</UE_compile_prog_args> + <UE_pre_exec></UE_pre_exec> + <UE_pre_exec_args></UE_pre_exec_args> + <UE_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue </UE_main_exec> + <UE_main_exec_args></UE_main_exec_args> + <UE_traffic_exec>ping 192.172.0.1</UE_traffic_exec> + <UE_traffic_exec_args></UE_traffic_exec_args> + <UE_search_expr_true></UE_search_expr_true> + <UE_search_expr_false></UE_search_expr_false> + <UE_terminate_missing_procs>True</UE_terminate_missing_procs> + <EPC_working_dir>/tmp</EPC_working_dir> + <EPC_config_file>BUILD/EPC/epc.local.enb.conf.in MCC \"208\" + BUILD/EPC/epc.local.enb.conf.in MNC \"92\" + BUILD/EPC/epc.local.enb.conf.in TAC \"1\" + BUILD/EPC/epc.local.enb.conf.in PGW_INTERFACE_NAME_FOR_SGI \"eth1\" + BUILD/EPC/epc.local.enb.conf.in PGW_IPV4_ADDRESS_FOR_SGI \"192.168.12.82/24\" </EPC_config_file> + <EPC_compile_prog>SCRIPTS/build_epc</EPC_compile_prog> + <EPC_compile_prog_args>-c -l</EPC_compile_prog_args> + <HSS_compile_prog>SCRIPTS/build_hss</HSS_compile_prog> + <HSS_compile_prog_args> -c -l </HSS_compile_prog_args> + + <EPC_pre_exec></EPC_pre_exec> + <EPC_pre_exec_args></EPC_pre_exec_args> + <EPC_main_exec>/opt/ltebox/tools/stop_ltebox ; /opt/ltebox/tools/start_ltebox ; sleep 3000</EPC_main_exec> + <EPC_main_exec_args></EPC_main_exec_args> + <HSS_main_exec>/opt/hss_sim0609/starthss >> /dev/null ; sleep 3000 </HSS_main_exec> + <HSS_main_exec_args></HSS_main_exec_args> + <EPC_traffic_exec>iperf -s</EPC_traffic_exec> + <EPC_traffic_exec_args></EPC_traffic_exec_args> + <EPC_search_expr_true></EPC_search_expr_true> + <EPC_search_expr_false></EPC_search_expr_false> + <EPC_terminate_missing_procs>True</EPC_terminate_missing_procs> + + <nruns>3</nruns> + </testCase> + + + <testCase id="015600" > + <class>lte-softmodem</class> + <desc></desc> + <eNB>calisson</eNB> + <UE>stevens</UE> + <EPC>nano</EPC> + <cleanupScript>oaisim* oaisim_nos1* lte-softmodem* lte-softmodem-nos1* mme_gw* run_epc* run_hss* iperf* ltebox*</cleanupScript> + <TimeOut_cmd>60</TimeOut_cmd> <eNB_working_dir>/tmp</eNB_working_dir> - <eNB_config_file>$OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf tracking_area_code 1 - $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf tracking_area_code 208 - $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf tracking_area_code 95</eNB_config_file> - <eNB_pre_compile_prog></eNB_pre_compile_prog> - <eNB_pre_compile_prog_args></eNB_pre_compile_prog_args> - <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai </eNB_compile_prog> + <eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf mobile_network_code \"92\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf mobile_network_code \"92\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf N_RB_DL 50 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf mme_ip_address "ipv4=\"192.168.12.62\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";"</eNB_config_file> + <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog> <eNB_compile_prog_args>--eNB -w USRP</eNB_compile_prog_args> - <eNB_pre_exec>iperf </eNB_pre_exec> + <eNB_pre_exec></eNB_pre_exec> <eNB_pre_exec_args></eNB_pre_exec_args> <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec> - <eNB_main_exec_args></eNB_main_exec_args> + <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf </eNB_main_exec_args> + <eNB_traffic_exec>iperf -s</eNB_traffic_exec> + <eNB_traffic_exec_args></eNB_traffic_exec_args> <eNB_search_expr_true></eNB_search_expr_true> <eNB_search_expr_false></eNB_search_expr_false> + <eNB_terminate_missing_procs>True</eNB_terminate_missing_procs> <UE_working_dir>/tmp</UE_working_dir> - <UE_pre_compile_prog></UE_pre_compile_prog> - <UE_pre_compile_prog_args></UE_pre_compile_prog_args> + <UE_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf mobile_network_code \"92\"</UE_config_file> <UE_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</UE_compile_prog> <UE_compile_prog_args>--eNB -w USRP</UE_compile_prog_args> - <UE_pre_exec>iperf </UE_pre_exec> + <UE_pre_exec></UE_pre_exec> <UE_pre_exec_args></UE_pre_exec_args> - <UE_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</UE_main_exec> + <UE_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue </UE_main_exec> <UE_main_exec_args></UE_main_exec_args> + <UE_traffic_exec>ping 192.172.0.1</UE_traffic_exec> + <UE_traffic_exec_args></UE_traffic_exec_args> <UE_search_expr_true></UE_search_expr_true> <UE_search_expr_false></UE_search_expr_false> + <UE_terminate_missing_procs>True</UE_terminate_missing_procs> + + <EPC_working_dir>/tmp</EPC_working_dir> + <EPC_config_file>BUILD/EPC/epc.local.enb.conf.in MCC \"208\" + BUILD/EPC/epc.local.enb.conf.in MNC \"92\" + BUILD/EPC/epc.local.enb.conf.in TAC \"1\" + BUILD/EPC/epc.local.enb.conf.in PGW_INTERFACE_NAME_FOR_SGI \"eth1\" + BUILD/EPC/epc.local.enb.conf.in PGW_IPV4_ADDRESS_FOR_SGI \"192.168.12.82/24\" + BUILD/EPC/epc.conf.in MCC \"208\" + BUILD/EPC/epc.conf.in MNC \"92\" + BUILD/EPC/epc.conf.in TAC \"1\" + BUILD/EPC/epc.conf.in PGW_INTERFACE_NAME_FOR_SGI \"eth1\" + BUILD/EPC/epc.conf.in PGW_IPV4_ADDRESS_FOR_SGI \"192.168.12.82/24\" + BUILD/EPC/epc.conf.in MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" + BUILD/EPC/epc.conf.in SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" + BUILD/EPC/epc.conf.in PGW_IPV4_ADDRESS_FOR_SGI \"192.168.12.62/24\"</EPC_config_file> + <EPC_compile_prog>SCRIPTS/build_epc</EPC_compile_prog> + <EPC_compile_prog_args>-c -l</EPC_compile_prog_args> + <HSS_compile_prog>SCRIPTS/build_hss</HSS_compile_prog> + <HSS_compile_prog_args> -c </HSS_compile_prog_args> + + <EPC_pre_exec></EPC_pre_exec> + <EPC_pre_exec_args></EPC_pre_exec_args> + <EPC_main_exec>/SCRIPTS/run_epc -g </EPC_main_exec> + <EPC_main_exec_args></EPC_main_exec_args> + <HSS_main_exec>/SCRIPTS/run_hss -g </HSS_main_exec> + <HSS_main_exec_args></HSS_main_exec_args> + <EPC_traffic_exec>iperf -s</EPC_traffic_exec> + <EPC_traffic_exec_args></EPC_traffic_exec_args> + <EPC_search_expr_true></EPC_search_expr_true> + <EPC_search_expr_false></EPC_search_expr_false> + <EPC_terminate_missing_procs>True</EPC_terminate_missing_procs> + <nruns>2</nruns> + </testCase> + + + <testCase id="015700" > + <class>lte-softmodem</class> + <desc></desc> + <eNB>calisson</eNB> + <UE>stevens</UE> + <EPC>calisson</EPC> + <cleanupScript>oaisim* oaisim_nos1* lte-softmodem* lte-softmodem-nos1* mme_gw* run_epc* run_hss* iperf* ltebox*</cleanupScript> + <TimeOut_cmd>60</TimeOut_cmd> + <eNB_working_dir>/tmp</eNB_working_dir> + <eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf mobile_network_code \"92\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf N_RB_DL 50 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf mobile_network_code \"92\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf N_RB_DL 50 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf mme_ip_address "ipv4=\"192.168.12.62\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";"</eNB_config_file> + <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog> + <eNB_compile_prog_args>--eNB -w USRP</eNB_compile_prog_args> + <eNB_pre_exec></eNB_pre_exec> + <eNB_pre_exec_args></eNB_pre_exec_args> + <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec> + <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf </eNB_main_exec_args> + <eNB_traffic_exec></eNB_traffic_exec> + <eNB_traffic_exec_args></eNB_traffic_exec_args> + <eNB_search_expr_true></eNB_search_expr_true> + <eNB_search_expr_false></eNB_search_expr_false> + <eNB_terminate_missing_procs>True</eNB_terminate_missing_procs> <UE_working_dir>/tmp</UE_working_dir> - <UE_pre_compile_prog></UE_pre_compile_prog> - <UE_pre_compile_prog_args></UE_pre_compile_prog_args> + <UE_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf mobile_network_code \"92\"</UE_config_file> <UE_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</UE_compile_prog> <UE_compile_prog_args>--eNB -w USRP</UE_compile_prog_args> - <UE_pre_exec>iperf </UE_pre_exec> + <UE_pre_exec></UE_pre_exec> <UE_pre_exec_args></UE_pre_exec_args> - <UE_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</UE_main_exec> + <UE_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --start-ue </UE_main_exec> <UE_main_exec_args></UE_main_exec_args> + <UE_traffic_exec>ping 192.172.0.1</UE_traffic_exec> + <UE_traffic_exec_args></UE_traffic_exec_args> <UE_search_expr_true></UE_search_expr_true> <UE_search_expr_false></UE_search_expr_false> + <UE_terminate_missing_procs>True</UE_terminate_missing_procs> <EPC_working_dir>/tmp</EPC_working_dir> - <EPC_pre_compile_prog></EPC_pre_compile_prog> - <EPC_pre_compile_prog_args></EPC_pre_compile_prog_args> - <EPC_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</EPC_compile_prog> - <EPC_compile_prog_args>--eNB -w USRP</EPC_compile_prog_args> - <EPC_pre_exec>iperf </EPC_pre_exec> + <EPC_config_file>BUILD/EPC/epc.local.enb.conf.in MCC \"208\" + BUILD/EPC/epc.local.enb.conf.in MNC \"92\" + BUILD/EPC/epc.local.enb.conf.in TAC \"1\" + BUILD/EPC/epc.local.enb.conf.in PGW_INTERFACE_NAME_FOR_SGI \"eth1\" + BUILD/EPC/epc.local.enb.conf.in PGW_IPV4_ADDRESS_FOR_SGI \"192.168.12.82/24\" + BUILD/EPC/epc.conf.in MCC \"208\" + BUILD/EPC/epc.conf.in MNC \"92\" + BUILD/EPC/epc.conf.in TAC \"1\" + BUILD/EPC/epc.conf.in PGW_INTERFACE_NAME_FOR_SGI \"eth1\" + BUILD/EPC/epc.conf.in PGW_IPV4_ADDRESS_FOR_SGI \"192.168.12.62/24\" + BUILD/EPC/epc.conf.in MME_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.62/24\" + BUILD/EPC/epc.conf.in SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP \"192.168.12.62/24\" + BUILD/EPC/epc.conf.in PGW_IPV4_ADDRESS_FOR_SGI \"192.168.12.62/24\"</EPC_config_file> + <EPC_compile_prog>SCRIPTS/build_epc</EPC_compile_prog> + <EPC_compile_prog_args>-c -l</EPC_compile_prog_args> + <HSS_compile_prog>SCRIPTS/build_hss</HSS_compile_prog> + <HSS_compile_prog_args> -c -l </HSS_compile_prog_args> + + <EPC_pre_exec></EPC_pre_exec> <EPC_pre_exec_args></EPC_pre_exec_args> - <EPC_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</EPC_main_exec> + <EPC_main_exec>SCRIPTS/run_epc -l </EPC_main_exec> <EPC_main_exec_args></EPC_main_exec_args> + <HSS_main_exec>SCRIPTS/run_hss </HSS_main_exec> + <HSS_main_exec_args></HSS_main_exec_args> + <EPC_traffic_exec>iperf -s</EPC_traffic_exec> + <EPC_traffic_exec_args></EPC_traffic_exec_args> <EPC_search_expr_true></EPC_search_expr_true> <EPC_search_expr_false></EPC_search_expr_false> + <EPC_terminate_missing_procs>True</EPC_terminate_missing_procs> + <nruns>2</nruns> - </testCase> + </testCase> </testCaseList> diff --git a/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py b/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py new file mode 100755 index 0000000000000000000000000000000000000000..2f959be55cd60eae536126aad6d7b67a5aa8850b --- /dev/null +++ b/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py @@ -0,0 +1,146 @@ +#!/usr/bin/python + +import time +import serial +import os +from pyroute2 import IPRoute +import sys +import re +import threading +import signal +import traceback +import os + +# configure the serial connections (the parameters differs on the device you are connecting to) +#First we find an open port to work with +serial_port='' +ser=serial.Serial() +def find_open_port(): + global serial_port, ser + max_ports=100 + if os.path.exists(serial_port) == True: + return serial_port + for port in range(2,100): + serial_port = '/dev/ttyUSB'+str(port) + if os.path.exists(serial_port) == True: + print 'New Serial Port : ' + serial_port + break + + ser = serial.Serial(port=serial_port) + return + +find_open_port() +print 'Using Serial port : ' + serial_port + +#serial_port = '/dev/ttyUSB2' +bandrich_ppd_config = '$OPENAIR_DIR/cmake_targets/autotests/tools/wdial.bandrich.conf' + +exit_flag=0 + +def signal_handler(signal, frame): + print('You pressed Ctrl+C!') + print('Resetting the UE to detached state') + timeout=10 + exit_flag=1 + send_command('AT+CGATT=0' , 'OK' , timeout) + sys.exit(0) + +signal.signal(signal.SIGINT, signal_handler) + + + +#ser.open() +#ser.isOpen() + +class pppThread (threading.Thread): + def __init__(self, threadID, name, counter): + threading.Thread.__init__(self) + self.threadID = threadID + self.name = name + self.counter = counter + def run(self): + print "Starting " + self.name + #Here we keep running pppd thread in indefinite loop as this script terminates sometimes + #while 1: + while 1: + time.sleep(5) #Hard coded, do not reduce this number! + print "Starting wvdial now..." + print 'exit_flag = ' + str(exit_flag) + send_command('AT+CGATT=1','OK', 300) + os.system('wvdial -C ' + bandrich_ppd_config + '' ) + if exit_flag == 1: + print "Exit flag set to true. Exiting pppThread now" + print "Terminating wvdial now..." + +def send_command (cmd, response, timeout): + count=0 + sleep_duration = 1 + print 'In function: send_command: cmd = <' + cmd + '> response: <' + response + '> \n' + global serial_port, ser + while count <= timeout: + try: + #Sometimes the port does not exist coz of reset in modem. + #In that case, we need to search for this port again + if os.path.exists(serial_port) == False: + find_open_port() + ser.write (cmd + '\r\n') + out = '' + time.sleep(sleep_duration) + count = count + sleep_duration + while ser.inWaiting() > 0: + out += ser.read(1) + print 'out = <' + out + '> response = <' + response + '> \n' + if re.search(response, out): + break + except Exception, e: + error = ' cmd : ' + cmd + ' response : ' + response + error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) + error = error + traceback.format_exc() + print error + + +def start_ue () : + #print 'Enter your commands below.\r\nInsert "exit" to leave the application.' + timeout=60 #timeout in seconds + send_command('AT', 'OK' , timeout) + send_command('AT+CGATT=0' , 'OK' , timeout) + send_command('AT+CGATT=1','OK', 300) + #os.system('wvdial -C ' + bandrich_ppd_config + ' &' ) + + thread_ppp = pppThread(1, "ppp_thread", 1) + thread_ppp.start() + + iface='ppp0' + + while 1: + time.sleep ( 2) + #Now we check if ppp0 interface is up and running + try: + if exit_flag == 1: + break + ip = IPRoute() + idx = ip.link_lookup(ifname=iface)[0] + os.system ('route add 192.172.0.1 ppp0') + break + except Exception, e: + error = ' Interface ' + iface + 'does not exist...' + error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) + error = error + traceback.format_exc() + print error + + thread_ppp.join() + +def stop_ue(): + timeout=60 + os.system('killall wvdial') + send_command('AT', 'OK' , timeout) + send_command('AT+CGATT=0' , 'OK' , timeout) + +for arg in sys.argv[1:]: + if arg == '--start-ue' : + start_ue() + elif arg == '--stop-ue' : + stop_ue() + else : + print " Script called with wrong arguments, arg = " + arg + sys.exit() diff --git a/cmake_targets/autotests/tools/search_repl.py b/cmake_targets/autotests/tools/search_repl.py new file mode 100755 index 0000000000000000000000000000000000000000..0a91945c771770992f926386d258b8f456921830 --- /dev/null +++ b/cmake_targets/autotests/tools/search_repl.py @@ -0,0 +1,35 @@ +#!/usr/bin/python +import sys +import re + +#Arg 1 name of file +#Arg 2 keyword +#arg 3 replacement text +#Note that these should be seperated by spaces +if len(sys.argv) != 4: + print "search_repl.py: Wrong number of arguments. This program needs 3 arguments" + sys.exit() +filename = sys.argv[1] +keyword = sys.argv[2] +replacement_text = sys.argv[3] + +file = open(filename, 'r') +string = file.read() +file.close() + + +if keyword == 'mme_ip_address': + #string = (re.sub(r"mme_ip_address\s*=\s*\([^\$]+)\)\s*;\s*", r"<% tex \1 %>", t, re.M) + replacement_text = keyword + ' = ( { ' + replacement_text + ' } ) ; ' + string = re.sub(r"mme_ip_address\s*=\s*\(([^\$]+?)\)\s*;", replacement_text, string, re.M) +else : + replacement_text = keyword + ' = ' + replacement_text + ' ; ' + string = re.sub(r"%s\s*=\s*([^\$]+?)\s*;" % keyword , replacement_text, string, re.M) +#else : +# replacement_text = keyword + ' =\"' + replacement_text + '\" ; ' +# string = re.sub(r"%s\s*=\s*\"([^\$]+?)\"\s*;" % keyword , replacement_text, string, re.M) + +file = open(filename, 'w') +file.write(string) +file.close() + diff --git a/cmake_targets/autotests/tools/wdial.bandrich.conf b/cmake_targets/autotests/tools/wdial.bandrich.conf new file mode 100644 index 0000000000000000000000000000000000000000..e1b64568f95d339bd2989979bfcb4fd654e813d7 --- /dev/null +++ b/cmake_targets/autotests/tools/wdial.bandrich.conf @@ -0,0 +1,36 @@ +[Dialer Defaults] +Modem = /dev/ttyUSB0 +ISDN = off +Modem Type = Analog Modem +Baud = 9600 +Init = ATZ +Init2 = AT+CPIN? +Init3 = AT+CGREG? +Init4 = AT+COPS? +Init5 = AT+CSQ +Init6 = +Init7 = AT+CGATT=1 +Init8 = +Init9 = +Phone = *99***1# +Phone1 = +Phone2 = +Phone3 = +Phone4 = +Dial Prefix = +Dial Attempts = 1 +Dial Command = ATM1L3DT +Ask Password = off +Password = '' +Username = ImaginLab +Auto Reconnect = off +Abort on Busy = off +Carrier Check = on +Check Def Route = on +Abort on No Dialtone = on +Stupid Mode = on +Idle Seconds = 0 +Auto DNS = on +;Minimize = off +;Dock = off +;Do NOT edit this file by hand! diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index af147d682af80063bfa910ae842f4ee04a02c7d3..6d337c6d52d5e8732574b07dac6b4a3c365680cd 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -54,6 +54,8 @@ CFLAGS_PROCESSOR_USER="" RUN_GROUP=0 TEST_CASE_GROUP="" +trap handle_ctrl_c INT + function print_help() { echo_info ' This program installs OpenAirInterface Software @@ -80,8 +82,6 @@ Options Makes the LTE softmodem --UE Makes the UE specific parts (ue_ip, usim, nvram) ---EPC - Makes the EPC (MME-SPGW, HSS) --RRH Makes the RRH -r | --3gpp-release @@ -116,8 +116,8 @@ Options Usage (first build): oaisim (eNB + UE): ./build_oai -I -g --oaisim -x --install-system-files - Eurecom EXMIMO + COTS UE : ./build_oai -I -g --eNB --EPC -x --install-system-files - NI/ETTUS B201 + COTS UE : ./build_oai -I -g --eNB --EPC -x --install-system-files -w USRP + Eurecom EXMIMO + COTS UE : ./build_oai -I -g --eNB -x --install-system-files + NI/ETTUS B201 + COTS UE : ./build_oai -I -g --eNB -x --install-system-files -w USRP Usage (Regular): oaisim : ./build_oai --oaisim -x Eurecom EXMIMO + OAI ENB : ./build_oai --eNB -x @@ -159,10 +159,6 @@ function main() { UE=1 echo_info "Will compile UE" shift;; - --EPC) - EPC=1 - echo_info "Will compile EPC" - shift;; --RRH) RRH=1 echo_info "Will compile RRH" @@ -416,7 +412,7 @@ function main() { # EXMIMO drivers & firmware loader ############### - if [ "$HW" = "EXMIMO" -a "$EPC" = "0" ] ; then + if [ "$HW" = "EXMIMO" ] ; then echo_info "Compiling Express MIMO 2 board drivers" compilations \ @@ -554,42 +550,24 @@ function main() { rrh_gw $dbin/rrh_gw fi - # EPC compilation - ################## - if [ "$EPC" = "1" ] ; then - echo_info "Compiling EPC" - # Example HSS and EPC run on the same host - if [ "$CLEAN" = "1" ]; then - $OPENAIR_DIR/cmake_targets/tools/build_epc --clean --debug --transport-tcp-only --transport-prefer-tcp --s6a-server - $OPENAIR_DIR/cmake_targets/tools/build_hss --clean --debug --transport-tcp-only --transport-prefer-tcp --fqdn `hostname --fqdn` --connect-to-mme `hostname --fqdn` - else - $OPENAIR_DIR/cmake_targets/tools/build_epc --debug --transport-tcp-only --transport-prefer-tcp --s6a-server - $OPENAIR_DIR/cmake_targets/tools/build_hss --debug --transport-tcp-only --transport-prefer-tcp --fqdn `hostname --fqdn` --connect-to-mme `hostname --fqdn` - fi - - # if [ "$INSTALL_SYSTEM_FILES" = "1" ] ;then - # if [ -f $dbin/hss.conf ] ; then - # sed -e 's/ *= */=/' $dbin/hss.conf > $dconf/hss.conf.nospace - # source $dconf/hss.conf.nospace - # rm -f $dconf/hss.conf.nospace - # create_hss_database root linux "$MYSQL_user" "$MYSQL_pass" "$MYSQL_db" - # else - # echo_warning "not created HSS database: config not found" - # fi - # fi - fi # Auto-tests ##################### if [ "$OAI_TEST" = "1" ]; then echo_info "10. Running OAI pre commit tests (pre-ci) ..." + read -s -p "Enter Password: " mypassword + echo -e "\n" + echo_info "The log file for the autotest script for debugging is located here: $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log " + echo_info "The results of autotests results is located here: $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml " + echo_info "You can hit CTRL-C any time to terminate the autotests..." rm -fr $OPENAIR_DIR/cmake_targets/autotests/log mkdir -p $OPENAIR_DIR/cmake_targets/autotests/log if [ "$RUN_GROUP" -eq "1" ]; then - $SUDO $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -g "$TEST_CASE_GROUP" + echo '$mypassword' | $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -g "$TEST_CASE_GROUP" >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log & else - $SUDO $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash + echo '$mypassword' | $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log & fi + wait else echo_info "10. Bypassing the Tests ..." fi diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 46997c277322179c9398e1b4e7dad56c56a61a1c..d58d7018ed7c670293ec1871729f214f4949ade0 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -255,7 +255,10 @@ check_install_oai_software() { openssl \ python \ subversion \ - xmlstarlet + xmlstarlet \ + python-pip \ + pydb \ + wvdial $SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so if [ `lsb_release -rs` = '12.04' ] ; then install_nettle_from_source @@ -263,6 +266,8 @@ check_install_oai_software() { else $SUDO apt-get install -y libgnutls-dev nettle-dev nettle-bin fi + $SUDO pip install paramiko + $SUDO pip install pyroute2 install_asn1c_from_source } @@ -319,3 +324,42 @@ set_openair_env(){ export OPENAIR_TARGETS=$openair_path/targets } +################################ +# Function to killall the subprocesses when Ctrl-C Key is hit +############################### +function handle_ctrl_c(){ +CURPID=$$ +ppid=$$ +arraycounter=1 +echo_info "** Trapped CTRL-C. Killing all subprocesses now..." +while true +do + FORLOOP=FALSE + # Get all the child process id + for i in `ps -ef| awk '$3 == '$ppid' { print $2 }'` + do + if [ $i -ne $CURPID ] ; then + procid[$arraycounter]=$i + arraycounter=`expr $arraycounter + 1` + ppid=$i + FORLOOP=TRUE + fi + done + if [ "$FORLOOP" = "FALSE" ] ; then + arraycounter=`expr $arraycounter - 1` + ## We want to kill child process id first and then parent id's + while [ $arraycounter -ne 0 ] + do + echo "first we send ctrl-c to program" + $SUDO kill -INT "${procid[$arraycounter]}" + sleep 5 + echo "Now we force kill if that didn't work" + $SUDO kill -9 "${procid[$arraycounter]}" >/dev/null + arraycounter=`expr $arraycounter - 1` + done + exit + fi +done +} + + diff --git a/cmake_targets/tools/init_nas_nos1 b/cmake_targets/tools/init_nas_nos1 old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/perf_oai.bash b/cmake_targets/tools/perf_oai.bash index 2254f64ea3ad11683daee822d243668bf078f29c..42d6be0716a8c3c1b4836c709d9ed52432c2262b 100755 --- a/cmake_targets/tools/perf_oai.bash +++ b/cmake_targets/tools/perf_oai.bash @@ -68,7 +68,7 @@ declare MAX_RATE=1000 # set paths to the required binaries and check if the required binaries are available ENB_CONFIG=$OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -OAISIM_EXEC=$OPENAIR_DIR/targets/bin/oaisim_nos1 +OAISIM_EXEC=$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1 BYPASSE_ITTI=0 OTGPLOT="$OPENAIR2_DIR/UTIL/OTG/OTGplot" PS2PDF="ps2pdf" @@ -301,8 +301,8 @@ oaisim_otg_stats(){ sync if [ ! -f $OAISIM_EXEC ]; then - echo_info "3.1 compiling OAISIM ($OPENAIR_TARGETS/cmake_targets/build_oai --oaisim -c)" - ($OPENAIR_TARGETS/cmake_targets/build_oai --oaisim -c >> results/perf_log.txt 2>&1 ) + echo_info "3.1 compiling OAISIM ($OPENAIR_DIR/cmake_targets/build_oai --oaisim -c --noS1)" + ($OPENAIR_DIR/cmake_targets/build_oai --oaisim -c --noS1 >> results/perf_log.txt 2>&1 ) build_stats=$? if [ $build_stats != 0 ] ; then echo_error "$OAISIM_EXEC cannot be built, check results/perf_log.txt file" diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index 134e6b28858aa3df5ad3a758415d7b967942cf6c..2dd0767d4c45c374529da8eeb645971b1aee4019 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -583,6 +583,10 @@ int main(int argc, char **argv) sprintf(bler_fname,"ULbler_mcs%d_nrb%d_ChannelModel%d_nsim%d.csv",mcs,nb_rb,chMod,n_frames); bler_fd = fopen(bler_fname,"w"); + if (bler_fd==NULL) { + fprintf(stderr,"Problem creating file %s\n",bler_fname); + exit(-1); + } fprintf(bler_fd,"#SNR;mcs;nb_rb;TBS;rate;errors[0];trials[0];errors[1];trials[1];errors[2];trials[2];errors[3];trials[3]\n"); @@ -591,13 +595,16 @@ int main(int argc, char **argv) hostname[1023] = '\0'; gethostname(hostname, 1023); printf("Hostname: %s\n", hostname); - char dirname[FILENAME_MAX]; - sprintf(dirname, "%s//SIMU/USER/pre-ci-logs-%s", getenv("OPENAIR_TARGETS"),hostname); - mkdir(dirname, 0777); - sprintf(time_meas_fname,"%s/time_meas_prb%d_mcs%d_antrx%d_channel%s_tx%d.csv", - dirname, + //char dirname[FILENAME_MAX]; + //sprintf(dirname, "%s//SIMU/USER/pre-ci-logs-%s", getenv("OPENAIR_TARGETS"),hostname); + //mkdir(dirname, 0777); + sprintf(time_meas_fname,"time_meas_prb%d_mcs%d_antrx%d_channel%s_tx%d.csv", N_RB_DL,mcs,n_rx,channel_model_input,transmission_mode); time_meas_fd = fopen(time_meas_fname,"w"); + if (time_meas_fd==NULL) { + fprintf(stderr,"Cannot create file %s!\n",time_meas_fname); + exit(-1); + } } /*