diff --git a/ci-scripts/cls_physim.py b/ci-scripts/cls_physim.py index fe7fc2d7d79e57f9d113c1c07ba5dd5e005254f9..5e0dbc11b227cf8918f5de57fa77fbc44de16006 100644 --- a/ci-scripts/cls_physim.py +++ b/ci-scripts/cls_physim.py @@ -56,7 +56,6 @@ class PhySim: self.__workSpacePath='' self.__buildLogFile='compile_phy_sim.log' self.__runLogFile='' - self.__runResults=[] self.__runLogPath='phy_sim_logs' @@ -71,13 +70,13 @@ class PhySim: mySSH.copyin(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord, self.__workSpacePath+self.__runLogFile, '.') mySSH.close() #parse results looking for Encoding and Decoding mean values - self.__runResults=[] + runResults=[] with open(self.__runLogFile) as f: for line in f: if 'mean' in line: - self.__runResults.append(line) + runResults.append(line) #the values are appended for each mean value (2), so we take these 2 values from the list - info=self.__runResults[0]+self.__runResults[1] + info = runResults[0] + runResults[1] #once parsed move the local logfile to its folder for tidiness os.system('mv '+self.__runLogFile+' '+ self.__runLogPath+'/.') @@ -89,6 +88,38 @@ class PhySim: HTML.CreateHtmlTestRowQueue(self.runargs, 'OK', 1, html_queue) return HTML + def __CheckResults_NRulsimTest(self, HTML, CONST, testcase_id): + html_queue = SimpleQueue() + #retrieve run log file and store it locally + mySSH = sshconnection.SSHConnection() + filename = self.__workSpacePath + self.__runLogFile + ret = mySSH.copyin(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord, filename, '.') + if ret != 0: + error_msg = f'could not recover test result file {filename}' + logging.error(error_msg) + html_queue.put(f'<pre style="background-color:white">{error_msg}</pre>') + HTML.CreateHtmlTestRowQueue("could not recover results", 'KO', 1, html_queue) + self.exitStatus = 1 + return HTML + + PUSCH_OK = False + with open(self.__runLogFile) as f: + PUSCH_OK = 'PUSCH test OK' in f.read() + + # once parsed move the local logfile to its folder for tidiness + os.system(f'mv {self.__runLogFile} {self.__runLogPath}/.') + + #updating the HTML with results + if PUSCH_OK: + html_queue.put('<pre style="background-color:white">succeeded</pre>') + HTML.CreateHtmlTestRowQueue(self.runargs, 'OK', 1, html_queue) + else: + error_msg = 'error: no "PUSCH test OK"' + logging.error(error_msg) + html_queue.put(f'<pre style="background-color:white">{error_msg}</pre>') + HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', 1, html_queue) + self.exitStatus = 1 + return HTML def __CheckBuild_PhySim(self, HTML, CONST): self.__workSpacePath=self.eNBSourceCodePath+'/cmake_targets/' @@ -183,3 +214,16 @@ class PhySim: lHTML = cls_oai_html.HTMLManagement() lHTML=self.__CheckResults_LDPCTest(htmlObj,constObj,testcase_id) return lHTML + + def Run_NRulsimTest(self, htmlObj, constObj, testcase_id): + self.__workSpacePath=self.eNBSourceCodePath+'/cmake_targets/' + os.system(f'mkdir -p ./{self.__runLogPath}') + self.__runLogFile = f'physim_{testcase_id}.log' + mySSH = sshconnection.SSHConnection() + mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) + mySSH.command(f'cd {self.__workSpacePath}', '\$', 5) + mySSH.command(f'sudo {self.__workSpacePath}ran_build/build/nr_ulsim {self.runargs} > {self.__runLogFile} 2>&1', '\$', 30) + mySSH.close() + #return updated HTML to main + lHTML = self.__CheckResults_NRulsimTest(htmlObj, constObj, testcase_id) + return lHTML diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 23c9ac9e21a2eb51b0669b525a9073887146f882..75018b64d632abd044f726cdff5b606969770423 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -457,7 +457,7 @@ def GetParametersFromXML(action): if (string_field is not None): CONTAINERS.testSvrId = string_field - elif action == 'Run_LDPCTest': + elif action == 'Run_LDPCTest' or action == 'Run_NRulsimTest': ldpc.runargs = test.findtext('physim_run_args') else: @@ -923,6 +923,10 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re HTML=ldpc.Run_LDPCTest(HTML,CONST,id) if ldpc.exitStatus==1: RAN.prematureExit = True + elif action == 'Run_NRulsimTest': + HTML=ldpc.Run_NRulsimTest(HTML,CONST,id) + if ldpc.exitStatus==1: + RAN.prematureExit = True elif action == 'Build_Image': CONTAINERS.BuildImage(HTML) elif action == 'Build_Proxy': diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml index 8a0800e8189e3104b5a69d41287932a2f1d91492..f9894d501f8e998eefb720b4519b49658751633c 100755 --- a/ci-scripts/xml_class_list.yml +++ b/ci-scripts/xml_class_list.yml @@ -1,6 +1,7 @@ - Build_Proxy - Build_PhySim - Run_LDPCTest + - Run_NRulsimTest - Build_eNB - WaitEndBuild_eNB - Initialize_eNB