Merge branch 'develop' into bugfix-56-UE_category3_throughput
This commit is contained in:
@@ -133,9 +133,6 @@ else (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
|
||||
if (CPUINFO MATCHES "avx2")
|
||||
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -mavx2")
|
||||
endif()
|
||||
if (CPUINFO MATCHES "sse4_2")
|
||||
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -msse4.2")
|
||||
endif()
|
||||
if (CPUINFO MATCHES "sse4_1")
|
||||
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -msse4.1")
|
||||
endif()
|
||||
@@ -149,8 +146,8 @@ set(C_FLAGS_PROCESSOR " ${C_FLAGS_PROCESSOR} ${CFLAGS_PROCESSOR_USER}")
|
||||
Message("C_FLAGS_PROCESSOR is ${C_FLAGS_PROCESSOR}")
|
||||
|
||||
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86")
|
||||
if ( (NOT( C_FLAGS_PROCESSOR MATCHES "ssse3")) OR (NOT( C_FLAGS_PROCESSOR MATCHES "msse4.1")) OR (NOT( C_FLAGS_PROCESSOR MATCHES "msse4.2")) )
|
||||
Message(FATAL_ERROR "For x86 Architecture, you must have following flags: -mssse3 -msse4.1 -msse4.2. The current detected flags are: ${C_FLAGS_PROCESSOR}. You can pass the flags manually in build script, for example: ./build_oai --cflags_processor \"-mssse3 -msse4.1 -msse4.2\" ")
|
||||
if ( (NOT( C_FLAGS_PROCESSOR MATCHES "ssse3")) OR (NOT( C_FLAGS_PROCESSOR MATCHES "msse4.1")) )
|
||||
Message(FATAL_ERROR "For x86 Architecture, you must have following flags: -mssse3 -msse4.1. The current detected flags are: ${C_FLAGS_PROCESSOR}. You can pass the flags manually in build script, for example: ./build_oai --cflags_processor \"-mssse3 -msse4.1\" ")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -6,41 +6,50 @@ Obj.# Case# Test# Description
|
||||
01 pre-commit test case
|
||||
01 01 Build OAI
|
||||
01 01 01 Build oaisim.Rel8
|
||||
01 01 02 Build oaisim.Rel8 + network device driver(nasmesh_fix)
|
||||
01 01 03 Build (lte-softmodem.Rel8.EXMIMO + lte-softmodem.Rel10.EXMIMO + lte-softmodem.Rel10.USRP)
|
||||
01 01 04 Build (dlsim.Rel10 + ulsim.Rel10 + pucchsim.Rel10 + prachsim.Rel10 + pdcchsim.Rel10 + pbchsim.Rel10 + mbmssim.Rel10
|
||||
01 01 02 Build oaisim.Rel10
|
||||
01 01 03 Build oaisim_noS1.Rel10
|
||||
01 01 10 Build lte-softmodem_noS1.USRP.Rel10
|
||||
01 01 11 Build lte-softmodem_noS1.EXMIMO.Rel10
|
||||
01 01 12 Build lte-softmodem_noS1.BLADERF.Rel10
|
||||
01 01 13 Build lte-softmodem_noS1.ETHERNET.Rel10
|
||||
01 01 20 Build lte-softmodem.USRP.Rel10
|
||||
01 01 21 Build lte-softmodem.EXMIMO.Rel10
|
||||
01 01 22 Build lte-softmodem.BLADERF.Rel10
|
||||
01 01 23 Build lte-softmodem.ETHERNET.Rel10
|
||||
|
||||
01 01 30 Build (dlsim.Rel10 + ulsim.Rel10 + pucchsim.Rel10 + prachsim.Rel10 + pdcchsim.Rel10 + pbchsim.Rel10 + mbmssim.Rel10
|
||||
secu_knas_encrypt_eia1.Rel10 secu_kenb.Rel10 aes128_ctr_encrypt.Rel10 aes128_ctr_decrypt.Rel10 secu_knas_encrypt_eea2.Rel10
|
||||
secu_knas.Rel10 secu_knas_encrypt_eea1.Rel10 kdf.Rel10 aes128_cmac_encrypt.Rel10 secu_knas_encrypt_eia2.Rel10)
|
||||
01 01 06 Build oaisim.Rel8 + ITTI
|
||||
01 01 07 Build oaisim.Rel10
|
||||
01 01 08 Build oaisim.Rel10 + ITTI
|
||||
01 01 20 Build Nasmesh
|
||||
01 01 30 Build RRH Gateway
|
||||
|
||||
01 01 40 Build RRH Gateway for USRP (Rel 10)
|
||||
01 01 41 Build RRH Gateway for EXMIMO (Rel 10)
|
||||
01 01 42 Build RRH Gateway for BLADERF (Rel 10)
|
||||
|
||||
|
||||
01 02 Run OAISIM Rel10 (TDD + 5MHz/10MHz/20MHz + TM 1,2,5,6), and check the operation
|
||||
01 02 00 Run OAISIM Rel10 TDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) and search for errors, segmentation fault or exit
|
||||
01 02 01 Run OAISIM Rel10 TDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode and search for errors
|
||||
01 02 02 Run OAISIM Rel10 TDD, 1 eNB + 3 UEs (5 MHz/10MHz/20MHz), (TM 1,2,5,6) and search for errors, segmentation fault or exit
|
||||
01 02 03 Run OAISIM Rel10 TDD, 1 eNB + 3 UEs (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode and search for errors
|
||||
01 02 04 Run OAI Rel10 TDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) without PHY_ABSTRACTION mode, ping from from eNB to UE,
|
||||
|
||||
01 02 Run OAISIM-NOS1 Rel10 (TDD + 5MHz/10MHz/20MHz + TM 1,2,5,6), and check the operation
|
||||
01 02 00 Run OAISIM-NOS1 Rel10 TDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) and search for errors, segmentation fault or exit
|
||||
01 02 01 Run OAISIM-NOS1 Rel10 TDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode and search for errors
|
||||
01 02 02 Run OAISIM-NOS1 Rel10 TDD, 1 eNB + 3 UEs (5 MHz/10MHz/20MHz), (TM 1,2,5,6) and search for errors, segmentation fault or exit
|
||||
01 02 03 Run OAISIM-NOS1 Rel10 TDD, 1 eNB + 3 UEs (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode and search for errors
|
||||
01 02 04 Run OAISIM-NOS1 Rel10 TDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) without PHY_ABSTRACTION mode, ping from from eNB to UE,
|
||||
and for check for no packet losses
|
||||
01 02 05 Run OAI Rel10 TDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode, send ping from from eNB to UE,
|
||||
01 02 05 Run OAISIM-NOS1 Rel10 TDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode, send ping from from eNB to UE,
|
||||
and check for no packet losses
|
||||
|
||||
01 03 Run OAISIM Rel10 (FDD + 5MHz/10MHz/20MHz + TM 1,2,5,6), and check the operation
|
||||
01 03 00 Run OAISIM Rel10 FDD, 1 eNB + 1 UE 1 eNB (5 MHz/10MHz/20MHz), (TM 1,2,5,6) and search for errors, segmentation fault or exit
|
||||
01 03 01 Run OAISIM Rel10 FDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode and search for errors
|
||||
01 03 02 Run OAISIM Rel10 FDD, 1 eNB + 3 UEs (5 MHz/10MHz/20MHz), (TM 1,2,5,6) and search for errors, segmentation fault or exit
|
||||
01 03 03 Run OAISIM Rel10 FDD, 1 eNB + 3 UEs (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode and search for errors
|
||||
01 03 04 Run OAI Rel10 FDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) without PHY_ABSTRACTION mode, ping from from eNB to UE,
|
||||
01 03 Run OAISIM-NOS1 Rel10 (FDD + 5MHz/10MHz/20MHz + TM 1,2,5,6), and check the operation
|
||||
01 03 00 Run OAISIM-NOS1 Rel10 FDD, 1 eNB + 1 UE 1 eNB (5 MHz/10MHz/20MHz), (TM 1,2,5,6) and search for errors, segmentation fault or exit
|
||||
01 03 01 Run OAISIM-NOS1 Rel10 FDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode and search for errors
|
||||
01 03 02 Run OAISIM-NOS1 Rel10 FDD, 1 eNB + 3 UEs (5 MHz/10MHz/20MHz), (TM 1,2,5,6) and search for errors, segmentation fault or exit
|
||||
01 03 03 Run OAISIM-NOS1 Rel10 FDD, 1 eNB + 3 UEs (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode and search for errors
|
||||
01 03 04 Run OAISIM-NOS1 Rel10 FDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) without PHY_ABSTRACTION mode, ping from from eNB to UE,
|
||||
and for check for no packet losses
|
||||
01 03 05 Run OAI Rel10 FDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode, send ping from from eNB to UE,
|
||||
01 03 05 Run OAISIM-NOS1 Rel10 FDD, 1 eNB + 1 UE (5 MHz/10MHz/20MHz), (TM 1,2,5,6) in PHY_ABSTRACTION mode, send ping from from eNB to UE,
|
||||
and check for no packet losses
|
||||
|
||||
|
||||
|
||||
01 04 MBSFN Tests
|
||||
01 04 OAISIM-NOS1 MBSFN Tests
|
||||
01 04 00 Check if eMBMS procedure is not finished completely, make sure that the SIB13/MCCH have been correclty received by UEs
|
||||
01 04 01 Check if eMBMS multicast/broadcast data is received, make sure that the SIB13/MCCH/MTCH have been correclty received by UEs
|
||||
01 04 02 Check for eMBMS multicast/broadcast data received in fdd mode, make sure that the SIB13/MCCH/MTCH have been correctly
|
||||
@@ -88,7 +97,31 @@ Obj.# Case# Test# Description
|
||||
01 51 06 mbmssim (TBD)
|
||||
|
||||
|
||||
01 55 lte-softmodem tests
|
||||
01 55 lte-softmodem tests with USRP B210 RF as eNB and ALU EPC w/ Bandrich COTS UE for `TX/1RX, 1TX/2RX, 2TX/1RX 2TX/2RX
|
||||
01 55 00 Band 7 FDD 5MHz UL Throughput for 60 sec for 1TX/1RX
|
||||
01 55 00 Band 7 FDD 10MHz UL Throughput for 60 sec
|
||||
01 55 00 Band 7 FDD 20MHz UL Throughput for 60 sec
|
||||
01 55 00 Band 7 FDD 5MHz DL Throughput for 60 sec
|
||||
01 55 00 Band 7 FDD 10MHz DL Throughput for 60 sec
|
||||
01 55 00 Band 7 FDD 20MHz DL Throughput for 60 sec
|
||||
|
||||
|
||||
01 56 lte-softmodem tests with USRP B210 RF as eNB and OAI EPC (eNB and EPC are on same machines) w/ Bandrich COTS UE
|
||||
|
||||
|
||||
01 57 lte-softmodem tests with USRP B210 RF as eNB and OAI EPC (eNB and EPC are on different machines) w/ Bandrich COTS UE
|
||||
|
||||
01 58 lte-softmodem tests with USRP X310 RF as eNB and ALU EPC w/ Bandrich COTS UE for `TX/1RX, 1TX/2RX, 2TX/1RX 2TX/2RX
|
||||
|
||||
01 59 lte-softmodem tests with USRP X310 RF as eNB and OAI EPC (eNB and EPC are on same machines) w/ Bandrich COTS UE
|
||||
|
||||
01 61 lte-softmodem tests with USRP X310 RF as eNB and OAI EPC (eNB and EPC are on different machines) w/ Bandrich COTS UE
|
||||
|
||||
01 61 lte-softmodem tests with EXMIMO RF as eNB and ALU EPC w/ Bandrich COTS UE
|
||||
01 62 lte-softmodem tests with EXMIMO RF as eNB and OAI EPC (eNB and EPC are on same machines) w/ Bandrich COTS UE
|
||||
01 63 lte-softmodem tests with EXMIMO RF as eNB and OAI EPC (eNB and EPC are on different machines) w/ Bandrich COTS UE
|
||||
|
||||
01 58 lte-softmodem-noS1 tests
|
||||
|
||||
02 Functional test case
|
||||
|
||||
|
||||
@@ -0,0 +1,349 @@
|
||||
#******************************************************************************
|
||||
|
||||
# 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 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, sudo=False):
|
||||
rsp1 = self.prompt1
|
||||
rsp2 = self.prompt2
|
||||
if sudo == True:
|
||||
command = 'echo \'' + self.password + '\' | sudo -S -E ' + command
|
||||
|
||||
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,sudo=False, timeout = 50, rsp1=None, rsp2=None,debug=0):
|
||||
if not rsp1:
|
||||
rsp1 = self.prompt1
|
||||
if not rsp2:
|
||||
rsp2 = self.prompt2
|
||||
self.wait_quiet()
|
||||
if sudo == True:
|
||||
command = 'echo \'' + self.password + '\' | sudo -S -E ' + command
|
||||
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, sudo=False, timeout=100, rsp1=None, rsp2=None,debug=0):
|
||||
if not rsp1:
|
||||
rsp1 = self.prompt1
|
||||
if not rsp2:
|
||||
rsp2 = self.prompt2
|
||||
self.wait_quiet()
|
||||
if sudo == True:
|
||||
command = 'echo \'' + self.password + '\' | sudo -S -E ' + command
|
||||
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, sudo=False, delay = 50, rsp1=None, rsp2=None,debug=0):
|
||||
if debug :
|
||||
print command
|
||||
print expect
|
||||
print delay
|
||||
rsp = self.send_recv(command, sudo, 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, sudo=False, raise_err=1, delay = 50, rsp1=None, rsp2=None,debug=0):
|
||||
rsp = self.send_recv(command, sudo, 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, sudo=False, delay = 5, rsp1=None, rsp2=None,debug=0):
|
||||
rsp = self.send_recv(command, sudo, 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, sudo=False, numretries=3, rsp1=None, rsp2=None,debug=0):
|
||||
timer = 0
|
||||
for i in range(numretries):
|
||||
rsp = self.send_recv(command, sudo, 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, sudo=False, numretries=3, rsp1=None, rsp2=None,debug=0):
|
||||
timer = 0
|
||||
for i in range(numretries):
|
||||
rsp = self.send_recv(command,sudo)
|
||||
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, sudo=False, numretries=3, rsp1=None, rsp2=None,debug=0):
|
||||
timer = 1
|
||||
for i in range(numretries):
|
||||
rsp = self.send_recv(command,sudo)
|
||||
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, sudo=False, numretries=3, rsp1=None, rsp2=None,debug=0):
|
||||
timer = 0
|
||||
for i in range(numretries):
|
||||
rsp = self.send_recv(command,sudo)
|
||||
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)
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
#******************************************************************************
|
||||
|
||||
# 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 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' )
|
||||
@@ -0,0 +1,262 @@
|
||||
#******************************************************************************
|
||||
|
||||
# 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 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 sys
|
||||
import traceback
|
||||
# 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
|
||||
self.password = ''
|
||||
# WE do not store the password when sending commands for secuirity reasons. The password might be accidentally logged in such cases.
|
||||
#The password is used only to make ssh connections. In case user wants to run programs with sudo, then he/she needs to add following line in /etc/sudoers
|
||||
# your_user_name ALL=(ALL:ALL) NOPASSWD: ALL
|
||||
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 Exception, e:
|
||||
error=''
|
||||
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
|
||||
error = error + traceback.format_exc()
|
||||
print error
|
||||
sys.exit(1)
|
||||
|
||||
def connect2(self, username, password, prompt='$'):
|
||||
self.prompt1 = prompt
|
||||
self.prompt2 = prompt
|
||||
self.password = password
|
||||
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, e:
|
||||
error=''
|
||||
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
|
||||
error = error + traceback.format_exc()
|
||||
print error
|
||||
sys.exit(1)
|
||||
|
||||
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, e:
|
||||
error=''
|
||||
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
|
||||
error = error + traceback.format_exc()
|
||||
print error
|
||||
sys.exit(1)
|
||||
|
||||
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 oaisim_nos1')
|
||||
os.system('pkill cc1')
|
||||
time.sleep(1)
|
||||
os.system('pkill oaisim oaisim_nos1')
|
||||
else :
|
||||
os.system('echo '+pw+' | sudo -S pkill oaisim oaisim_nos1')
|
||||
os.system('echo '+pw+' | sudo -S pkill cc1')
|
||||
time.sleep(1)
|
||||
os.system('echo '+pw+' | sudo -S pkill oaisim oaisim_nos1')
|
||||
except Exception, e:
|
||||
error=''
|
||||
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
|
||||
error = error + traceback.format_exc()
|
||||
print error
|
||||
sys.exit(1)
|
||||
|
||||
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 Exception, e:
|
||||
error=''
|
||||
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
|
||||
error = error + traceback.format_exc()
|
||||
print error
|
||||
sys.exit(1)
|
||||
|
||||
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 Exception, e:
|
||||
error=''
|
||||
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
|
||||
error = error + traceback.format_exc()
|
||||
print error
|
||||
sys.exit(1)
|
||||
|
||||
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 Exception, e:
|
||||
error=''
|
||||
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
|
||||
error = error + traceback.format_exc()
|
||||
print error
|
||||
sys.exit(1)
|
||||
#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
|
||||
@@ -7,12 +7,15 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
trap handle_ctrl_c INT
|
||||
|
||||
source $OPENAIR_DIR/cmake_targets/tools/test_helper
|
||||
|
||||
|
||||
#SUDO="sudo -E "
|
||||
tdir=$OPENAIR_DIR/cmake_targets/autotests
|
||||
rm -fr $tdir/bin $tdir/log
|
||||
mkdir -p $tdir/bin $tdir/log
|
||||
rm -fr $tdir/bin
|
||||
mkdir -p $tdir/bin
|
||||
results_file="$tdir/log/results_autotests.xml"
|
||||
|
||||
updated=$(svn st -q $OPENAIR_DIR)
|
||||
@@ -36,12 +39,12 @@ cd $tdir
|
||||
#\param $12 -> class of the test case (compilation, execution)
|
||||
#\param $13 -> output of compilation program that needs to be found for test case to pass
|
||||
#\param $14 -> tags to help identify the test case for readability in output xml file
|
||||
test_compile() {
|
||||
function test_compile() {
|
||||
|
||||
xUnit_start
|
||||
test_case_name=$1
|
||||
log_dir=$tdir/log
|
||||
log_file=$tdir/log/test.$1.txt
|
||||
log_dir=$tdir/log/$test_case_name
|
||||
log_file=$log_dir/test.$1.log.txt
|
||||
compile_prog=$2
|
||||
compile_args=$3
|
||||
pre_exec_file=$4
|
||||
@@ -54,11 +57,18 @@ test_compile() {
|
||||
class=${12}
|
||||
compile_prog_out=${13}
|
||||
tags=${14}
|
||||
build_dir=$tdir/$1/build
|
||||
exec_file=$build_dir/$6
|
||||
xmlfile_testcase=$log_dir/test.$1.xml
|
||||
#build_dir=$tdir/$1/build
|
||||
#exec_file=$build_dir/$6
|
||||
|
||||
#compile_prog_out=`eval "echo $compile_prog_out"`
|
||||
#echo "compile_prog_out = $compile_prog_out"
|
||||
read -a compile_prog_out_array <<< "$compile_prog_out"
|
||||
|
||||
#Temporary log file where execution log is stored.
|
||||
temp_exec_log=$log_dir/temp_log.txt
|
||||
rm -fr $log_dir
|
||||
mkdir -p $log_dir
|
||||
|
||||
|
||||
|
||||
@@ -74,44 +84,78 @@ test_compile() {
|
||||
compile_prog_array=()
|
||||
read -a compile_prog_array <<<"$compile_prog"
|
||||
|
||||
tags_array=()
|
||||
read -a tags_array <<<"$tags"
|
||||
#tags_array=()
|
||||
#read -a tags_array <<<"$tags"
|
||||
|
||||
pre_compile_prog_array=()
|
||||
readarray -t pre_compile_prog_array <<< "$pre_compile_prog"
|
||||
#pre_compile_prog_array=()
|
||||
#readarray -t pre_compile_prog_array <<< "$pre_compile_prog"
|
||||
result=1
|
||||
result_string=""
|
||||
for (( run_index=1; run_index <= $nruns; run_index++ ))
|
||||
do
|
||||
tags_array_index=0
|
||||
for pre_compile_prog_array_index in "${pre_compile_prog_array[@]}"
|
||||
do
|
||||
|
||||
#tags_array_index=0
|
||||
#for pre_compile_prog_array_index in "${pre_compile_prog_array[@]}"
|
||||
#do
|
||||
|
||||
for compile_prog_array_index in "${compile_prog_array[@]}"
|
||||
do
|
||||
echo "Compiling test case $test_case_name.$compile_prog_array_index.${tags_array[$tags_array_index]} Log file = $log_file"
|
||||
echo "<COMPILATION LOG file=$compile_prog_array_index , Run = $run_index>" >> $log_file
|
||||
rm -fr $build_dir
|
||||
mkdir -p $build_dir
|
||||
cd $build_dir
|
||||
#for compile_prog_array_index in "${compile_prog_array[@]}"
|
||||
#do
|
||||
echo "Compiling test case $test_case_name.${tags} Log file = $log_file"
|
||||
date=`date`
|
||||
echo "<COMPILATION LOG file=$test_case_name.${tags} , Run = $run_index>, Date = $date " >> $log_file
|
||||
#rm -fr $build_dir
|
||||
#mkdir -p $build_dir
|
||||
cd $log_dir
|
||||
{
|
||||
eval $pre_compile_prog_array_index
|
||||
cmake ..
|
||||
#rm -fv $exec_file
|
||||
make -j`nproc` $compile_prog_array_index $compile_args
|
||||
uname -a
|
||||
compile_log_dir=`eval echo \"$OPENAIR_DIR/cmake_targets/log/\"`
|
||||
echo "Removing compilation log files in $compile_log_dir"
|
||||
rm -frv $compile_log_dir
|
||||
echo "Executing $compile_prog $compile_prog_args ...."
|
||||
eval $compile_prog $compile_prog_args
|
||||
echo "Copying compilation log files to test case log directory: $log_dir"
|
||||
cp -fvr $OPENAIR_DIR/cmake_targets/log/ $log_dir/compile_log
|
||||
}>> $log_file 2>&1
|
||||
echo "</COMPILATION LOG>" >> $log_file 2>&1
|
||||
if [ "$class" == "compilation" ]; then
|
||||
if [ -s "$compile_prog_array_index" ] || [ -s "$compile_prog_out" ] ; then
|
||||
echo_success "$test_case_name.$compile_prog_array_index.${tags_array[$tags_array_index]} compiled"
|
||||
xUnit_success "compilation" "$test_case_name.$compile_prog_array_index.${tags_array[$tags_array_index]}" "PASS" "$run_index"
|
||||
else
|
||||
echo_error "$test_case_name.$exec_prog.${tags_array[$tags_array_index]} compilation failed"
|
||||
xUnit_fail "compilation" "$test_case_name.$compile_prog_array_index.${tags_array[$tags_array_index]}" "FAIL" "$run_index"
|
||||
for compile_prog_out_index in ${compile_prog_out_array[@]}
|
||||
do
|
||||
if [ -s "$compile_prog_out_index" ]; then
|
||||
let "result = result&1"
|
||||
|
||||
echo_success "$test_case_name.${tags} RUN = $run_index $compile_prog_out_index = compiled"
|
||||
|
||||
else
|
||||
let "result = result&0"
|
||||
|
||||
echo_error "$test_case_name.${tags} RUN = $run_index $compile_prog_out_index failed"
|
||||
|
||||
fi
|
||||
done #end of for loop compile_prog_out_index
|
||||
if [ "$result" == "1" ]; then
|
||||
result_string=$result_string" Run_$run_index = PASS"
|
||||
else
|
||||
result_string=$result_string" Run_$run_index = FAIL"
|
||||
fi
|
||||
|
||||
fi
|
||||
let "tags_array_index++"
|
||||
done # End of for loop compile_prog_array
|
||||
done # End of for loop (pre_compile_prog_array_index)
|
||||
#let "tags_array_index++"
|
||||
#done # End of for loop compile_prog_array
|
||||
#done # End of for loop (pre_compile_prog_array_index)
|
||||
done #End of for loop (run_index)
|
||||
|
||||
|
||||
#If for for some reason upper for loop does not execute, we fail the test case completely
|
||||
if [ "$result_string" == "" ]; then
|
||||
result=0
|
||||
fi
|
||||
if [ "$result" == "1" ]; then
|
||||
echo_success "$test_case_name.${tags} PASSED"
|
||||
xUnit_success "compilation" "$test_case_name.$tags" "PASS" "$result_string" "$xmlfile_testcase"
|
||||
else
|
||||
echo_error "$test_case_name.${tags} FAILED"
|
||||
xUnit_fail "compilation" "$test_case_name.$tags" "FAIL" "$result_string" "$xmlfile_testcase"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -130,12 +174,13 @@ test_compile() {
|
||||
#\param $12 -> class of the test case (compilation, execution)
|
||||
#\param $13 -> output of compilation program that needs to be found for test case to pass
|
||||
#\param $14 -> tags to help identify the test case for readability in output xml file
|
||||
#\param $15 => password for the user to run certain commands as sudo
|
||||
|
||||
test_compile_and_run() {
|
||||
function test_compile_and_run() {
|
||||
xUnit_start
|
||||
test_case_name=$1
|
||||
log_dir=$tdir/log
|
||||
log_file=$tdir/log/test.$1.txt
|
||||
log_dir=$tdir/log/$test_case_name
|
||||
log_file=$log_dir/test.$1.log.txt
|
||||
compile_prog=$2
|
||||
compile_args=$3
|
||||
pre_exec_file=$4
|
||||
@@ -149,16 +194,20 @@ test_compile_and_run() {
|
||||
class=${12}
|
||||
compile_prog_out=${13}
|
||||
tags=${14}
|
||||
mypassword=${15}
|
||||
build_dir=$tdir/$1/build
|
||||
exec_file=$build_dir/$6
|
||||
|
||||
#exec_file=$build_dir/$6
|
||||
xmlfile_testcase=$log_dir/test.$1.xml
|
||||
#Temporary log file where execution log is stored.
|
||||
temp_exec_log=$log_dir/temp_log.txt
|
||||
|
||||
rm -fr $log_dir
|
||||
mkdir -p $log_dir
|
||||
|
||||
rm -fr $OPENAIR_DIR/cmake_targets/log
|
||||
|
||||
|
||||
|
||||
echo "" > $temp_exec_log
|
||||
echo "" > $log_file
|
||||
#echo "log_dir = $log_dir"
|
||||
#echo "log_file = $log_file"
|
||||
#echo "exec_file = $exec_file"
|
||||
@@ -168,63 +217,68 @@ test_compile_and_run() {
|
||||
#echo "nruns = $nruns"
|
||||
echo "class = $class"
|
||||
|
||||
compile_prog_array=()
|
||||
read -a compile_prog_array <<<"$compile_prog"
|
||||
#compile_prog_array=()
|
||||
#read -a compile_prog_array <<<"$compile_prog"
|
||||
|
||||
tags_array=()
|
||||
read -a tags_array <<<"$tags"
|
||||
|
||||
main_exec_args_array=()
|
||||
readarray -t main_exec_args_array <<< "$exec_args"
|
||||
|
||||
|
||||
#for search_expr in "${compile_prog_array[@]}"
|
||||
#do
|
||||
echo "Compiling test case $test_case_name Log file = $log_file"
|
||||
echo "<COMPILATION LOG file=$log_file>" >> $log_file
|
||||
|
||||
for search_expr in "${compile_prog_array[@]}"
|
||||
do
|
||||
echo "Compiling test case $test_case_name.$search_expr Log file = $log_file"
|
||||
echo "<COMPILATION LOG file=$search_expr>" >> $log_file
|
||||
#rm -fr $build_dir
|
||||
#mkdir -p $build_dir
|
||||
|
||||
rm -fr $build_dir
|
||||
mkdir -p $build_dir
|
||||
|
||||
cd $build_dir
|
||||
cd $log_dir
|
||||
{
|
||||
eval $pre_compile_prog
|
||||
cmake ..
|
||||
uname -a
|
||||
#eval $pre_compile_prog
|
||||
#cmake ..
|
||||
#rm -fv $exec_file
|
||||
make -j`nproc` $search_expr $compile_args
|
||||
echo "Executing $compile_prog $compile_args" >> $log_file
|
||||
eval "$compile_prog $compile_args"
|
||||
echo "Copying compilation log files to test case log directory: $log_dir"
|
||||
cp -fvr $OPENAIR_DIR/cmake_targets/log/ $log_dir/compile_log
|
||||
}>> $log_file 2>&1
|
||||
echo "</COMPILATION LOG>" >> $log_file 2>&1
|
||||
if [ "$class" == "compilation" ]; then
|
||||
if [ -s "$search_expr" ] ; then
|
||||
echo_success "$test_case_name $search_expr compiled"
|
||||
xUnit_success "compilation" "$test_name.$search_expr" "PASS" 1
|
||||
else
|
||||
echo_error "$test_case_name $exec_prog compilation failed"
|
||||
xUnit_fail "compilation" "$test_name.$search_expr" "FAIL" 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
#done
|
||||
|
||||
#process the test case if it is that of execution
|
||||
if [ "$class" == "execution" ]; then
|
||||
tags_array_index=0
|
||||
for main_exec_args_array_index in "${main_exec_args_array[@]}"
|
||||
do
|
||||
for (( run_index=1; run_index <= $nruns; run_index++ ))
|
||||
global_result=1
|
||||
result_string=""
|
||||
|
||||
for (( run_index=1; run_index <= $nruns; run_index++ ))
|
||||
do
|
||||
echo "Executing test case $test_case_name.$main_exec.${tags_array[$tags_array_index]}, Run Index = $run_index, Log file = $log_file"
|
||||
temp_exec_log=$log_dir/test.$test_case_name.${tags_array[$tags_array_index]}.run_$run_index
|
||||
echo "" > $temp_exec_log
|
||||
|
||||
echo "-----------------------------------------------------------------------------" >> $log_file 2>&1
|
||||
echo "<EXECUTION LOG Run = $run_index >" >> $log_file 2>&1
|
||||
|
||||
echo "Executing test case $test_case_name.${tags_array[$tags_array_index]}, Run Index = $run_index, Execution Log file = $temp_exec_log"
|
||||
|
||||
echo "-----------------------------------------------------------------------------" >> $temp_exec_log 2>&1
|
||||
echo "<EXECUTION LOG Test Case = $test_case_name.${tags_array[$tags_array_index]}, Run = $run_index >" >> $temp_exec_log 2>&1
|
||||
|
||||
if [ -n "$pre_exec_file" ]; then
|
||||
{ eval "source $pre_exec_file $pre_exec_args"; } >> $log_file 2>&1
|
||||
fi
|
||||
echo "Executing $exec_file $main_exec_args_array_index "
|
||||
echo "Executing $exec_file $main_exec_args_array_index " >> $log_file
|
||||
{ eval "$exec_file $main_exec_args_array_index" ;} > $temp_exec_log 2>&1
|
||||
{ echo " Executing $pre_exec_file $pre_exec_args "
|
||||
eval " echo '$mypassword' |sudo -S -E $pre_exec_file $pre_exec_args " ; }>> $temp_exec_log 2>&1
|
||||
|
||||
fi
|
||||
echo "Executing $main_exec $main_exec_args_array_index "
|
||||
echo "Executing $main_exec $main_exec_args_array_index " >> $temp_exec_log
|
||||
{ uname -a ; eval "$main_exec $main_exec_args_array_index" ;} >> $temp_exec_log 2>&1
|
||||
|
||||
echo "</EXECUTION LOG Test Case = $test_case_name.${tags_array[$tags_array_index]}, Run = $run_index >" >> $temp_exec_log 2>&1
|
||||
cat $temp_exec_log >> $log_file 2>&1
|
||||
echo "</EXECUTION LOG Test Case = $test_case_name.$main_exec.${tags_array[$tags_array_index]}, Run = $run_index >" >> $log_file 2>&1
|
||||
|
||||
|
||||
result=1
|
||||
for search_expr in "${search_expr_array[@]}"
|
||||
@@ -241,68 +295,59 @@ test_compile_and_run() {
|
||||
let "result = result & 1"
|
||||
fi
|
||||
done
|
||||
|
||||
#If we find a negative search result then there is crash of program and test case is failed even if above condition is true
|
||||
search_result=`grep -iE "$search_expr_negative" $temp_exec_log`
|
||||
if [ -n "$search_result" ]; then
|
||||
result=0
|
||||
fi
|
||||
let "global_result = global_result & result"
|
||||
|
||||
#echo "result = $result"
|
||||
|
||||
test_case_result=""
|
||||
|
||||
#this is a result of this run
|
||||
#test_case_result=""
|
||||
if [ "$result" -eq "0" ]; then
|
||||
test_case_result="FAIL"
|
||||
result_string=$result_string" Run_$run_index =FAIL"
|
||||
echo_error "$test_case_name.${tags_array[$tags_array_index]} RUN = $run_index Result = FAIL"
|
||||
fi
|
||||
|
||||
if [ "$result" -eq "1" ]; then
|
||||
test_case_result="PASS"
|
||||
result_string=$result_string" Run_$run_index =PASS"
|
||||
echo_success "$test_case_name.${tags_array[$tags_array_index]} RUN = $run_index Result = PASS"
|
||||
fi
|
||||
|
||||
#If we find a negative search result then there is crash of program and test case is failed even if above condition is true
|
||||
|
||||
search_result=`grep -iE "$search_expr_negative" $temp_exec_log`
|
||||
if [ -n "$search_result" ]; then
|
||||
test_case_result="FAIL"
|
||||
fi
|
||||
|
||||
if [ "$test_case_result" == "FAIL" ]; then
|
||||
echo_error "execution $test_case_name.$compile_prog.${tags_array[$tags_array_index]} FAIL $run_index"
|
||||
xUnit_fail "execution" "$test_case_name.$compile_prog.${tags_array[$tags_array_index]}" "FAIL" "$run_index"
|
||||
fi
|
||||
|
||||
if [ "$test_case_result" == "PASS" ]; then
|
||||
echo_success "execution $test_case_name.$compile_prog.${tags_array[$tags_array_index]} PASS $run_index"
|
||||
xUnit_success "execution" "$test_case_name.$compile_prog.${tags_array[$tags_array_index]}" "PASS" "$run_index"
|
||||
fi
|
||||
|
||||
|
||||
done
|
||||
done #End of for loop (nindex)
|
||||
|
||||
echo " Result String = $result_string"
|
||||
|
||||
if [ "$result_string" == "" ]; then
|
||||
echo_error "execution $test_case_name.$compile_prog.${tags_array[$tags_array_index]} Run_Result = \"$result_string\" Result = FAIL"
|
||||
xUnit_fail "execution" "$test_case_name.${tags_array[$tags_array_index]}" "FAIL" "$result_string" "$xmlfile_testcase"
|
||||
else
|
||||
if [ "$global_result" == "0" ]; then
|
||||
echo_error "execution $test_case_name.${tags_array[$tags_array_index]} Run_Result = \"$result_string\" Result = FAIL"
|
||||
xUnit_fail "execution" "$test_case_name.${tags_array[$tags_array_index]}" "FAIL" "$result_string" "$xmlfile_testcase"
|
||||
fi
|
||||
|
||||
if [ "$global_result" == "1" ]; then
|
||||
echo_success "execution $test_case_name.${tags_array[$tags_array_index]} Run_Result = \"$result_string\" Result = PASS "
|
||||
xUnit_success "execution" "$test_case_name.${tags_array[$tags_array_index]}" "PASS" "$result_string" "$xmlfile_testcase"
|
||||
fi
|
||||
fi
|
||||
|
||||
let "tags_array_index++"
|
||||
done # End of for loop (nindex)
|
||||
done
|
||||
fi
|
||||
rm -fr $build_dir
|
||||
}
|
||||
|
||||
dbin=$OPENAIR_DIR/cmake_targets/autotests/bin
|
||||
dlog=$OPENAIR_DIR/cmake_targets/autotests/log
|
||||
|
||||
run_test() {
|
||||
case=case$1; shift
|
||||
cmd=$1; shift
|
||||
expected=$3; shift
|
||||
echo "expected = $expected"
|
||||
exit
|
||||
|
||||
$cmd > $dlog/$case.txt 2>&1
|
||||
if [ $expected = "true" ] ; then
|
||||
if $* $dlog/$case.txt; then
|
||||
echo_success "test $case, command: $cmd ok"
|
||||
else
|
||||
echo_error "test $case, command: $cmd Failed"
|
||||
fi
|
||||
else
|
||||
if $* $dlog/$case.txt; then
|
||||
echo_error "test $case, command: $cmd Failed"
|
||||
else
|
||||
echo_success "test $case, command: $cmd ok"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
print_help() {
|
||||
function print_help() {
|
||||
echo_info '
|
||||
This program runs automated test case system for OpenAirInterface
|
||||
You should have ubuntu 14.xx, updated, and the Linux kernel >= 3.14
|
||||
@@ -311,14 +356,20 @@ Options
|
||||
This help
|
||||
-g | --run-group
|
||||
Run test cases in a group. For example, ./run_exec_autotests "0101* 010102"
|
||||
-p
|
||||
Use password for logging
|
||||
'
|
||||
}
|
||||
|
||||
main () {
|
||||
function main () {
|
||||
RUN_GROUP=0
|
||||
SET_PASSWORD=0
|
||||
passwd=""
|
||||
test_case_group=""
|
||||
test_case_group_array=()
|
||||
test_case_array=()
|
||||
echo_info "Note that the user should be sudoer for executing certain commands, for example loading kernel modules"
|
||||
|
||||
|
||||
until [ -z "$1" ]
|
||||
do
|
||||
@@ -328,6 +379,10 @@ until [ -z "$1" ]
|
||||
test_case_group=$2
|
||||
echo_info "Will execute test cases only in group $test_case_group"
|
||||
shift 2;;
|
||||
-p)
|
||||
SET_PASSWORD=1
|
||||
passwd=$2
|
||||
shift 2;;
|
||||
-h | --help)
|
||||
print_help
|
||||
exit 1;;
|
||||
@@ -338,6 +393,22 @@ until [ -z "$1" ]
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$SET_PASSWORD" == "1" ]; then
|
||||
mypassword=$passwd
|
||||
else
|
||||
read -s -p "Enter Password: " mypassword
|
||||
fi
|
||||
|
||||
tmpfile=`mktemp`
|
||||
echo \'$passwd\' | sudo echo $HOME >& $tmpfile
|
||||
tstsudo=`cat $tmpfile`
|
||||
if [ "$tstsudo" != "$HOME" ]; then
|
||||
echo "User might not have sudo privileges. Exiting"
|
||||
echo "tstsudo = $tstsudo"
|
||||
exit
|
||||
fi
|
||||
echo "tstsudo = $tstsudo"
|
||||
rm -fr $tmpfile
|
||||
|
||||
xml_conf="$OPENAIR_DIR/cmake_targets/autotests/test_case_list.xml"
|
||||
|
||||
@@ -392,6 +463,8 @@ for search_expr in "${test_case_array[@]}"
|
||||
echo "Description = $desc"
|
||||
echo "pre_compile_prog = $pre_compile_prog"
|
||||
echo "compile_prog = $compile_prog"
|
||||
echo "compile_prog_args = $compile_prog_args"
|
||||
echo "compile_prog_out = $compile_prog_out"
|
||||
echo "pre_exec = $pre_exec"
|
||||
echo "pre_exec_args = $pre_exec_args"
|
||||
echo "main_exec = $main_exec"
|
||||
@@ -401,6 +474,7 @@ for search_expr in "${test_case_array[@]}"
|
||||
echo "nruns = $nruns"
|
||||
|
||||
#eval $pre_exec
|
||||
compile_prog_out=`eval echo \"$compile_prog_out\"`
|
||||
|
||||
search_array_true=()
|
||||
|
||||
@@ -421,9 +495,9 @@ for search_expr in "${test_case_array[@]}"
|
||||
if [ "$class" == "compilation" ]; then
|
||||
test_compile "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags"
|
||||
elif [ "$class" == "execution" ]; then
|
||||
test_compile_and_run "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags"
|
||||
test_compile_and_run "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags" "$mypassword"
|
||||
else
|
||||
echo "Unexpected class of test case...Exiting...."
|
||||
echo "Unexpected class of test case...Skipping the test case $name ...."
|
||||
fi
|
||||
|
||||
done
|
||||
@@ -432,6 +506,8 @@ for search_expr in "${test_case_array[@]}"
|
||||
|
||||
}
|
||||
|
||||
uname -a
|
||||
|
||||
main "$@"
|
||||
|
||||
xUnit_write "$results_file"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+154
@@ -0,0 +1,154 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import time
|
||||
import serial
|
||||
import os
|
||||
from pyroute2 import IPRoute
|
||||
import sys
|
||||
import re
|
||||
import threading
|
||||
import signal
|
||||
import traceback
|
||||
import os
|
||||
|
||||
# configure the serial connections (the parameters differs on the device you are connecting to)
|
||||
#First we find an open port to work with
|
||||
serial_port=''
|
||||
ser=serial.Serial()
|
||||
openair_dir = os.environ.get('OPENAIR_DIR')
|
||||
if openair_dir == None:
|
||||
print "Error getting OPENAIR_DIR environment variable"
|
||||
sys.exit(1)
|
||||
|
||||
def find_open_port():
|
||||
global serial_port, ser
|
||||
max_ports=100
|
||||
if os.path.exists(serial_port) == True:
|
||||
return serial_port
|
||||
for port in range(2,100):
|
||||
serial_port = '/dev/ttyUSB'+str(port)
|
||||
if os.path.exists(serial_port) == True:
|
||||
print 'New Serial Port : ' + serial_port
|
||||
break
|
||||
|
||||
ser = serial.Serial(port=serial_port)
|
||||
return
|
||||
|
||||
find_open_port()
|
||||
print 'Using Serial port : ' + serial_port
|
||||
|
||||
#serial_port = '/dev/ttyUSB2'
|
||||
bandrich_ppd_config = os.environ.get('OPENAIR_DIR') + '/cmake_targets/autotests/tools/wdial.bandrich.conf'
|
||||
|
||||
exit_flag=0
|
||||
|
||||
def signal_handler(signal, frame):
|
||||
print('You pressed Ctrl+C!')
|
||||
print('Resetting the UE to detached state')
|
||||
timeout=10
|
||||
exit_flag=1
|
||||
send_command('AT+CGATT=0' , 'OK' , timeout)
|
||||
sys.exit(0)
|
||||
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
|
||||
|
||||
|
||||
#ser.open()
|
||||
#ser.isOpen()
|
||||
|
||||
class pppThread (threading.Thread):
|
||||
def __init__(self, threadID, name, counter):
|
||||
threading.Thread.__init__(self)
|
||||
self.threadID = threadID
|
||||
self.name = name
|
||||
self.counter = counter
|
||||
def run(self):
|
||||
print "Starting " + self.name
|
||||
#Here we keep running pppd thread in indefinite loop as this script terminates sometimes
|
||||
#while 1:
|
||||
while 1:
|
||||
time.sleep(5) #Hard coded, do not reduce this number!
|
||||
print "Starting wvdial now..."
|
||||
print 'exit_flag = ' + str(exit_flag)
|
||||
send_command('AT+CGATT=1','OK', 300)
|
||||
os.system('wvdial -C ' + bandrich_ppd_config + '' )
|
||||
if exit_flag == 1:
|
||||
print "Exit flag set to true. Exiting pppThread now"
|
||||
print "Terminating wvdial now..."
|
||||
|
||||
def send_command (cmd, response, timeout):
|
||||
count=0
|
||||
sleep_duration = 1
|
||||
print 'In function: send_command: cmd = <' + cmd + '> response: <' + response + '> \n'
|
||||
global serial_port, ser
|
||||
while count <= timeout:
|
||||
try:
|
||||
#Sometimes the port does not exist coz of reset in modem.
|
||||
#In that case, we need to search for this port again
|
||||
if os.path.exists(serial_port) == False:
|
||||
find_open_port()
|
||||
ser.write (cmd + '\r\n')
|
||||
out = ''
|
||||
time.sleep(sleep_duration)
|
||||
count = count + sleep_duration
|
||||
while ser.inWaiting() > 0:
|
||||
out += ser.read(1)
|
||||
print 'out = <' + out + '> response = <' + response + '> \n'
|
||||
if re.search(response, out):
|
||||
break
|
||||
except Exception, e:
|
||||
error = ' cmd : ' + cmd + ' response : ' + response
|
||||
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
|
||||
error = error + traceback.format_exc()
|
||||
print error
|
||||
|
||||
|
||||
def start_ue () :
|
||||
#print 'Enter your commands below.\r\nInsert "exit" to leave the application.'
|
||||
timeout=60 #timeout in seconds
|
||||
send_command('AT', 'OK' , timeout)
|
||||
send_command('AT+CFUN=1' , 'OK' , timeout)
|
||||
#send_command('AT+CGATT=0' , 'OK' , timeout)
|
||||
send_command('AT+CGATT=1','OK', 300)
|
||||
#os.system('wvdial -C ' + bandrich_ppd_config + ' &' )
|
||||
|
||||
thread_ppp = pppThread(1, "ppp_thread", 1)
|
||||
thread_ppp.start()
|
||||
|
||||
iface='ppp0'
|
||||
|
||||
while 1:
|
||||
time.sleep ( 2)
|
||||
#Now we check if ppp0 interface is up and running
|
||||
try:
|
||||
if exit_flag == 1:
|
||||
break
|
||||
ip = IPRoute()
|
||||
idx = ip.link_lookup(ifname=iface)[0]
|
||||
os.system ('route add 192.172.0.1 ppp0')
|
||||
os.system ('ping 192.172.0.1')
|
||||
break
|
||||
except Exception, e:
|
||||
error = ' Interface ' + iface + 'does not exist...'
|
||||
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
|
||||
error = error + traceback.format_exc()
|
||||
print error
|
||||
|
||||
thread_ppp.join()
|
||||
|
||||
def stop_ue():
|
||||
timeout=60
|
||||
os.system('killall wvdial')
|
||||
send_command('AT', 'OK' , timeout)
|
||||
send_command('AT+CGATT=0' , 'OK|ERROR' , timeout)
|
||||
send_command('AT+CFUN=4' , 'OK' , timeout)
|
||||
|
||||
for arg in sys.argv[1:]:
|
||||
if arg == '--start-ue' :
|
||||
start_ue()
|
||||
elif arg == '--stop-ue' :
|
||||
stop_ue()
|
||||
else :
|
||||
print " Script called with wrong arguments, arg = " + arg
|
||||
sys.exit()
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
import re
|
||||
|
||||
#Arg 1 name of file
|
||||
#Arg 2 keyword
|
||||
#arg 3 replacement text
|
||||
#Note that these should be seperated by spaces
|
||||
if len(sys.argv) != 4:
|
||||
print "search_repl.py: Wrong number of arguments. This program needs 3 arguments"
|
||||
sys.exit()
|
||||
filename = sys.argv[1]
|
||||
keyword = sys.argv[2]
|
||||
replacement_text = sys.argv[3]
|
||||
|
||||
file = open(filename, 'r')
|
||||
string = file.read()
|
||||
file.close()
|
||||
|
||||
|
||||
if keyword == 'mme_ip_address':
|
||||
#string = (re.sub(r"mme_ip_address\s*=\s*\([^\$]+)\)\s*;\s*", r"<% tex \1 %>", t, re.M)
|
||||
replacement_text = keyword + ' = ( { ' + replacement_text + ' } ) ; '
|
||||
string = re.sub(r"mme_ip_address\s*=\s*\(([^\$]+?)\)\s*;", replacement_text, string, re.M)
|
||||
else :
|
||||
replacement_text = keyword + ' = ' + replacement_text + ' ; '
|
||||
string = re.sub(r"%s\s*=\s*([^\$]+?)\s*;" % keyword , replacement_text, string, re.M)
|
||||
#else :
|
||||
# replacement_text = keyword + ' =\"' + replacement_text + '\" ; '
|
||||
# string = re.sub(r"%s\s*=\s*\"([^\$]+?)\"\s*;" % keyword , replacement_text, string, re.M)
|
||||
|
||||
file = open(filename, 'w')
|
||||
file.write(string)
|
||||
file.close()
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
[Dialer Defaults]
|
||||
Modem = /dev/ttyUSB0
|
||||
ISDN = off
|
||||
Modem Type = Analog Modem
|
||||
Baud = 9600
|
||||
Init = ATZ
|
||||
Init2 = AT+CPIN?
|
||||
Init3 = AT+CGREG?
|
||||
Init4 = AT+COPS?
|
||||
Init5 = AT+CSQ
|
||||
Init6 =
|
||||
Init7 = AT+CGATT=1
|
||||
Init8 =
|
||||
Init9 =
|
||||
Phone = *99***1#
|
||||
Phone1 =
|
||||
Phone2 =
|
||||
Phone3 =
|
||||
Phone4 =
|
||||
Dial Prefix =
|
||||
Dial Attempts = 1
|
||||
Dial Command = ATM1L3DT
|
||||
Ask Password = off
|
||||
Password = ''
|
||||
Username = ImaginLab
|
||||
Auto Reconnect = off
|
||||
Abort on Busy = off
|
||||
Carrier Check = on
|
||||
Check Def Route = on
|
||||
Abort on No Dialtone = on
|
||||
Stupid Mode = on
|
||||
Idle Seconds = 0
|
||||
Auto DNS = on
|
||||
;Minimize = off
|
||||
;Dock = off
|
||||
;Do NOT edit this file by hand!
|
||||
+13
-35
@@ -54,6 +54,8 @@ CFLAGS_PROCESSOR_USER=""
|
||||
RUN_GROUP=0
|
||||
TEST_CASE_GROUP=""
|
||||
|
||||
trap handle_ctrl_c INT
|
||||
|
||||
function print_help() {
|
||||
echo_info '
|
||||
This program installs OpenAirInterface Software
|
||||
@@ -80,8 +82,6 @@ Options
|
||||
Makes the LTE softmodem
|
||||
--UE
|
||||
Makes the UE specific parts (ue_ip, usim, nvram)
|
||||
--EPC
|
||||
Makes the EPC (MME-SPGW, HSS)
|
||||
--RRH
|
||||
Makes the RRH
|
||||
-r | --3gpp-release
|
||||
@@ -116,8 +116,8 @@ Options
|
||||
|
||||
Usage (first build):
|
||||
oaisim (eNB + UE): ./build_oai -I -g --oaisim -x --install-system-files
|
||||
Eurecom EXMIMO + COTS UE : ./build_oai -I -g --eNB --EPC -x --install-system-files
|
||||
NI/ETTUS B201 + COTS UE : ./build_oai -I -g --eNB --EPC -x --install-system-files -w USRP
|
||||
Eurecom EXMIMO + COTS UE : ./build_oai -I -g --eNB -x --install-system-files
|
||||
NI/ETTUS B201 + COTS UE : ./build_oai -I -g --eNB -x --install-system-files -w USRP
|
||||
Usage (Regular):
|
||||
oaisim : ./build_oai --oaisim -x
|
||||
Eurecom EXMIMO + OAI ENB : ./build_oai --eNB -x
|
||||
@@ -159,10 +159,6 @@ function main() {
|
||||
UE=1
|
||||
echo_info "Will compile UE"
|
||||
shift;;
|
||||
--EPC)
|
||||
EPC=1
|
||||
echo_info "Will compile EPC"
|
||||
shift;;
|
||||
--RRH)
|
||||
RRH=1
|
||||
echo_info "Will compile RRH"
|
||||
@@ -416,7 +412,7 @@ function main() {
|
||||
|
||||
# EXMIMO drivers & firmware loader
|
||||
###############
|
||||
if [ "$HW" = "EXMIMO" -a "$EPC" = "0" ] ; then
|
||||
if [ "$HW" = "EXMIMO" ] ; then
|
||||
|
||||
echo_info "Compiling Express MIMO 2 board drivers"
|
||||
compilations \
|
||||
@@ -554,42 +550,24 @@ function main() {
|
||||
rrh_gw $dbin/rrh_gw
|
||||
fi
|
||||
|
||||
# EPC compilation
|
||||
##################
|
||||
if [ "$EPC" = "1" ] ; then
|
||||
echo_info "Compiling EPC"
|
||||
# Example HSS and EPC run on the same host
|
||||
if [ "$CLEAN" = "1" ]; then
|
||||
$OPENAIR_DIR/cmake_targets/tools/build_epc --clean --debug --transport-tcp-only --transport-prefer-tcp --s6a-server
|
||||
$OPENAIR_DIR/cmake_targets/tools/build_hss --clean --debug --transport-tcp-only --transport-prefer-tcp --fqdn `hostname --fqdn` --connect-to-mme `hostname --fqdn`
|
||||
else
|
||||
$OPENAIR_DIR/cmake_targets/tools/build_epc --debug --transport-tcp-only --transport-prefer-tcp --s6a-server
|
||||
$OPENAIR_DIR/cmake_targets/tools/build_hss --debug --transport-tcp-only --transport-prefer-tcp --fqdn `hostname --fqdn` --connect-to-mme `hostname --fqdn`
|
||||
fi
|
||||
|
||||
# if [ "$INSTALL_SYSTEM_FILES" = "1" ] ;then
|
||||
# if [ -f $dbin/hss.conf ] ; then
|
||||
# sed -e 's/ *= */=/' $dbin/hss.conf > $dconf/hss.conf.nospace
|
||||
# source $dconf/hss.conf.nospace
|
||||
# rm -f $dconf/hss.conf.nospace
|
||||
# create_hss_database root linux "$MYSQL_user" "$MYSQL_pass" "$MYSQL_db"
|
||||
# else
|
||||
# echo_warning "not created HSS database: config not found"
|
||||
# fi
|
||||
# fi
|
||||
fi
|
||||
|
||||
# Auto-tests
|
||||
#####################
|
||||
if [ "$OAI_TEST" = "1" ]; then
|
||||
echo_info "10. Running OAI pre commit tests (pre-ci) ..."
|
||||
read -s -p "Enter Password: " mypassword
|
||||
echo -e "\n"
|
||||
echo_info "The log file for the autotest script for debugging is located here: $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log "
|
||||
echo_info "The results of autotests results is located here: $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml "
|
||||
echo_info "You can hit CTRL-C any time to terminate the autotests..."
|
||||
rm -fr $OPENAIR_DIR/cmake_targets/autotests/log
|
||||
mkdir -p $OPENAIR_DIR/cmake_targets/autotests/log
|
||||
if [ "$RUN_GROUP" -eq "1" ]; then
|
||||
$SUDO $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -g "$TEST_CASE_GROUP"
|
||||
echo '$mypassword' | $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -g "$TEST_CASE_GROUP" >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
|
||||
else
|
||||
$SUDO $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash
|
||||
echo '$mypassword' | $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
|
||||
fi
|
||||
wait
|
||||
else
|
||||
echo_info "10. Bypassing the Tests ..."
|
||||
fi
|
||||
|
||||
@@ -111,7 +111,12 @@ compilations() {
|
||||
cd $OPENAIR_DIR/cmake_targets/$1/build
|
||||
{
|
||||
rm -f $3
|
||||
make -j`nproc` $2 VERBOSE=$VERBOSE_COMPILE
|
||||
if [ "$VERBOSE_COMPILE" == "1" ]; then
|
||||
make -j`nproc` $2 VERBOSE=$VERBOSE_COMPILE
|
||||
else
|
||||
make -j`nproc` $2
|
||||
fi
|
||||
|
||||
} > $dlog/$2.$REL.txt 2>&1
|
||||
echo_info "Log file for compilation has been written to: $dlog/$2.$REL.txt"
|
||||
if [ -s $3 ] ; then
|
||||
@@ -158,22 +163,33 @@ install_gnutls_from_source(){
|
||||
|
||||
|
||||
check_install_usrp_uhd_driver(){
|
||||
log_file=$OPENAIR_DIR/cmake_targets/log/check_install_usrp_uhd_driver_log.txt
|
||||
echo_info "\nIn function: check_install_usrp_uhd_driver(). Installing USRP Drivers : The logfile for the installation is located here: $log_file "
|
||||
(
|
||||
v=$(lsb_release -cs)
|
||||
$SUDO apt-add-repository "deb http://files.ettus.com/binaries/uhd/repo/uhd/ubuntu/$v $v main"
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get -y install python python-tk libboost-all-dev libusb-1.0-0-dev
|
||||
$SUDO apt-get -y install -t `lsb_release -cs` uhd --force-yes
|
||||
) >& $log_file
|
||||
}
|
||||
check_install_bladerf_driver(){
|
||||
log_file=$OPENAIR_DIR/cmake_targets/log/check_install_bladerf_driver_log.txt
|
||||
echo_info "\nIn function: check_install_bladerf_driver(). Install BLADERF drivers : The logfile for the installation is located here: $log_file "
|
||||
(
|
||||
$SUDO add-apt-repository -y ppa:bladerf/bladerf
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get install -y bladerf libbladerf-dev
|
||||
$SUDO apt-get install bladerf-firmware-fx3
|
||||
$SUDO apt-get install bladerf-fpga-hostedx40
|
||||
$SUDO apt-get install -y bladerf-firmware-fx3
|
||||
$SUDO apt-get install -y bladerf-fpga-hostedx40
|
||||
bladeRF-cli --flash-firmware /usr/share/Nuand/bladeRF/bladeRF_fw.img
|
||||
) >& $log_file
|
||||
}
|
||||
|
||||
check_install_additional_tools (){
|
||||
log_file=$OPENAIR_DIR/cmake_targets/log/check_install_additional_tools_log.txt
|
||||
echo_info "\nIn function: check_install_oai_software(). Installing optional OAI packages : The logfile for the installation is located here: $log_file "
|
||||
(
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get install -y \
|
||||
check \
|
||||
@@ -194,27 +210,32 @@ check_install_additional_tools (){
|
||||
unzip \
|
||||
valgrind \
|
||||
vlan \
|
||||
ctags
|
||||
ctags \
|
||||
ntpdate
|
||||
) >& $log_file
|
||||
}
|
||||
|
||||
check_install_oai_software() {
|
||||
|
||||
log_file=$OPENAIR_DIR/cmake_targets/log/check_install_oai_software_log.txt
|
||||
echo_info "\nIn function: check_install_oai_software(). Installing mandatory OAI packages : The logfile for the installation is located here: $log_file "
|
||||
(
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get install -y \
|
||||
autoconf \
|
||||
autoconf \
|
||||
automake \
|
||||
bison \
|
||||
build-essential \
|
||||
cmake \
|
||||
cmake-curses-gui \
|
||||
doxygen \
|
||||
doxygen-gui\
|
||||
texlive-latex-base\
|
||||
doxygen-gui \
|
||||
texlive-latex-base \
|
||||
ethtool \
|
||||
flex \
|
||||
gccxml \
|
||||
gdb \
|
||||
git \
|
||||
gccxml \
|
||||
gdb \
|
||||
git \
|
||||
graphviz \
|
||||
gtkwave \
|
||||
guile-2.0-dev \
|
||||
@@ -233,7 +254,7 @@ check_install_oai_software() {
|
||||
libgmp-dev \
|
||||
libgtk-3-dev \
|
||||
libidn2-0-dev \
|
||||
libidn11-dev \
|
||||
libidn11-dev \
|
||||
libmysqlclient-dev \
|
||||
liboctave-dev \
|
||||
libpgm-5.1 \
|
||||
@@ -255,7 +276,11 @@ check_install_oai_software() {
|
||||
openssl \
|
||||
python \
|
||||
subversion \
|
||||
xmlstarlet
|
||||
xmlstarlet \
|
||||
python-pip \
|
||||
pydb \
|
||||
wvdial \
|
||||
python-numpy
|
||||
$SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so
|
||||
if [ `lsb_release -rs` = '12.04' ] ; then
|
||||
install_nettle_from_source
|
||||
@@ -263,20 +288,29 @@ check_install_oai_software() {
|
||||
else
|
||||
$SUDO apt-get install -y libgnutls-dev nettle-dev nettle-bin
|
||||
fi
|
||||
$SUDO pip install paramiko
|
||||
$SUDO pip install pyroute2
|
||||
) > $log_file 2>&1
|
||||
install_asn1c_from_source
|
||||
$SUDO rm -fr /opt/ssh
|
||||
$SUDO git clone https://gist.github.com/2190472.git /opt/ssh
|
||||
}
|
||||
|
||||
install_asn1c_from_source(){
|
||||
asn1_install_dir=$OPENAIR_DIR/cmake_targets/log/asn1c_install_log.txt
|
||||
echo_info "\nInstalling ASN1. The log file for ASN1 installation is here: $asn1_install_dir "
|
||||
(
|
||||
rm -rf /tmp/asn1c-r1516
|
||||
mkdir -p /tmp/asn1c-r1516
|
||||
cd /tmp/asn1c-r1516
|
||||
rm -rf /tmp/asn1c-r1516/*
|
||||
svn co https://github.com/vlm/asn1c/trunk /tmp/asn1c-r1516 -r 1516 > /tmp/log_compile_asn1c
|
||||
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch.p0 >> /tmp/log_compile_asn1c
|
||||
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_2.p0 >> /tmp/log_compile_asn1c
|
||||
patch -p0 < $OPENAIR_DIR/openair2/RRC/LITE/MESSAGES/asn1c/asn1cpatch.p0 >> /tmp/log_compile_asn1c
|
||||
svn co https://github.com/vlm/asn1c/trunk /tmp/asn1c-r1516 -r 1516
|
||||
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch.p0
|
||||
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_2.p0
|
||||
patch -p0 < $OPENAIR_DIR/openair2/RRC/LITE/MESSAGES/asn1c/asn1cpatch.p0
|
||||
./configure
|
||||
make > /tmp/log_compile_asn1c 2>&1
|
||||
$SUDO make install
|
||||
make -j`nproc`
|
||||
$SUDO make install
|
||||
) > $asn1_install_dir 2>&1
|
||||
}
|
||||
|
||||
#################################################
|
||||
@@ -319,3 +353,42 @@ set_openair_env(){
|
||||
export OPENAIR_TARGETS=$openair_path/targets
|
||||
}
|
||||
|
||||
################################
|
||||
# Function to killall the subprocesses when Ctrl-C Key is hit
|
||||
###############################
|
||||
function handle_ctrl_c(){
|
||||
CURPID=$$
|
||||
ppid=$$
|
||||
arraycounter=1
|
||||
echo_info "** Trapped CTRL-C. Killing all subprocesses now..."
|
||||
while true
|
||||
do
|
||||
FORLOOP=FALSE
|
||||
# Get all the child process id
|
||||
for i in `ps -ef| awk '$3 == '$ppid' { print $2 }'`
|
||||
do
|
||||
if [ $i -ne $CURPID ] ; then
|
||||
procid[$arraycounter]=$i
|
||||
arraycounter=`expr $arraycounter + 1`
|
||||
ppid=$i
|
||||
FORLOOP=TRUE
|
||||
fi
|
||||
done
|
||||
if [ "$FORLOOP" = "FALSE" ] ; then
|
||||
arraycounter=`expr $arraycounter - 1`
|
||||
## We want to kill child process id first and then parent id's
|
||||
while [ $arraycounter -ne 0 ]
|
||||
do
|
||||
echo "first we send ctrl-c to program"
|
||||
$SUDO kill -INT "${procid[$arraycounter]}"
|
||||
sleep 5
|
||||
echo "Now we force kill if that didn't work"
|
||||
$SUDO kill -9 "${procid[$arraycounter]}" >/dev/null
|
||||
arraycounter=`expr $arraycounter - 1`
|
||||
done
|
||||
exit
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
|
||||
Regular → Executable
@@ -68,7 +68,7 @@ declare MAX_RATE=1000
|
||||
|
||||
# set paths to the required binaries and check if the required binaries are available
|
||||
ENB_CONFIG=$OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf
|
||||
OAISIM_EXEC=$OPENAIR_DIR/targets/bin/oaisim_nos1
|
||||
OAISIM_EXEC=$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1
|
||||
BYPASSE_ITTI=0
|
||||
OTGPLOT="$OPENAIR2_DIR/UTIL/OTG/OTGplot"
|
||||
PS2PDF="ps2pdf"
|
||||
@@ -301,8 +301,8 @@ oaisim_otg_stats(){
|
||||
sync
|
||||
|
||||
if [ ! -f $OAISIM_EXEC ]; then
|
||||
echo_info "3.1 compiling OAISIM ($OPENAIR_TARGETS/cmake_targets/build_oai --oaisim -c)"
|
||||
($OPENAIR_TARGETS/cmake_targets/build_oai --oaisim -c >> results/perf_log.txt 2>&1 )
|
||||
echo_info "3.1 compiling OAISIM ($OPENAIR_DIR/cmake_targets/build_oai --oaisim -c --noS1)"
|
||||
($OPENAIR_DIR/cmake_targets/build_oai --oaisim -c --noS1 >> results/perf_log.txt 2>&1 )
|
||||
build_stats=$?
|
||||
if [ $build_stats != 0 ] ; then
|
||||
echo_error "$OAISIM_EXEC cannot be built, check results/perf_log.txt file"
|
||||
|
||||
@@ -24,15 +24,18 @@ xUnit_start() {
|
||||
# \param $1 classname
|
||||
# \param $2 testcase name
|
||||
# \param $3 testcase result
|
||||
# \param $4 run index
|
||||
# \param $4 run result
|
||||
# \param $5 XML file local to test case for storing its own results
|
||||
xUnit_fail() {
|
||||
class=$1
|
||||
test_case=$2
|
||||
result=$3
|
||||
run_index=$4
|
||||
run_result=$4
|
||||
xmlfile_testcase=$5
|
||||
currtime=$(date +%s.%N)
|
||||
time=$(echo "$currtime - $XUNIT_START" | bc -l)
|
||||
xml="<testcase classname='$class' name='$test_case' run='$run_index' time='$time' RESULT='$result'></testcase>"
|
||||
xml="<testcase classname='$class' name='$test_case' Run_result='$run_result' time='$time s' RESULT='$result'></testcase>"
|
||||
echo -e $xml >> $xmlfile_testcase
|
||||
XUNIT_TESTCASES_XML="$XUNIT_TESTCASES_XML \n$xml"
|
||||
XUNIT_FAILED=$((XUNIT_FAILED+1))
|
||||
}
|
||||
@@ -43,15 +46,18 @@ xUnit_fail() {
|
||||
# \param $1 classname
|
||||
# \param $2 testcase name
|
||||
# \param $3 testcase result
|
||||
# \param $4 run index
|
||||
# \param $4 run result
|
||||
# \param $5 XML file local to test case for storing its own results
|
||||
xUnit_success() {
|
||||
class=$1
|
||||
test_case=$2
|
||||
result=$3
|
||||
run_index=$4
|
||||
run_result=$4
|
||||
xmlfile_testcase=$5
|
||||
currtime=$(date +%s.%N)
|
||||
time=$(echo "$currtime - $XUNIT_START" | bc -l)
|
||||
xml="<testcase classname='$class' name='$test_case' run='$run_index' time='$time' RESULT='$result'></testcase>"
|
||||
xml="<testcase classname='$class' name='$test_case' Run_result='$run_result' time='$time s' RESULT='$result'></testcase>"
|
||||
echo -e $xml >> $xmlfile_testcase
|
||||
XUNIT_TESTCASES_XML="$XUNIT_TESTCASES_XML \n$xml"
|
||||
XUNIT_SUCCESS=$((XUNIT_SUCCESS+1))
|
||||
}
|
||||
|
||||
@@ -564,6 +564,10 @@ int main(int argc, char **argv)
|
||||
|
||||
sprintf(bler_fname,"ULbler_mcs%d_nrb%d_ChannelModel%d_nsim%d.csv",mcs,nb_rb,chMod,n_frames);
|
||||
bler_fd = fopen(bler_fname,"w");
|
||||
if (bler_fd==NULL) {
|
||||
fprintf(stderr,"Problem creating file %s\n",bler_fname);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
fprintf(bler_fd,"#SNR;mcs;nb_rb;TBS;rate;errors[0];trials[0];errors[1];trials[1];errors[2];trials[2];errors[3];trials[3]\n");
|
||||
|
||||
@@ -572,13 +576,16 @@ int main(int argc, char **argv)
|
||||
hostname[1023] = '\0';
|
||||
gethostname(hostname, 1023);
|
||||
printf("Hostname: %s\n", hostname);
|
||||
char dirname[FILENAME_MAX];
|
||||
sprintf(dirname, "%s//SIMU/USER/pre-ci-logs-%s", getenv("OPENAIR_TARGETS"),hostname);
|
||||
mkdir(dirname, 0777);
|
||||
sprintf(time_meas_fname,"%s/time_meas_prb%d_mcs%d_antrx%d_channel%s_tx%d.csv",
|
||||
dirname,
|
||||
//char dirname[FILENAME_MAX];
|
||||
//sprintf(dirname, "%s//SIMU/USER/pre-ci-logs-%s", getenv("OPENAIR_TARGETS"),hostname);
|
||||
//mkdir(dirname, 0777);
|
||||
sprintf(time_meas_fname,"time_meas_prb%d_mcs%d_antrx%d_channel%s_tx%d.csv",
|
||||
N_RB_DL,mcs,n_rx,channel_model_input,transmission_mode);
|
||||
time_meas_fd = fopen(time_meas_fname,"w");
|
||||
if (time_meas_fd==NULL) {
|
||||
fprintf(stderr,"Cannot create file %s!\n",time_meas_fname);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -52,7 +52,7 @@ int openair0_device_init(openair0_device *device, openair0_config_t *openair0_cf
|
||||
openair0_dev_init_exmimo(device, openair0_cfg);
|
||||
printf("openair0_dev_init_exmimo...\n");
|
||||
#elif OAI_USRP
|
||||
device->type=USRP_IF;
|
||||
device->type=USRP_B200_IF;
|
||||
openair0_dev_init_usrp(device, openair0_cfg);
|
||||
printf("openair0_dev_init_usrp ...\n");
|
||||
#elif OAI_BLADERF
|
||||
|
||||
@@ -84,10 +84,10 @@ typedef struct {
|
||||
double sample_rate;
|
||||
//! number of samples per RX/TX packet (USRP + Ethernet)
|
||||
int samples_per_packet;
|
||||
// delay in sending samples (write) due to hardware access, softmodem processing and fronthaul delay if exist
|
||||
int tx_delay;
|
||||
//! adjust the position of the samples after delay when sending
|
||||
unsigned int tx_forward_nsamps;
|
||||
//! delay in sending samples (write) due to hardware access, softmodem processing and fronthaul delay if exist
|
||||
int tx_scheduling_advance;
|
||||
//! offset in samples between TX and RX paths
|
||||
int tx_sample_advance;
|
||||
//! number of RX channels (=RX antennas)
|
||||
int rx_num_channels;
|
||||
//! number of TX channels (=TX antennas)
|
||||
@@ -98,6 +98,10 @@ typedef struct {
|
||||
//! \brief Center frequency in Hz for TX.
|
||||
//! index: [0..rx_num_channels[ !!! see lte-ue.c:427 FIXME iterates over rx_num_channels
|
||||
double tx_freq[4];
|
||||
|
||||
//! \brief Pointer to Calibration table for RX gains
|
||||
rx_gain_calib_table_t *rx_gain_calib_table;
|
||||
|
||||
//! mode for rxgain (ExpressMIMO2)
|
||||
rx_gain_t rxg_mode[4];
|
||||
//! \brief Gain for RX in dB.
|
||||
@@ -147,8 +151,10 @@ typedef enum {
|
||||
ETH_IF,
|
||||
/*!\brief device is ExpressMIMO */
|
||||
EXMIMO_IF,
|
||||
/*!\brief device is USRP*/
|
||||
USRP_IF,
|
||||
/*!\brief device is USRP B200/B210*/
|
||||
USRP_B200_IF,
|
||||
/*!\brief device is USRP X300/X310*/
|
||||
USRP_X300_IF,
|
||||
/*!\brief device is BLADE RF*/
|
||||
BLADERF_IF,
|
||||
/*!\brief device is NONE*/
|
||||
|
||||
@@ -171,31 +171,45 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if (cc>1) {
|
||||
if (device->type == USRP_B200_IF) {
|
||||
if (cc>1) {
|
||||
// receive multiple channels (e.g. RF A and RF B)
|
||||
std::vector<void *> buff_ptrs;
|
||||
for (int i=0;i<cc;i++) buff_ptrs.push_back(buff_tmp[i]);
|
||||
samples_received = s->rx_stream->recv(buff_ptrs, nsamps, s->rx_md);
|
||||
} else {
|
||||
std::vector<void *> buff_ptrs;
|
||||
|
||||
for (int i=0;i<cc;i++) buff_ptrs.push_back(buff_tmp[i]);
|
||||
samples_received = s->rx_stream->recv(buff_ptrs, nsamps, s->rx_md);
|
||||
} else {
|
||||
// receive a single channel (e.g. from connector RF A)
|
||||
samples_received = s->rx_stream->recv(buff_tmp[0], nsamps, s->rx_md);
|
||||
}
|
||||
|
||||
samples_received = s->rx_stream->recv(buff_tmp[0], nsamps, s->rx_md);
|
||||
}
|
||||
|
||||
// bring RX data into 12 LSBs for softmodem RX
|
||||
for (int i=0;i<cc;i++) {
|
||||
for (int j=0; j<nsamps2; j++) {
|
||||
for (int i=0;i<cc;i++) {
|
||||
for (int j=0; j<nsamps2; j++) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#ifdef __AVX2__
|
||||
((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],4);
|
||||
((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],4);
|
||||
#else
|
||||
((__m128i *)buff[i])[j] = _mm_srai_epi16(buff_tmp[i][j],4);
|
||||
((__m128i *)buff[i])[j] = _mm_srai_epi16(buff_tmp[i][j],4);
|
||||
#endif
|
||||
#elif defined(__arm__)
|
||||
((int16x8_t*)buff[i])[j] = vshrq_n_s16(buff_tmp[i][j],4);
|
||||
((int16x8_t*)buff[i])[j] = vshrq_n_s16(buff_tmp[i][j],4);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} else if (device->type == USRP_X300_IF) {
|
||||
if (cc>1) {
|
||||
// receive multiple channels (e.g. RF A and RF B)
|
||||
std::vector<void *> buff_ptrs;
|
||||
|
||||
for (int i=0;i<cc;i++) buff_ptrs.push_back(buff[i]);
|
||||
samples_received = s->rx_stream->recv(buff_ptrs, nsamps, s->rx_md);
|
||||
} else {
|
||||
// receive a single channel (e.g. from connector RF A)
|
||||
samples_received = s->rx_stream->recv(buff[0], nsamps, s->rx_md);
|
||||
}
|
||||
}
|
||||
|
||||
if (samples_received < nsamps) {
|
||||
printf("[recv] received %d samples out of %d\n",samples_received,nsamps);
|
||||
|
||||
@@ -279,7 +293,7 @@ int trx_usrp_set_gains(openair0_device* device,
|
||||
exit(-1);
|
||||
}
|
||||
s->usrp->set_rx_gain(openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0]);
|
||||
printf("Setting USRP RX gain to %f\n", openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0]);
|
||||
printf("Setting USRP RX gain to %f (rx_gain %f,gain_range.stop() %f)\n", openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0],openair0_cfg[0].rx_gain[0],gain_range.stop());
|
||||
|
||||
return(0);
|
||||
}
|
||||
@@ -289,7 +303,7 @@ int trx_usrp_stop(int card) {
|
||||
}
|
||||
|
||||
|
||||
rx_gain_calib_table_t calib_table[] = {
|
||||
rx_gain_calib_table_t calib_table_b210[] = {
|
||||
{3500000000.0,46.0},
|
||||
{2660000000.0,53.0},
|
||||
{2300000000.0,54.0},
|
||||
@@ -297,19 +311,29 @@ rx_gain_calib_table_t calib_table[] = {
|
||||
{816000000.0,62.0},
|
||||
{-1,0}};
|
||||
|
||||
rx_gain_calib_table_t calib_table_x310[] = {
|
||||
{3500000000.0,77.0},
|
||||
{2660000000.0,80.0},
|
||||
{2300000000.0,81.0},
|
||||
{1880000000.0,82.0},
|
||||
{816000000.0,85.0},
|
||||
{-1,0}};
|
||||
|
||||
void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) {
|
||||
|
||||
int i=0;
|
||||
// loop through calibration table to find best adjustment factor for RX frequency
|
||||
double min_diff = 6e9,diff;
|
||||
|
||||
while (calib_table[i].freq>0) {
|
||||
diff = fabs(openair0_cfg->rx_freq[chain_index] - calib_table[i].freq);
|
||||
|
||||
while (openair0_cfg->rx_gain_calib_table[i].freq>0) {
|
||||
diff = fabs(openair0_cfg->rx_freq[chain_index] - openair0_cfg->rx_gain_calib_table[i].freq);
|
||||
printf("cal %d: freq %f, offset %f, diff %f\n",
|
||||
i,calib_table[i].freq,calib_table[i].offset,diff);
|
||||
i,
|
||||
openair0_cfg->rx_gain_calib_table[i].freq,
|
||||
openair0_cfg->rx_gain_calib_table[i].offset,diff);
|
||||
if (min_diff > diff) {
|
||||
min_diff = diff;
|
||||
openair0_cfg->rx_gain_offset[chain_index] = calib_table[i].offset;
|
||||
openair0_cfg->rx_gain_offset[chain_index] = openair0_cfg->rx_gain_calib_table[i].offset;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -372,9 +396,43 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_
|
||||
// lock mboard clocks
|
||||
s->usrp->set_clock_source("internal");
|
||||
|
||||
//Setting device type to USRP X300/X310
|
||||
device->type=USRP_X300_IF;
|
||||
|
||||
// this is not working yet, master clock has to be set via constructor
|
||||
// set master clock rate and sample rate for tx & rx for streaming
|
||||
//s->usrp->set_master_clock_rate(usrp_master_clock);
|
||||
|
||||
openair0_cfg[0].rx_gain_calib_table = calib_table_x310;
|
||||
|
||||
switch ((int)openair0_cfg[0].sample_rate) {
|
||||
case 30720000:
|
||||
// from usrp_time_offset
|
||||
openair0_cfg[0].samples_per_packet = 2048;
|
||||
openair0_cfg[0].tx_sample_advance = 15;
|
||||
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[0].samples_per_packet;
|
||||
break;
|
||||
case 15360000:
|
||||
openair0_cfg[0].samples_per_packet = 2048;
|
||||
openair0_cfg[0].tx_sample_advance = 45;
|
||||
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[0].samples_per_packet;
|
||||
break;
|
||||
case 7680000:
|
||||
openair0_cfg[0].samples_per_packet = 1024;
|
||||
openair0_cfg[0].tx_sample_advance = 50;
|
||||
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[0].samples_per_packet;
|
||||
break;
|
||||
case 1920000:
|
||||
openair0_cfg[0].samples_per_packet = 256;
|
||||
openair0_cfg[0].tx_sample_advance = 50;
|
||||
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[0].samples_per_packet;
|
||||
break;
|
||||
default:
|
||||
printf("Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
printf("Found USRP B200");
|
||||
s->usrp = uhd::usrp::multi_usrp::make(args);
|
||||
@@ -386,10 +444,42 @@ int openair0_dev_init_usrp(openair0_device* device, openair0_config_t *openair0_
|
||||
// // lock mboard clocks
|
||||
// s->usrp->set_clock_source("internal");
|
||||
// set master clock rate and sample rate for tx & rx for streaming
|
||||
|
||||
device->type = USRP_B200_IF;
|
||||
s->usrp->set_master_clock_rate(30.72e6);
|
||||
|
||||
openair0_cfg[0].rx_gain_calib_table = calib_table_b210;
|
||||
|
||||
switch ((int)openair0_cfg[0].sample_rate) {
|
||||
case 30720000:
|
||||
// from usrp_time_offset
|
||||
openair0_cfg[0].samples_per_packet = 2048;
|
||||
openair0_cfg[0].tx_sample_advance = 115;
|
||||
openair0_cfg[0].tx_scheduling_advance = 11*openair0_cfg[0].samples_per_packet;
|
||||
break;
|
||||
case 15360000:
|
||||
openair0_cfg[0].samples_per_packet = 2048;
|
||||
openair0_cfg[0].tx_sample_advance = 113;
|
||||
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[0].samples_per_packet;
|
||||
break;
|
||||
case 7680000:
|
||||
openair0_cfg[0].samples_per_packet = 1024;
|
||||
openair0_cfg[0].tx_sample_advance = 103;
|
||||
openair0_cfg[0].tx_scheduling_advance = 5*openair0_cfg[0].samples_per_packet;
|
||||
break;
|
||||
case 1920000:
|
||||
openair0_cfg[0].samples_per_packet = 256;
|
||||
openair0_cfg[0].tx_sample_advance = 40;
|
||||
openair0_cfg[0].tx_scheduling_advance = 8*openair0_cfg[0].samples_per_packet;
|
||||
break;
|
||||
default:
|
||||
printf("Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
for(i=0;i<s->usrp->get_rx_num_channels();i++) {
|
||||
if (i<openair0_cfg[0].rx_num_channels) {
|
||||
|
||||
@@ -35,7 +35,7 @@ eNBs =
|
||||
nb_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
tx_gain = 32;
|
||||
rx_gain = 84;
|
||||
rx_gain = 116;
|
||||
prach_root = 0;
|
||||
prach_config_index = 0;
|
||||
prach_high_speed = "DISABLE";
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
Active_eNBs = ( "eNB_Eurecom_LTEBox");
|
||||
# Asn1_verbosity, choice in: none, info, annoying
|
||||
Asn1_verbosity = "none";
|
||||
|
||||
eNBs =
|
||||
(
|
||||
{
|
||||
////////// Identification parameters:
|
||||
eNB_ID = 0xe00;
|
||||
|
||||
cell_type = "CELL_MACRO_ENB";
|
||||
|
||||
eNB_name = "eNB_Eurecom_LTEBox";
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = "1";
|
||||
|
||||
mobile_country_code = "208";
|
||||
mobile_network_code = "92";
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
component_carriers = (
|
||||
{
|
||||
frame_type = "FDD";
|
||||
tdd_config = 3;
|
||||
tdd_config_s = 0;
|
||||
prefix_type = "NORMAL";
|
||||
eutra_band = 7;
|
||||
downlink_frequency = 2660000000L;
|
||||
uplink_frequency_offset = -120000000;
|
||||
Nid_cell = 0;
|
||||
N_RB_DL = 25;
|
||||
Nid_cell_mbsfn = 0;
|
||||
nb_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
tx_gain = 32;
|
||||
rx_gain = 116;
|
||||
prach_root = 0;
|
||||
prach_config_index = 0;
|
||||
prach_high_speed = "DISABLE";
|
||||
prach_zero_correlation = 1;
|
||||
prach_freq_offset = 2;
|
||||
pucch_delta_shift = 1;
|
||||
pucch_nRB_CQI = 1;
|
||||
pucch_nCS_AN = 0;
|
||||
pucch_n1_AN = 32;
|
||||
pdsch_referenceSignalPower = -16;
|
||||
pdsch_p_b = 0;
|
||||
pusch_n_SB = 1;
|
||||
pusch_enable64QAM = "DISABLE";
|
||||
pusch_hoppingMode = "interSubFrame";
|
||||
pusch_hoppingOffset = 0;
|
||||
pusch_groupHoppingEnabled = "ENABLE";
|
||||
pusch_groupAssignment = 0;
|
||||
pusch_sequenceHoppingEnabled = "DISABLE";
|
||||
pusch_nDMRS1 = 1;
|
||||
phich_duration = "NORMAL";
|
||||
phich_resource = "ONESIXTH";
|
||||
srs_enable = "DISABLE";
|
||||
/* srs_BandwidthConfig =;
|
||||
srs_SubframeConfig =;
|
||||
srs_ackNackST =;
|
||||
srs_MaxUpPts =;*/
|
||||
|
||||
pusch_p0_Nominal = -90;
|
||||
pusch_alpha = "AL1";
|
||||
pucch_p0_Nominal = -108;
|
||||
msg3_delta_Preamble = 6;
|
||||
pucch_deltaF_Format1 = "deltaF2";
|
||||
pucch_deltaF_Format1b = "deltaF3";
|
||||
pucch_deltaF_Format2 = "deltaF0";
|
||||
pucch_deltaF_Format2a = "deltaF0";
|
||||
pucch_deltaF_Format2b = "deltaF0";
|
||||
|
||||
rach_numberOfRA_Preambles = 64;
|
||||
rach_preamblesGroupAConfig = "DISABLE";
|
||||
/*
|
||||
rach_sizeOfRA_PreamblesGroupA = ;
|
||||
rach_messageSizeGroupA = ;
|
||||
rach_messagePowerOffsetGroupB = ;
|
||||
*/
|
||||
rach_powerRampingStep = 4;
|
||||
rach_preambleInitialReceivedTargetPower = -108;
|
||||
rach_preambleTransMax = 10;
|
||||
rach_raResponseWindowSize = 10;
|
||||
rach_macContentionResolutionTimer = 48;
|
||||
rach_maxHARQ_Msg3Tx = 4;
|
||||
|
||||
pcch_default_PagingCycle = 128;
|
||||
pcch_nB = "oneT";
|
||||
bcch_modificationPeriodCoeff = 2;
|
||||
ue_TimersAndConstants_t300 = 1000;
|
||||
ue_TimersAndConstants_t301 = 1000;
|
||||
ue_TimersAndConstants_t310 = 1000;
|
||||
ue_TimersAndConstants_t311 = 10000;
|
||||
ue_TimersAndConstants_n310 = 20;
|
||||
ue_TimersAndConstants_n311 = 1;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
srb1_parameters :
|
||||
{
|
||||
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
|
||||
timer_poll_retransmit = 80;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
|
||||
timer_reordering = 35;
|
||||
|
||||
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
|
||||
timer_status_prohibit = 0;
|
||||
|
||||
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
|
||||
poll_pdu = 4;
|
||||
|
||||
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
|
||||
poll_byte = 99999;
|
||||
|
||||
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
|
||||
max_retx_threshold = 4;
|
||||
}
|
||||
|
||||
# ------- SCTP definitions
|
||||
SCTP :
|
||||
{
|
||||
# Number of streams to use in input/output
|
||||
SCTP_INSTREAMS = 2;
|
||||
SCTP_OUTSTREAMS = 2;
|
||||
};
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.168.12.26";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24";
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
|
||||
log_config :
|
||||
{
|
||||
global_log_level ="debug";
|
||||
global_log_verbosity ="medium";
|
||||
hw_log_level ="info";
|
||||
hw_log_verbosity ="medium";
|
||||
phy_log_level ="info";
|
||||
phy_log_verbosity ="medium";
|
||||
mac_log_level ="info";
|
||||
mac_log_verbosity ="high";
|
||||
rlc_log_level ="info";
|
||||
rlc_log_verbosity ="medium";
|
||||
pdcp_log_level ="info";
|
||||
pdcp_log_verbosity ="medium";
|
||||
rrc_log_level ="info";
|
||||
rrc_log_verbosity ="medium";
|
||||
};
|
||||
|
||||
}
|
||||
);
|
||||
@@ -35,7 +35,7 @@ eNBs =
|
||||
nb_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
tx_gain = 32;
|
||||
rx_gain = 82;
|
||||
rx_gain = 120;
|
||||
prach_root = 0;
|
||||
prach_config_index = 0;
|
||||
prach_high_speed = "DISABLE";
|
||||
|
||||
@@ -16,7 +16,7 @@ eNBs =
|
||||
tracking_area_code = "1";
|
||||
|
||||
mobile_country_code = "208";
|
||||
mobile_network_code = "95";
|
||||
mobile_network_code = "92";
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
@@ -30,12 +30,12 @@ eNBs =
|
||||
downlink_frequency = 2660000000L;
|
||||
uplink_frequency_offset = -120000000;
|
||||
Nid_cell = 0;
|
||||
N_RB_DL = 25;
|
||||
N_RB_DL = 100;
|
||||
Nid_cell_mbsfn = 0;
|
||||
nb_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
tx_gain = 90;
|
||||
rx_gain = 120;
|
||||
rx_gain = 119;
|
||||
prach_root = 0;
|
||||
prach_config_index = 0;
|
||||
prach_high_speed = "DISABLE";
|
||||
@@ -130,12 +130,10 @@ eNBs =
|
||||
};
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.168.12.62";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
mme_ip_address = ( {ipv4 = "192.168.12.26";
|
||||
ipv6="192:168:30::17";
|
||||
active="yes";
|
||||
preference="ipv4";});
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ eNBs =
|
||||
nb_antennas_tx = 1;
|
||||
nb_antennas_rx = 1;
|
||||
tx_gain = 32;
|
||||
rx_gain = 84;
|
||||
rx_gain = 116;
|
||||
prach_root = 0;
|
||||
prach_config_index = 0;
|
||||
prach_high_speed = "DISABLE";
|
||||
|
||||
@@ -172,7 +172,7 @@ void config_BBU_mod( rrh_module_t *mod_enb, uint8_t RT_flag, uint8_t NRT_flag) {
|
||||
mod_enb->devs->openair0_cfg.tx_delay = 8;
|
||||
}
|
||||
}
|
||||
else if (mod_enb->devs->type == USRP_IF) {
|
||||
else if ((mod_enb->devs->type == USRP_B200_IF )||(mod_enb->devs->type == USRP_X300_IF )) {
|
||||
if ( mod_enb->devs->openair0_cfg.num_rb_dl == 100 ) {
|
||||
mod_enb->devs->openair0_cfg.samples_per_packet = 2048;
|
||||
mod_enb->devs->openair0_cfg.tx_forward_nsamps = 175;
|
||||
|
||||
@@ -293,10 +293,6 @@ static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/;
|
||||
char ref[128] = "internal";
|
||||
char channels[128] = "0";
|
||||
|
||||
//unsigned int samples_per_frame = 307200;
|
||||
//unsigned int tx_forward_nsamps=0;
|
||||
//int tx_delay;
|
||||
|
||||
#endif
|
||||
|
||||
int rx_input_level_dBm;
|
||||
@@ -1559,7 +1555,7 @@ static void* eNB_thread( void* arg )
|
||||
int hw_subframe = 0; // 0..NUM_ENB_THREADS-1 => 0..9
|
||||
|
||||
unsigned int rx_pos = 0;
|
||||
unsigned int tx_pos = 0; //spp*tx_delay;
|
||||
unsigned int tx_pos = 0;
|
||||
#endif
|
||||
int CC_id=0;
|
||||
struct timespec trx_time0, trx_time1, trx_time2;
|
||||
@@ -1634,8 +1630,8 @@ static void* eNB_thread( void* arg )
|
||||
int frame = 0;
|
||||
|
||||
#ifndef EXMIMO
|
||||
spp = openair0_cfg[0].samples_per_packet;
|
||||
tx_pos=spp*openair0_cfg[0].tx_delay;
|
||||
spp = openair0_cfg[0].samples_per_packet;
|
||||
tx_pos = openair0_cfg[0].tx_scheduling_advance;
|
||||
#endif
|
||||
|
||||
while (!oai_exit) {
|
||||
@@ -1796,11 +1792,10 @@ static void* eNB_thread( void* arg )
|
||||
// prepare tx buffer pointers
|
||||
for (i=0; i<PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_tx; i++)
|
||||
txp[i] = (void*)&txdata[i][tx_pos];
|
||||
//printf("tx_pos %d ts %d, ts_offset %d txp[i] %p, ap %d\n", tx_pos, timestamp, (timestamp+(tx_delay*spp)-tx_forward_nsamps),txp[i], i);
|
||||
// if symb_written < spp ==> error
|
||||
if (frame > 50) {
|
||||
openair0.trx_write_func(&openair0,
|
||||
(timestamp+(openair0_cfg[card].tx_delay*spp)-openair0_cfg[card].tx_forward_nsamps),
|
||||
(timestamp+(openair0_cfg[card].tx_scheduling_advance)-openair0_cfg[card].tx_sample_advance),
|
||||
txp,
|
||||
spp,
|
||||
PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_tx,
|
||||
@@ -1808,7 +1803,7 @@ static void* eNB_thread( void* arg )
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, timestamp&0xffffffff );
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp+(openair0_cfg[card].tx_delay*spp)-openair0_cfg[card].tx_forward_nsamps)&0xffffffff );
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp+(openair0_cfg[card].tx_scheduling_advance)-openair0_cfg[card].tx_sample_advance)&0xffffffff );
|
||||
|
||||
stop_meas( &softmodem_stats_mt );
|
||||
clock_gettime( CLOCK_MONOTONIC, &trx_time2 );
|
||||
@@ -2847,66 +2842,33 @@ int main( int argc, char **argv )
|
||||
for (card=0; card<MAX_CARDS; card++) {
|
||||
|
||||
if(frame_parms[0]->N_RB_DL == 100) {
|
||||
sample_rate = 30.72e6;
|
||||
bw = 10.0e6;
|
||||
#ifndef EXMIMO
|
||||
openair0_cfg[card].sample_rate=30.72e6;
|
||||
openair0_cfg[card].samples_per_packet = 2048;
|
||||
openair0_cfg[card].samples_per_frame = 307200;
|
||||
openair0_cfg[card].tx_bw = 10e6;
|
||||
openair0_cfg[card].rx_bw = 10e6;
|
||||
// from usrp_time_offset
|
||||
openair0_cfg[card].tx_forward_nsamps = 175;
|
||||
openair0_cfg[card].tx_delay = 8;
|
||||
#endif
|
||||
} else if(frame_parms[0]->N_RB_DL == 50) {
|
||||
sample_rate = 15.36e6;
|
||||
bw = 5.0e6;
|
||||
#ifndef EXMIMO
|
||||
openair0_cfg[card].sample_rate=15.36e6;
|
||||
openair0_cfg[card].samples_per_packet = 2048;
|
||||
openair0_cfg[card].samples_per_frame = 153600;
|
||||
openair0_cfg[card].tx_bw = 5e6;
|
||||
openair0_cfg[card].rx_bw = 5e6;
|
||||
openair0_cfg[card].tx_forward_nsamps = 95;
|
||||
openair0_cfg[card].tx_delay = 5;
|
||||
#endif
|
||||
} else if (frame_parms[0]->N_RB_DL == 25) {
|
||||
sample_rate = 7.68e6;
|
||||
bw = 2.5e6;
|
||||
#ifndef EXMIMO
|
||||
openair0_cfg[card].sample_rate=7.68e6;
|
||||
openair0_cfg[card].samples_per_frame = 76800;
|
||||
openair0_cfg[card].tx_bw = 2.5e6;
|
||||
openair0_cfg[card].rx_bw = 2.5e6;
|
||||
openair0_cfg[card].samples_per_packet = 1024;
|
||||
#ifdef OAI_USRP
|
||||
openair0_cfg[card].tx_forward_nsamps = 70;
|
||||
openair0_cfg[card].tx_delay = 5;
|
||||
#elif OAI_BLADERF
|
||||
openair0_cfg[card].tx_forward_nsamps = 0;
|
||||
openair0_cfg[card].tx_delay = 8;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} else if (frame_parms[0]->N_RB_DL == 6) {
|
||||
sample_rate = 1.92e6;
|
||||
bw = 0.96e6;
|
||||
#ifndef EXMIMO
|
||||
openair0_cfg[card].sample_rate=1.92e6;
|
||||
openair0_cfg[card].samples_per_packet = 256;
|
||||
openair0_cfg[card].samples_per_frame = 19200;
|
||||
openair0_cfg[card].tx_bw = 1.5e6;
|
||||
openair0_cfg[card].rx_bw = 1.5e6;
|
||||
openair0_cfg[card].tx_forward_nsamps = 40;
|
||||
openair0_cfg[card].tx_delay = 8;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ETHERNET
|
||||
|
||||
//calib needed
|
||||
openair0_cfg[card].tx_delay = 0;
|
||||
openair0_cfg[card].tx_forward_nsamps = 0;
|
||||
openair0_cfg[card].tx_scheduling_advance = 0;
|
||||
openair0_cfg[card].tx_sample_advance = 0;
|
||||
|
||||
if (frame_parms[0]->N_RB_DL == 6)
|
||||
openair0_cfg[card].samples_per_packet = 256;
|
||||
@@ -2917,9 +2879,6 @@ int main( int argc, char **argv )
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef EXMIMO
|
||||
openair0_cfg[card].samples_per_packet = openair0_cfg[0].samples_per_packet;
|
||||
#endif
|
||||
printf("HW: Configuring card %d, nb_antennas_tx/rx %d/%d\n",card,
|
||||
((UE_flag==0) ? PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_tx : PHY_vars_UE_g[0][0]->lte_frame_parms.nb_antennas_tx),
|
||||
((UE_flag==0) ? PHY_vars_eNB_g[0][0]->lte_frame_parms.nb_antennas_rx : PHY_vars_UE_g[0][0]->lte_frame_parms.nb_antennas_rx));
|
||||
@@ -2935,11 +2894,9 @@ int main( int argc, char **argv )
|
||||
openair0_cfg[card].remote_ip = &rrh_eNB_ip[0];
|
||||
openair0_cfg[card].remote_port = rrh_eNB_port;
|
||||
}
|
||||
openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
|
||||
openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
|
||||
#endif
|
||||
openair0_cfg[card].sample_rate = sample_rate;
|
||||
openair0_cfg[card].tx_bw = bw;
|
||||
openair0_cfg[card].rx_bw = bw;
|
||||
|
||||
// in the case of the USRP, the following variables need to be initialized before the init
|
||||
// since the USRP only supports one CC (for the moment), we initialize all the cards with first CC.
|
||||
// in the case of EXMIMO2, these values are overwirtten in the function setup_eNB/UE_buffer
|
||||
@@ -2965,24 +2922,28 @@ openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
|
||||
else {
|
||||
openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB;// - USRP_GAIN_OFFSET; // calibrated for USRP B210 @ 2.6 GHz, 30.72 MS/s
|
||||
}
|
||||
|
||||
|
||||
switch(frame_parms[0]->N_RB_DL) {
|
||||
case 6:
|
||||
openair0_cfg[card].rx_gain[i] -= 6;
|
||||
openair0_cfg[card].rx_gain[i] -= 12;
|
||||
break;
|
||||
|
||||
case 25:
|
||||
openair0_cfg[card].rx_gain[i] += 6;
|
||||
openair0_cfg[card].rx_gain[i] -= 6;
|
||||
break;
|
||||
|
||||
case 50:
|
||||
openair0_cfg[card].rx_gain[i] += 8;
|
||||
openair0_cfg[card].rx_gain[i] -= 3;
|
||||
break;
|
||||
|
||||
case 100:
|
||||
openair0_cfg[card].rx_gain[i] -= 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3070,7 +3031,7 @@ openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
|
||||
// connect the TX/RX buffers
|
||||
if (UE_flag==1) {
|
||||
#ifdef OAI_USRP
|
||||
openair_daq_vars.timing_advance = 160;
|
||||
openair_daq_vars.timing_advance = 0;
|
||||
#else
|
||||
openair_daq_vars.timing_advance = 160;
|
||||
#endif
|
||||
|
||||
@@ -410,6 +410,7 @@ static void *UE_thread_synch(void *arg)
|
||||
UE->UE_scan_carrier = 0;
|
||||
// rerun with new cell parameters and frequency-offset
|
||||
for (i=0;i<openair0_cfg[0].rx_num_channels;i++) {
|
||||
openair0_cfg[0].rx_gain[i] = UE->rx_total_gain_dB;//-USRP_GAIN_OFFSET;
|
||||
openair0_cfg[0].rx_freq[i] -= UE->lte_ue_common_vars.freq_offset;
|
||||
openair0_cfg[0].tx_freq[i] = openair0_cfg[0].rx_freq[i]+uplink_frequency_offset[0][i];
|
||||
downlink_frequency[0][i] = openair0_cfg[0].rx_freq[i];
|
||||
@@ -1002,7 +1003,7 @@ void *UE_thread(void *arg)
|
||||
static int UE_thread_retval;
|
||||
PHY_VARS_UE *UE = PHY_vars_UE_g[0][0];
|
||||
int spp = openair0_cfg[0].samples_per_packet;
|
||||
int slot=1, frame=0, hw_subframe=0, rxpos=0, txpos=spp*openair0_cfg[0].tx_delay;
|
||||
int slot=1, frame=0, hw_subframe=0, rxpos=0, txpos=spp*openair0_cfg[0].tx_scheduling_advance;
|
||||
#ifdef __AVX2__
|
||||
int dummy[2][spp] __attribute__((aligned(32)));
|
||||
#else
|
||||
@@ -1127,7 +1128,7 @@ void *UE_thread(void *arg)
|
||||
txp[i] = (void*)&txdata[i][txpos];
|
||||
|
||||
openair0.trx_write_func(&openair0,
|
||||
(timestamp+spp*openair0_cfg[0].tx_delay-openair0_cfg[0].tx_forward_nsamps),
|
||||
(timestamp+openair0_cfg[0].tx_scheduling_advance-openair0_cfg[0].tx_sample_advance),
|
||||
txp,
|
||||
spp - ((first_rx==1) ? rx_off_diff : 0),
|
||||
UE->lte_frame_parms.nb_antennas_tx,
|
||||
|
||||
@@ -216,7 +216,7 @@ static rrh_module_t new_module (unsigned int id) {
|
||||
LOG_I(RRH,"Setting RF device to EXMIMO\n");
|
||||
#elif OAI_USRP
|
||||
rrh_mod.devs=oai_dv;
|
||||
rrh_mod.devs->type=USRP_IF;
|
||||
rrh_mod.devs->type=USRP_B200_IF;
|
||||
LOG_I(RRH,"Setting RF device to USRP\n");
|
||||
#elif OAI_BLADERF
|
||||
rrh_mod.devs=oai_dv;
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
/*! \brief RRH supports two types of modules: eNB and UE
|
||||
each module is associated with an ethernet device (device of ETH_IF)
|
||||
and optionally with a RF device (device type can be USRP_IF/BLADERF_IF/EXMIMO_IF/NONE_IF)
|
||||
and optionally with a RF device (device type can be USRP_B200/USRP_X300/BLADERF_IF/EXMIMO_IF/NONE_IF)
|
||||
UE modules will always have RF device type NONE_IF */
|
||||
typedef struct {
|
||||
/*! \brief module id */
|
||||
|
||||
Reference in New Issue
Block a user