From 39a5ddf5518e35af0906054b9ba8fbd279bdb48d Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 21 Apr 2020 20:15:57 +0200 Subject: [PATCH] CI: cleanup Signed-off-by: Raphael Defosseux --- ci-scripts/constants.py | 2 +- ci-scripts/epc.py | 7 ++---- ci-scripts/helpreadme.py | 2 +- ci-scripts/html.py | 50 +++++++++++-------------------------- ci-scripts/main.py | 7 +----- ci-scripts/ran.py | 16 ++---------- ci-scripts/sshconnection.py | 5 ++-- 7 files changed, 24 insertions(+), 65 deletions(-) diff --git a/ci-scripts/constants.py b/ci-scripts/constants.py index 65fca7193b..ca3cde446d 100644 --- a/ci-scripts/constants.py +++ b/ci-scripts/constants.py @@ -1,4 +1,4 @@ - +#/* # * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more # * contributor license agreements. See the NOTICE file distributed with # * this work for additional information regarding copyright ownership. diff --git a/ci-scripts/epc.py b/ci-scripts/epc.py index 07462bf762..e67de43b09 100644 --- a/ci-scripts/epc.py +++ b/ci-scripts/epc.py @@ -1,3 +1,4 @@ +#/* # * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more # * contributor license agreements. See the NOTICE file distributed with # * this work for additional information regarding copyright ownership. @@ -27,7 +28,6 @@ # pexpect #--------------------------------------------------------------------- - #----------------------------------------------------------- # Import #----------------------------------------------------------- @@ -124,7 +124,7 @@ class EPCManagement(): mySSH.command('if [ -d ' + self.SourceCodePath + '/scripts ]; then echo ' + self.Password + ' | sudo -S rm -Rf ' + self.SourceCodePath + '/scripts ; fi', '\$', 5) mySSH.command('mkdir -p ' + self.SourceCodePath + '/scripts', '\$', 5) mySSH.command('cd /opt/hss_sim0609', '\$', 5) - mySSH.command('echo ' + self.Password + ' | sudo -S rm -f hss.log daemon.log', '\$', 5) + mySSH.command('echo ' + self.Password + ' | sudo -S rm -f hss.log', '\$', 5) mySSH.command('echo ' + self.Password + ' | sudo -S echo "Starting sudo session" && sudo su -c "screen -dm -S simulated_hss ./starthss"', '\$', 5) else: logging.error('This option should not occur!') @@ -198,7 +198,6 @@ class EPCManagement(): if self.htmlObj is not None: self.htmlObj.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK) - def CheckHSSProcess(self, status_queue): try: mySSH = SSH.SSHConnection() @@ -267,7 +266,6 @@ class EPCManagement(): except: os.kill(os.getppid(),signal.SIGUSR1) - def TerminateHSS(self): mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) @@ -349,7 +347,6 @@ class EPCManagement(): if self.htmlObj is not None: self.htmlObj.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) - def LogCollectHSS(self): mySSH = SSH.SSHConnection() mySSH.open(self.IPAddress, self.UserName, self.Password) diff --git a/ci-scripts/helpreadme.py b/ci-scripts/helpreadme.py index 307ab4ff31..4b58c77510 100644 --- a/ci-scripts/helpreadme.py +++ b/ci-scripts/helpreadme.py @@ -1,3 +1,4 @@ +#/* # * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more # * contributor license agreements. See the NOTICE file distributed with # * this work for additional information regarding copyright ownership. @@ -27,7 +28,6 @@ # pexpect #--------------------------------------------------------------------- - #----------------------------------------------------------- # Functions Declaration #----------------------------------------------------------- diff --git a/ci-scripts/html.py b/ci-scripts/html.py index 6daf36a314..ac2362477a 100644 --- a/ci-scripts/html.py +++ b/ci-scripts/html.py @@ -1,3 +1,4 @@ +#/* # * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more # * contributor license agreements. See the NOTICE file distributed with # * this work for additional information regarding copyright ownership. @@ -27,7 +28,6 @@ # pexpect #--------------------------------------------------------------------- - #----------------------------------------------------------- # Import #----------------------------------------------------------- @@ -39,6 +39,8 @@ import time import subprocess from multiprocessing import Process, Lock, SimpleQueue +import constants as CONST + #----------------------------------------------------------- # Class Declaration #----------------------------------------------------------- @@ -87,11 +89,6 @@ class HTMLManagement(): def SetHmleNBFailureMsg(self, msg): self.htmleNBFailureMsg = msg - def SetreseNB(self,rsenb): - self.reseNB = rsenb - def SetresUE(self,rsue): - self.resUE = rsue - def Setdesc(self, dsc): self.desc = dsc @@ -105,35 +102,19 @@ class HTMLManagement(): def SetranRepository(self, repository): self.ranRepository = repository - def GetranRepository(self): - return self.ranRepository - def SetranAllowMerge(self, merge): self.ranAllowMerge = merge - def GetranAllowMerge(self): - return self.ranAllowMerge - def SetranBranch(self, branch): self.ranBranch = branch - def GetranBranch(self): - return self.ranBranch - def SetranCommitID(self, commitid): self.ranCommitID = commitid - def GetranCommitID(self): - return self.ranCommitID - def SetranTargetBranch(self, tbranch): self.ranTargetBranch = tbranch - def GetranTargetBranch(self): - return self.ranTargetBranch def SethtmlUEConnected(self, nbUEs): self.htmlUEConnected = nbUEs - def SethtmlNb_Smartphones(self, nbUEs): self.htmlNb_Smartphones = nbUEs - def SethtmlNb_CATM_Modules(self, nbUEs): self.htmlNb_CATM_Modules = nbUEs @@ -400,29 +381,29 @@ class HTMLManagement(): elif (str(status) == 'KO'): if (processesStatus == 0): self.htmlFile.write(' ' + str(status) + '\n') - elif (processesStatus == ENB_PROCESS_FAILED): + elif (processesStatus == CONST.ENB_PROCESS_FAILED): self.htmlFile.write(' KO - eNB process not found\n') - elif (processesStatus == OAI_UE_PROCESS_FAILED): + elif (processesStatus == CONST.OAI_UE_PROCESS_FAILED): self.htmlFile.write(' KO - OAI UE process not found\n') - elif (processesStatus == ENB_PROCESS_SEG_FAULT) or (processesStatus == OAI_UE_PROCESS_SEG_FAULT): + elif (processesStatus == CONST.ENB_PROCESS_SEG_FAULT) or (processesStatus == CONST.OAI_UE_PROCESS_SEG_FAULT): self.htmlFile.write(' KO - ' + machine + ' process ended in Segmentation Fault\n') - elif (processesStatus == ENB_PROCESS_ASSERTION) or (processesStatus == OAI_UE_PROCESS_ASSERTION): + elif (processesStatus == CONST.ENB_PROCESS_ASSERTION) or (processesStatus == CONST.OAI_UE_PROCESS_ASSERTION): self.htmlFile.write(' KO - ' + machine + ' process ended in Assertion\n') - elif (processesStatus == ENB_PROCESS_REALTIME_ISSUE): + elif (processesStatus == CONST.ENB_PROCESS_REALTIME_ISSUE): self.htmlFile.write(' KO - ' + machine + ' process faced Real Time issue(s)\n') - elif (processesStatus == ENB_PROCESS_NOLOGFILE_TO_ANALYZE) or (processesStatus == OAI_UE_PROCESS_NOLOGFILE_TO_ANALYZE): + elif (processesStatus == CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE) or (processesStatus == CONST.OAI_UE_PROCESS_NOLOGFILE_TO_ANALYZE): self.htmlFile.write(' OK?\n') - elif (processesStatus == ENB_PROCESS_SLAVE_RRU_NOT_SYNCED): + elif (processesStatus == CONST.ENB_PROCESS_SLAVE_RRU_NOT_SYNCED): self.htmlFile.write(' KO - ' + machine + ' Slave RRU could not synch\n') - elif (processesStatus == OAI_UE_PROCESS_COULD_NOT_SYNC): + elif (processesStatus == CONST.OAI_UE_PROCESS_COULD_NOT_SYNC): self.htmlFile.write(' KO - UE could not sync\n') - elif (processesStatus == HSS_PROCESS_FAILED): + elif (processesStatus == CONST.HSS_PROCESS_FAILED): self.htmlFile.write(' KO - HSS process not found\n') - elif (processesStatus == MME_PROCESS_FAILED): + elif (processesStatus == CONST.MME_PROCESS_FAILED): self.htmlFile.write(' KO - MME process not found\n') - elif (processesStatus == SPGW_PROCESS_FAILED): + elif (processesStatus == CONST.SPGW_PROCESS_FAILED): self.htmlFile.write(' KO - SPGW process not found\n') - elif (processesStatus == UE_IP_ADDRESS_ISSUE): + elif (processesStatus == CONST.UE_IP_ADDRESS_ISSUE): self.htmlFile.write(' KO - Could not retrieve UE IP address\n') else: self.htmlFile.write(' ' + str(status) + '\n') @@ -491,4 +472,3 @@ class HTMLManagement(): self.htmlFile.write(' \n') self.htmlFile.close() - diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 5a9836f474..6aeefdef54 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -104,8 +104,6 @@ class OaiCiTest(): self.Initialize_OAI_UE_args = '' self.clean_repository = True self.expectedNbOfConnectedUEs = 0 - self.startTime = 0 - def BuildOAIUE(self): if self.UEIPAddress == '' or RAN.GetranRepository() == '' or RAN.GetranBranch() == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '': @@ -1901,7 +1899,6 @@ class OaiCiTest(): def Iperf_common(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue): try: - logging.debug('entring Iperf_common') # Single-UE profile -- iperf only on one UE if self.iperf_profile == 'single-ue' and idx != 0: return @@ -2239,7 +2236,6 @@ class OaiCiTest(): ue_num = len(self.UEIPAddresses) lock = Lock() status_queue = SimpleQueue() - logging.debug('ue_num = ' + str(ue_num)) for UE_IPAddress in self.UEIPAddresses: device_id = self.UEDevices[i] p = Process(target = self.Iperf_common, args = (lock,UE_IPAddress,device_id,i,ue_num,status_queue,)) @@ -3559,8 +3555,7 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re CiTestObj.FailReportCnt = 0 RAN.SetprematureExit(True) - CiTestObj.startTime = int(round(time.time() * 1000)) - HTML.SetstartTime(CiTestObj.startTime) + HTML.SetstartTime(int(round(time.time() * 1000)) while CiTestObj.FailReportCnt < CiTestObj.repeatCounts[0] and RAN.GetprematureExit(): RAN.SetprematureExit(False) # At every iteratin of the retry loop, a separator will be added diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index 7efe96dc2e..917410b8ae 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -1,4 +1,4 @@ - +#/* # * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more # * contributor license agreements. See the NOTICE file distributed with # * this work for additional information regarding copyright ownership. @@ -28,7 +28,6 @@ # pexpect #--------------------------------------------------------------------- - #----------------------------------------------------------- # Import #----------------------------------------------------------- @@ -233,8 +232,6 @@ class RANManagement(): # RAN management functions #----------------------------------------------------------- - - def BuildeNB(self): if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '': GenericHelp(Version) @@ -347,8 +344,6 @@ class RANManagement(): mySSH.close() self.checkBuildeNB(lIpAddr, lUserName, lPassWord, lSourcePath, self.testCase_id) - - def WaitBuildeNBisFinished(self): if self.eNB_serverId == '0': lIpAddr = self.eNBIPAddress @@ -444,7 +439,6 @@ class RANManagement(): self.htmlObj.CreateHtmlTabFooter(False) sys.exit(1) - def InitializeeNB(self): if self.eNB_serverId == '0': lIpAddr = self.eNBIPAddress @@ -638,8 +632,6 @@ class RANManagement(): self.htmlObj.CreateHtmlTestRow('-O ' + config_file + extra_options, 'OK', CONST.ALL_PROCESSES_OK) logging.debug('\u001B[1m Initialize eNB Completed\u001B[0m') - - def CheckeNBProcess(self, status_queue): try: # At least the instance 0 SHALL be on! @@ -672,8 +664,6 @@ class RANManagement(): except: os.kill(os.getppid(),signal.SIGUSR1) - - def TerminateeNB(self): if self.eNB_serverId == '0': lIpAddr = self.eNBIPAddress @@ -780,7 +770,6 @@ class RANManagement(): self.eNBmbmsEnables[int(self.eNB_instance)] = False self.eNBstatuses[int(self.eNB_instance)] = -1 - def LogCollecteNB(self): mySSH = SSH.SSHConnection() mySSH.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) @@ -791,7 +780,6 @@ class RANManagement(): mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap enb_*txt', '\$', 5) mySSH.close() - def AnalyzeLogFile_eNB(self, eNBlogFile): if (not os.path.isfile('./' + eNBlogFile)): return -1 @@ -1043,7 +1031,7 @@ class RANManagement(): if foundRealTimeIssue: logging.debug('\u001B[1;37;41m ' + nodeB_prefix + 'NB faced real time issues! \u001B[0m') htmleNBFailureMsg += nodeB_prefix + 'NB faced real time issues!\n' - #return ENB_PROCESS_REALTIME_ISSUE + #return CONST.ENB_PROCESS_REALTIME_ISSUE if rlcDiscardBuffer > 0: rlcMsg = nodeB_prefix + 'NB RLC discarded ' + str(rlcDiscardBuffer) + ' buffer(s)' logging.debug('\u001B[1;37;41m ' + rlcMsg + ' \u001B[0m') diff --git a/ci-scripts/sshconnection.py b/ci-scripts/sshconnection.py index 6fad5065e2..cdd062f846 100644 --- a/ci-scripts/sshconnection.py +++ b/ci-scripts/sshconnection.py @@ -1,4 +1,4 @@ - +#/* # * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more # * contributor license agreements. See the NOTICE file distributed with # * this work for additional information regarding copyright ownership. @@ -28,7 +28,6 @@ # pexpect #--------------------------------------------------------------------- - #----------------------------------------------------------- # Import #----------------------------------------------------------- @@ -36,6 +35,7 @@ import pexpect # pexpect import logging import time # sleep import re + #----------------------------------------------------------- # Class Declaration #----------------------------------------------------------- @@ -89,7 +89,6 @@ class SSHConnection(): else: sys.exit('SSH Connection Failed') - def command(self, commandline, expectedline, timeout): logging.debug(commandline) self.ssh.timeout = timeout