Merge remote-tracking branch 'origin/ci-physim-cleanup' into integration_2022_wk41

This commit is contained in:
Robert Schmidt
2022-10-10 16:12:43 +02:00
226 changed files with 2960 additions and 35216 deletions
-48
View File
@@ -1,48 +0,0 @@
OAI Test PLAN
Obj.# Case# Test# Description
01 pre-commit test case
01 01 Build OAI
01 01 00 Check Makefiles and
01 01 01 Build oaisim Rel8
01 01 02 Build oaisim Rel8 + network device driver(nasmesh_fix)
01 01 03 Build lte-softmode Rel8
01 01 04 Build dlsim Rel8
01 01 05 Build ulsim Rel8
01 01 06 Build oaisim Rel10
01 01 07 Build oaisim Rel8 with cellular RRC for eNB
01 01 08 Build oaisim Rel8 with cellular RRC for UE
01 01 09 "commented test in targets/TEST/OAI/case01.py"
01 01 10 "commented test in targets/TEST/OAI/case01.py"
01 01 11 "commented test in targets/TEST/OAI/case01.py"
01 01 12 "commented test in targets/TEST/OAI/case01.py"
01 01 13 Build network device driver(oai_nw_drv type ethernet)
01 01 14 Build oaisim Rel8 with RRC lite (new cellular+ITTI) + RAL (802.21)
01 01 15 Build oaisim Rel10 with RRC lite (new cellular+ITTI) + RAL (802.21)
01 02 Run OAI Rel8, and check the operation
01 02 00 Run OAI Rel8, and search for segmentation fault or exit
01 02 01 Run OAI Rel8, and search for execution errors
01 02 02 Run OAI Rel8 in abstraction mode and check that RRC proc is finished completely for the configured number of eNB and UE
01 02 03 Run OAI Rel8 in abstraction mode, send ping from from one eNB to each UE, and check that there is no packet losses
01 02 04 Run OAI Rel8 with full PHY, and check that the RRC proc for eNBsxUEs
01 02 05 Run OAI Rel8 with full PHY in FDD mode, and check that the RRC proc for eNBsxUEs
01 03 Run OAI Rel10, and check the operation
01 03 00 Run OAI Rel10, and search for segmentation fault or exit
01 03 01 Run OAI Rel10, and search for execution errors
01 03 02 Run OAI Rel10 in abstraction mode, and check the RRC proc for eNBsxUEs
01 03 03 Run OAI Rel10 in full phy mode, and check the RRC proc for eNBsxUEs
01 03 04 Run OAI Rel10 in full phy mode in FDD mode, and check the RRC proc for eNBsxUEs
01 03 05 Run OAI Rel10 with eMBMS enabled, and check the SIB13 and MCCH
01 03 06 Run OAI Rel10 with eMBMS enabled, and check the MTCH
01 03 07 Run OAI Rel10 with eMBMS enabled and FDD mode, and check the MTCH
02 Functional test case
03 Non-Functional test case
04 Failure test case
05 Performance test case
-285
View File
@@ -1,285 +0,0 @@
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
# \file case01.py
# \brief test case 01 for OAI: compilations
# \author Navid Nikaein
# \date 2013 - 2015
# \version 0.1
# @ingroup _test
import log
import openair
import core
makerr1 = '***'
makerr2 = 'Error 1'
def execute(oai, user, pw, host, logfile,logdir,debug,timeout):
case = '01'
rv = 1
oai.send_recv('cd $OPENAIR_TARGETS;')
try:
log.start()
test = '00'
name = 'Check oai.svn.add'
conf = 'svn st -q | grep makefile'
diag = 'Makefile(s) changed. If you are adding a new file, make sure that it is added to the svn'
rsp = oai.send_recv('svn st -q | grep -i makefile;')
for item in rsp.split("\n"):
if "Makefile" in item:
rsp2=item.strip() + '\n'
oai.find_false_re(rsp,'Makefile')
except log.err, e:
diag = diag + "\n" + rsp2
#log.skip(case, test, name, conf, e.value, logfile)
log.skip(case, test, name, conf, '', diag, logfile)
else:
log.ok(case, test, name, conf, '', logfile)
oai.send('cd SIMU/USER;')
oai.send('mkdir ' + logdir + ';')
try:
log.start()
test = '01'
name = 'Compile oai.rel8.make'
conf = 'make'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = "check the compilation errors for oai"
oai.send('make cleanall;')
oai.send('make cleanasn1;')
oai.send('rm -f ./oaisim.rel8.'+host)
oai.send_expect_false('make -j4 JF=1' + tee, makerr1, timeout)
oai.send('cp ./oaisim ./oaisim.rel8.'+host)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
rv = 0
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '02'
name = 'Compile oai.rel8.nas.make'
conf = 'make nasmesh_fix; make LINK_ENB_PDCP_TO_IP_DRIVER=1'
diag = 'check the compilation errors for oai and nas driver'
oai.send('make cleanall;')
oai.send('rm -f ./oaisim.rel8.nas'+host)
oai.send('rm -f ./nasmesh;')
oai.send('make nasmesh_clean;')
trace = logdir + '/log_' + case + test + '_1.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('make nasmesh_fix' + tee, makerr1, 60)
oai.send('cp $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko .')
trace = logdir + '/log_' + case + test + '_2.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('make LINK_ENB_PDCP_TO_IP_DRIVER=1 JF=1 -j4' + tee, makerr1, timeout)
oai.send('cp ./oaisim ./oaisim.rel8.nas.'+host)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
rv = 0
else:
log.ok(case, test, name, conf, '', logfile)
oai.send('cd $OPENAIR_TARGETS;')
oai.send('cd RT/USER;')
try:
log.start()
test = '03'
name = 'Compile oai.rel8.rf.make'
conf = 'make RTAI=0 EXMIMO=1 Rel8=1'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for Rel8'
oai.send('make cleanall;')
oai.send('rm -f ./oaisim.rel8.rf.'+host)
oai.send_expect_false('make RTAI=0 EXMIMO=1 -j4' + tee, makerr1, timeout)
oai.send('cp ./oaisim ./oaisim.rel8.rf.'+host)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
oai.send('cd $OPENAIR1_DIR;')
oai.send('cd SIMULATION/LTE_PHY;')
try:
log.start()
test = '04'
name = 'Compile oai.rel8.phy.dlsim.make'
conf = 'make dlsim'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for dlsim in $OPENAIR1_DIR/SIMULATION/LTE_PHY'
oai.send('make clean;')
oai.send('rm -f ./dlsim.rel8.'+host)
oai.send_expect_false('make dlsim -j4 PERFECT_CE=1' + tee, makerr1, timeout)
oai.send('cp ./dlsim ./dlsim.rel8.'+host)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
rv = 0
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '05'
name = 'Compile oai.rel8.phy.ulsim.make'
conf = 'make ulsim'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for ulsim in $OPENAIR1_DIR/SIMULATION/LTE_PHY'
oai.send('make clean;')
oai.send('rm -f ./ulsim.rel8.'+host)
oai.send_expect_false('make ulsim -j4' + tee, makerr1, timeout)
oai.send('cp ./ulsim ./ulsim.rel8.'+host)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
rv = 0
else:
log.ok(case, test, name, conf, '', logfile)
oai.send('cd $OPENAIR_TARGETS;')
oai.send('cd SIMU/USER;')
try:
log.start()
test = '06'
name = 'Compile oai.rel8.itti.make'
conf = 'make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 Rel8=1'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for ITTI Rel8'
oai.send('make clean;')
oai.send('rm -f ./oaisim.rel8.itti.'+host)
oai.send_expect_false('make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 Rel8=1 -j4' + tee, makerr1, timeout)
oai.send('cp ./oaisim ./oaisim.rel8.itti.'+host)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
rv = 0
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '07'
name = 'Compile oai.rel10.make'
conf = 'make RLC_STOP_ON_LOST_PDU=1 Rel10=1'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for Rel10'
oai.send('make clean;')
oai.send('make cleanall;')
oai.send('make cleanasn1;')
oai.send('rm -f ./oaisim.rel10.'+host)
oai.send_expect_false('make RLC_STOP_ON_LOST_PDU=1 Rel10=1 -j4' + tee, makerr1, timeout)
oai.send('cp ./oaisim ./oaisim.rel10.'+host)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
rv = 0
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '08'
name = 'Compile oai.rel10.itti.make'
conf = 'make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for ITTI Rel10'
oai.send('make cleanall;')
oai.send('rm -f ./oaisim.rel10.itti.'+host)
oai.send_expect_false('make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1 -j4' + tee, makerr1, timeout)
oai.send('cp ./oaisim ./oaisim.rel10.itti.'+host)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
rv = 0
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '13'
name = 'Compile oai_nw_ether IP driver'
conf = 'make oai_nw_drv'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for ITTI Rel8'
oai.send('make clean;')
oai.send('make cleanall;')
oai.send('make cleanasn1;')
oai.send('rm -f ./oai_nw_drv;')
oai.send('make oai_nw_drv_clean;')
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('make oai_nw_drv' + tee, makerr1, 60)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '14'
name = 'Compile oai.rel8.itti.ral.make'
conf = 'make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel8=1'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for ITTI Rel8'
oai.send('make clean;')
oai.send('make cleanall;')
oai.send('make cleanasn1;')
oai.send('rm -f ./oaisim.rel8.itti.ral.'+host)
oai.send_expect_false('make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel8=1 -j4' + tee, makerr1, timeout)
oai.send('cp ./oaisim ./oaisim.rel8.itti.ral.'+host)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '15'
name = 'Compile oai.rel10.itti.ral.make'
conf = 'make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for ITTI Rel10'
oai.send('make clean;')
oai.send('make cleanall;')
oai.send('make cleanasn1;')
oai.send('rm -f ./oaisim.rel10.itti.ral.'+host)
oai.send_expect_false('make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1 -j4' + tee, makerr1, timeout)
oai.send('cp ./oaisim ./oaisim.rel10.itti.ral.'+host)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
return rv
-247
View File
@@ -1,247 +0,0 @@
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
# \file case02.py
# \brief test case 02 for OAI: executions
# \author Navid Nikaein
# \date 2013 - 2015
# \version 0.1
# @ingroup _test
import time
import random
import log
import openair
import core
NUM_UE=2
NUM_eNB=1
NUM_TRIALS=3
def execute(oai, user, pw, host, logfile,logdir,debug):
case = '02'
oai.send('cd $OPENAIR_TARGETS;')
oai.send('cd SIMU/USER;')
try:
log.start()
test = '00'
name = 'Run oai.rel8.sf'
conf = '-a -A AWGN -n 100'
diag = 'OAI is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed'
trace = logdir + '/log_' + host + case + test + '_1.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./oaisim.rel8.' + host + ' ' + conf + tee, 'Segmentation fault', 30)
trace = logdir + '/log_' + host + case + test + '_2.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./oaisim.rel8.' + host + ' ' + conf + tee, 'Exiting', 30)
trace = logdir + '/log_' + host + case + test + '_3.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./oaisim.rel8.' + host + ' ' + conf + tee, 'FATAL', 30)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '01'
name = 'Run oai.rel8.err'
conf = '-a -A AWGN -n 100 '
trace = logdir + '/log_' + host + case + test + '_1.txt;'
tee = ' 2>&1 | tee ' + trace
diag = '[E] Error(s) found during the execution, check the execution logs'
oai.send_expect_false('./oaisim.rel8.'+ host + ' ' + conf, '[E]', 30)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '02'
name = 'Run oai.rel8.tdd.5MHz.rrc.abs'
diag = 'RRC procedure is not finished completely, check the execution logs and trace BCCH, CCCH, and DCCH channels'
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-a -A AWGN -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1)
trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel8.' + host + ' ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i), (i+1) * 100)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '03'
name = 'Run oai.rel8.tdd.5MHz.rrc.itti.abs'
diag = 'RRC procedure is not finished completely, check the eNB config file (default is enb.band7.generic.conf), in addition to the execution logs and trace BCCH, CCCH, and DCCH channels'
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
log_name = logdir + '/log_' + host + case + test + '_' + str(i) + str(j)
itti_name = log_name + '.log'
trace_name = log_name + '.txt'
conf = '-a -l7 -A AWGN --enb-conf ../../PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.conf -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1) + ' -K' + itti_name
tee = ' 2>&1 | tee ' + trace_name
command = './oaisim.rel8.itti.' + host + ' ' + conf
oai.send('echo ' + command + ' > ' + trace_name + ';')
oai.send_expect(command + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i), (i+1) * 500)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile, trace_name)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test='04'
name = 'Run oai.rel8.tdd.5MHz.abs.ocg.otg'
diag = 'Check the scenario if the test 0202 is passed.'
conf = '-a -c26'
trace = logdir + '/log_' + host + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel8.' + host + ' ' + conf + tee, ' DL and UL loss rate below 10 ', 500)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test='05'
name = 'Run oai.rel8.fdd.5MHz.abs.ocg.otg'
diag = 'Check the template 26 and the results of test 0202.'
conf = '-a -F -c26'
trace = logdir + '/log_' + host + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel8.' + host + ' ' + conf + tee, ' DL and UL loss rate below 10 ', 500)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '06'
name = 'Run oai.rel8.tdd.5MHz.abs.ping'
diag = 'Data-plane is not working normally, check the OAI protocol stack, OAI driver, and normal operation of the OS'
oai.driver(oai,user,pw)
for i in range(NUM_eNB) :
for j in range(NUM_UE) :
conf = '-a -A AWGN -u' + str(j+1) +' -b'+ str(i+1)
trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt;'
tee = ' 2>&1 > ' + trace
if user == 'root' :
oai.send_nowait('./oaisim.rel8.nas.' + host + ' ' + conf + ' &')
else :
oai.send_nowait('echo '+pw+ ' | sudo -S -E ./oaisim.rel8.nas.'+ host + ' ' + conf + tee + ' &')
time.sleep(10)
for k in range(NUM_TRIALS) :
trace_ping = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + str(k) + '_ping.txt;'
tee_ping = ' 2>&1 | tee ' + trace_ping
oai.send_expect('ping 10.0.'+str(j+1)+'.'+str(NUM_eNB+i+1) + ' -c ' + str(random.randint(2, 10))+ ' -s ' + str(random.randint(128, 1500)) + tee_ping, ' 0% packet loss', 20)
if user == 'root' :
oai.send('pkill -f oaisim.rel8.nas.'+host)
time.sleep(1)
oai.send('pkill -f oaisim.rel8.nas.'+host)
else :
oai.send('pkill -f oaisim.rel8.nas.'+host)
time.sleep(1)
oai.send('echo '+pw+ ' | sudo -S pkill -f oaisim.rel8.nas.'+host)
time.sleep(1)
oai.send('echo '+pw+ ' | sudo -S pkill -f oaisim.rel8.nas.'+host)
time.sleep(1)
oai.rm_driver(oai,user,pw)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '07'
name = 'Run oai.rel8.tdd.5MHz.phy.rrc'
diag = 'RRC procedure is not finished completely, check the execution logs and trace BCCH, CCCH, and DCCH channels'
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-A AWGN -n' + str((i+1+j) * 100) + ' -u' + str(i+1) +' -b'+ str(j+1) + ' -x1'
trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel8.' + host + ' ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i), (i+1) * 500)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '08'
name = 'Run oai.rel8.fdd.5MHz.phy.rrc'
diag = 'RRC procedure is not finished completely in FDD mode, check the execution logs and trace BCCH, CCCH, and DCCH channels'
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-A AWGN -F -n' + str((i+1+j) * 100) + ' -u' + str(i+1) +' -b'+ str(j+1) + ' -x1'
trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel8.' + host + ' ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i), (i+1) * 500)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '09'
name = 'Run oai.rel8.fdd.10MHz.phy.rrc'
diag = 'RRC procedure is not finished completely, check th execution logs and trace BCCH, CCCH, and DCCH channels and the results of test 0204'
conf = '-A AWGN -F -R 50 -n 150 -u 1 -b 1 -x1'
trace = logdir + '/log_' + host + case + test + '_1.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel8.' + host + ' ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE 0', 600)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '10'
name = 'Run oai.rel8.fdd.20MHz.phy.rrc'
diag = 'RRC procedure is not finished completely, check th execution logs and trace BCCH, CCCH, and DCCH channels and the results of test 0204'
conf = '-A AWGN -F -R 100 -n 200 -u 1 -b 1 -x1'
trace = logdir + '/log_' + host + case + test + '_1.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel8.' + host + ' ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE 0', 700)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
-208
View File
@@ -1,208 +0,0 @@
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
# \file case03.py
# \brief test case 03 for OAI: executions
# \author Navid Nikaein
# \date 2013
# \version 0.1
# @ingroup _test
import time
import random
import log
import openair
import core
NUM_UE=2
NUM_eNB=1
NUM_TRIALS=3
def execute(oai, user, pw, host, logfile,logdir,debug):
case = '03'
oai.send('cd $OPENAIR_TARGETS;')
oai.send('cd SIMU/USER;')
try:
log.start()
test = '00'
name = 'Run oai.rel10.sf'
conf = '-a -A AWGN -l7 -n 100'
diag = 'OAI is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed'
trace = logdir + '/log_' + host + case + test + '_1.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./oaisim.rel10.' + host + ' ' + conf + tee, 'Segmentation fault', 30)
trace = logdir + '/log_' + host + case + test + '_2.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./oaisim.rel10.' + host + ' ' + conf + tee, 'Exiting', 30)
trace = logdir + '/log_' + host + case + test + '_3.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./oaisim.rel10.' + host + ' ' + conf + tee, 'FATAL', 30)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '01'
name = 'Run oai.rel10.err'
conf = '-a -A AWGN -l7 -n 100'
trace = logdir + '/log_' + host + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'Error(s) found in the execution, check the execution logs'
oai.send_expect_false('./oaisim.rel10.' + host + ' ' + conf + tee, '[E]', 30)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '02'
name = 'Run oai.rel10.tdd.5MHz.abs.rrc'
diag = 'RRC procedure is not finished completely, check the execution logs and trace BCCH, CCCH, and DCCH channels'
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-a -l7 -A AWGN -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1)
trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel10.' + host + ' ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i), (i+1) * 100)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '03'
name = 'Run oai.rel10.tdd.5MHz.phy.rrc'
diag = 'RRC procedure is not finished completely, check the execution logs and trace BCCH, CCCH, and DCCH channels'
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-A AWGN -l7 -x 1 -n' + str((i+1+j) * 100) + ' -u' + str(i+1) +' -b'+ str(j+1)
trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel10.' + host + ' ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i), (i+1) * 500)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '04'
name = 'Run oai.rel10.fdd.5MHz.phy.rrc'
diag = 'RRC procedure is not finished completely in FDD mode, check the execution logs and trace BCCH, CCCH, and DCCH channels'
for i in range(NUM_UE) :
for j in range(NUM_eNB) :
conf = '-A AWGN -l7 -F -x 1 -n' + str((i+1+j) * 100) + ' -u' + str(i+1) +' -b'+ str(j+1)
trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./oaisim.rel10.' + host + ' ' + conf + tee, ' Received RRCConnectionReconfigurationComplete from UE ' + str(i), (i+1) * 500)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
# try:
# test = '05'
# name = 'Run oai.rel10.phy.eMBMS.MCCH'
# diag = 'eMBMS procedure is not finished completely, make sure that the SIB13/MCCH have been correclty received by UEs'
# for i in range(NUM_UE) :
# for j in range(NUM_eNB) :
# conf = '-A AWGN -l7 -x 1 -Q3 -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1)
# trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt'
# tee = ' 2>&1 | tee ' + trace
# oai.send_expect('./oaisim.rel10.' + host + ' ' + conf + tee, ' Found MBSFNAreaConfiguration from eNB ' + str(j), (i+1) * 200)
# except log.err, e:
# log.fail(case, test, name, conf, e.value, diag, logfile,trace)
# else:
# log.ok(case, test, name, conf, '', logfile)
# try:
# test = '06'
# name = 'Run oai.rel10.phy.eMBMS.OTG'
# diag = 'eMBMS multicast/broadcast data is not received, make sure that the SIB13/MCCH/MTCH have been correclty received by UEs'
# for i in range(NUM_UE) :
# for j in range(NUM_eNB) :
# conf = '-A AWGN -l7 -x 1 -T mscbr -Q3 -n' + str((i+1+j) * 100) + ' -u' + str(i+1) +' -b'+ str(j+1)
# trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt'
# tee = ' 2>&1 | tee ' + trace
# oai.send_expect('./oaisim.rel10.' + host + ' ' + conf + tee, ' Received a multicast packet', (i+1) * 200)
# except log.err, e:
# log.fail(case, test, name, conf, e.value, diag, logfile,trace)
# else:
# log.ok(case, test, name, conf, 'Note: check the packet loss from the OTG stats', logfile)
# try:
# test = '07'
# name = 'Run oai.rel10.phy.eMBMS.OTG.fdd'
# diag = 'eMBMS multicast/broadcast data is not received in fdd mode, make sure that the SIB13/MCCH/MTCH have been correclty received by UEs'
# for i in range(NUM_UE) :
# for j in range(NUM_eNB) :
# conf = '-A AWGN -l7 -F -x 1 -T mscbr -Q3 -n' + str((i+1+j) * 100) + ' -u' + str(i+1) +' -b'+ str(j+1)
# trace = logdir + '/log_' + host + case + test + '_' + str(i) + str(j) + '.txt'
# tee = ' 2>&1 | tee ' + trace
# oai.send_expect('./oaisim.rel10.' + host + ' ' + conf + tee, ' Received a multicast packet', (i+1) * 200)
# except log.err, e:
# log.fail(case, test, name, conf, e.value, diag, logfile,trace)
# else:
# log.ok(case, test, name, conf, 'Note: check the packet loss from the OTG stats', logfile)
# try:
# test = '08'
# name = 'Run oai.rel10.phy.eMBMS.Relay.OTG.fdd'
# diag = 'eMBMS multicast/broadcast DF relaying is not working properly in fdd mode, make sure that the SIB13/MCCH/MTCH have been correclty received by UEs'
# conf = '-c43 -F -T mbvbr -Q4 -j1 -n120'
# tee = ' | tee ' + logs_dir + '/log_' + case + test + '.txt'
# oai.send_expect('./oaisim.rel10 ' + conf + tee, ' MTCH for sync area 1', 100)
# except log.err, e:
# log.fail(case, test, name, conf, e.value, diag, logfile)
# else:
# log.ok(case, test, name, conf, 'Note: check the packet loss from the OTG stats', logfile)
# try:
# test = '09'
# name = 'Run oai.rel10.itti.phy.eMBMS.MCCH'
# diag = 'eMBMS procedure is not finished completely, check the eNB config file (enb.band7.generic.conf), and make sure that the SIB13/MCCH have been correclty received by UEs'
# for i in range(NUM_UE) :
# for j in range(NUM_eNB) :
# log_name = logdir + '/log_' + host + case + test + '_' + str(i) + str(j)
# itti_name = log_name + '.log'
# trace_name = log_name + '.txt'
# conf = '-A AWGN -l7 -x 1 -Q3 --enb-conf ../../PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.conf -n' + str((i+1+j) * 50) + ' -u' + str(i+1) +' -b'+ str(j+1) + ' -K' + itti_name
# tee = ' 2>&1 | tee -a ' + trace_name
# command = './oaisim.rel10.itti.' + host + ' ' + conf
# oai.send('echo ' + command + ' > ' + trace_name + ';')
# oai.send_expect(command + tee, ' Found MBSFNAreaConfiguration from eNB ' + str(j), (i+1) * 200)
# except log.err, e:
# log.fail(case, test, name, conf, e.value, diag, logfile, trace_name)
# else:
# log.ok(case, test, name, conf, '', logfile)
-201
View File
@@ -1,201 +0,0 @@
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
# \file case04.py
# \brief test case 04 for OAI: executions
# \author Navid Nikaein
# \date 2013 - 2015
# \version 0.1
# @ingroup _test
import time
import random
import log
import openair
import core
NUM_UE=2
NUM_eNB=1
NUM_TRIALS=3
def execute(oai, user, pw, host, logfile,logdir,debug):
case = '04'
oai.send('cd $OPENAIR1_DIR;')
oai.send('cd SIMULATION/LTE_PHY;')
try:
log.start()
test = '00'
name = 'Perf oai.dlsim.sanity'
conf = '-a -A AWGN -n 100'
diag = 'dlsim is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed'
trace = logdir + '/log_' + host + case + test + '_1.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./dlsim.rel8.' + host + ' ' + conf + tee, 'Segmentation fault', 30)
trace = logdir + '/log_' + host + case + test + '_2.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./dlsim.rel8.' + host + ' ' + conf + tee, 'Exiting', 30)
trace = logdir + '/log_' + host + case + test + '_3.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./dlsim.rel8.' + host + ' ' + conf + tee, 'FATAL', 30)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '01'
name = 'Perf oai.dlsim.test1'
diag = 'Test 1, 10 MHz, R2.FDD (MCS 5), EVA5, -1dB'
conf = '-m5 -gF -s-1 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70 -L'
trace = logdir + '/log_' + host + case + test +'.txt'
tee = ' 2>&1 | tee ' + trace
cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
oai.send_expect(cmd, 'passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
# try:
# test = '05'
# name = 'Perf oai.dlsim.test5'
# diag = 'Test 5, 1.4 MHz, R4.FDD (MCS 4), EVA5, 0dB (70%)'
# conf = '-m4 -gF -s0 -w1.0 -f.2 -n500 -B6 -c4 -z2 -O70'
# trace = logdir + '/log_' + host + case + test + '.txt'
# tee = ' 2>&1 | tee ' + trace
# cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
# oai.send_expect(cmd, 'passed', 150)
# except log.err, e:
# log.fail(case, test, name, conf, e.value, diag, logfile,trace)
# else:
# log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '06'
name = 'Perf oai.dlsim.test6'
diag = 'Test 6, 10 MHz, R3.FDD (MCS 15), EVA5, 6.7dB (70%)'
conf = '-m15 -gF -s6.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70 -L'
trace = logdir + '/log_' + host + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
oai.send_expect(cmd, 'passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '06b'
name = 'Perf oai.dlsim.test6b'
diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (70%)'
conf = '-m14 -gF -s6.7 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70 -L'
trace = logdir + '/log_' + host + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
oai.send_expect(cmd, 'passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '07'
name = 'Perf oai.dlsim.test7'
diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (30%)'
conf = '-m15 -gG -s6.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O30 -L'
trace = logdir + '/log_' + host + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
oai.send_expect(cmd, 'passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '07b'
name = 'Perf oai.dlsim.test7b'
diag = 'Test 7b, 5 MHz, R3-1.FDD (MCS 15), ETU70, 1.4 dB (30%)'
conf = '-m14 -gG -s1.4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O30 -L'
trace = logdir + '/log_' + host + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
oai.send_expect(cmd, 'passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '10'
name = 'Perf oai.dlsim.test10'
diag = 'Test 10, 5 MHz, R6.FDD (MCS 25), EVA5, 17.4 dB (70%)'
conf = '-m25 -gF -s17.4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70 -L'
trace = logdir + '/log_' + host + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
oai.send_expect(cmd, 'passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '10b'
name = 'Perf oai.dlsim.test10b'
diag = 'Test 10b, 5 MHz, R6-1.FDD (MCS 24,18 PRB), EVA5, 17.5dB (70%)'
conf = '-m25 -gF -s17.5 -w1.0 -f.2 -n500 -B25 -c3 -z2 -r1022 -O70 -L'
trace = logdir + '/log_' + host + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
oai.send_expect(cmd, 'passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '11'
name = 'Perf oai.dlsim.test11'
diag = 'Test 11, 10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%)'
conf = '-m26 -gF -s17.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70 -L'
trace = logdir + '/log_' + host + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
cmd = 'taskset -c 0 ./dlsim.rel8.' + host + ' ' + conf + tee
oai.send_expect(cmd, 'passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
-163
View File
@@ -1,163 +0,0 @@
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
# \file case05.py
# \brief test case 05 for OAI: executions
# \author Navid Nikaein
# \date 2013 - 2015
# \version 0.1
# @ingroup _test
import time
import random
import log
import openair
import core
NUM_UE=2
NUM_eNB=1
NUM_TRIALS=3
def execute(oai, user, pw, host,logfile,logdir,debug):
case = '04'
oai.send('cd $OPENAIR1_DIR;')
oai.send('cd SIMULATION/LTE_PHY;')
try:
log.start()
test = '00'
name = 'Perf oai.ulsim.sanity'
conf = '-a -A AWGN -n 100'
diag = 'ulsim is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed'
trace = logdir + '/log_' + host + case + test + '_1.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./ulsim.rel8.' + host + ' ' + conf + tee, 'Segmentation fault', 30)
trace = logdir + '/log_' + host + case + test + '_2.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./ulsim.rel8.' + host + ' ' + conf + tee, 'Exiting', 30)
trace = logdir + '/log_' + host + case + test + '_3.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./ulsim.rel8.' + host + ' ' + conf + tee, 'FATAL', 30)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '01'
name = 'Perf oai.ulsim.test1'
diag = 'Test 1, 5 MHz, FDD (MCS 5), AWGN, 6dB'
conf = '-B25 -m5 -y1 -gN -x1 -s6 -w1.0 -e.1 -P -n500 -O70 -L'
trace = logdir + '/log_' + host + case + test +'.txt'
tee = ' 2>&1 | tee ' + trace
#print test + 'not performed'
cmd = 'taskset -c 0 ./ulsim.rel8.' + host + ' ' + conf + tee
oai.send_expect(cmd, 'passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '02'
name = 'Perf oai.ulsim.test2'
diag = 'Test 2, 5 MHz, FDD (MCS 16), AWGN , 12dB (70%)'
conf = '-B25 -m16 -y1 -gN -x1 -s12 -w1.0 -e.1 -P -n500 -O70 -L'
trace = logdir + '/log_' + host + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
#print test + 'not performed'
cmd = 'taskset -c 0 ./ulsim.rel8.' + host + ' ' + conf + tee
oai.send_expect(cmd, 'passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '03'
name = 'Perf oai.ulsim.test3'
diag = 'Test 3, 10 MHz, R3.FDD (MCS 5), AWGN, 6dB (70%)'
conf = '-B50 -m5 -y1 -gN -x1 -s6 -w1.0 -e.1 -P -n500 -O70 -L'
trace = logdir + '/log_' + host + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
#print test + 'not performed'
cmd = 'taskset -c 0 ./ulsim.rel8.' + host + ' ' + conf + tee
oai.send_expect(cmd, 'passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '04'
name = 'Perf oai.ulsim.test4'
diag = 'Test 4, 10 MHz, R3-1.FDD (MCS 16), AWGN, 12dB (70%)'
conf = '-B50 -m16 -y1 -gN -x1 -s12 -w1.0 -e.1 -P -n500 -O70 -L'
trace = logdir + '/log_' + host + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
#print test + 'not performed'
cmd = 'taskset -c 0 ./ulsim.rel8.' + host + ' ' + conf + tee
oai.send_expect(cmd, 'passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '05'
name = 'Perf oai.ulsim.test7'
diag = 'Test 5, 20 MHz, FDD (MCS 5), AWGN, 6dB (70%)'
conf = '-B100 -m5 -y1 -gN -x1 -s6 -w1.0 -e.1 -P -n500 -O70 -L'
trace = logdir + '/log_' + host + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
#print test + 'not performed'
cmd = 'taskset -c 0 ./ulsim.rel8.' + host + ' ' + conf + tee
oai.send_expect(cmd, 'passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '06'
name = 'Perf oai.ulsim.test10'
diag = 'Test 06, 20 MHz, FDD (MCS 16), AWGN, 12 dB (70%)'
conf = '-B100 -m16 -y1 -gN -x1 -s12 -w1.0 -e.1 -P -n500 -O70 -L'
trace = logdir + '/log_' + host + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
#print test + 'not performed'
cmd = 'taskset -c 0 ./ulsim.rel8.' + host + ' ' + conf + tee
oai.send_expect(cmd, 'passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
-81
View File
@@ -1,81 +0,0 @@
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
# \file case01.py
# \brief test case 01 for OAI: compilations
# \author Navid Nikaein
# \date 2014
# \version 0.1
# @ingroup _test
import log
import openair
import core
makerr1 = '***'
makerr2 = 'Error 1'
def execute(oai, user, pw, host,logfile,logdir,debug):
case = '101'
rv = 1;
oai.send('cd $OPENAIR1_DIR;')
oai.send('cd SIMULATION/LTE_PHY;')
try:
log.start()
test = '01'
name = 'Compile oai.rel8.phy.dlsim.make'
conf = 'make dlsim' # PERFECT_CE=1 # for perfect channel estimation
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for dlsim in $OPENAIR1_DIR/SIMULATION/LTE_PHY'
oai.send('make clean; make cleanall;')
oai.send('rm -f ./dlsim.rel8.'+host)
oai.send_expect_false('make dlsim -j4' + tee, makerr1, 1500)
oai.send('cp ./dlsim ./dlsim.rel8.'+host)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
rv =0
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '02'
name = 'Compile oai.rel8.phy.ulsim.make'
conf = 'make ulsim'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for ulsim in $OPENAIR1_DIR/SIMULATION/LTE_PHY'
oai.send('make cleanall;')
oai.send('rm -f ./ulsim.rel8.'+host)
oai.send_expect_false('make ulsim -j4' + tee, makerr1, 1500)
oai.send('cp ./ulsim ./ulsim.rel8.'+host)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
rv = 0
else:
log.ok(case, test, name, conf, '', logfile)
return rv
-143
View File
@@ -1,143 +0,0 @@
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
# \file case02.py
# \brief test case 02 for OAI: executions
# \author Navid Nikaein
# \date 2013
# \version 0.1
# @ingroup _test
import time
import random
import log
import openair
import core
import os
import shutil # copy file
NUM_UE=1
NUM_eNB=1
NUM_TRIALS=3
PRB=[25,50,100]
MCS=[0,4,9,10,13,16,17,22,27]
#PRB=[100]
#MCS=[27]
#SNR=[0,0,0,0,0,0,0,0,0]
ANT_TX=2 # 2
ANT_RX=2 # 2
PDCCH=2 #, 2, 3, 4
CHANNEL=["N"]
#CHANNEL=["C","E","F","G","H","I","L","M"]
TX_MODE=2 # 2,
MIN_SNR=0
MAX_SNR=40
PERF=75
OPT="-L"
FRAME=2000
#OPT="-L -d" # 8bit decoder , activate dci decoding at UE
def execute(oai, user, pw, host, logfile,logdir,debug,cpu):
case = '10'
oai.send('cd $OPENAIR1_DIR;')
oai.send('cd SIMULATION/LTE_PHY;')
try:
log.start()
test = '200'
name = 'Run oai.dlsim.sanity'
conf = '-a -n 100'
diag = 'dlsim is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed'
trace = logdir + '/log_' + host + case + test + '_1.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./dlsim.rel8.'+ host + ' ' + conf + tee, 'Segmentation fault', 30)
trace = logdir + '/log_' + host + case + test + '_2.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./dlsim.rel8.'+ host + ' ' + conf + tee, 'Exiting', 30)
trace = logdir + '/log_' + host + case + test + '_3.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./dlsim.rel8.'+ host + ' ' + conf + tee, 'FATAL', 30)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = 210
name = 'Run oai.dlsim.perf.'+str(PERF)+'%'
diag = 'no diagnostic is available, check the log file'
for i in range(len(PRB)):
for o in range(len(CHANNEL)):
MIN_SNR = 0
for j in range(len(MCS)):
for k in range(1,ANT_TX):
for m in range (1,ANT_RX):
for n in range(1,PDCCH):
for p in range(1,TX_MODE):
for q in range(MIN_SNR,MAX_SNR):
#if if PRB[i] :
conf = '-B' + str(PRB[i]) + ' -m'+str(MCS[j]) + ' -y'+str(k) + ' -z'+str(m) +' -c'+str(n) + ' -g'+str(CHANNEL[o]) + ' -x'+str(p) + ' -s'+str(q) + ' -w1.0 -f.1 -P -n'+str(FRAME)+' -O'+str(PERF) +' '+ OPT
trace = logdir + '/time_meas' + '_prb'+str(PRB[i])+'_mcs'+ str(MCS[j])+ '_anttx' + str(k)+ '_antrx' + str(m) + '_pdcch' + str(n) + '_channel' +str(CHANNEL[o]) + '_tx' +str(p) + '_snr' +str(q)+'.'+case+str(test)+ '.log'
tee = ' 2>&1 | tee ' + trace
if cpu > -1 :
cmd = 'taskset -c '+ str(cpu) + ' ./dlsim.rel8.'+ host + ' ' + conf + tee
else :
cmd = './dlsim.rel8.'+ host + ' ' + conf + tee
if debug :
print cmd
match = oai.send_expect_re(cmd, 'passed', 0, 1000)
if match :
#SNR[j]=q
log.ok(case, str(test), name, conf, '', logfile)
MIN_SNR = q -1 # just to speed up the test
test+=1
break # found the smallest snr
else :
if q == MAX_SNR -1 :
log.skip(case,str(test), name, conf,'','',logfile)
test+=1
break # do not remove the last log file
try:
if os.path.isfile(trace) :
os.remove(trace)
except OSError, e: ## if failed, report it back to the user ##
print ("Error: %s - %s." % (e.filename,e.strerror))
except log.err, e:
log.fail(case, str(test), name, conf, e.value, diag, logfile,trace)
#else:
# log.ok(case, test, name, conf, '', logfile)
-143
View File
@@ -1,143 +0,0 @@
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
# \file case02.py
# \brief test case 02 for OAI: executions
# \author Navid Nikaein
# \date 2013
# \version 0.1
# @ingroup _test
import time
import random
import log
import openair
import core
import os
import shutil # copy file
NUM_UE=1
NUM_eNB=1
NUM_TRIALS=3
PRB=[25,50,100]
MCS=[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28]
#MCS=[0,4,9,10,13,16,17,22,27]
#PRB=[100]
#MCS=[16]
ANT_TX=2 # 2
ANT_RX=2 # 2
CHANNEL=["N"]
#CHANNEL=["C","E","F","G","H","I","L","M"] # A,B,C,D,E,F,
TX_MODE=2 # 2,
MIN_SNR=10
MAX_SNR=40
PERF=75
OPT="-L"
FRAME=2000
#OPT="-L -d" # 8bit decoder , activate dci decoding at UE
def execute(oai, user, pw, host,logfile,logdir,debug,cpu):
case = '10'
oai.send('cd $OPENAIR_TARGETS;')
oai.send('cd bin;')
oai.send('cp ./ulsim.Rel10 ./ulsim.Rel10.'+host)
try:
log.start()
test = '300'
name = 'Run oai.ulsim.sanity'
conf = '-a -n 100'
diag = 'ulsim is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed'
trace = logdir + '/log_' + host + case + test + '_1.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./ulsim.Rel10.'+ host + ' ' + conf + tee, 'Segmentation fault', 30)
trace = logdir + '/log_' + host + case + test + '_2.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./ulsim.Rel10.'+ host + ' ' + conf + tee, 'Exiting', 30)
trace = logdir + '/log_' + host + case + test + '_3.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./ulsim.Rel10.'+ host + ' ' + conf + tee, 'FATAL', 30)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = 310
name = 'Run oai.ulsim.perf.'+str(PERF)+'%'
diag = 'no diagnostic is available, check the log file'
for i in range(len(PRB)):
for o in range(len(CHANNEL)):
MIN_SNR=10
for j in range(len(MCS)):
for m in range (1,ANT_RX):
for p in range(1,TX_MODE):
for r in range(5,PRB[i]):
for q in range(MIN_SNR,MAX_SNR):
if r ==7 or r ==11 or r ==14 or r == 17 or r==19 or r == 21 or r == 23 or r == 26 or r == 28 :
continue
conf = '-B' + str(PRB[i]) + ' -r'+str(r) + ' -m'+str(MCS[j]) + ' -y'+str(m) + ' -g'+str(CHANNEL[o]) + ' -x'+str(p) + ' -s'+str(q) + ' -w1.0 -e.1 -P -n'+str(FRAME)+' -O'+str(PERF)+' '+ OPT
trace = logdir + '/time_meas' + '_prb'+str(PRB[i])+ '_rb'+str(r)+'_mcs'+ str(MCS[j])+ '_antrx' + str(m) + '_channel' +str(CHANNEL[o]) + '_tx' +str(p) + '_snr' +str(q)+'.'+case+str(test)+ '.log'
tee = ' 2>&1 | tee ' + trace
if cpu > -1 :
cmd = 'taskset -c ' + str(cpu) + ' ./ulsim.Rel10.'+ host + ' ' + conf + tee
else :
cmd = './ulsim.Rel10.'+ host + ' ' + conf + tee
if debug :
print cmd
match = oai.send_expect_re(cmd, 'passed', 0, 1000)
#match =1
if match :
log.ok(case, str(test), name, conf, '', logfile)
MIN_SNR = q - 1 # just to speed up the test
test+=1
break # found the smallest snr
else :
if q == MAX_SNR -1 :
log.skip(case,str(test), name, conf,'','',logfile)
test+=1
break
try:
if os.path.isfile(trace) :
os.remove(trace)
except OSError, e: ## if failed, report it back to the user ##
print ("Error: %s - %s." % (e.filename,e.strerror))
except log.err, e:
log.fail(case, str(test), name, conf, e.value, diag, logfile,trace)
#else:
# log.ok(case, test, name, conf, '', logfile)
-334
View File
@@ -1,334 +0,0 @@
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
# \file core.py
# \brief OAI core testing class that provides various primitives to send/recv cmd to openair class searching for patterns and process the responses and tag the test case as passed/failed/skipped
# \author Navid Nikaein
# \date 2013
# \version 0.1
# @ingroup _test
import pexpect
import time
import re
import string
import sys
import os
import openair
import log
class core:
def __init__(self):
self.send_cr = 1
self.expect_echo = 0
self.expect_response = 1
self.flag_errors = 1
self.log = None
def clean(self, obj):
if type(obj) is str:
return obj
else:
return repr(obj)
def mark(self, marker):
if self.log:
print >> self.log, "\n\n{" + marker + "}\n\n"
def expected(self, expected, got):
return "================================= Failure ===================================\n"+\
"_________________________________ Expected __________________________________\n"+\
"--->" + expected + "<-\n" +\
"_________________________________ Received __________________________________\n"+\
"--->" + got + "<-\n" +\
"=============================================================================\n"
def unexpected(self, notexpected, got):
return "================================= Failure ===================================\n"+\
"__________________________ not expect to find _______________________________\n"+\
"---> " + self.clean(notexpected) + "\n" +\
"_________________________________ Received___________________________________\n"+\
"---> " + self.clean(got) + "\n" +\
"=============================================================================\n"
def failed(self, command, expect,debug):
time.sleep(2)
ret = "================================= Failure =================================\n"
ret +="_________________________________ Sent ____________________________________\n"
ret +="---> " + command + "\n"
ret +="______________________________Searching for _______________________________\n"
ret +="---> " + self.clean(expect) + "\n"
if debug >= 1 :
ret +="________________________________ Received _________________________________\n"
ret +="---> " + self.clean(self.oai.before) + "\n"
ret +="_______________________________ Remaining _________________________________\n"
ret +="---> " + self.clean(self.oai.after) + "\n"
ret +="===========================================================================\n"
return ret
def err(self, command):
return "============================ Error received ================================\n"+\
"__________________________________ Sent ____________________________________\n"+\
'---> ' + command + "\n"+\
"_________________________________ Error was ________________________________\n"+\
"---> " + self.oai.before + "\n" +\
"============================================================================\n"
def wait_quiet(self, timeout=0.5):
while 1:
try:
self.oai.expect(['..*'], timeout=0.5)
except pexpect.TIMEOUT, e:
return
# print '[Flushing ' + self.oai.after + ']'
# **************************Send*****************************
# 1) send a command and return, do not wait
# ************************************************************
def send_nowait(self, command):
rsp1 = self.prompt1
rsp2 = self.prompt2
self.wait_quiet()
if self.send_cr:
log.stats['cmd'] += 1
self.oai.sendline(command)
else:
self.oai.send(command)
# **************************Send*****************************
# 1) send a command
# 2) wait for a return prompt. Don't capture the response.
# 3) Check for error or timeout.
# ************************************************************
def send(self, command, timeout = 50, rsp1=None, rsp2=None,debug=0):
if not rsp1:
rsp1 = self.prompt1
if not rsp2:
rsp2 = self.prompt2
self.wait_quiet()
if self.send_cr:
log.stats['cmd'] += 1
self.oai.sendline(command)
else:
self.oai.send(command)
if self.expect_echo:
#cmd = self.oai.expect([re.escape(command), pexpect.TIMEOUT], timeout=timeout);
cmd = self.oai.expect_exact([command, pexpect.TIMEOUT], timeout=timeout);
if cmd != 0:
raise log.err(self.failed(command, command,debug))
if self.expect_response:
#index = self.oai.expect([re.escape(rsp1), re.escape(rsp2),'%', pexpect.TIMEOUT], timeout=timeout)
index = self.oai.expect_exact([rsp1, rsp2, pexpect.TIMEOUT], timeout=timeout)
if index == 0 or index == 1:
return 'OK'
elif index == 2:
#self.oai.expect([re.escape(rsp1), re.escape(rsp2), pexpect.TIMEOUT], timeout=timeout)
self.oai.expect_exact([rsp1, rsp2, pexpect.TIMEOUT], timeout=timeout)
if self.flag_errors:
raise log.err(self.err(command))
else:
return 'OK'
else:
raise log.err(self.failed(command, rsp1 + ' or ' + rsp2,debug))
# **************************send_recv*************************
# 1) send a command
# 2) wait for either rsp1 or rsp2 is found (normally prompts)
# 3) return everything seen before that
# ************************************************************
def send_recv(self, command, timeout=50, rsp1=None, rsp2=None,debug=0):
if not rsp1:
rsp1 = self.prompt1
if not rsp2:
rsp2 = self.prompt2
self.wait_quiet()
if self.send_cr:
log.stats['cmd'] += 1
self.oai.sendline(command)
else:
self.oai.send(command)
#index = self.oai.expect([re.escape(rsp1), re.escape(rsp2), pexpect.TIMEOUT], timeout=timeout);
index = self.oai.expect_exact([rsp1, rsp2, pexpect.TIMEOUT], timeout=timeout);
if index == 0 or index == 1 :
return self.oai.before
else:
raise log.err(self.failed(command, rsp1 + ' or ' + rsp2,debug))
# **************************send_expect*************************
# 1) send a command, and optionally specify a the time to wait
# 2) search for an expected pattern in the response
# 3) raise an error if not found
# **************************************************************
def send_expect(self, command, expect, delay = 50, rsp1=None, rsp2=None,debug=0):
if debug :
print command
print expect
print delay
rsp = self.send_recv(command, delay, rsp1, rsp2)
#print rsp
if (rsp.find(expect) != -1):
return 'Ok'
raise log.err(self.failed(command, expect,debug))
# **************************send_expect_re*************************
# 1) send a command, and optionally specify a the time to wait
# 2) search for an expected pattern defined by a regular expression in the response
# 3) return a error if raise_err flag is set and re not found, otherwise return 'Ok'
# *****************************************************************
def send_expect_re(self, command, expect, raise_err=1, delay = 50, rsp1=None, rsp2=None,debug=0):
rsp = self.send_recv(command, delay, rsp1, rsp2)
# print rsp
match = re.compile(expect).search(rsp)
if match:
return match
if raise_err:
raise log.err(self.failed(command, expect,debug))
else :
return None
# **************************send_expect*************************
# 1) send a command, and optionally specify a the time to wait
# 2) search for an expected pattern defined by a re in the response
# 3) return ok if not found
# **************************************************************
def send_expect_false(self, command, expect, delay = 5, rsp1=None, rsp2=None,debug=0):
rsp = self.send_recv(command, delay, rsp1, rsp2)
# print rsp
if (rsp.find(expect) == -1):
return 'OK'
raise log.err(self.failed(command, expect,debug))
# **************************send_wait*************************
# 1) send a command, and optionally specify a the time to wait
# 2) search for an expected pattern in the response
# 3) retry for a numretries if not found
# 4) return an error if not found after the numtries
# 3) return the response if found
# **************************************************************
def send_wait(self, command, expect, numretries=3, rsp1=None, rsp2=None,debug=0):
timer = 0
for i in range(numretries):
rsp = self.send_recv(command, 10, rsp1, rsp2)
if (rsp.find(expect) != -1):
return rsp;
time.sleep(2)
timer = timer+2
raise log.err(self.failed(command, expect,debug))
# **************************send_wait_re*************************
# 1) send a command, and optionally specify a the time to wait
# 2) search for an expected pattern defined by a re in the response
# 3) retry for a numretries if not found
# 4) return an error if not found after the numtries
# 3) return the response if found
# **************************************************************
def send_wait_re(self, command, expect, numretries=3, rsp1=None, rsp2=None,debug=0):
timer = 0
for i in range(numretries):
rsp = self.send_recv(command)
if re.compile(expect).search(rsp):
# print "Found in",i,"attempts"
return rsp;
time.sleep(2)
timer = timer+2
raise log.err(self.failed(command, expect,debug))
# **************************send_wait_false*************************
# 1) send a command, and optionally specify a the time to wait
# 2) search for an expect pattern in the response
# 3) return the response if not found
# 4) return an error if the pattern found after the numtries
# **************************************************************
def send_wait_false(self, command, expect, numretries=3, rsp1=None, rsp2=None,debug=0):
timer = 1
for i in range(numretries):
rsp = self.send_recv(command)
if (rsp.find(expect) == -1):
return rsp;
time.sleep(2)
timer = timer+2
raise log.err(self.failed(command, expect,debug))
# **************************send_wait_false*************************
# 1) send a command, and optionally specify a the time to wait
# 2) search for an expect pattern defined by a re in the response
# 3) return the response if not found
# 4) return an error if the pattern found after the numtries
# **************************************************************
def send_wait_false_re(self, command, expect, numretries=3, rsp1=None, rsp2=None,debug=0):
timer = 0
for i in range(numretries):
rsp = self.send_recv(command)
if not re.compile(expect).search(rsp):
return rsp;
time.sleep(2)
timer = timer+2
raise log.err(self.failed(command, expect,debug))
# **************************find*************************
# 1) find an exact pattern in a given string
# 2) raise an error if not found
# **************************************************************
def find(self, string, pattern):
word = string.replace(pattern,'*','\*')
words = string.replace(word,' ','\s*')
if re.search(words,string):
pass
else:
raise log.err(string)
# **************************find_false**************************
# 1) find an exact pattern in a given string
# 2) raise an error if found
# **************************************************************
def find_false(self, string, pattern):
if string.find(pattern) != -1:
raise log.err(string)
# **************************find_re*************************
# 1) find an exact re pattern in a given string
# 2) raise an error if not found
# **************************************************************
def find_re(self, string, pattern):
if not re.compile(pattern).search(string):
raise log.err(string)
# **************************find_false_re*************************
# 1) find an exact re pattern in a given string
# 2) raise an error if found
# **************************************************************
def find_false_re(self, string, pattern):
if re.compile(pattern).search(string):
raise log.err(string)
-198
View File
@@ -1,198 +0,0 @@
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
# \file log.py
# \brief provides primitives and defines how the logs and statistics are generated
# \author Navid Nikaein
# \date 2013
# \version 0.1
# @ingroup _test
import sys
import re
import time
import datetime
import array
import xml.etree.ElementTree as ET
debug = False
docfile = ''
start_time = time.time()
testcase_starttime = start_time
debug = 0
stats = {'passed':0, 'failed':0, 'skipped':0, 'internal_errors':0, 'cmd':0}
# xml result (jUnit like)
xUnitTestsuites = ET.Element( 'testsuites' )
xUnitTestsuite = ET.SubElement( xUnitTestsuites, 'testsuite' )
xUnitTestsuite.set( 'name', 'OAI' )
xUnitTestsuite.set( 'timestamp', datetime.datetime.fromtimestamp(start_time).strftime('%Y-%m-%dT%H:%M:%S') )
xUnitTestsuite.set( 'hostname', 'localhost' )
#xUnitSystemOut = ET.SubElement( xUnitTestsuite, 'system-out' )
class bcolors:
header = '\033[95m'
okblue = '\033[94m'
okgreen = '\033[92m'
warning = '\033[93m'
fail = '\033[91m'
normal = '\033[0m'
def __init__(self):
if not sys.stdout.isatty():
self.disable()
def disable(self):
self.header = ''
self.okblue = ''
self.okgreen = ''
self.warning = ''
self.fail = ''
self.normal = ''
class err(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
def writefile(logfile, message):
F_testlog = open(logfile, 'a')
F_testlog.write(message + '\n')
F_testlog.close()
def sleep(seconds):
time.sleep(seconds)
def start():
"""Start the timer for the following testcase."""
global testcase_starttime
testcase_starttime = time.time()
def set_debug_level(level):
debug = level
def statistics(logfile):
global start_time
#if stats['passed'] == 0:
# print "no test executed...exiting"
# sys.exit()
total_tests = stats['passed'] + stats['failed'] + stats['skipped']
total_ex_tests = stats['passed'] + stats['failed']
elapsed_time = time.gmtime(time.time() - start_time)
print '\n'
log_record('info', '===============================================')
log_record('info', 'Total tests performed ' + repr(total_tests))
log_record('info', 'Tests passed ' + repr(stats['passed']))
log_record('info', 'Tests failed ' + repr(stats['failed']))
log_record('info', 'Tests skipped ' + repr(stats['skipped']))
log_record('info', '')
log_record('info', 'Total commands sent ' + repr(stats['cmd']))
log_record('info', 'Total elapsed time (h:m:s) ' + time.strftime('%H:%M:%S', elapsed_time))
log_record('info', '===============================================')
log_record('info', 'Testing pass rate ' + repr((stats['passed'] * 100) / total_tests) + '%')
log_record('info', '===============================================')
writefile(logfile, '\n=====================Results===================')
writefile(logfile, 'Total tests performed ' + repr(total_tests))
writefile(logfile, 'Tests passed ' + repr(stats['passed']))
writefile(logfile, 'Tests failed ' + repr(stats['failed']))
writefile(logfile, 'Tests skipped ' + repr(stats['skipped']))
writefile(logfile, '')
writefile(logfile, 'Total commands sent ' + repr(stats['cmd']))
writefile(logfile, 'Total elapsed time (h:m:s) ' + time.strftime('%H:%M:%S', elapsed_time))
writefile(logfile, '===============================================')
writefile(logfile, 'Testing pass rate ' + repr((stats['passed'] * 100) / total_tests) + '%')
writefile(logfile, '===============================================\n')
xUnitTestsuite.set( 'tests', repr(total_tests) )
xUnitTestsuite.set( 'failures', repr(stats['failed']) )
xUnitTestsuite.set( 'skipped', repr(stats['skipped']) )
xUnitTestsuite.set( 'errors', '0' )
time_delta = datetime.datetime.now() - datetime.datetime.fromtimestamp(start_time)
xUnitTestsuite.set( 'time', repr(time_delta.total_seconds()) )
writefile( logfile + '.xml', ET.tostring( xUnitTestsuites, encoding="utf-8", method="xml" ) )
def log_record(level, message):
ts = time.strftime('%d %b %Y %H:%M')
message = ts + ' [' + level + '] ' + message
if level == 'passed' :
print bcolors.okgreen + message + bcolors.normal
elif level == 'failed' :
print bcolors.fail + message + bcolors.normal
elif level == 'skipped' :
print bcolors.warning + message + bcolors.normal
else :
print message
def fail(case, testnum, testname, conf, message, diag, output,trace):
# report(case, testnum, testname, conf, 'failed', output, diag, message)
report(case, testnum, testname, conf, 'failed', output, diag)
log_record('failed', case + testnum + ' : ' + testname + ' ('+ conf+')')
if message :
log_record('failed', "Output follows:\n" + message )
if trace :
log_record('failed', "trace file can be found in " + trace + "\n" )
stats['failed'] += 1
def failquiet(case, testnum, testname, conf):
log_record('failed', case + testnum + ' :' + testname + ' ('+ conf+')')
stats['failed'] += 1
def ok(case, testnum, testname, conf, message, output):
report(case, testnum, testname, conf, 'passed', output)
log_record('passed', case + testnum + ' : ' + testname + ' ('+ conf+')')
if message :
print bcolors.okgreen + message + bcolors.normal
stats['passed'] += 1
def skip(case, testnum, testname, conf, message=None, diag=None, output=None):
log_record('skipped', case + testnum + ' :' + testname + ' ('+ conf+')')
report(case, testnum, testname, conf, 'skipped', output, diag)
if message :
log_record('skipped', "Output follows:\n" + message )
if diag :
log_record('skipped', "Diagnostic: \n" + diag )
stats['skipped'] += 1
def report(case, test, name, conf, status, output, diag=None, desc=None):
writefile (output, '[' +status+ '] ' + case + test + ' : ' + name + ' ('+ conf+')')
if diag :
writefile (output, '-------> ' + diag)
if desc:
writefile(output, desc)
#log_record('report', + case + test + ' documented')
e = ET.SubElement( xUnitTestsuite, 'testcase' )
e.set( 'name', case + '_' + test + '_' + name )
e.set( 'classname', 'shellscript' )
e.set( 'time', repr( time.time() - testcase_starttime ) )
if status == 'failed':
e = ET.SubElement( e, 'failure' )
e.set( 'message', 'failed' )
e.text = diag
if status == 'skipped':
e = ET.SubElement( e, 'skipped' )
-223
View File
@@ -1,223 +0,0 @@
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
# \file openair.py
# \brief class that define the oaisim class and its attributes
# \author Navid Nikaein
# \date 2013
# \version 0.1
# @ingroup _test
import pexpect
import pxssh
import time
import os
import array
import shutil
import subprocess
# import call
from core import *
SHELL = '/bin/bash'
class openair(core):
def __init__(self, hostname, address):
self.error = '% '
self.hostname = hostname
self.address = address
self.localhost = None
core.__init__(self)
@property
def localhost(self):
if self.localhost :
return self.localhost
elif self.hostname in ['localhost', '127.0.0.7', '::1'] :
self.localhost = self.hostname
return self.localhost
@localhost.setter
def localhost(self,localhost):
self.localhost = localhost
def shcmd(self,cmd,sudo=False):
if sudo:
cmd = "sudo %s" % command
proc = subprocess.Popen(command, shell=True,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE)
stdout, stderr = proc.communicate()
return (stdout, stderr)
def connect(self, username, password, prompt='PEXPECT_OAI'):
self.prompt1 = prompt
self.prompt2 = prompt
try:
if not username:
username = root
if not password:
password = username
self.oai = pxssh.pxssh()
self.oai.login(self.address,username,password)
self.oai.sendline('PS1='+self.prompt1)
self.oai.PROMPT='PEXPECT_OAI'
# need to look for twice the string of the prompt
self.oai.prompt()
self.oai.prompt()
self.oai.sendline('uptime')
self.oai.prompt()
print self.oai.before
except Error, val :
print "Error: can't connect to"+username+"@"+self.address
def connect2(self, username, password, prompt='$'):
self.prompt1 = prompt
self.prompt2 = prompt
while 1:
try:
if not username:
username = root
if not password:
password = username
self.oai = pexpect.spawn('ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -o "ConnectionAttempts=1" ' \
+ username + '@' + self.address)
index = self.oai.expect([re.escape(self.prompt1), re.escape(self.prompt2), pexpect.TIMEOUT], timeout=40)
if index == 0 :
return 'Ok'
else :
index = self.oai.expect(['password:', pexpect.TIMEOUT], timeout=40)
if index == 0 :
self.oai.sendline(password)
index = self.oai.expect([re.escape(self.prompt1), re.escape(self.prompt2), pexpect.TIMEOUT], timeout=10)
if index != 0:
print 'ERROR! could not login with SSH.'
print 'Expected ' + self.prompt1 + ', received >>>>' + self.oai.before + '<<<<'
sys.exit(1)
return 'Ok'
except Exception, val:
time.sleep(5)
print "Error:", val
def connect_localshell(self, prompt='$'):
self.prompt1 = prompt
self.prompt2 = prompt
while 1:
try:
# start a shell and use the current environment
self.oai = pexpect.spawn('bash --norc --noprofile')
index = self.oai.expect([re.escape(self.prompt1), re.escape(self.prompt2), pexpect.TIMEOUT], timeout=40)
if index == 0 :
return 'Ok'
else :
sys.exit(1)
except Exception, val:
time.sleep(5)
print "Error:", val
def disconnect(self):
print 'disconnecting the ssh connection to ' + self.address + '\n'
self.oai.send('exit')
# self.cancel()
def kill(self, user, pw):
try:
if user == 'root' :
os.system('pkill oaisim')
os.system('pkill cc1')
time.sleep(1)
os.system('pkill oaisim')
else :
os.system('echo '+pw+' | sudo -S pkill oaisim')
os.system('echo '+pw+' | sudo -S pkill cc1')
time.sleep(1)
os.system('echo '+pw+' | sudo -S pkill oaisim')
except Error, val:
print "Error:", val
def rm_driver(self,oai,user, pw):
try:
if user == 'root' :
#oai.send_nowait('rmmod nasmesh;')
os.system('rmmod nasmesh;')
else :
oai.send_nowait('echo '+pw+ ' | sudo -S rmmod nasmesh;')
#os.system('echo '+pw+ ' | sudo -S rmmod nasmesh;')
except Error, val:
print "Error removing oai network driver module:", val
def driver(self,oai,user,pw):
#pwd = oai.send_recv('pwd')
oai.send('cd $OPENAIR_TARGETS;')
oai.send('cd SIMU/USER;')
try:
if user == 'root' :
oai.send_nowait('insmod ./nasmesh.ko;')
else :
oai.send('echo '+pw+ ' | sudo -S insmod ./nasmesh.ko;')
except Error, val:
print "Error inserting oai network driver module:", val
def cleandir (self, logdir,debug) :
for filename in os.listdir(logdir):
filepath = os.path.join(logdir, filename)
if debug == 2 :
print 'logdir is ' + logdir
print 'filepath is ' + filepath
try:
shutil.rmtree(filepath)
except OSError:
os.remove(filepath)
#print 'Could not remove the filepath'+ filepath + ' with error ' + OSError
def create_dir(self,dirname,debug) :
if not os.path.exists(dirname) :
try:
os.makedirs(dirname,0755)
except OSError:
# There was an error on creation, so make sure we know about it
raise
def cpu_freq(self):
freq=0
proc = subprocess.Popen(["cat","/proc/cpuinfo"],
stdout=subprocess.PIPE)
out, err = proc.communicate()
for line in out.split("\n"):
if "cpu MHz" in line:
freq = float(line.split(":")[1])
break
return freq
-182
View File
@@ -1,182 +0,0 @@
#! /usr/bin/python
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
# \file test01.py
# \brief test 01 for OAI
# \author Navid Nikaein
# \date 2013 - 2015
# \version 0.1
# @ingroup _test
import sys
import wave
import os
import time
import datetime
import getpass
import math #from time import clock
import log
import case01
import case02
import case03
import case04
import case05
from openair import *
debug = 0
pw =''
i = 0
dlsim=0
localshell=0
is_compiled = 0
timeout=2000
for arg in sys.argv:
if arg == '-d':
debug = 1
elif arg == '-dd':
debug = 2
elif arg == '-p' :
prompt2 = sys.argv[i+1]
elif arg == '-w' :
pw = sys.argv[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]
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()
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)
# get the oai object
host = os.uname()[1]
oai = openair('localdomain','localhost')
#start_time = time.time() # datetime.datetime.now()
user = getpass.getuser()
if localshell == 0:
try:
print '\n******* Note that the user <'+user+'> should be a sudoer *******\n'
print '******* Connecting to the localhost to perform the test *******\n'
if not pw :
print "username: " + user
pw = getpass.getpass()
else :
print "username: " + user
#print "password: " + pw
# issues in ubuntu 12.04
# oai.connect(user,pw)
oai.connect2(user,pw)
#oai.get_shell()
except :
print 'Fail to connect to the local host'
sys.exit(1)
else:
pw = ''
oai.connect_localshell()
cpu_freq = int(oai.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)
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
#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 + '====================='
-173
View File
@@ -1,173 +0,0 @@
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
# \file test01.py
# \brief test 02 for OAI: downlink and uplink performance and profiler
# \author Navid Nikaein
# \date 2014
# \version 0.1
# @ingroup _test
import sys
import wave
import os
import time
import datetime
import getpass
import math #from time import clock
import log
import case11
import case12
import case13
from openair import *
debug = 0
prompt = '$'
pw =''
i = 0
clean = 0
start_case = 0
cpu = -1
localshell=0
for arg in sys.argv:
if arg == '-d':
debug = 1
elif arg == '-dd':
debug = 2
elif arg == '-p' :
prompt = sys.argv[i+1]
elif arg == '-w' :
pw = sys.argv[i+1]
elif arg == '-c' :
clean = 1
elif arg == '-t' :
cpu = sys.argv[i+1]
elif arg == '-s' :
start_case = sys.argv[i+1]
elif arg == '-l' :
localshell = 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 "-c: clean the log directory "
print "-t: set the cpu "
print "-l: use local shell instead of ssh connection"
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)
host = os.uname()[1]
# get the oai object
oai = openair('localdomain','localhost')
#start_time = time.time() # datetime.datetime.now()
user = getpass.getuser()
if localshell == 0:
try:
print '\n******* Note that the user <'+user+'> should be a sudoer *******\n'
if cpu > -1 :
print '******* Connecting to the localhost <'+host+'> to perform the test on CPU '+str(cpu)+' *******\n'
else :
print '******* Connecting to the localhost <'+host+'> to perform the test *******\n'
if not pw :
print "username: " + user
pw = getpass.getpass()
else :
print "username: " + user
#print "password: " + pw
print "prompt: " + prompt
oai.connect(user,pw,prompt)
#oai.get_shell()
except :
print 'Fail to connect to the local host'
sys.exit(1)
else:
pw = ''
print "prompt: " + prompt
oai.connect_localshell(prompt)
test = 'test02'
ctime=datetime.datetime.utcnow().strftime("%Y-%m-%d.%Hh%M")
logdir = os.getcwd() + '/PERF_'+host;
logfile = logdir+'/'+user+'.'+test+'.'+ctime+'.txt'
#oai.send_nowait('mkdir -p -m 755' + logdir + ';')
oai.create_dir(logdir,debug)
#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)
if clean == 1 :
oai.cleandir(logdir,debug)
#oai.rm_driver(oai,user,pw)
# start te test cases
#compile
rv=case11.execute(oai, user, pw, host,logfile,logdir,debug)
if rv == 1 :
case12.execute(oai, user, pw, host,logfile,logdir,debug,cpu)
case13.execute(oai, user, pw, host,logfile,logdir,debug,cpu)
else :
print 'Compilation error: skip case 12 and 13'
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 + '====================='