Commit cde318ce authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Rework nr_dlsim/nr_ulsim test and analysis function

- Enable both nr_ulsim and nr_dlsim test with Run_T2Test
- Introduce time threshold variable for T2/CPU LDPC tests
  - Set threshold individually for each test - T2 encoding/decoding and CPU encoding/decoding
  - Check if encoder/decoder processing time is below the threshold
  - Remove NOK return option - keep only OK (processing time below threshold) or KO (proceesing time beyond threshold)
- Rename function to run and check results of CUDA ldpctest
- Use new SSH class in function for check T2 test results, use f-strings
parent 3c3c1e6f
...@@ -33,9 +33,11 @@ import logging ...@@ -33,9 +33,11 @@ import logging
import sshconnection import sshconnection
#to update the HTML object #to update the HTML object
import cls_oai_html import cls_oai_html
import cls_cmd
from multiprocessing import SimpleQueue from multiprocessing import SimpleQueue
#for log folder maintenance #for log folder maintenance
import os import os
import re
class PhySim: class PhySim:
def __init__(self): def __init__(self):
...@@ -84,42 +86,44 @@ class PhySim: ...@@ -84,42 +86,44 @@ class PhySim:
HTML.CreateHtmlTestRowQueue(self.runargs, 'OK', [info]) HTML.CreateHtmlTestRowQueue(self.runargs, 'OK', [info])
return HTML return HTML
def __CheckResults_LDPCt1Test(self,HTML,CONST,testcase_id): def __CheckResults_LDPCt2Test(self,HTML,CONST,testcase_id):
thrs_NOK = 500 thrs_KO = int(self.timethrs)
thrs_KO = 1000 mySSH = cls_cmd.getConnection(self.eNBIpAddr)
mySSH = sshconnection.SSHConnection()
mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord)
#retrieve run log file and store it locally$ #retrieve run log file and store it locally$
mySSH.copyin(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord, self.__workSpacePath+self.__runLogFile, '.') mySSH.copyin(f'{self.__workSpacePath}{self.__runLogFile}', f'{self.__runLogFile}')
mySSH.close() mySSH.close()
#parse results looking for Decoding values #parse results looking for encoder/decoder processing time values
runResultsT1=[]
with open(self.__runLogFile) as g: with open(self.__runLogFile) as g:
for line in g: for line in g:
if 'decoding time' in line: res_enc = re.search(r"DLSCH encoding time\s+(\d+\.\d+)\s+us",line)
runResultsT1.append(line) res_dec = re.search(r'ULSCH total decoding time\s+(\d+\.\d+)\s+us',line)
if res_dec is not None:
time = res_dec.group(1)
info = res_dec.group(0)
break
if res_enc is not None:
time = res_enc.group(1)
info = res_enc.group(0)
break
# In case the T1 board does work properly, there is no statistics # In case the T2 board does work properly, there is no statistics
if len(runResultsT1) == 0: if res_enc is None and res_dec is None:
logging.error('no statistics') logging.error(f'no statistics: res_enc {res_enc} res_dec {res_dec}')
HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', ['no statistics']) HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', ['no statistics'])
self.exitStatus = 1 self.exitStatus = 1
os.system('mv '+self.__runLogFile+' '+ self.__runLogPath+'/.') os.system(f'mv {self.__runLogFile} {self.__runLogPath}/.')
return HTML return HTML
info = runResultsT1[0][15:-13] #once parsed move the local logfile to its folder
result = int(''.join(filter(str.isdigit, info)))/100 os.system(f'mv {self.__runLogFile} {self.__runLogPath}/.')
#once parsed move the local logfile to its folder for tidiness if float(time) < thrs_KO:
os.system('mv '+self.__runLogFile+' '+ self.__runLogPath+'/.')
if result < thrs_NOK:
HTML.CreateHtmlTestRowQueue(self.runargs, 'OK', [info]) HTML.CreateHtmlTestRowQueue(self.runargs, 'OK', [info])
elif result > thrs_KO: else:
error_msg = f'Decoding time exceeds a limit of {thrs_KO} us' error_msg = f'Processing time exceeds a limit of {thrs_KO} us'
logging.error(error_msg) logging.error(error_msg)
HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', [info + '\n' + error_msg]) HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', [info + '\n' + error_msg])
self.exitStatus = 1 self.exitStatus = 1
else:
HTML.CreateHtmlTestRowQueue(self.runargs, 'NOK', [info])
return HTML return HTML
def __CheckResults_NRulsimTest(self, HTML, CONST, testcase_id): def __CheckResults_NRulsimTest(self, HTML, CONST, testcase_id):
...@@ -246,22 +250,21 @@ class PhySim: ...@@ -246,22 +250,21 @@ class PhySim:
lHTML=self.__CheckResults_LDPCTest(htmlObj,constObj,testcase_id) lHTML=self.__CheckResults_LDPCTest(htmlObj,constObj,testcase_id)
return lHTML return lHTML
def Run_LDPCt1Test(self,htmlObj,constObj,testcase_id): def Run_T2Test(self,htmlObj,constObj,testcase_id):
self.__workSpacePath = self.eNBSourceCodePath+'/cmake_targets/' self.__workSpacePath = f'{self.eNBSourceCodePath}/cmake_targets/'
#create run logs folder locally #create run logs folder locally
os.system('mkdir -p ./'+self.__runLogPath) os.system(f'mkdir -p ./{self.__runLogPath}')
#log file is tc_<testcase_id>.log remotely #log file is tc_<testcase_id>.log remotely
self.__runLogFile='physim_'+str(testcase_id)+'.log' self.__runLogFile=f'physim_{str(testcase_id)}.log'
#open a session for test run #open a session for test run
mySSH = sshconnection.SSHConnection() mySSH = cls_cmd.getConnection(self.eNBIpAddr)
mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) mySSH.run(f'cd {self.__workSpacePath}')
mySSH.command('cd '+self.__workSpacePath,'\$',5)
#run and redirect the results to a log file #run and redirect the results to a log file
mySSH.command(f'sudo {self.__workSpacePath}ran_build/build/nr_ulsim {self.runargs} > {self.__runLogFile} 2>&1', '\$', 30) mySSH.run(f'sudo {self.__workSpacePath}ran_build/build/{self.runsim} {self.runargs} > {self.__workSpacePath}{self.__runLogFile} 2>&1')
mySSH.close() mySSH.close()
#return updated HTML to main #return updated HTML to main
lHTML = cls_oai_html.HTMLManagement() lHTML = cls_oai_html.HTMLManagement()
lHTML=self.__CheckResults_LDPCt1Test(htmlObj,constObj,testcase_id) lHTML=self.__CheckResults_LDPCt2Test(htmlObj,constObj,testcase_id)
return lHTML return lHTML
def Run_NRulsimTest(self, htmlObj, constObj, testcase_id): def Run_NRulsimTest(self, htmlObj, constObj, testcase_id):
......
...@@ -376,8 +376,10 @@ def GetParametersFromXML(action): ...@@ -376,8 +376,10 @@ def GetParametersFromXML(action):
if (string_field is not None): if (string_field is not None):
CONTAINERS.ran_checkers['u_retx_th'] = [float(x) for x in string_field.split(',')] CONTAINERS.ran_checkers['u_retx_th'] = [float(x) for x in string_field.split(',')]
elif action == 'Run_LDPCTest' or action == 'Run_NRulsimTest' or action == 'Run_LDPCt1Test': elif action == 'Run_LDPCTest' or action == 'Run_NRulsimTest' or action == 'Run_T2Test':
ldpc.runargs = test.findtext('physim_run_args') ldpc.runargs = test.findtext('physim_run_args')
ldpc.runsim = test.findtext('physim_run')
ldpc.timethrs = test.findtext('physim_time_threshold')
elif action == 'LicenceAndFormattingCheck': elif action == 'LicenceAndFormattingCheck':
pass pass
...@@ -800,8 +802,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re ...@@ -800,8 +802,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
HTML=ldpc.Run_LDPCTest(HTML,CONST,id) HTML=ldpc.Run_LDPCTest(HTML,CONST,id)
if ldpc.exitStatus==1: if ldpc.exitStatus==1:
RAN.prematureExit = True RAN.prematureExit = True
elif action == 'Run_LDPCt1Test': elif action == 'Run_T2Test':
HTML=ldpc.Run_LDPCt1Test(HTML,CONST,id) HTML=ldpc.Run_T2Test(HTML,CONST,id)
if ldpc.exitStatus==1: if ldpc.exitStatus==1:
RAN.prematureExit = True RAN.prematureExit = True
elif action == 'Run_NRulsimTest': elif action == 'Run_NRulsimTest':
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
- Pull_Cluster_Image - Pull_Cluster_Image
- Build_PhySim - Build_PhySim
- Run_LDPCTest - Run_LDPCTest
- Run_LDPCt1Test - Run_T2Test
- Run_NRulsimTest - Run_NRulsimTest
- Build_eNB - Build_eNB
- WaitEndBuild_eNB - WaitEndBuild_eNB
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment