Consistently return success true/false from task steps
This commit is contained in:
@@ -85,6 +85,7 @@ def CreateWorkspace(sshSession, sourcePath, ranRepository, ranCommitID, ranTarge
|
|||||||
sshSession.command('git log --oneline | head -n5', '\$', 5)
|
sshSession.command('git log --oneline | head -n5', '\$', 5)
|
||||||
logging.error(f'problems during checkout, is at: {sshSession.getBefore()}')
|
logging.error(f'problems during checkout, is at: {sshSession.getBefore()}')
|
||||||
self.exitStatus = 1
|
self.exitStatus = 1
|
||||||
|
return False
|
||||||
else:
|
else:
|
||||||
logging.debug('successful checkout')
|
logging.debug('successful checkout')
|
||||||
# if the branch is not develop, then it is a merge request and we need to do
|
# if the branch is not develop, then it is a merge request and we need to do
|
||||||
@@ -94,6 +95,7 @@ def CreateWorkspace(sshSession, sourcePath, ranRepository, ranCommitID, ranTarge
|
|||||||
ranTargetBranch = 'develop'
|
ranTargetBranch = 'develop'
|
||||||
logging.debug(f'Merging with the target branch: {ranTargetBranch}')
|
logging.debug(f'Merging with the target branch: {ranTargetBranch}')
|
||||||
sshSession.command(f'git merge --ff origin/{ranTargetBranch} -m "Temporary merge for CI"', '\$', 30)
|
sshSession.command(f'git merge --ff origin/{ranTargetBranch} -m "Temporary merge for CI"', '\$', 30)
|
||||||
|
return True
|
||||||
|
|
||||||
def ImageTagToUse(imageName, ranCommitID, ranBranch, ranAllowMerge):
|
def ImageTagToUse(imageName, ranCommitID, ranBranch, ranAllowMerge):
|
||||||
shortCommit = ranCommitID[0:8]
|
shortCommit = ranCommitID[0:8]
|
||||||
@@ -969,8 +971,12 @@ class Containerize():
|
|||||||
logging.info(f"Running on server {lIpAddr}")
|
logging.info(f"Running on server {lIpAddr}")
|
||||||
sshSession = cls_cmd.getConnection(lIpAddr)
|
sshSession = cls_cmd.getConnection(lIpAddr)
|
||||||
|
|
||||||
CreateWorkspace(sshSession, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge)
|
success = CreateWorkspace(sshSession, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge)
|
||||||
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
|
if success:
|
||||||
|
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
|
||||||
|
else:
|
||||||
|
HTML.CreateHtmlTestRowQueue('N/A', 'KO', ["cannot create workspace"])
|
||||||
|
return success
|
||||||
|
|
||||||
def DeployObject(self, HTML):
|
def DeployObject(self, HTML):
|
||||||
lIpAddr, lUserName, lPassWord, lSourcePath = GetCredentials(self)
|
lIpAddr, lUserName, lPassWord, lSourcePath = GetCredentials(self)
|
||||||
@@ -988,7 +994,7 @@ class Containerize():
|
|||||||
self.exitStatus = 1
|
self.exitStatus = 1
|
||||||
logging.error('Could not deploy')
|
logging.error('Could not deploy')
|
||||||
HTML.CreateHtmlTestRow('Could not deploy', 'KO', CONST.ALL_PROCESSES_OK)
|
HTML.CreateHtmlTestRow('Could not deploy', 'KO', CONST.ALL_PROCESSES_OK)
|
||||||
return
|
return False
|
||||||
services_list = allServices if self.services[self.eNB_instance].split() == [] else self.services[self.eNB_instance].split()
|
services_list = allServices if self.services[self.eNB_instance].split() == [] else self.services[self.eNB_instance].split()
|
||||||
status = True
|
status = True
|
||||||
imagesInfo=""
|
imagesInfo=""
|
||||||
@@ -1011,6 +1017,7 @@ class Containerize():
|
|||||||
self.exitStatus = 1
|
self.exitStatus = 1
|
||||||
imagesInfo += ("Unhealthy deployment! -- Check logs for reason!")
|
imagesInfo += ("Unhealthy deployment! -- Check logs for reason!")
|
||||||
HTML.CreateHtmlTestRowQueue('N/A', 'KO', [(imagesInfo)])
|
HTML.CreateHtmlTestRowQueue('N/A', 'KO', [(imagesInfo)])
|
||||||
|
return status
|
||||||
|
|
||||||
def UndeployObject(self, HTML, RAN):
|
def UndeployObject(self, HTML, RAN):
|
||||||
lIpAddr, lUserName, lPassWord, lSourcePath = GetCredentials(self)
|
lIpAddr, lUserName, lPassWord, lSourcePath = GetCredentials(self)
|
||||||
@@ -1029,11 +1036,13 @@ class Containerize():
|
|||||||
HTML.htmleNBFailureMsg='Could not copy logfile(s) to analyze it!'
|
HTML.htmleNBFailureMsg='Could not copy logfile(s) to analyze it!'
|
||||||
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE)
|
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE)
|
||||||
self.exitStatus = 1
|
self.exitStatus = 1
|
||||||
|
return False
|
||||||
else:
|
else:
|
||||||
log_results = [CheckLogs(self, mySSH, self.yamlPath[0].split('/'), service_name, HTML, RAN) for service_name, _ in services]
|
log_results = [CheckLogs(self, mySSH, self.yamlPath[0].split('/'), service_name, HTML, RAN) for service_name, _ in services]
|
||||||
self.exitStatus = 1 if any(log_results) else 0
|
self.exitStatus = 1 if any(log_results) else 0
|
||||||
logging.info('\u001B[1m Undeploying OAI Object Pass\u001B[0m') if self.exitStatus == 0 else logging.error('\u001B[1m Undeploying OAI Object Failed\u001B[0m')
|
logging.info('\u001B[1m Undeploying OAI Object Pass\u001B[0m') if self.exitStatus == 0 else logging.error('\u001B[1m Undeploying OAI Object Failed\u001B[0m')
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
|
return self.exitStatus == 0
|
||||||
|
|
||||||
def CheckAndAddRoute(self, svrName, ipAddr, userName, password):
|
def CheckAndAddRoute(self, svrName, ipAddr, userName, password):
|
||||||
logging.debug('Checking IP routing on ' + svrName)
|
logging.debug('Checking IP routing on ' + svrName)
|
||||||
|
|||||||
@@ -291,6 +291,7 @@ class OaiCiTest():
|
|||||||
messages.append(f'{uename}: initialized' if f.result() else f'{uename}: ERROR during Initialization')
|
messages.append(f'{uename}: initialized' if f.result() else f'{uename}: ERROR during Initialization')
|
||||||
[f.result() for f in futures]
|
[f.result() for f in futures]
|
||||||
HTML.CreateHtmlTestRowQueue('N/A', 'OK', messages)
|
HTML.CreateHtmlTestRowQueue('N/A', 'OK', messages)
|
||||||
|
return True
|
||||||
|
|
||||||
def AttachUE(self, HTML, RAN, EPC, CONTAINERS):
|
def AttachUE(self, HTML, RAN, EPC, CONTAINERS):
|
||||||
ues = [cls_module.Module_UE(ue_id, server_name) for ue_id, server_name in zip(self.ue_ids, self.nodes)]
|
ues = [cls_module.Module_UE(ue_id, server_name) for ue_id, server_name in zip(self.ue_ids, self.nodes)]
|
||||||
@@ -300,12 +301,14 @@ class OaiCiTest():
|
|||||||
futures = [executor.submit(ue.checkMTU) for ue in ues]
|
futures = [executor.submit(ue.checkMTU) for ue in ues]
|
||||||
mtus = [f.result() for f in futures]
|
mtus = [f.result() for f in futures]
|
||||||
messages = [f"UE {ue.getName()}: {ue.getIP()}" for ue in ues]
|
messages = [f"UE {ue.getName()}: {ue.getIP()}" for ue in ues]
|
||||||
if all(attached) and all(mtus):
|
success = all(attached) and all(mtus)
|
||||||
|
if success:
|
||||||
HTML.CreateHtmlTestRowQueue('N/A', 'OK', messages)
|
HTML.CreateHtmlTestRowQueue('N/A', 'OK', messages)
|
||||||
else:
|
else:
|
||||||
logging.error(f'error attaching or wrong MTU: attached {attached}, mtus {mtus}')
|
logging.error(f'error attaching or wrong MTU: attached {attached}, mtus {mtus}')
|
||||||
HTML.CreateHtmlTestRowQueue('N/A', 'KO', ["Could not retrieve UE IP address(es) or MTU(s) wrong!"])
|
HTML.CreateHtmlTestRowQueue('N/A', 'KO', ["Could not retrieve UE IP address(es) or MTU(s) wrong!"])
|
||||||
self.AutoTerminateUEandeNB(HTML, RAN, EPC, CONTAINERS)
|
self.AutoTerminateUEandeNB(HTML, RAN, EPC, CONTAINERS)
|
||||||
|
return success
|
||||||
|
|
||||||
def DetachUE(self, HTML):
|
def DetachUE(self, HTML):
|
||||||
ues = [cls_module.Module_UE(ue_id, server_name) for ue_id, server_name in zip(self.ue_ids, self.nodes)]
|
ues = [cls_module.Module_UE(ue_id, server_name) for ue_id, server_name in zip(self.ue_ids, self.nodes)]
|
||||||
@@ -314,18 +317,21 @@ class OaiCiTest():
|
|||||||
[f.result() for f in futures]
|
[f.result() for f in futures]
|
||||||
messages = [f"UE {ue.getName()}: detached" for ue in ues]
|
messages = [f"UE {ue.getName()}: detached" for ue in ues]
|
||||||
HTML.CreateHtmlTestRowQueue('NA', 'OK', messages)
|
HTML.CreateHtmlTestRowQueue('NA', 'OK', messages)
|
||||||
|
return True
|
||||||
|
|
||||||
def DataDisableUE(self, HTML):
|
def DataDisableUE(self, HTML):
|
||||||
ues = [cls_module.Module_UE(n.strip()) for n in self.ue_ids]
|
ues = [cls_module.Module_UE(n.strip()) for n in self.ue_ids]
|
||||||
with concurrent.futures.ThreadPoolExecutor(max_workers=64) as executor:
|
with concurrent.futures.ThreadPoolExecutor(max_workers=64) as executor:
|
||||||
futures = [executor.submit(ue.dataDisable) for ue in ues]
|
futures = [executor.submit(ue.dataDisable) for ue in ues]
|
||||||
status = [f.result() for f in futures]
|
status = [f.result() for f in futures]
|
||||||
if all(status):
|
success = all(status)
|
||||||
|
if success:
|
||||||
messages = [f"UE {ue.getName()}: data disabled" for ue in ues]
|
messages = [f"UE {ue.getName()}: data disabled" for ue in ues]
|
||||||
HTML.CreateHtmlTestRowQueue('NA', 'OK', messages)
|
HTML.CreateHtmlTestRowQueue('NA', 'OK', messages)
|
||||||
else:
|
else:
|
||||||
logging.error(f'error enabling data: {status}')
|
logging.error(f'error enabling data: {status}')
|
||||||
HTML.CreateHtmlTestRowQueue('N/A', 'KO', ["Could not disable UE data!"])
|
HTML.CreateHtmlTestRowQueue('N/A', 'KO', ["Could not disable UE data!"])
|
||||||
|
return success
|
||||||
|
|
||||||
def DataEnableUE(self, HTML):
|
def DataEnableUE(self, HTML):
|
||||||
ues = [cls_module.Module_UE(n.strip()) for n in self.ue_ids]
|
ues = [cls_module.Module_UE(n.strip()) for n in self.ue_ids]
|
||||||
@@ -333,12 +339,14 @@ class OaiCiTest():
|
|||||||
with concurrent.futures.ThreadPoolExecutor(max_workers=64) as executor:
|
with concurrent.futures.ThreadPoolExecutor(max_workers=64) as executor:
|
||||||
futures = [executor.submit(ue.dataEnable) for ue in ues]
|
futures = [executor.submit(ue.dataEnable) for ue in ues]
|
||||||
status = [f.result() for f in futures]
|
status = [f.result() for f in futures]
|
||||||
if all(status):
|
success = all(status)
|
||||||
|
if success:
|
||||||
messages = [f"UE {ue.getName()}: data enabled" for ue in ues]
|
messages = [f"UE {ue.getName()}: data enabled" for ue in ues]
|
||||||
HTML.CreateHtmlTestRowQueue('NA', 'OK', messages)
|
HTML.CreateHtmlTestRowQueue('NA', 'OK', messages)
|
||||||
else:
|
else:
|
||||||
logging.error(f'error enabling data: {status}')
|
logging.error(f'error enabling data: {status}')
|
||||||
HTML.CreateHtmlTestRowQueue('N/A', 'KO', ["Could not enable UE data!"])
|
HTML.CreateHtmlTestRowQueue('N/A', 'KO', ["Could not enable UE data!"])
|
||||||
|
return success
|
||||||
|
|
||||||
def CheckStatusUE(self,HTML):
|
def CheckStatusUE(self,HTML):
|
||||||
ues = [cls_module.Module_UE(n.strip()) for n in self.ue_ids]
|
ues = [cls_module.Module_UE(n.strip()) for n in self.ue_ids]
|
||||||
@@ -348,6 +356,7 @@ class OaiCiTest():
|
|||||||
futures = [executor.submit(ue.check) for ue in ues]
|
futures = [executor.submit(ue.check) for ue in ues]
|
||||||
messages = [f.result() for f in futures]
|
messages = [f.result() for f in futures]
|
||||||
HTML.CreateHtmlTestRowQueue('NA', 'OK', messages)
|
HTML.CreateHtmlTestRowQueue('NA', 'OK', messages)
|
||||||
|
return True
|
||||||
|
|
||||||
def Ping_common(self, EPC, ue, RAN, logPath):
|
def Ping_common(self, EPC, ue, RAN, logPath):
|
||||||
# Launch ping on the EPC side (true for ltebox and old open-air-cn)
|
# Launch ping on the EPC side (true for ltebox and old open-air-cn)
|
||||||
@@ -455,6 +464,7 @@ class OaiCiTest():
|
|||||||
else:
|
else:
|
||||||
HTML.CreateHtmlTestRowQueue(self.ping_args, 'KO', messages)
|
HTML.CreateHtmlTestRowQueue(self.ping_args, 'KO', messages)
|
||||||
self.AutoTerminateUEandeNB(HTML,RAN,EPC,CONTAINERS)
|
self.AutoTerminateUEandeNB(HTML,RAN,EPC,CONTAINERS)
|
||||||
|
return success
|
||||||
|
|
||||||
def Iperf_Module(self, EPC, ue, svr, RAN, idx, ue_num, logPath):
|
def Iperf_Module(self, EPC, ue, svr, RAN, idx, ue_num, logPath):
|
||||||
ueIP = ue.getIP()
|
ueIP = ue.getIP()
|
||||||
@@ -540,6 +550,7 @@ class OaiCiTest():
|
|||||||
else:
|
else:
|
||||||
HTML.CreateHtmlTestRowQueue(self.iperf_args, 'KO', messages)
|
HTML.CreateHtmlTestRowQueue(self.iperf_args, 'KO', messages)
|
||||||
self.AutoTerminateUEandeNB(HTML,RAN,EPC,CONTAINERS)
|
self.AutoTerminateUEandeNB(HTML,RAN,EPC,CONTAINERS)
|
||||||
|
return success
|
||||||
|
|
||||||
def Iperf2_Unidir(self,HTML,RAN,EPC,CONTAINERS):
|
def Iperf2_Unidir(self,HTML,RAN,EPC,CONTAINERS):
|
||||||
if self.ue_ids == [] or self.svr_id == None or len(self.ue_ids) != 1:
|
if self.ue_ids == [] or self.svr_id == None or len(self.ue_ids) != 1:
|
||||||
@@ -580,6 +591,7 @@ class OaiCiTest():
|
|||||||
else:
|
else:
|
||||||
HTML.CreateHtmlTestRowQueue(self.iperf_args, 'KO', [f'{ue_header}\n{msg}'])
|
HTML.CreateHtmlTestRowQueue(self.iperf_args, 'KO', [f'{ue_header}\n{msg}'])
|
||||||
self.AutoTerminateUEandeNB(HTML,RAN,EPC,CONTAINERS)
|
self.AutoTerminateUEandeNB(HTML,RAN,EPC,CONTAINERS)
|
||||||
|
return success
|
||||||
|
|
||||||
def AnalyzeLogFile_UE(self, UElogFile,HTML,RAN):
|
def AnalyzeLogFile_UE(self, UElogFile,HTML,RAN):
|
||||||
if (not os.path.isfile(f'{UElogFile}')):
|
if (not os.path.isfile(f'{UElogFile}')):
|
||||||
@@ -860,6 +872,7 @@ class OaiCiTest():
|
|||||||
archive_info = [f'Log at: {a}' if a else 'No log available' for a in archives]
|
archive_info = [f'Log at: {a}' if a else 'No log available' for a in archives]
|
||||||
messages = [f"UE {ue.getName()}: {log}" for (ue, log) in zip(ues, archive_info)]
|
messages = [f"UE {ue.getName()}: {log}" for (ue, log) in zip(ues, archive_info)]
|
||||||
HTML.CreateHtmlTestRowQueue(f'N/A', 'OK', messages)
|
HTML.CreateHtmlTestRowQueue(f'N/A', 'OK', messages)
|
||||||
|
return True
|
||||||
|
|
||||||
def AutoTerminateUEandeNB(self,HTML,RAN,EPC,CONTAINERS):
|
def AutoTerminateUEandeNB(self,HTML,RAN,EPC,CONTAINERS):
|
||||||
if (RAN.Initialize_eNB_args != ''):
|
if (RAN.Initialize_eNB_args != ''):
|
||||||
|
|||||||
+13
-23
@@ -84,7 +84,7 @@ class PhySim:
|
|||||||
os.system('mv '+self.__runLogFile+' '+ self.__runLogPath+'/.')
|
os.system('mv '+self.__runLogFile+' '+ self.__runLogPath+'/.')
|
||||||
|
|
||||||
HTML.CreateHtmlTestRowQueue(self.runargs, 'OK', [info])
|
HTML.CreateHtmlTestRowQueue(self.runargs, 'OK', [info])
|
||||||
return HTML
|
return True
|
||||||
|
|
||||||
def __CheckResults_LDPCt2Test(self,HTML,CONST,testcase_id):
|
def __CheckResults_LDPCt2Test(self,HTML,CONST,testcase_id):
|
||||||
thrs_KO = int(self.timethrs)
|
thrs_KO = int(self.timethrs)
|
||||||
@@ -113,18 +113,19 @@ class PhySim:
|
|||||||
HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', ['no statistics'])
|
HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', ['no statistics'])
|
||||||
self.exitStatus = 1
|
self.exitStatus = 1
|
||||||
os.system(f'mv {self.__runLogFile} {self.__runLogPath}/.')
|
os.system(f'mv {self.__runLogFile} {self.__runLogPath}/.')
|
||||||
return HTML
|
return False
|
||||||
|
|
||||||
#once parsed move the local logfile to its folder
|
#once parsed move the local logfile to its folder
|
||||||
os.system(f'mv {self.__runLogFile} {self.__runLogPath}/.')
|
os.system(f'mv {self.__runLogFile} {self.__runLogPath}/.')
|
||||||
if float(time) < thrs_KO:
|
success = float(time) < thrs_KO
|
||||||
|
if success:
|
||||||
HTML.CreateHtmlTestRowQueue(self.runargs, 'OK', [info])
|
HTML.CreateHtmlTestRowQueue(self.runargs, 'OK', [info])
|
||||||
else:
|
else:
|
||||||
error_msg = f'Processing 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
|
||||||
return HTML
|
return success
|
||||||
|
|
||||||
def __CheckResults_NRulsimTest(self, HTML, CONST, testcase_id):
|
def __CheckResults_NRulsimTest(self, HTML, CONST, testcase_id):
|
||||||
#retrieve run log file and store it locally
|
#retrieve run log file and store it locally
|
||||||
@@ -136,7 +137,7 @@ class PhySim:
|
|||||||
logging.error(error_msg)
|
logging.error(error_msg)
|
||||||
HTML.CreateHtmlTestRowQueue("could not recover results", 'KO', [error_msg])
|
HTML.CreateHtmlTestRowQueue("could not recover results", 'KO', [error_msg])
|
||||||
self.exitStatus = 1
|
self.exitStatus = 1
|
||||||
return HTML
|
return False
|
||||||
|
|
||||||
PUSCH_OK = False
|
PUSCH_OK = False
|
||||||
with open(self.__runLogFile) as f:
|
with open(self.__runLogFile) as f:
|
||||||
@@ -153,7 +154,7 @@ class PhySim:
|
|||||||
logging.error(error_msg)
|
logging.error(error_msg)
|
||||||
HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', 1, [error_msg])
|
HTML.CreateHtmlTestRowQueue(self.runargs, 'KO', 1, [error_msg])
|
||||||
self.exitStatus = 1
|
self.exitStatus = 1
|
||||||
return HTML
|
return PUSCH_OK
|
||||||
|
|
||||||
def __CheckBuild_PhySim(self, HTML, CONST):
|
def __CheckBuild_PhySim(self, HTML, CONST):
|
||||||
self.__workSpacePath=self.eNBSourceCodePath+'/cmake_targets/'
|
self.__workSpacePath=self.eNBSourceCodePath+'/cmake_targets/'
|
||||||
@@ -169,13 +170,13 @@ class PhySim:
|
|||||||
if 'BUILD SHOULD BE SUCCESSFUL' in f.read():
|
if 'BUILD SHOULD BE SUCCESSFUL' in f.read():
|
||||||
HTML.CreateHtmlTestRow(self.buildargs, 'OK', CONST.ALL_PROCESSES_OK, 'PhySim')
|
HTML.CreateHtmlTestRow(self.buildargs, 'OK', CONST.ALL_PROCESSES_OK, 'PhySim')
|
||||||
self.exitStatus=0
|
self.exitStatus=0
|
||||||
return HTML
|
return True
|
||||||
logging.error('\u001B[1m Building Physical Simulators Failed\u001B[0m')
|
logging.error('\u001B[1m Building Physical Simulators 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
|
#exitStatus=1 will do a sys.exit in main
|
||||||
self.exitStatus = 1
|
self.exitStatus = 1
|
||||||
return HTML
|
return False
|
||||||
|
|
||||||
|
|
||||||
#-----------------$
|
#-----------------$
|
||||||
@@ -226,10 +227,7 @@ class PhySim:
|
|||||||
mySSH.command(f'./build_oai {self.buildargs} 2>&1 | tee {self.__buildLogFile}', '\$', 1500)
|
mySSH.command(f'./build_oai {self.buildargs} 2>&1 | tee {self.__buildLogFile}', '\$', 1500)
|
||||||
|
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
#check build status and update HTML object
|
return __CheckBuild_PhySim(htmlObj,constObj)
|
||||||
lHTML = cls_oai_html.HTMLManagement()
|
|
||||||
lHTML=self.__CheckBuild_PhySim(htmlObj,constObj)
|
|
||||||
return lHTML
|
|
||||||
|
|
||||||
|
|
||||||
def Run_CUDATest(self,htmlObj,constObj,testcase_id):
|
def Run_CUDATest(self,htmlObj,constObj,testcase_id):
|
||||||
@@ -245,10 +243,7 @@ class PhySim:
|
|||||||
#run and redirect the results to a log file
|
#run and redirect the results to a log file
|
||||||
mySSH.command(self.__workSpacePath+'ran_build/build/ldpctest ' + self.runargs + ' >> '+self.__runLogFile, '\$', 30)
|
mySSH.command(self.__workSpacePath+'ran_build/build/ldpctest ' + self.runargs + ' >> '+self.__runLogFile, '\$', 30)
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
#return updated HTML to main
|
return self.__CheckResults_LDPCcudaTest(htmlObj,constObj,testcase_id)
|
||||||
lHTML = cls_oai_html.HTMLManagement()
|
|
||||||
lHTML=self.__CheckResults_LDPCcudaTest(htmlObj,constObj,testcase_id)
|
|
||||||
return lHTML
|
|
||||||
|
|
||||||
def Run_T2Test(self,htmlObj,constObj,testcase_id):
|
def Run_T2Test(self,htmlObj,constObj,testcase_id):
|
||||||
self.__workSpacePath = f'{self.eNBSourceCodePath}/cmake_targets/'
|
self.__workSpacePath = f'{self.eNBSourceCodePath}/cmake_targets/'
|
||||||
@@ -262,10 +257,7 @@ class PhySim:
|
|||||||
#run and redirect the results to a log file
|
#run and redirect the results to a log file
|
||||||
mySSH.run(f'sudo {self.__workSpacePath}ran_build/build/{self.runsim} {self.runargs} > {self.__workSpacePath}{self.__runLogFile} 2>&1')
|
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 self.__CheckResults_LDPCt2Test(htmlObj,constObj,testcase_id)
|
||||||
lHTML = cls_oai_html.HTMLManagement()
|
|
||||||
lHTML=self.__CheckResults_LDPCt2Test(htmlObj,constObj,testcase_id)
|
|
||||||
return lHTML
|
|
||||||
|
|
||||||
def Run_NRulsimTest(self, htmlObj, constObj, testcase_id):
|
def Run_NRulsimTest(self, htmlObj, constObj, testcase_id):
|
||||||
self.__workSpacePath=self.eNBSourceCodePath+'/cmake_targets/'
|
self.__workSpacePath=self.eNBSourceCodePath+'/cmake_targets/'
|
||||||
@@ -276,6 +268,4 @@ class PhySim:
|
|||||||
mySSH.command(f'cd {self.__workSpacePath}', '\$', 5)
|
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.command(f'sudo {self.__workSpacePath}ran_build/build/nr_ulsim {self.runargs} > {self.__runLogFile} 2>&1', '\$', 30)
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
#return updated HTML to main
|
return self.__CheckResults_NRulsimTest(htmlObj, constObj, testcase_id)
|
||||||
lHTML = self.__CheckResults_NRulsimTest(htmlObj, constObj, testcase_id)
|
|
||||||
return lHTML
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ class PhySim:
|
|||||||
mySSH.close()
|
mySSH.close()
|
||||||
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL)
|
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL)
|
||||||
RAN.prematureExit = True
|
RAN.prematureExit = True
|
||||||
return
|
return False
|
||||||
else:
|
else:
|
||||||
logging.debug('\u001B[1m Login to OC Cluster Successfully\u001B[0m')
|
logging.debug('\u001B[1m Login to OC Cluster Successfully\u001B[0m')
|
||||||
mySSH.command(f'oc project {ocProjectName}', '\$', 30)
|
mySSH.command(f'oc project {ocProjectName}', '\$', 30)
|
||||||
@@ -134,7 +134,7 @@ class PhySim:
|
|||||||
mySSH.close()
|
mySSH.close()
|
||||||
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PROJECT_FAIL)
|
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PROJECT_FAIL)
|
||||||
RAN.prematureExit = True
|
RAN.prematureExit = True
|
||||||
return
|
return False
|
||||||
else:
|
else:
|
||||||
logging.debug(f'\u001B[1m Now using project {ocProjectName}\u001B[0m')
|
logging.debug(f'\u001B[1m Now using project {ocProjectName}\u001B[0m')
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ class PhySim:
|
|||||||
mySSH.close()
|
mySSH.close()
|
||||||
self.AnalyzeLogFile_phySim()
|
self.AnalyzeLogFile_phySim()
|
||||||
RAN.prematureExit = True
|
RAN.prematureExit = True
|
||||||
return
|
return False
|
||||||
else:
|
else:
|
||||||
logging.debug('\u001B[1m Deployed PhySim Successfully using helm chart\u001B[0m')
|
logging.debug('\u001B[1m Deployed PhySim Successfully using helm chart\u001B[0m')
|
||||||
isRunning = False
|
isRunning = False
|
||||||
@@ -187,7 +187,7 @@ class PhySim:
|
|||||||
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PHYSIM_DEPLOY_FAIL)
|
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PHYSIM_DEPLOY_FAIL)
|
||||||
HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult)
|
HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult)
|
||||||
RAN.prematureExit = True
|
RAN.prematureExit = True
|
||||||
return
|
return False
|
||||||
# Waiting to complete the running test
|
# Waiting to complete the running test
|
||||||
count = 0
|
count = 0
|
||||||
isFinished = False
|
isFinished = False
|
||||||
@@ -255,6 +255,7 @@ class PhySim:
|
|||||||
HTML.CreateHtmlTestRow('Some test(s) timed-out!', 'KO', CONST.ALL_PROCESSES_OK)
|
HTML.CreateHtmlTestRow('Some test(s) timed-out!', 'KO', CONST.ALL_PROCESSES_OK)
|
||||||
HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult)
|
HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult)
|
||||||
logging.error('\u001B[1m Physical Simulator Fail\u001B[0m')
|
logging.error('\u001B[1m Physical Simulator Fail\u001B[0m')
|
||||||
|
return self.testStatus
|
||||||
|
|
||||||
def AnalyzeLogFile_phySim(self):
|
def AnalyzeLogFile_phySim(self):
|
||||||
mySSH = SSH.SSHConnection()
|
mySSH = SSH.SSHConnection()
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ class StaticCodeAnalysis():
|
|||||||
HTML.CreateHtmlTestRowCppCheckResults(CCR)
|
HTML.CreateHtmlTestRowCppCheckResults(CCR)
|
||||||
logging.info('\u001B[1m Static Code Analysis Pass\u001B[0m')
|
logging.info('\u001B[1m Static Code Analysis Pass\u001B[0m')
|
||||||
|
|
||||||
return 0
|
return True
|
||||||
|
|
||||||
def LicenceAndFormattingCheck(self, HTML):
|
def LicenceAndFormattingCheck(self, HTML):
|
||||||
# Workspace is no longer recreated from scratch.
|
# Workspace is no longer recreated from scratch.
|
||||||
@@ -356,4 +356,4 @@ class StaticCodeAnalysis():
|
|||||||
HTML.htmleNBFailureMsg = 'Could not access oai-formatting-check.txt file'
|
HTML.htmleNBFailureMsg = 'Could not access oai-formatting-check.txt file'
|
||||||
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE)
|
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE)
|
||||||
|
|
||||||
return finalStatus
|
return finalStatus == 0
|
||||||
|
|||||||
+26
-7
@@ -135,6 +135,7 @@ class EPCManagement():
|
|||||||
logging.error('This option should not occur!')
|
logging.error('This option should not occur!')
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
HTML.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
|
HTML.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
|
||||||
|
return True
|
||||||
|
|
||||||
def InitializeMME(self, HTML):
|
def InitializeMME(self, HTML):
|
||||||
if self.IPAddress == '' or self.UserName == '' or self.Password == '' or self.SourceCodePath == '' or self.Type == '':
|
if self.IPAddress == '' or self.UserName == '' or self.Password == '' or self.SourceCodePath == '' or self.Type == '':
|
||||||
@@ -175,6 +176,7 @@ class EPCManagement():
|
|||||||
logging.error('This option should not occur!')
|
logging.error('This option should not occur!')
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
HTML.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
|
HTML.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
|
||||||
|
return True
|
||||||
|
|
||||||
def SetMmeIPAddress(self):
|
def SetMmeIPAddress(self):
|
||||||
# Not an error if we don't need an EPC
|
# Not an error if we don't need an EPC
|
||||||
@@ -241,12 +243,14 @@ class EPCManagement():
|
|||||||
logging.error('This option should not occur!')
|
logging.error('This option should not occur!')
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
HTML.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
|
HTML.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
|
||||||
|
return True
|
||||||
|
|
||||||
def Initialize5GCN(self, HTML):
|
def Initialize5GCN(self, HTML):
|
||||||
if self.IPAddress == '' or self.UserName == '' or self.Password == '' or self.Type == '':
|
if self.IPAddress == '' or self.UserName == '' or self.Password == '' or self.Type == '':
|
||||||
HELP.GenericHelp(CONST.Version)
|
HELP.GenericHelp(CONST.Version)
|
||||||
HELP.EPCSrvHelp(self.IPAddress, self.UserName, self.Password, self.Type)
|
HELP.EPCSrvHelp(self.IPAddress, self.UserName, self.Password, self.Type)
|
||||||
sys.exit('Insufficient EPC Parameters')
|
logging.error('Insufficient EPC Parameters')
|
||||||
|
return False
|
||||||
mySSH = cls_cmd.getConnection(self.IPAddress)
|
mySSH = cls_cmd.getConnection(self.IPAddress)
|
||||||
html_cell = ''
|
html_cell = ''
|
||||||
if re.match('ltebox', self.Type, re.IGNORECASE):
|
if re.match('ltebox', self.Type, re.IGNORECASE):
|
||||||
@@ -306,7 +310,8 @@ class EPCManagement():
|
|||||||
HTML.CreateHtmlTestRow('N/A', 'KO', report)
|
HTML.CreateHtmlTestRow('N/A', 'KO', report)
|
||||||
HTML.CreateHtmlTabFooter(False)
|
HTML.CreateHtmlTabFooter(False)
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
sys.exit("OC OAI CN5G: CN deployment failed!")
|
logging.error("OC OAI CN5G: CN deployment failed!")
|
||||||
|
return False
|
||||||
for line in report.stdout.split('\n')[1:]:
|
for line in report.stdout.split('\n')[1:]:
|
||||||
columns = line.strip().split()
|
columns = line.strip().split()
|
||||||
name = columns[0]
|
name = columns[0]
|
||||||
@@ -317,6 +322,7 @@ class EPCManagement():
|
|||||||
logging.error('This option should not occur!')
|
logging.error('This option should not occur!')
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
HTML.CreateHtmlTestRowQueue(self.Type, 'OK', [html_cell])
|
HTML.CreateHtmlTestRowQueue(self.Type, 'OK', [html_cell])
|
||||||
|
return True
|
||||||
|
|
||||||
def SetAmfIPAddress(self):
|
def SetAmfIPAddress(self):
|
||||||
# Not an error if we don't need an 5GCN
|
# Not an error if we don't need an 5GCN
|
||||||
@@ -472,6 +478,7 @@ class EPCManagement():
|
|||||||
logging.error('This should not happen!')
|
logging.error('This should not happen!')
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
|
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
|
||||||
|
return True
|
||||||
|
|
||||||
def TerminateMME(self, HTML):
|
def TerminateMME(self, HTML):
|
||||||
mySSH = SSH.SSHConnection()
|
mySSH = SSH.SSHConnection()
|
||||||
@@ -499,6 +506,7 @@ class EPCManagement():
|
|||||||
logging.error('This should not happen!')
|
logging.error('This should not happen!')
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
|
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
|
||||||
|
return True
|
||||||
|
|
||||||
def TerminateSPGW(self, HTML):
|
def TerminateSPGW(self, HTML):
|
||||||
mySSH = SSH.SSHConnection()
|
mySSH = SSH.SSHConnection()
|
||||||
@@ -542,6 +550,7 @@ class EPCManagement():
|
|||||||
logging.error('This should not happen!')
|
logging.error('This should not happen!')
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
|
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
|
||||||
|
return True
|
||||||
|
|
||||||
def Terminate5GCN(self, HTML):
|
def Terminate5GCN(self, HTML):
|
||||||
mySSH = cls_cmd.getConnection(self.IPAddress)
|
mySSH = cls_cmd.getConnection(self.IPAddress)
|
||||||
@@ -583,25 +592,29 @@ class EPCManagement():
|
|||||||
if not succeeded:
|
if not succeeded:
|
||||||
HTML.CreateHtmlTestRow('N/A', 'KO', report)
|
HTML.CreateHtmlTestRow('N/A', 'KO', report)
|
||||||
HTML.CreateHtmlTabFooter(False)
|
HTML.CreateHtmlTabFooter(False)
|
||||||
sys.exit("OC OAI CN5G: CN undeployment failed!")
|
logging.error("OC OAI CN5G: CN undeployment failed!")
|
||||||
|
return False
|
||||||
else:
|
else:
|
||||||
message = report.stdout
|
message = report.stdout
|
||||||
else:
|
else:
|
||||||
logging.error('This should not happen!')
|
logging.error('This should not happen!')
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
HTML.CreateHtmlTestRowQueue(self.Type, 'OK', [message])
|
HTML.CreateHtmlTestRowQueue(self.Type, 'OK', [message])
|
||||||
|
return True
|
||||||
|
|
||||||
def DeployEpc(self, HTML):
|
def DeployEpc(self, HTML):
|
||||||
logging.debug('Trying to deploy')
|
logging.debug('Trying to deploy')
|
||||||
if not re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
|
if not re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
|
||||||
HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER)
|
HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER)
|
||||||
HTML.CreateHtmlTabFooter(False)
|
HTML.CreateHtmlTabFooter(False)
|
||||||
sys.exit('Deploy not possible with this EPC type: ' + self.Type)
|
logging.error('Deploy not possible with this EPC type: ' + self.Type)
|
||||||
|
return False
|
||||||
|
|
||||||
if self.IPAddress == '' or self.UserName == '' or self.Password == '' or self.SourceCodePath == '' or self.Type == '':
|
if self.IPAddress == '' or self.UserName == '' or self.Password == '' or self.SourceCodePath == '' or self.Type == '':
|
||||||
HELP.GenericHelp(CONST.Version)
|
HELP.GenericHelp(CONST.Version)
|
||||||
HELP.EPCSrvHelp(self.IPAddress, self.UserName, self.Password, self.SourceCodePath, self.Type)
|
HELP.EPCSrvHelp(self.IPAddress, self.UserName, self.Password, self.SourceCodePath, self.Type)
|
||||||
sys.exit('Insufficient EPC Parameters')
|
logging.error('Insufficient EPC Parameters')
|
||||||
|
return False
|
||||||
mySSH = SSH.SSHConnection()
|
mySSH = SSH.SSHConnection()
|
||||||
mySSH.open(self.IPAddress, self.UserName, self.Password)
|
mySSH.open(self.IPAddress, self.UserName, self.Password)
|
||||||
mySSH.command('docker-compose --version', '\$', 5)
|
mySSH.command('docker-compose --version', '\$', 5)
|
||||||
@@ -610,7 +623,8 @@ class EPCManagement():
|
|||||||
mySSH.close()
|
mySSH.close()
|
||||||
HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER)
|
HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER)
|
||||||
HTML.CreateHtmlTabFooter(False)
|
HTML.CreateHtmlTabFooter(False)
|
||||||
sys.exit('docker-compose not installed on ' + self.IPAddress)
|
logging.error('docker-compose not installed on ' + self.IPAddress)
|
||||||
|
return False
|
||||||
|
|
||||||
# Checking if it is a MAGMA deployment
|
# Checking if it is a MAGMA deployment
|
||||||
self.isMagmaUsed = False
|
self.isMagmaUsed = False
|
||||||
@@ -660,7 +674,8 @@ class EPCManagement():
|
|||||||
if not db_init_status:
|
if not db_init_status:
|
||||||
HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER)
|
HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER)
|
||||||
HTML.CreateHtmlTabFooter(False)
|
HTML.CreateHtmlTabFooter(False)
|
||||||
sys.exit('Cassandra DB deployment/configuration went wrong!')
|
logging.error('Cassandra DB deployment/configuration went wrong!')
|
||||||
|
return True
|
||||||
|
|
||||||
# deploying EPC cNFs
|
# deploying EPC cNFs
|
||||||
mySSH.command('docker-compose up -d oai_spgwu', '\$', 60)
|
mySSH.command('docker-compose up -d oai_spgwu', '\$', 60)
|
||||||
@@ -729,10 +744,12 @@ class EPCManagement():
|
|||||||
mySSH.close()
|
mySSH.close()
|
||||||
logging.debug('Deployment OK')
|
logging.debug('Deployment OK')
|
||||||
HTML.CreateHtmlTestRowQueue(self.Type, 'OK', [html_cell])
|
HTML.CreateHtmlTestRowQueue(self.Type, 'OK', [html_cell])
|
||||||
|
return True
|
||||||
else:
|
else:
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
logging.debug('Deployment went wrong')
|
logging.debug('Deployment went wrong')
|
||||||
HTML.CreateHtmlTestRowQueue(self.Type, 'KO', [html_cell])
|
HTML.CreateHtmlTestRowQueue(self.Type, 'KO', [html_cell])
|
||||||
|
return False
|
||||||
|
|
||||||
def UndeployEpc(self, HTML):
|
def UndeployEpc(self, HTML):
|
||||||
logging.debug('Trying to undeploy')
|
logging.debug('Trying to undeploy')
|
||||||
@@ -802,9 +819,11 @@ class EPCManagement():
|
|||||||
if noMoreContainerNb == nbContainers and noMoreNetworkNb == 2:
|
if noMoreContainerNb == nbContainers and noMoreNetworkNb == 2:
|
||||||
logging.debug('Undeployment OK')
|
logging.debug('Undeployment OK')
|
||||||
HTML.CreateHtmlTestRowQueue(self.Type, 'OK', [message])
|
HTML.CreateHtmlTestRowQueue(self.Type, 'OK', [message])
|
||||||
|
return True
|
||||||
else:
|
else:
|
||||||
logging.debug('Undeployment went wrong')
|
logging.debug('Undeployment went wrong')
|
||||||
HTML.CreateHtmlTestRowQueue(self.Type, 'KO', [message])
|
HTML.CreateHtmlTestRowQueue(self.Type, 'KO', [message])
|
||||||
|
return False
|
||||||
|
|
||||||
def LogCollectHSS(self):
|
def LogCollectHSS(self):
|
||||||
mySSH = SSH.SSHConnection()
|
mySSH = SSH.SSHConnection()
|
||||||
|
|||||||
+43
-45
@@ -189,7 +189,7 @@ class RANManagement():
|
|||||||
if not mismatch:
|
if not mismatch:
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
HTML.CreateHtmlTestRow(self.Build_eNB_args, 'OK', CONST.ALL_PROCESSES_OK)
|
HTML.CreateHtmlTestRow(self.Build_eNB_args, 'OK', CONST.ALL_PROCESSES_OK)
|
||||||
return
|
return True
|
||||||
|
|
||||||
mySSH.command('echo ' + lPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30)
|
mySSH.command('echo ' + lPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30)
|
||||||
# if the commit ID is provided use it to point to it
|
# if the commit ID is provided use it to point to it
|
||||||
@@ -219,10 +219,10 @@ class RANManagement():
|
|||||||
mySSH.close()
|
mySSH.close()
|
||||||
HTML.CreateHtmlTestRow(self.Build_eNB_args, 'OK', CONST.ALL_PROCESSES_OK)
|
HTML.CreateHtmlTestRow(self.Build_eNB_args, 'OK', CONST.ALL_PROCESSES_OK)
|
||||||
self.backgroundBuildTestId[int(self.eNB_instance)] = self.testCase_id
|
self.backgroundBuildTestId[int(self.eNB_instance)] = self.testCase_id
|
||||||
return
|
return True
|
||||||
mySSH.command('stdbuf -o0 ./build_oai ' + self.Build_eNB_args + ' 2>&1 | stdbuf -o0 tee compile_oai_enb.log', 'BUILD SHOULD BE SUCCESSFUL|build have failed', 900)
|
mySSH.command('stdbuf -o0 ./build_oai ' + self.Build_eNB_args + ' 2>&1 | stdbuf -o0 tee compile_oai_enb.log', 'BUILD SHOULD BE SUCCESSFUL|build have failed', 900)
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
self.checkBuildeNB(lIpAddr, lUserName, lPassWord, lSourcePath, self.testCase_id, HTML)
|
return self.checkBuildeNB(lIpAddr, lUserName, lPassWord, lSourcePath, self.testCase_id, HTML)
|
||||||
|
|
||||||
def checkBuildeNB(self, lIpAddr, lUserName, lPassWord, lSourcePath, testcaseId, HTML):
|
def checkBuildeNB(self, lIpAddr, lUserName, lPassWord, lSourcePath, testcaseId, HTML):
|
||||||
HTML.testCase_id=testcaseId
|
HTML.testCase_id=testcaseId
|
||||||
@@ -283,8 +283,7 @@ class RANManagement():
|
|||||||
else:
|
else:
|
||||||
logging.error('\u001B[1m Building OAI ' + self.air_interface[self.eNB_instance] + ' Failed\u001B[0m')
|
logging.error('\u001B[1m Building OAI ' + self.air_interface[self.eNB_instance] + ' Failed\u001B[0m')
|
||||||
HTML.CreateHtmlTestRow(self.Build_eNB_args, 'KO', CONST.ALL_PROCESSES_OK)
|
HTML.CreateHtmlTestRow(self.Build_eNB_args, 'KO', CONST.ALL_PROCESSES_OK)
|
||||||
HTML.CreateHtmlTabFooter(False)
|
return buildStatus
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
def InitializeeNB(self, HTML, EPC):
|
def InitializeeNB(self, HTML, EPC):
|
||||||
if self.eNB_serverId[self.eNB_instance] == '0':
|
if self.eNB_serverId[self.eNB_instance] == '0':
|
||||||
@@ -453,8 +452,7 @@ class RANManagement():
|
|||||||
copyin_res = mySSH.copyin(localEpcIpAddr, localEpcUserName, localEpcPassword, '/tmp/' + self.epcPcapFile, '.')
|
copyin_res = mySSH.copyin(localEpcIpAddr, localEpcUserName, localEpcPassword, '/tmp/' + self.epcPcapFile, '.')
|
||||||
if (copyin_res == 0):
|
if (copyin_res == 0):
|
||||||
mySSH.copyout(lIpAddr, lUserName, lPassWord, self.epcPcapFile, lSourcePath + '/cmake_targets/.')
|
mySSH.copyout(lIpAddr, lUserName, lPassWord, self.epcPcapFile, lSourcePath + '/cmake_targets/.')
|
||||||
self.prematureExit = True
|
return False
|
||||||
return
|
|
||||||
else:
|
else:
|
||||||
mySSH.command('stdbuf -o0 cat enb_' + self.testCase_id + '.log | grep -E --text --color=never -i "wait|sync|Starting|Started"', '\$', 4)
|
mySSH.command('stdbuf -o0 cat enb_' + self.testCase_id + '.log | grep -E --text --color=never -i "wait|sync|Starting|Started"', '\$', 4)
|
||||||
if rruCheck:
|
if rruCheck:
|
||||||
@@ -492,45 +490,44 @@ class RANManagement():
|
|||||||
|
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
|
|
||||||
|
|
||||||
HTML.CreateHtmlTestRow(f'{self.cmd_prefix} {self.air_interface[self.eNB_instance]} -O {config_file} {extra_options}', 'OK', CONST.ALL_PROCESSES_OK)
|
HTML.CreateHtmlTestRow(f'{self.cmd_prefix} {self.air_interface[self.eNB_instance]} -O {config_file} {extra_options}', 'OK', CONST.ALL_PROCESSES_OK)
|
||||||
logging.debug('\u001B[1m Initialize eNB/gNB Completed\u001B[0m')
|
logging.debug('\u001B[1m Initialize eNB/gNB Completed\u001B[0m')
|
||||||
|
return enbDidSync
|
||||||
|
|
||||||
def CheckeNBProcess(self, status_queue):
|
def CheckeNBProcess(self, status_queue):
|
||||||
try:
|
# At least the instance 0 SHALL be on!
|
||||||
# At least the instance 0 SHALL be on!
|
if self.eNBstatuses[0] == 0:
|
||||||
if self.eNBstatuses[0] == 0:
|
lIpAddr = self.eNBIPAddress
|
||||||
lIpAddr = self.eNBIPAddress
|
lUserName = self.eNBUserName
|
||||||
lUserName = self.eNBUserName
|
lPassWord = self.eNBPassword
|
||||||
lPassWord = self.eNBPassword
|
elif self.eNBstatuses[0] == 1:
|
||||||
elif self.eNBstatuses[0] == 1:
|
lIpAddr = self.eNB1IPAddress
|
||||||
lIpAddr = self.eNB1IPAddress
|
lUserName = self.eNB1UserName
|
||||||
lUserName = self.eNB1UserName
|
lPassWord = self.eNB1Password
|
||||||
lPassWord = self.eNB1Password
|
elif self.eNBstatuses[0] == 2:
|
||||||
elif self.eNBstatuses[0] == 2:
|
lIpAddr = self.eNB2IPAddress
|
||||||
lIpAddr = self.eNB2IPAddress
|
lUserName = self.eNB2UserName
|
||||||
lUserName = self.eNB2UserName
|
lPassWord = self.eNB2Password
|
||||||
lPassWord = self.eNB2Password
|
else:
|
||||||
else:
|
lIpAddr = self.eNBIPAddress
|
||||||
lIpAddr = self.eNBIPAddress
|
lUserName = self.eNBUserName
|
||||||
lUserName = self.eNBUserName
|
lPassWord = self.eNBPassword
|
||||||
lPassWord = self.eNBPassword
|
mySSH = SSH.SSHConnection()
|
||||||
mySSH = SSH.SSHConnection()
|
mySSH.open(lIpAddr, lUserName, lPassWord)
|
||||||
mySSH.open(lIpAddr, lUserName, lPassWord)
|
if self.air_interface[self.eNB_instance] == '':
|
||||||
if self.air_interface[self.eNB_instance] == '':
|
pattern = 'softmodem'
|
||||||
pattern = 'softmodem'
|
else:
|
||||||
else:
|
pattern = self.air_interface[self.eNB_instance]
|
||||||
pattern = self.air_interface[self.eNB_instance]
|
mySSH.command('stdbuf -o0 ps -aux | grep --color=never ' + pattern + ' | grep -v grep', '\$', 5)
|
||||||
mySSH.command('stdbuf -o0 ps -aux | grep --color=never ' + pattern + ' | grep -v grep', '\$', 5)
|
result = re.search(pattern, mySSH.getBefore())
|
||||||
result = re.search(pattern, mySSH.getBefore())
|
success = result is not None
|
||||||
if result is None:
|
if not success:
|
||||||
logging.debug('\u001B[1;37;41m eNB Process Not Found! \u001B[0m')
|
logging.debug('\u001B[1;37;41m eNB Process Not Found! \u001B[0m')
|
||||||
status_queue.put(CONST.ENB_PROCESS_FAILED)
|
status_queue.put(CONST.ENB_PROCESS_FAILED)
|
||||||
else:
|
else:
|
||||||
status_queue.put(CONST.ENB_PROCESS_OK)
|
status_queue.put(CONST.ENB_PROCESS_OK)
|
||||||
mySSH.close()
|
mySSH.close()
|
||||||
except:
|
return success
|
||||||
os.kill(os.getppid(),signal.SIGUSR1)
|
|
||||||
|
|
||||||
def TerminateeNB(self, HTML, EPC):
|
def TerminateeNB(self, HTML, EPC):
|
||||||
if self.eNB_serverId[self.eNB_instance] == '0':
|
if self.eNB_serverId[self.eNB_instance] == '0':
|
||||||
@@ -610,6 +607,7 @@ class RANManagement():
|
|||||||
logStatus = self.AnalyzeLogFile_eNB(extracted_log_file, HTML, self.ran_checkers)
|
logStatus = self.AnalyzeLogFile_eNB(extracted_log_file, HTML, self.ran_checkers)
|
||||||
HTML.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
|
HTML.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
|
||||||
self.eNBLogFiles[int(self.eNB_instance)] = ''
|
self.eNBLogFiles[int(self.eNB_instance)] = ''
|
||||||
|
return True
|
||||||
else:
|
else:
|
||||||
analyzeFile = False
|
analyzeFile = False
|
||||||
if self.eNBLogFiles[int(self.eNB_instance)] != '':
|
if self.eNBLogFiles[int(self.eNB_instance)] != '':
|
||||||
@@ -628,7 +626,7 @@ class RANManagement():
|
|||||||
HTML.htmleNBFailureMsg='Could not copy ' + nodeB_prefix + 'NB logfile to analyze it!'
|
HTML.htmleNBFailureMsg='Could not copy ' + nodeB_prefix + 'NB logfile to analyze it!'
|
||||||
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE)
|
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE)
|
||||||
self.eNBmbmsEnables[int(self.eNB_instance)] = False
|
self.eNBmbmsEnables[int(self.eNB_instance)] = False
|
||||||
return
|
return False
|
||||||
if self.eNB_serverId[self.eNB_instance] != '0':
|
if self.eNB_serverId[self.eNB_instance] != '0':
|
||||||
#*stats.log files + pickle + png
|
#*stats.log files + pickle + png
|
||||||
|
|
||||||
@@ -646,9 +644,8 @@ class RANManagement():
|
|||||||
#display rt stats for gNB only
|
#display rt stats for gNB only
|
||||||
if len(self.datalog_rt_stats)!=0 and nodeB_prefix == 'g':
|
if len(self.datalog_rt_stats)!=0 and nodeB_prefix == 'g':
|
||||||
HTML.CreateHtmlDataLogTable(self.datalog_rt_stats)
|
HTML.CreateHtmlDataLogTable(self.datalog_rt_stats)
|
||||||
self.prematureExit = True
|
|
||||||
self.eNBmbmsEnables[int(self.eNB_instance)] = False
|
self.eNBmbmsEnables[int(self.eNB_instance)] = False
|
||||||
return
|
return False
|
||||||
else:
|
else:
|
||||||
HTML.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
|
HTML.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
|
||||||
else:
|
else:
|
||||||
@@ -658,6 +655,7 @@ class RANManagement():
|
|||||||
HTML.CreateHtmlDataLogTable(self.datalog_rt_stats)
|
HTML.CreateHtmlDataLogTable(self.datalog_rt_stats)
|
||||||
self.eNBmbmsEnables[int(self.eNB_instance)] = False
|
self.eNBmbmsEnables[int(self.eNB_instance)] = False
|
||||||
self.eNBstatuses[int(self.eNB_instance)] = -1
|
self.eNBstatuses[int(self.eNB_instance)] = -1
|
||||||
|
return True
|
||||||
|
|
||||||
def LogCollecteNB(self):
|
def LogCollecteNB(self):
|
||||||
mySSH = SSH.SSHConnection()
|
mySSH = SSH.SSHConnection()
|
||||||
|
|||||||
@@ -31,15 +31,15 @@ class TestDeploymentMethods(unittest.TestCase):
|
|||||||
self.cont.eNBSourceCodePath = os.getcwd()
|
self.cont.eNBSourceCodePath = os.getcwd()
|
||||||
|
|
||||||
def test_deploy(self):
|
def test_deploy(self):
|
||||||
self.cont.DeployObject(self.html)
|
success = self.cont.DeployObject(self.html)
|
||||||
self.assertEqual(self.cont.exitStatus, 0)
|
self.assertTrue(success)
|
||||||
self.cont.UndeployObject(self.html, self.ran)
|
self.cont.UndeployObject(self.html, self.ran)
|
||||||
|
|
||||||
def test_deployfails(self):
|
def test_deployfails(self):
|
||||||
old = self.cont.yamlPath
|
old = self.cont.yamlPath
|
||||||
self.cont.yamlPath[0] = 'tests/simple-fail/'
|
self.cont.yamlPath[0] = 'tests/simple-fail/'
|
||||||
self.cont.DeployObject(self.html)
|
success = self.cont.DeployObject(self.html)
|
||||||
self.assertEqual(self.cont.exitStatus, 1)
|
self.assertFalse(success)
|
||||||
self.cont.UndeployObject(self.html, self.ran)
|
self.cont.UndeployObject(self.html, self.ran)
|
||||||
self.cont.yamlPath = old
|
self.cont.yamlPath = old
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ class TestPingIperf(unittest.TestCase):
|
|||||||
self.ci.ping_args = "-c3 127.0.0.1"
|
self.ci.ping_args = "-c3 127.0.0.1"
|
||||||
self.ci.ping_packetloss_threshold = "0"
|
self.ci.ping_packetloss_threshold = "0"
|
||||||
# TODO Should need nothing but options and UE(s) to use
|
# TODO Should need nothing but options and UE(s) to use
|
||||||
self.ci.Ping(self.html, self.ran, self.epc, self.cont)
|
success = self.ci.Ping(self.html, self.ran, self.epc, self.cont)
|
||||||
|
self.assertTrue(success)
|
||||||
|
|
||||||
def test_iperf(self):
|
def test_iperf(self):
|
||||||
# note: needs to be five seconds because Iperf() adds -O 3, so if it is
|
# note: needs to be five seconds because Iperf() adds -O 3, so if it is
|
||||||
@@ -49,7 +50,8 @@ class TestPingIperf(unittest.TestCase):
|
|||||||
self.ci.iperf_bitrate_threshold = "0"
|
self.ci.iperf_bitrate_threshold = "0"
|
||||||
self.ci.iperf_profile = "balanced"
|
self.ci.iperf_profile = "balanced"
|
||||||
# TODO Should need nothing but options and UE(s) to use
|
# TODO Should need nothing but options and UE(s) to use
|
||||||
self.ci.Iperf(self.html, self.ran, self.epc, self.cont)
|
success = self.ci.Iperf(self.html, self.ran, self.epc, self.cont)
|
||||||
|
self.assertTrue(success)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user