*update dlsim to capture overall timing

*add performance measurment test cases
*update the start_one_eNB_multi_UE_nas script



git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5151 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
Navid Nikaein
2014-03-12 16:33:33 +00:00
parent 3dfe046cf1
commit 388ad20553
17 changed files with 1047 additions and 80 deletions
+191
View File
@@ -0,0 +1,191 @@
#******************************************************************************
# Eurecom OpenAirInterface
# Copyright(c) 1999 - 2013 Eurecom
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
# The full GNU General Public License is included in this distribution in
# the file called "COPYING".
# Contact Information
# Openair Admin: openair_admin@eurecom.fr
# Openair Tech : openair_tech@eurecom.fr
# Forums : http://forums.eurecom.fsr/openairinterface
# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France
#*****************************************************************************
# \file case02.py
# \brief test case 02 for OAI: executions
# \author Navid Nikaein
# \date 2013
# \version 0.1
# @ingroup _test
import time
import random
import log
import openair
import core
NUM_UE=2
NUM_eNB=1
NUM_TRIALS=3
def execute(oai, user, pw, logfile,logdir):
case = '04'
oai.send('cd $OPENAIR1_DIR;')
oai.send('cd SIMULATION/LTE_PHY;')
try:
test = '00'
name = 'Run oai.dlsim.sanity'
conf = '-a -A AWGN -n 100'
diag = 'dlsim is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed'
trace = logdir + '/log_' + case + test + '_1.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./dlsim.rel8 ' + conf + tee, 'Segmentation fault', 30)
trace = logdir + '/log_' + case + test + '_2.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./dlsim.rel8 ' + conf + tee, 'Exiting', 30)
trace = logdir + '/log_' + case + test + '_3.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./dlsim.rel8 ' + conf + tee, 'FATAL', 30)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '01'
name = 'Run oai.dlsim.test1'
diag = 'Test 1, 10 MHz, R2.FDD (MCS 5), EVA5, -1dB'
conf = '-m5 -gF -s-3.2 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
trace = logdir + '/log_' + case + test +'.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '06'
name = 'Run oai.dlsim.test5'
diag = 'Test 5, 1.4 MHz, R4.FDD (MCS 4), EVA5, 0dB (70%)'
conf = '-m4 -gF -s-2 -w1.0 -f.2 -n500 -B6 -c4 -z2 -O70'
trace = logdir + '/log_' + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '06'
name = 'Run oai.dlsim.test6'
diag = 'Test 6, 10 MHz, R3.FDD (MCS 15), EVA5, 6.7dB (70%)'
conf = '-m15 -gF -s4 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
trace = logdir + '/log_' + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '06b'
name = 'Run oai.dlsim.test6b'
diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (70%)'
conf = '-m14 -gF -s4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70'
trace = logdir + '/log_' + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '07'
name = 'Run oai.dlsim.test7'
diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (30%)'
conf = '-m15 -gG -s-1 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O30'
trace = logdir + '/log_' + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '07b'
name = 'Run oai.dlsim.test7b'
diag = 'Test 7b, 5 MHz, R3-1.FDD (MCS 15), ETU70, 1.4 dB (30%)'
conf = '-m14 -gG -s-1 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O30'
trace = logdir + '/log_' + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '10'
name = 'Run oai.dlsim.test10'
diag = 'Test 10, 5 MHz, R6.FDD (MCS 25), EVA5, 17.4 dB (70%)'
conf = '-m25 -gF -s13 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70'
trace = logdir + '/log_' + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '10b'
name = 'Run oai.dlsim.test10b'
diag = 'Test 10b, 5 MHz, R6-1.FDD (MCS 24,18 PRB), EVA5, 17.5dB (70%)'
conf = '-m25 -gF -s15.2 -w1.0 -f.2 -n500 -B25 -c3 -z2 -r1022 -O70'
trace = logdir + '/log_' + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '11'
name = 'Run oai.dlsim.test11'
diag = 'Test 11, 10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%)'
conf = '-m26 -gF -s14.2 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
trace = logdir + '/log_' + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
oai.send_expect('./dlsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
+185
View File
@@ -0,0 +1,185 @@
#******************************************************************************
# Eurecom OpenAirInterface
# Copyright(c) 1999 - 2013 Eurecom
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
# The full GNU General Public License is included in this distribution in
# the file called "COPYING".
# Contact Information
# Openair Admin: openair_admin@eurecom.fr
# Openair Tech : openair_tech@eurecom.fr
# Forums : http://forums.eurecom.fsr/openairinterface
# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France
#*****************************************************************************
# \file case02.py
# \brief test case 02 for OAI: executions
# \author Navid Nikaein
# \date 2013
# \version 0.1
# @ingroup _test
import time
import random
import log
import openair
import core
NUM_UE=2
NUM_eNB=1
NUM_TRIALS=3
def execute(oai, user, pw, logfile,logdir):
case = '04'
oai.send('cd $OPENAIR1_DIR;')
oai.send('cd SIMULATION/LTE_PHY;')
try:
test = '00'
name = 'Run oai.dlsim.sanity'
conf = '-a -A AWGN -n 100'
diag = 'ulsim is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed'
trace = logdir + '/log_' + case + test + '_1.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./ulsim.rel8 ' + conf + tee, 'Segmentation fault', 30)
trace = logdir + '/log_' + case + test + '_2.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./ulsim.rel8 ' + conf + tee, 'Exiting', 30)
trace = logdir + '/log_' + case + test + '_3.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./ulsim.rel8 ' + conf + tee, 'FATAL', 30)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '01'
name = 'Run oai.ulsim.test1'
diag = 'Test 1, 10 MHz, R2.FDD (MCS 5), EVA5, -1dB'
conf = '-m5 -gF -s-3.2 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
trace = logdir + '/log_' + case + test +'.txt'
tee = ' 2>&1 | tee ' + trace
print test + 'not performed'
#oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '06'
name = 'Run oai.ulsim.test5'
diag = 'Test 5, 1.4 MHz, R4.FDD (MCS 4), EVA5, 0dB (70%)'
conf = '-m4 -gF -s-2 -w1.0 -f.2 -n500 -B6 -c4 -z2 -O70'
trace = logdir + '/log_' + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
print test + 'not performed'
#oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '06'
name = 'Run oai.ulsim.test6'
diag = 'Test 6, 10 MHz, R3.FDD (MCS 15), EVA5, 6.7dB (70%)'
conf = '-m15 -gF -s4 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
trace = logdir + '/log_' + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
print test + 'not performed'
#oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '06b'
name = 'Run oai.ulsim.test6b'
diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (70%)'
conf = '-m14 -gF -s4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70'
trace = logdir + '/log_' + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
print test + 'not performed'
#oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '07'
name = 'Run oai.ulsim.test7'
diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (30%)'
conf = '-m15 -gG -s-1 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O30'
trace = logdir + '/log_' + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
print test + 'not performed'
#oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '10'
name = 'Run oai.ulsim.test10'
diag = 'Test 10, 5 MHz, R6.FDD (MCS 25), EVA5, 17.4 dB (70%)'
conf = '-m25 -gF -s13 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70'
trace = logdir + '/log_' + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
print test + 'not performed'
#oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '10b'
name = 'Run oai.ulsim.test10b'
diag = 'Test 10b, 5 MHz, R6-1.FDD (MCS 24,18 PRB), EVA5, 17.5dB (70%)'
conf = '-m25 -gF -s15.2 -w1.0 -f.2 -n500 -B25 -c3 -z2 -r1022 -O70'
trace = logdir + '/log_' + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
print test + 'not performed'
#oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '11'
name = 'Run oai.ulsim.test11'
diag = 'Test 11, 10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%)'
conf = '-m26 -gF -s14.2 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70'
trace = logdir + '/log_' + case + test + '.txt'
tee = ' 2>&1 | tee ' + trace
print test + 'not performed'
#oai.send_expect('./ulsim.rel8 ' + conf + tee, ' effective rate passed', 150)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
+84
View File
@@ -0,0 +1,84 @@
#******************************************************************************
# Eurecom OpenAirInterface
# Copyright(c) 1999 - 2013 Eurecom
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
# The full GNU General Public License is included in this distribution in
# the file called "COPYING".
# Contact Information
# Openair Admin: openair_admin@eurecom.fr
# Openair Tech : openair_tech@eurecom.fr
# Forums : http://forums.eurecom.fsr/openairinterface
# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France
#*****************************************************************************
# \file case01.py
# \brief test case 01 for OAI: compilations
# \author Navid Nikaein
# \date 2014
# \version 0.1
# @ingroup _test
import log
import openair
import core
makerr1 = '***'
makerr2 = 'Error 1'
def execute(oai, user, pw, logfile,logdir):
case = '101'
oai.send('cd $OPENAIR1_DIR;')
oai.send('cd SIMULATION/LTE_PHY;')
try:
test = '01'
name = 'Compile oai.rel8.phy.dlsim.make'
conf = 'make dlsim'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for dlsim in $OPENAIR1_DIR/SIMULATION/LTE_PHY'
oai.send('make clean;')
oai.send('rm -f ./dlsim.rel8;')
oai.send_expect_false('make dlsim -j4' + tee, makerr1, 1500)
oai.send('cp ./dlsim ./dlsim.rel8;')
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = '02'
name = 'Compile oai.rel8.phy.ulsim.make'
conf = 'make ulsim'
trace = logdir + '/log_' + case + test + '.txt;'
tee = ' 2>&1 | tee ' + trace
diag = 'check the compilation errors for ulsim in $OPENAIR1_DIR/SIMULATION/LTE_PHY'
oai.send('make clean;')
oai.send('rm -f ./ulsim.rel8;')
oai.send_expect_false('make ulsim -j4' + tee, makerr1, 1500)
oai.send('cp ./ulsim ./ulsim.rel8;')
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
+128
View File
@@ -0,0 +1,128 @@
#******************************************************************************
# Eurecom OpenAirInterface
# Copyright(c) 1999 - 2013 Eurecom
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
# The full GNU General Public License is included in this distribution in
# the file called "COPYING".
# Contact Information
# Openair Admin: openair_admin@eurecom.fr
# Openair Tech : openair_tech@eurecom.fr
# Forums : http://forums.eurecom.fsr/openairinterface
# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France
#*****************************************************************************
# \file case02.py
# \brief test case 02 for OAI: executions
# \author Navid Nikaein
# \date 2013
# \version 0.1
# @ingroup _test
import time
import random
import log
import openair
import core
import os
import shutil # copy file
NUM_UE=2
NUM_eNB=1
NUM_TRIALS=3
PRB=[25,50,75,100]
MCS=[4,5,7,9,12,15,18,21,24,27]
ANT_TX=2 # 2
ANT_RX=2 # 2
PDCCH=2 #, 2, 3, 4
CHANNEL=["N"] # A,B,C,D,E,F,
TX_MODE=2 # 2,
MIN_SNR=2
MAX_SNR=18
#OPT="-L -d" # 8bit decoder , activate dci decoding at UE
def execute(oai, user, pw, logfile,logdir):
case = '102'
oai.send('cd $OPENAIR1_DIR;')
oai.send('cd SIMULATION/LTE_PHY;')
try:
test = '0'
name = 'Run oai.dlsim.sanity'
conf = '-a -n 100'
diag = 'dlsim is not running normally (Segmentation fault / Exiting / FATAL), debugging might be needed'
trace = logdir + '/log_' + case + test + '_1.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./dlsim.rel8 ' + conf + tee, 'Segmentation fault', 30)
trace = logdir + '/log_' + case + test + '_2.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./dlsim.rel8 ' + conf + tee, 'Exiting', 30)
trace = logdir + '/log_' + case + test + '_3.txt;'
tee = ' 2>&1 | tee ' + trace
oai.send_expect_false('./dlsim.rel8 ' + conf + tee, 'FATAL', 30)
except log.err, e:
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
else:
log.ok(case, test, name, conf, '', logfile)
try:
test = 1
MIN_SNR = 2
name = 'Run oai.dlsim.perf.70%'
diag = 'no diagnostic is available, check the log file'
for i in range(len(PRB)):
for j in range(len(MCS)):
for k in range(1,ANT_TX):
for m in range (1,ANT_RX):
for n in range(1,PDCCH):
for o in range(len(CHANNEL)):
for p in range(1,TX_MODE):
for q in range(MIN_SNR,MAX_SNR):
#if if PRB[i] :
conf = '-B' + str(PRB[i]) + ' -m'+str(MCS[j]) + ' -y'+str(k) + ' -z'+str(m) +' -c'+str(n) + ' -g'+str(CHANNEL[o]) + ' -x'+str(p) + ' -s'+str(q) + ' -w1.0 -f.1 -n500 -P -O80' #+ OPT
trace = logdir + '/time_meas' + '_prb'+str(PRB[i])+'_mcs'+ str(MCS[j])+ '_anttx' + str(k)+ '_antrx' + str(m) + '_pdcch' + str(n) + '_channel' +str(CHANNEL[o]) + '_tx' +str(p) + '_snr' +str(q)+'.'+case+str(test)+ '.log'
tee = ' 2>&1 | tee ' + trace
match = oai.send_expect_re('./dlsim.rel8 ' + conf + tee, 'passed', 0, 1000)
#print conf
if match :
log.ok(case, str(test), name, conf, '', logfile)
MIN_SNR = q # just to speed up the test
test+=1
break; # found smallest snr
else :
try:
if os.path.isfile(trace) :
os.remove(trace)
except OSError, e: ## if failed, report it back to the user ##
print ("Error: %s - %s." % (e.filename,e.strerror))
except log.err, e:
log.fail(case, str(test), name, conf, e.value, diag, logfile,trace)
#else:
# log.ok(case, test, name, conf, '', logfile)
+7 -5
View File
@@ -201,17 +201,19 @@ class core:
# **************************send_expect_re*************************
# 1) send a command, and optionally specify a the time to wait
# 2) search for an expected pattern defined by a regular expression in the response
# 3) return a error if not found
# 3) return a error if raise_err flag is set and re not found, otherwise return 'Ok'
# *****************************************************************
def send_expect_re(self, command, expect, delay = 5, rsp1=None, rsp2=None,debug=0):
def send_expect_re(self, command, expect, raise_err=1, delay = 50, rsp1=None, rsp2=None,debug=0):
rsp = self.send_recv(command, delay, rsp1, rsp2)
# print rsp
match = re.compile(expect).search(rsp)
if match:
return match
raise log.err(self.failed(command, expect,debug))
if raise_err:
raise log.err(self.failed(command, expect,debug))
else :
return None
# **************************send_expect*************************
# 1) send a command, and optionally specify a the time to wait
# 2) search for an expected pattern defined by a re in the response
+30 -5
View File
@@ -50,6 +50,7 @@ class openair(core):
self.error = '% '
self.hostname = hostname
self.address = address
self.localhost = None
self.shell_prompt = '$'
core.__init__(self)
@@ -66,6 +67,30 @@ class openair(core):
except Exception, val:
print "Error:", val
@property
def localhost(self):
if self.localhost :
return self.localhost
elif self.hostname in ['localhost', '127.0.0.7', '::1'] :
self.localhost = self.hostname
return self.localhost
@localhost.setter
def localhost(self,localhost):
self.localhost = localhost
def shcmd(self,cmd,sudo=False):
if sudo:
cmd = "sudo %s" % command
proc = subprocess.Popen(command, shell=True,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE)
stdout, stderr = proc.communicate()
return (stdout, stderr)
def connect(self, username, password, prompt):
self.prompt1 = self.shell_prompt
if not prompt :
@@ -78,12 +103,12 @@ class openair(core):
username = root
if not password:
password = username
self.oai = pexpect.spawn('ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -o "ConnectionAttempts=1" ' \
+ username + '@' + self.address)
index = self.oai.expect([re.escape(self.prompt1), re.escape(self.prompt2), pexpect.TIMEOUT], timeout=40)
if index == 0 :
index = self.oai.expect([re.escape(self.prompt1), re.escape(self.prompt2), pexpect.TIMEOUT], timeout=40)
if index == 0 :
return 'Ok'
else :
index = self.oai.expect(['password:', pexpect.TIMEOUT], timeout=40)
@@ -95,11 +120,11 @@ class openair(core):
print 'Expected ' + self.prompt1 + ', received >>>>' + self.oai.before + '<<<<'
sys.exit(1)
return 'Ok'
except Exception, val:
time.sleep(5)
print "Error:", val
def disconnect(self):
print 'disconnecting the ssh connection to ' + self.address + '\n'
+9
View File
@@ -47,6 +47,8 @@ import log
import case01
import case02
import case03
import case04
import case05
from openair import *
@@ -54,6 +56,8 @@ debug = 0
prompt = '$'
pw =''
i = 0
dlsim=0
for arg in sys.argv:
if arg == '-d':
debug = 1
@@ -63,6 +67,8 @@ for arg in sys.argv:
prompt = sys.argv[i+1]
elif arg == '-w' :
pw = sys.argv[i+1]
elif arg == '-P' :
dlsim = 1
elif arg == '-h' :
print "-d: low debug level"
print "-dd: high debug level"
@@ -112,6 +118,9 @@ oai.rm_driver(oai,user,pw)
case01.execute(oai, user, pw, logfile,logdir)
case02.execute(oai, user, pw, logfile,logdir)
case03.execute(oai, user, pw, logfile,logdir)
if dlsim != 0 :
case04.execute(oai, user, pw, logfile,logdir)
case05.execute(oai, user, pw, logfile,logdir)
oai.kill(user, pw)
oai.rm_driver(oai,user,pw)
+129
View File
@@ -0,0 +1,129 @@
#******************************************************************************
# Eurecom OpenAirInterface
# Copyright(c) 1999 - 2013 Eurecom
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
# The full GNU General Public License is included in this distribution in
# the file called "COPYING".
# Contact Information
# Openair Admin: openair_admin@eurecom.fr
# Openair Tech : openair_tech@eurecom.fr
# Forums : http://forums.eurecom.fsr/openairinterface
# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France
#*****************************************************************************
# \file test01.py
# \brief test 02 for OAI: downlink and uplink performance and profiler
# \author Navid Nikaein
# \date 2014
# \version 0.1
# @ingroup _test
import sys
import wave
import os
import time
import datetime
import getpass
import math #from time import clock
import log
import case11
import case12
from openair import *
debug = 0
prompt = '$'
pw =''
i = 0
for arg in sys.argv:
if arg == '-d':
debug = 1
elif arg == '-dd':
debug = 2
elif arg == '-p' :
prompt = sys.argv[i+1]
elif arg == '-w' :
pw = sys.argv[i+1]
elif arg == '-h' :
print "-d: low debug level"
print "-dd: high debug level"
print "-p: set the prompt"
print "-w: set the password for ssh to localhost"
sys.exit()
i= i + 1
# get the oai object
oai = openair('localdomain','localhost')
#start_time = time.time() # datetime.datetime.now()
try:
user = getpass.getuser()
print '\n******* Note that the user <'+user+'> should be a sudoer *******\n'
print '******* Connecting to the localhost to perform the test *******\n'
if not pw :
print "username: " + user
pw = getpass.getpass()
else :
print "username: " + user
#print "password: " + pw
print "prompt: " + prompt
oai.connect(user,pw,prompt)
#oai.get_shell()
except :
print 'Fail to connect to the local host'
sys.exit(1)
test = 'test02'
ctime=datetime.datetime.utcnow().strftime("%Y-%m-%d.%Hh%M")
logdir = os.getcwd() + '/PERF';
logfile = logdir+'/'+user+'.'+test+'.'+ctime+'.txt'
oai.send_nowait('mkdir -p -m 755' + logdir + ';')
#print '=================start the ' + test + ' at ' + ctime + '=================\n'
#print 'Results will be reported in log file : ' + logfile
log.writefile(logfile,'====================start'+test+' at ' + ctime + '=======================\n')
log.set_debug_level(debug)
oai.kill(user, pw)
#oai.rm_driver(oai,user,pw)
# start te test cases
case11.execute(oai, user, pw, logfile,logdir)
case12.execute(oai, user, pw, logfile,logdir)
oai.kill(user, pw)
#oai.rm_driver(oai,user,pw)
# perform the stats
log.statistics(logfile)
oai.disconnect()
ctime=datetime.datetime.utcnow().strftime("%Y-%m-%d_%Hh%M")
log.writefile(logfile,'====================end the '+ test + ' at ' + ctime +'====================')
print 'Test results can be found in : ' + logfile
#print '\nThis test took %f minutes\n' % math.ceil((time.time() - start_time)/60)
#print '\n=====================end the '+ test + ' at ' + ctime + '====================='