Commit a9dbcf6b authored by Raphael Defosseux's avatar Raphael Defosseux

added in-code comments and changed attr to private

parent dcadc24a
...@@ -48,23 +48,32 @@ class PhySim: ...@@ -48,23 +48,32 @@ class PhySim:
self.ranAllowMerge= "" self.ranAllowMerge= ""
self.ranTargetBranch= "" self.ranTargetBranch= ""
self.exitStatus=0 self.exitStatus=0
self.workSpacePath='' #private attributes
self.buildLogFile='compile_oai_enb.log' self.__workSpacePath=''
self.runLogFile='ldpctest_run_results.log' self.__buildLogFile='compile_oai_enb.log'
self.runResults=[] self.__runLogFile='ldpctest_run_results.log'
self.__runResults=[]
#-----------------
#PRIVATE Methods
#-----------------
def __CheckResults_PhySim(self,HTML,CONST): def __CheckResults_PhySim(self,HTML,CONST):
mySSH = sshconnection.SSHConnection() mySSH = sshconnection.SSHConnection()
mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord)
#retrieve run log file locally$ #retrieve run log file and store it locally$
mySSH.copyin(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord, self.workSpacePath+self.runLogFile, '.') mySSH.copyin(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord, self.__workSpacePath+self.__runLogFile, '.')
mySSH.close() mySSH.close()
with open(self.runLogFile) as f: #parse results looking for Encoding and Decoding mean values
with open(self.__runLogFile) as f:
for line in f: for line in f:
if 'mean' in line: if 'mean' in line:
self.runResults.append(line) self.__runResults.append(line)
info=self.runResults[-1]+self.runResults[-2] #the value are appended for each test, so we take the last 2 values from the list
info=self.__runResults[-1]+self.__runResults[-2]
#updating the HTML with results
html_cell = '<pre style="background-color:white">' + info + '</pre>' html_cell = '<pre style="background-color:white">' + info + '</pre>'
html_queue=SimpleQueue() html_queue=SimpleQueue()
html_queue.put(html_cell) html_queue.put(html_cell)
...@@ -73,17 +82,18 @@ class PhySim: ...@@ -73,17 +82,18 @@ class PhySim:
def __CheckBuild_PhySim(self, HTML, CONST): def __CheckBuild_PhySim(self, HTML, CONST):
self.workSpacePath=self.eNBSourceCodePath+'/cmake_targets/' self.__workSpacePath=self.eNBSourceCodePath+'/cmake_targets/'
mySSH = sshconnection.SSHConnection() mySSH = sshconnection.SSHConnection()
mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord)
#retrieve compile log file locally #retrieve compile log file and store it locally
mySSH.copyin(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord, self.workSpacePath+self.buildLogFile, '.') mySSH.copyin(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord, self.__workSpacePath+self.__buildLogFile, '.')
#delete older run log file #delete older run log file
mySSH.command('rm ' + self.workSpacePath+self.runLogFile, '\$', 5) mySSH.command('rm ' + self.__workSpacePath+self.__runLogFile, '\$', 5)
mySSH.close() mySSH.close()
#check build result from local compile log file #check build result from local compile log file
buildStatus=False buildStatus=False
with open(self.buildLogFile) as f: with open(self.__buildLogFile) as f:
#nr_prachsim is the last compile step
if 'nr_prachsim compiled' in f.read(): if 'nr_prachsim compiled' in f.read():
buildStatus=True buildStatus=True
#update HTML based on build status #update HTML based on build status
...@@ -94,9 +104,15 @@ class PhySim: ...@@ -94,9 +104,15 @@ class PhySim:
logging.error('\u001B[1m Building OAI UE Failed\u001B[0m') logging.error('\u001B[1m Building OAI UE Failed\u001B[0m')
HTML.CreateHtmlTestRow(self.buildargs, 'KO', CONST.ALL_PROCESSES_OK, 'LDPC') HTML.CreateHtmlTestRow(self.buildargs, 'KO', CONST.ALL_PROCESSES_OK, 'LDPC')
HTML.CreateHtmlTabFooter(False) HTML.CreateHtmlTabFooter(False)
#exitStatus=1 will do a sys.exit in main
self.exitStatus=1 self.exitStatus=1
return HTML return HTML
#-----------------$
#PUBLIC Methods$
#-----------------$
def Build_PhySim(self,htmlObj,constObj): def Build_PhySim(self,htmlObj,constObj):
mySSH = sshconnection.SSHConnection() mySSH = sshconnection.SSHConnection()
mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord)
...@@ -145,11 +161,14 @@ class PhySim: ...@@ -145,11 +161,14 @@ class PhySim:
def Run_PhySim(self,htmlObj,constObj): def Run_PhySim(self,htmlObj,constObj):
#open a session for test run
mySSH = sshconnection.SSHConnection() mySSH = sshconnection.SSHConnection()
mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord)
mySSH.command('cd '+self.workSpacePath,'\$',5) mySSH.command('cd '+self.__workSpacePath,'\$',5)
mySSH.command(self.workSpacePath+'phy_simulators/build/ldpctest ' + self.runargs + ' >> '+self.runLogFile, '\$', 30) #run and redirect the results to a log file
mySSH.command(self.__workSpacePath+'phy_simulators/build/ldpctest ' + self.runargs + ' >> '+self.__runLogFile, '\$', 30)
mySSH.close() mySSH.close()
#return updated HTML to main
lHTML = html.HTMLManagement() lHTML = html.HTMLManagement()
lHTML=self.__CheckResults_PhySim(htmlObj,constObj) lHTML=self.__CheckResults_PhySim(htmlObj,constObj)
return lHTML return lHTML
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