Commit e3f107fc authored by Raphael Defosseux's avatar Raphael Defosseux

[CI] python code clean

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 3c16caec
...@@ -42,10 +42,8 @@ from multiprocessing import Process, Lock, SimpleQueue ...@@ -42,10 +42,8 @@ from multiprocessing import Process, Lock, SimpleQueue
# OAI Testing modules # OAI Testing modules
#----------------------------------------------------------- #-----------------------------------------------------------
import sshconnection as SSH import sshconnection as SSH
import epc
import helpreadme as HELP import helpreadme as HELP
import constants as CONST import constants as CONST
import html
#----------------------------------------------------------- #-----------------------------------------------------------
# Class Declaration # Class Declaration
...@@ -82,15 +80,12 @@ class Containerize(): ...@@ -82,15 +80,12 @@ class Containerize():
self.flexranCtrlDeployed = False self.flexranCtrlDeployed = False
self.flexranCtrlIpAddress = '' self.flexranCtrlIpAddress = ''
self.htmlObj = None
self.epcObj = None
self.ranObj = None
#----------------------------------------------------------- #-----------------------------------------------------------
# Container management functions # Container management functions
#----------------------------------------------------------- #-----------------------------------------------------------
def BuildImage(self): def BuildImage(self, HTML):
if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '': if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '':
HELP.GenericHelp(CONST.Version) HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter') sys.exit('Insufficient Parameter')
...@@ -137,10 +132,7 @@ class Containerize(): ...@@ -137,10 +132,7 @@ class Containerize():
# Workaround for some servers, we need to erase completely the workspace # Workaround for some servers, we need to erase completely the workspace
if self.forcedWorkspaceCleanup: if self.forcedWorkspaceCleanup:
mySSH.command('echo ' + lPassWord + ' | sudo -S rm -Rf ' + lSourcePath, '\$', 15) mySSH.command('echo ' + lPassWord + ' | sudo -S rm -Rf ' + lSourcePath, '\$', 15)
if self.htmlObj is not None: self.testCase_id = HTML.testCase_id
self.testCase_id = self.htmlObj.testCase_id
else:
self.testCase_id = '000000'
# on RedHat/CentOS .git extension is mandatory # on RedHat/CentOS .git extension is mandatory
result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository) result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository)
if result is not None: if result is not None:
...@@ -239,9 +231,8 @@ class Containerize(): ...@@ -239,9 +231,8 @@ class Containerize():
if not status: if not status:
mySSH.close() mySSH.close()
logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') logging.error('\u001B[1m Building OAI Images Failed\u001B[0m')
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTabFooter(False)
self.htmlObj.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
# Recover build logs, for the moment only possible when build is successful # Recover build logs, for the moment only possible when build is successful
...@@ -261,10 +252,9 @@ class Containerize(): ...@@ -261,10 +252,9 @@ class Containerize():
mySSH.close() mySSH.close()
logging.info('\u001B[1m Building OAI Image(s) Pass\u001B[0m') logging.info('\u001B[1m Building OAI Image(s) Pass\u001B[0m')
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.imageKind, 'OK', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow(self.imageKind, 'OK', CONST.ALL_PROCESSES_OK)
def DeployObject(self): def DeployObject(self, HTML, EPC):
if self.eNB_serverId[self.eNB_instance] == '0': if self.eNB_serverId[self.eNB_instance] == '0':
lIpAddr = self.eNBIPAddress lIpAddr = self.eNBIPAddress
lUserName = self.eNBUserName lUserName = self.eNBUserName
...@@ -299,8 +289,7 @@ class Containerize(): ...@@ -299,8 +289,7 @@ class Containerize():
if (self.ranAllowMerge): if (self.ranAllowMerge):
imageTag = 'ci-temp' imageTag = 'ci-temp'
mySSH.command('sed -i -e "s/image: oai-enb:latest/image: oai-enb:' + imageTag + '/" ci-docker-compose.yml', '\$', 2) mySSH.command('sed -i -e "s/image: oai-enb:latest/image: oai-enb:' + imageTag + '/" ci-docker-compose.yml', '\$', 2)
if self.epcObj is not None: localMmeIpAddr = EPC.MmeIPAddress
localMmeIpAddr = self.epcObj.MmeIPAddress
mySSH.command('sed -i -e "s/CI_MME_IP_ADDR/' + localMmeIpAddr + '/" ci-docker-compose.yml', '\$', 2) mySSH.command('sed -i -e "s/CI_MME_IP_ADDR/' + localMmeIpAddr + '/" ci-docker-compose.yml', '\$', 2)
if self.flexranCtrlDeployed: if self.flexranCtrlDeployed:
mySSH.command('sed -i -e \'s/FLEXRAN_ENABLED:.*/FLEXRAN_ENABLED: "yes"/\' ci-docker-compose.yml', '\$', 2) mySSH.command('sed -i -e \'s/FLEXRAN_ENABLED:.*/FLEXRAN_ENABLED: "yes"/\' ci-docker-compose.yml', '\$', 2)
...@@ -356,19 +345,15 @@ class Containerize(): ...@@ -356,19 +345,15 @@ class Containerize():
time.sleep(10) time.sleep(10)
mySSH.close() mySSH.close()
if self.htmlObj is not None: self.testCase_id = HTML.testCase_id
self.testCase_id = self.htmlObj.testCase_id
else:
self.testCase_id = '000000'
self.eNB_logFile[self.eNB_instance] = 'enb_' + self.testCase_id + '.log' self.eNB_logFile[self.eNB_instance] = 'enb_' + self.testCase_id + '.log'
if self.htmlObj is not None:
if status: if status:
self.htmlObj.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
else: else:
self.htmlObj.CreateHtmlTestRow('N/A', 'KO', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ALL_PROCESSES_OK)
def UndeployObject(self): def UndeployObject(self, HTML, RAN):
logging.info('\u001B[1m Undeploying OAI Object Pass\u001B[0m') logging.info('\u001B[1m Undeploying OAI Object Pass\u001B[0m')
if self.eNB_serverId[self.eNB_instance] == '0': if self.eNB_serverId[self.eNB_instance] == '0':
lIpAddr = self.eNBIPAddress lIpAddr = self.eNBIPAddress
...@@ -410,20 +395,16 @@ class Containerize(): ...@@ -410,20 +395,16 @@ class Containerize():
mySSH.close() mySSH.close()
# Analyzing log file! # Analyzing log file!
if self.ranObj is not None:
copyin_res = mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/' + self.eNB_logFile[self.eNB_instance], '.') copyin_res = mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/' + self.eNB_logFile[self.eNB_instance], '.')
nodeB_prefix = 'e' nodeB_prefix = 'e'
if (copyin_res == -1): if (copyin_res == -1):
if self.htmlObj is not None: HTML.htmleNBFailureMsg='Could not copy ' + nodeB_prefix + 'NB logfile to analyze it!'
self.htmlObj.htmleNBFailureMsg='Could not copy ' + nodeB_prefix + 'NB logfile to analyze it!' HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE)
self.htmlObj.CreateHtmlTestRow('N/A', 'KO', CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE)
else: else:
logging.debug('\u001B[1m Analyzing ' + nodeB_prefix + 'NB logfile \u001B[0m ' + self.eNB_logFile[self.eNB_instance]) logging.debug('\u001B[1m Analyzing ' + nodeB_prefix + 'NB logfile \u001B[0m ' + self.eNB_logFile[self.eNB_instance])
logStatus = self.ranObj.AnalyzeLogFile_eNB(self.eNB_logFile[self.eNB_instance]) logStatus = RAN.AnalyzeLogFile_eNB(self.eNB_logFile[self.eNB_instance], HTML)
if (logStatus < 0): if (logStatus < 0):
if self.htmlObj is not None: HTML.CreateHtmlTestRow(RAN.runtime_stats, 'KO', logStatus)
self.htmlObj.CreateHtmlTestRow(self.ranObj.runtime_stats, 'KO', logStatus)
else: else:
if self.htmlObj is not None: HTML.CreateHtmlTestRow(RAN.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow(self.ranObj.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
...@@ -558,7 +558,7 @@ class OaiCiTest(): ...@@ -558,7 +558,7 @@ class OaiCiTest():
HTML.htmlUEFailureMsg='nr-uesoftmodem did NOT synced' HTML.htmlUEFailureMsg='nr-uesoftmodem did NOT synced'
HTML.CreateHtmlTestRow(self.air_interface + ' ' + self.Initialize_OAI_UE_args, 'KO', CONST.OAI_UE_PROCESS_COULD_NOT_SYNC, 'OAI UE') HTML.CreateHtmlTestRow(self.air_interface + ' ' + self.Initialize_OAI_UE_args, 'KO', CONST.OAI_UE_PROCESS_COULD_NOT_SYNC, 'OAI UE')
logging.error('\033[91mInitialize OAI UE Failed! \033[0m') logging.error('\033[91mInitialize OAI UE Failed! \033[0m')
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
def checkDevTTYisUnlocked(self): def checkDevTTYisUnlocked(self):
SSH = sshconnection.SSHConnection() SSH = sshconnection.SSHConnection()
...@@ -636,7 +636,7 @@ class OaiCiTest(): ...@@ -636,7 +636,7 @@ class OaiCiTest():
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
self.checkDevTTYisUnlocked() self.checkDevTTYisUnlocked()
def AttachCatM(self,HTML,RAN,COTS_UE): def AttachCatM(self,HTML,RAN,COTS_UE,EPC):
if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '': if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '':
HELP.GenericHelp(CONST.Version) HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter') sys.exit('Insufficient Parameter')
...@@ -709,9 +709,9 @@ class OaiCiTest(): ...@@ -709,9 +709,9 @@ class OaiCiTest():
html_cell = '<pre style="background-color:white">CAT-M module Attachment Failed</pre>' html_cell = '<pre style="background-color:white">CAT-M module Attachment Failed</pre>'
html_queue.put(html_cell) html_queue.put(html_cell)
HTML.CreateHtmlTestRowQueue('N/A', 'KO', 1, html_queue) HTML.CreateHtmlTestRowQueue('N/A', 'KO', 1, html_queue)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
def PingCatM(self,HTML,RAN,EPC,COTS_UE): def PingCatM(self,HTML,RAN,EPC,COTS_UE,EPC):
if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.SourceCodePath == '': if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.SourceCodePath == '':
HELP.GenericHelp(CONST.Version) HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter') sys.exit('Insufficient Parameter')
...@@ -720,7 +720,7 @@ class OaiCiTest(): ...@@ -720,7 +720,7 @@ class OaiCiTest():
pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC) pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC)
if (pStatus < 0): if (pStatus < 0):
HTML.CreateHtmlTestRow(self.ping_args, 'KO', pStatus) HTML.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
return return
try: try:
statusQueue = SimpleQueue() statusQueue = SimpleQueue()
...@@ -741,7 +741,7 @@ class OaiCiTest(): ...@@ -741,7 +741,7 @@ class OaiCiTest():
moduleIPAddr = result.group('ipaddr') moduleIPAddr = result.group('ipaddr')
else: else:
HTML.CreateHtmlTestRow(self.ping_args, 'KO', pStatus) HTML.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
return return
ping_time = re.findall("-c (\d+)",str(self.ping_args)) ping_time = re.findall("-c (\d+)",str(self.ping_args))
device_id = 'catm' device_id = 'catm'
...@@ -805,7 +805,7 @@ class OaiCiTest(): ...@@ -805,7 +805,7 @@ class OaiCiTest():
HTML.CreateHtmlTestRowQueue(self.ping_args, 'OK', 1, statusQueue) HTML.CreateHtmlTestRowQueue(self.ping_args, 'OK', 1, statusQueue)
else: else:
HTML.CreateHtmlTestRowQueue(self.ping_args, 'KO', 1, statusQueue) HTML.CreateHtmlTestRowQueue(self.ping_args, 'KO', 1, statusQueue)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
except: except:
os.kill(os.getppid(),signal.SIGUSR1) os.kill(os.getppid(),signal.SIGUSR1)
...@@ -906,7 +906,7 @@ class OaiCiTest(): ...@@ -906,7 +906,7 @@ class OaiCiTest():
pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC) pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC)
if (pStatus < 0): if (pStatus < 0):
HTML.CreateHtmlTestRow('N/A', 'KO', pStatus) HTML.CreateHtmlTestRow('N/A', 'KO', pStatus)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
return return
multi_jobs = [] multi_jobs = []
status_queue = SimpleQueue() status_queue = SimpleQueue()
...@@ -925,7 +925,7 @@ class OaiCiTest(): ...@@ -925,7 +925,7 @@ class OaiCiTest():
if (status_queue.empty()): if (status_queue.empty()):
HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ALL_PROCESSES_OK)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
return return
else: else:
attach_status = True attach_status = True
...@@ -954,7 +954,7 @@ class OaiCiTest(): ...@@ -954,7 +954,7 @@ class OaiCiTest():
time.sleep(5) time.sleep(5)
else: else:
HTML.CreateHtmlTestRowQueue('N/A', 'KO', len(self.UEDevices), html_queue) HTML.CreateHtmlTestRowQueue('N/A', 'KO', len(self.UEDevices), html_queue)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
def DetachUE_common(self, device_id, idx,COTS_UE): def DetachUE_common(self, device_id, idx,COTS_UE):
try: try:
...@@ -987,7 +987,7 @@ class OaiCiTest(): ...@@ -987,7 +987,7 @@ class OaiCiTest():
pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC) pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC)
if (pStatus < 0): if (pStatus < 0):
HTML.CreateHtmlTestRow('N/A', 'KO', pStatus) HTML.CreateHtmlTestRow('N/A', 'KO', pStatus)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
return return
multi_jobs = [] multi_jobs = []
cnt = 0 cnt = 0
...@@ -1302,7 +1302,7 @@ class OaiCiTest(): ...@@ -1302,7 +1302,7 @@ class OaiCiTest():
if (status_queue.empty()): if (status_queue.empty()):
HTML.CreateHtmlTestRow(htmlOptions, 'KO', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRow(htmlOptions, 'KO', CONST.ALL_PROCESSES_OK)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
else: else:
check_status = True check_status = True
html_queue = SimpleQueue() html_queue = SimpleQueue()
...@@ -1318,7 +1318,7 @@ class OaiCiTest(): ...@@ -1318,7 +1318,7 @@ class OaiCiTest():
HTML.CreateHtmlTestRowQueue(htmlOptions, 'OK', len(self.UEDevices), html_queue) HTML.CreateHtmlTestRowQueue(htmlOptions, 'OK', len(self.UEDevices), html_queue)
else: else:
HTML.CreateHtmlTestRowQueue(htmlOptions, 'KO', len(self.UEDevices), html_queue) HTML.CreateHtmlTestRowQueue(htmlOptions, 'KO', len(self.UEDevices), html_queue)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
def GetAllUEIPAddresses(self): def GetAllUEIPAddresses(self):
SSH = sshconnection.SSHConnection() SSH = sshconnection.SSHConnection()
...@@ -1496,7 +1496,7 @@ class OaiCiTest(): ...@@ -1496,7 +1496,7 @@ class OaiCiTest():
pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC) pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC)
if (pStatus < 0): if (pStatus < 0):
HTML.CreateHtmlTestRow(self.ping_args, 'KO', pStatus) HTML.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
return return
ping_from_eNB = re.search('oaitun_enb1', str(self.ping_args)) ping_from_eNB = re.search('oaitun_enb1', str(self.ping_args))
if ping_from_eNB is not None: if ping_from_eNB is not None:
...@@ -1598,12 +1598,12 @@ class OaiCiTest(): ...@@ -1598,12 +1598,12 @@ class OaiCiTest():
pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC) pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC)
if (pStatus < 0): if (pStatus < 0):
HTML.CreateHtmlTestRow(self.ping_args, 'KO', pStatus) HTML.CreateHtmlTestRow(self.ping_args, 'KO', pStatus)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
return return
ueIpStatus = self.GetAllUEIPAddresses() ueIpStatus = self.GetAllUEIPAddresses()
if (ueIpStatus < 0): if (ueIpStatus < 0):
HTML.CreateHtmlTestRow(self.ping_args, 'KO', CONST.UE_IP_ADDRESS_ISSUE) HTML.CreateHtmlTestRow(self.ping_args, 'KO', CONST.UE_IP_ADDRESS_ISSUE)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
return return
multi_jobs = [] multi_jobs = []
i = 0 i = 0
...@@ -1621,7 +1621,7 @@ class OaiCiTest(): ...@@ -1621,7 +1621,7 @@ class OaiCiTest():
if (status_queue.empty()): if (status_queue.empty()):
HTML.CreateHtmlTestRow(self.ping_args, 'KO', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRow(self.ping_args, 'KO', CONST.ALL_PROCESSES_OK)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
else: else:
ping_status = True ping_status = True
html_queue = SimpleQueue() html_queue = SimpleQueue()
...@@ -1638,7 +1638,7 @@ class OaiCiTest(): ...@@ -1638,7 +1638,7 @@ class OaiCiTest():
HTML.CreateHtmlTestRowQueue(self.ping_args, 'OK', len(self.UEDevices), html_queue) HTML.CreateHtmlTestRowQueue(self.ping_args, 'OK', len(self.UEDevices), html_queue)
else: else:
HTML.CreateHtmlTestRowQueue(self.ping_args, 'KO', len(self.UEDevices), html_queue) HTML.CreateHtmlTestRowQueue(self.ping_args, 'KO', len(self.UEDevices), html_queue)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
def Iperf_ComputeTime(self): def Iperf_ComputeTime(self):
result = re.search('-t (?P<iperf_time>\d+)', str(self.iperf_args)) result = re.search('-t (?P<iperf_time>\d+)', str(self.iperf_args))
...@@ -2279,7 +2279,7 @@ class OaiCiTest(): ...@@ -2279,7 +2279,7 @@ class OaiCiTest():
pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC) pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC)
if (pStatus < 0): if (pStatus < 0):
HTML.CreateHtmlTestRow(self.iperf_args, 'KO', pStatus) HTML.CreateHtmlTestRow(self.iperf_args, 'KO', pStatus)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
return return
server_on_enb = re.search('-R', str(self.iperf_args)) server_on_enb = re.search('-R', str(self.iperf_args))
if server_on_enb is not None: if server_on_enb is not None:
...@@ -2377,7 +2377,7 @@ class OaiCiTest(): ...@@ -2377,7 +2377,7 @@ class OaiCiTest():
HTML.CreateHtmlTestRowQueue(self.iperf_args, 'OK', len(self.UEDevices), html_queue) HTML.CreateHtmlTestRowQueue(self.iperf_args, 'OK', len(self.UEDevices), html_queue)
else: else:
HTML.CreateHtmlTestRowQueue(self.iperf_args, 'KO', len(self.UEDevices), html_queue) HTML.CreateHtmlTestRowQueue(self.iperf_args, 'KO', len(self.UEDevices), html_queue)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
def Iperf(self,HTML,RAN,EPC,COTS_UE): def Iperf(self,HTML,RAN,EPC,COTS_UE):
result = re.search('noS1', str(RAN.Initialize_eNB_args)) result = re.search('noS1', str(RAN.Initialize_eNB_args))
...@@ -2395,13 +2395,13 @@ class OaiCiTest(): ...@@ -2395,13 +2395,13 @@ class OaiCiTest():
pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC) pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC)
if (pStatus < 0): if (pStatus < 0):
HTML.CreateHtmlTestRow(self.iperf_args, 'KO', pStatus) HTML.CreateHtmlTestRow(self.iperf_args, 'KO', pStatus)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
return return
ueIpStatus = self.GetAllUEIPAddresses() ueIpStatus = self.GetAllUEIPAddresses()
if (ueIpStatus < 0): if (ueIpStatus < 0):
logging.debug('going here') logging.debug('going here')
HTML.CreateHtmlTestRow(self.iperf_args, 'KO', CONST.UE_IP_ADDRESS_ISSUE) HTML.CreateHtmlTestRow(self.iperf_args, 'KO', CONST.UE_IP_ADDRESS_ISSUE)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
return return
self.dummyIperfVersion = '2.0.10' self.dummyIperfVersion = '2.0.10'
...@@ -2432,7 +2432,7 @@ class OaiCiTest(): ...@@ -2432,7 +2432,7 @@ class OaiCiTest():
if (status_queue.empty()): if (status_queue.empty()):
HTML.CreateHtmlTestRow(self.iperf_args, 'KO', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRow(self.iperf_args, 'KO', CONST.ALL_PROCESSES_OK)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
else: else:
iperf_status = True iperf_status = True
iperf_noperf = False iperf_noperf = False
...@@ -2454,7 +2454,7 @@ class OaiCiTest(): ...@@ -2454,7 +2454,7 @@ class OaiCiTest():
HTML.CreateHtmlTestRowQueue(self.iperf_args, 'OK', len(self.UEDevices), html_queue) HTML.CreateHtmlTestRowQueue(self.iperf_args, 'OK', len(self.UEDevices), html_queue)
else: else:
HTML.CreateHtmlTestRowQueue(self.iperf_args, 'KO', len(self.UEDevices), html_queue) HTML.CreateHtmlTestRowQueue(self.iperf_args, 'KO', len(self.UEDevices), html_queue)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
def CheckProcessExist(self, check_eNB, check_OAI_UE,RAN,EPC): def CheckProcessExist(self, check_eNB, check_OAI_UE,RAN,EPC):
multi_jobs = [] multi_jobs = []
...@@ -2915,11 +2915,11 @@ class OaiCiTest(): ...@@ -2915,11 +2915,11 @@ class OaiCiTest():
# Not an error then # Not an error then
if (logStatus != CONST.OAI_UE_PROCESS_COULD_NOT_SYNC) or (ueAction != 'Sniffing'): if (logStatus != CONST.OAI_UE_PROCESS_COULD_NOT_SYNC) or (ueAction != 'Sniffing'):
self.Initialize_OAI_UE_args = '' self.Initialize_OAI_UE_args = ''
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
else: else:
if (logStatus == CONST.OAI_UE_PROCESS_COULD_NOT_SYNC): if (logStatus == CONST.OAI_UE_PROCESS_COULD_NOT_SYNC):
self.Initialize_OAI_UE_args = '' self.Initialize_OAI_UE_args = ''
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC)
else: else:
logging.debug('\u001B[1m' + ueAction + ' Completed \u001B[0m') logging.debug('\u001B[1m' + ueAction + ' Completed \u001B[0m')
HTML.htmlUEFailureMsg='<b>' + ueAction + ' Completed</b>\n' + HTML.htmlUEFailureMsg HTML.htmlUEFailureMsg='<b>' + ueAction + ' Completed</b>\n' + HTML.htmlUEFailureMsg
...@@ -2928,7 +2928,7 @@ class OaiCiTest(): ...@@ -2928,7 +2928,7 @@ class OaiCiTest():
else: else:
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
def AutoTerminateUEandeNB(self,HTML,RAN,COTS_UE): def AutoTerminateUEandeNB(self,HTML,RAN,COTS_UE,EPC):
if (self.ADBIPAddress != 'none'): if (self.ADBIPAddress != 'none'):
self.testCase_id = 'AUTO-KILL-UE' self.testCase_id = 'AUTO-KILL-UE'
HTML.testCase_id=self.testCase_id HTML.testCase_id=self.testCase_id
...@@ -2954,7 +2954,7 @@ class OaiCiTest(): ...@@ -2954,7 +2954,7 @@ class OaiCiTest():
if RAN.air_interface[instance]!='': if RAN.air_interface[instance]!='':
logging.debug('Auto Termination of Instance ' + str(instance) + ' : ' + RAN.air_interface[instance]) logging.debug('Auto Termination of Instance ' + str(instance) + ' : ' + RAN.air_interface[instance])
RAN.eNB_instance=instance RAN.eNB_instance=instance
RAN.TerminateeNB() RAN.TerminateeNB(HTML,EPC)
if RAN.flexranCtrlInstalled and RAN.flexranCtrlStarted: if RAN.flexranCtrlInstalled and RAN.flexranCtrlStarted:
self.testCase_id = 'AUTO-KILL-flexran-ctl' self.testCase_id = 'AUTO-KILL-flexran-ctl'
HTML.testCase_id=self.testCase_id HTML.testCase_id=self.testCase_id
......
...@@ -46,7 +46,6 @@ from multiprocessing import Process, Lock, SimpleQueue ...@@ -46,7 +46,6 @@ from multiprocessing import Process, Lock, SimpleQueue
import sshconnection as SSH import sshconnection as SSH
import helpreadme as HELP import helpreadme as HELP
import constants as CONST import constants as CONST
import html
#----------------------------------------------------------- #-----------------------------------------------------------
# Class Declaration # Class Declaration
...@@ -61,7 +60,6 @@ class EPCManagement(): ...@@ -61,7 +60,6 @@ class EPCManagement():
self.SourceCodePath = '' self.SourceCodePath = ''
self.Type = '' self.Type = ''
self.PcapFileName = '' self.PcapFileName = ''
self.htmlObj = None
self.testCase_id = '' self.testCase_id = ''
self.MmeIPAddress = '' self.MmeIPAddress = ''
self.containerPrefix = 'prod' self.containerPrefix = 'prod'
...@@ -73,7 +71,7 @@ class EPCManagement(): ...@@ -73,7 +71,7 @@ class EPCManagement():
# EPC management functions # EPC management functions
#----------------------------------------------------------- #-----------------------------------------------------------
def InitializeHSS(self): def InitializeHSS(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 == '':
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)
...@@ -115,10 +113,9 @@ class EPCManagement(): ...@@ -115,10 +113,9 @@ class EPCManagement():
else: else:
logging.error('This option should not occur!') logging.error('This option should not occur!')
mySSH.close() mySSH.close()
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
def InitializeMME(self): 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 == '':
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)
...@@ -154,8 +151,7 @@ class EPCManagement(): ...@@ -154,8 +151,7 @@ class EPCManagement():
else: else:
logging.error('This option should not occur!') logging.error('This option should not occur!')
mySSH.close() mySSH.close()
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
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
...@@ -176,7 +172,7 @@ class EPCManagement(): ...@@ -176,7 +172,7 @@ class EPCManagement():
else: else:
self.MmeIPAddress = self.IPAddress self.MmeIPAddress = self.IPAddress
def InitializeSPGW(self): def InitializeSPGW(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 == '':
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)
...@@ -213,8 +209,7 @@ class EPCManagement(): ...@@ -213,8 +209,7 @@ class EPCManagement():
else: else:
logging.error('This option should not occur!') logging.error('This option should not occur!')
mySSH.close() mySSH.close()
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
def CheckHSSProcess(self, status_queue): def CheckHSSProcess(self, status_queue):
try: try:
...@@ -298,7 +293,7 @@ class EPCManagement(): ...@@ -298,7 +293,7 @@ class EPCManagement():
except: except:
os.kill(os.getppid(),signal.SIGUSR1) os.kill(os.getppid(),signal.SIGUSR1)
def TerminateHSS(self): def TerminateHSS(self, HTML):
mySSH = SSH.SSHConnection() mySSH = SSH.SSHConnection()
mySSH.open(self.IPAddress, self.UserName, self.Password) mySSH.open(self.IPAddress, self.UserName, self.Password)
if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
...@@ -331,10 +326,9 @@ class EPCManagement(): ...@@ -331,10 +326,9 @@ class EPCManagement():
else: else:
logging.error('This should not happen!') logging.error('This should not happen!')
mySSH.close() mySSH.close()
if self.htmlObj is not None: HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
def TerminateMME(self): def TerminateMME(self, HTML):
mySSH = SSH.SSHConnection() mySSH = SSH.SSHConnection()
mySSH.open(self.IPAddress, self.UserName, self.Password) mySSH.open(self.IPAddress, self.UserName, self.Password)
if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
...@@ -358,10 +352,9 @@ class EPCManagement(): ...@@ -358,10 +352,9 @@ class EPCManagement():
else: else:
logging.error('This should not happen!') logging.error('This should not happen!')
mySSH.close() mySSH.close()
if self.htmlObj is not None: HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
def TerminateSPGW(self): def TerminateSPGW(self, HTML):
mySSH = SSH.SSHConnection() mySSH = SSH.SSHConnection()
mySSH.open(self.IPAddress, self.UserName, self.Password) mySSH.open(self.IPAddress, self.UserName, self.Password)
if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
...@@ -402,15 +395,13 @@ class EPCManagement(): ...@@ -402,15 +395,13 @@ class EPCManagement():
else: else:
logging.error('This should not happen!') logging.error('This should not happen!')
mySSH.close() mySSH.close()
if self.htmlObj is not None: HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
def DeployEpc(self): 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):
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER)
self.htmlObj.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER) HTML.CreateHtmlTabFooter(False)
self.htmlObj.CreateHtmlTabFooter(False)
sys.exit('Deploy not possible with this EPC type: ' + self.Type) sys.exit('Deploy not possible with this EPC type: ' + self.Type)
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 == '':
...@@ -423,9 +414,8 @@ class EPCManagement(): ...@@ -423,9 +414,8 @@ class EPCManagement():
result = re.search('docker-compose version 1', mySSH.getBefore()) result = re.search('docker-compose version 1', mySSH.getBefore())
if result is None: if result is None:
mySSH.close() mySSH.close()
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER)
self.htmlObj.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER) HTML.CreateHtmlTabFooter(False)
self.htmlObj.CreateHtmlTabFooter(False)
sys.exit('docker-compose not installed on ' + self.IPAddress) sys.exit('docker-compose not installed on ' + self.IPAddress)
mySSH.command('if [ -d ' + self.SourceCodePath + '/scripts ]; then echo ' + self.Password + ' | sudo -S rm -Rf ' + self.SourceCodePath + '/scripts ; fi', '\$', 5) mySSH.command('if [ -d ' + self.SourceCodePath + '/scripts ]; then echo ' + self.Password + ' | sudo -S rm -Rf ' + self.SourceCodePath + '/scripts ; fi', '\$', 5)
...@@ -458,9 +448,8 @@ class EPCManagement(): ...@@ -458,9 +448,8 @@ class EPCManagement():
cnt += 1 cnt += 1
mySSH.command('docker rm -f prod-db-init', '\$', 5) mySSH.command('docker rm -f prod-db-init', '\$', 5)
if not db_init_status: if not db_init_status:
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER)
self.htmlObj.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER) HTML.CreateHtmlTabFooter(False)
self.htmlObj.CreateHtmlTabFooter(False)
sys.exit('Cassandra DB deployment/configuration went wrong!') sys.exit('Cassandra DB deployment/configuration went wrong!')
# deploying EPC cNFs # deploying EPC cNFs
...@@ -503,13 +492,13 @@ class EPCManagement(): ...@@ -503,13 +492,13 @@ class EPCManagement():
mySSH.command('docker exec -d prod-oai-spgwu-tiny /bin/bash -c "nohup tshark -i any -f \'port 8805\' -w /tmp/spgwu_check_run.pcap 2>&1 > /dev/null"', '\$', 10) mySSH.command('docker exec -d prod-oai-spgwu-tiny /bin/bash -c "nohup tshark -i any -f \'port 8805\' -w /tmp/spgwu_check_run.pcap 2>&1 > /dev/null"', '\$', 10)
mySSH.close() mySSH.close()
logging.debug('Deployment OK') logging.debug('Deployment OK')
self.htmlObj.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
else: else:
mySSH.close() mySSH.close()
logging.debug('Deployment went wrong') logging.debug('Deployment went wrong')
self.htmlObj.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER) HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER)
def UndeployEpc(self): def UndeployEpc(self, HTML):
logging.debug('Trying to undeploy') logging.debug('Trying to undeploy')
# No check down, we suppose everything done before. # No check down, we suppose everything done before.
...@@ -551,10 +540,10 @@ class EPCManagement(): ...@@ -551,10 +540,10 @@ class EPCManagement():
mySSH.close() mySSH.close()
if noMoreContainerNb == nbContainers and noMoreNetworkNb == 2: if noMoreContainerNb == nbContainers and noMoreNetworkNb == 2:
logging.debug('Undeployment OK') logging.debug('Undeployment OK')
self.htmlObj.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
else: else:
logging.debug('Undeployment went wrong') logging.debug('Undeployment went wrong')
self.htmlObj.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER) HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER)
def LogCollectHSS(self): def LogCollectHSS(self):
mySSH = SSH.SSHConnection() mySSH = SSH.SSHConnection()
......
...@@ -379,14 +379,6 @@ RAN = ran.RANManagement() ...@@ -379,14 +379,6 @@ RAN = ran.RANManagement()
HTML = html.HTMLManagement() HTML = html.HTMLManagement()
CONTAINERS = cls_containerize.Containerize() CONTAINERS = cls_containerize.Containerize()
EPC.htmlObj=HTML
RAN.htmlObj=HTML
RAN.epcObj=EPC
CONTAINERS.htmlObj=HTML
CONTAINERS.epcObj=EPC
CONTAINERS.ranObj=RAN
ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU build ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU build
...@@ -668,17 +660,16 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re ...@@ -668,17 +660,16 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
RAN.prematureExit = True RAN.prematureExit = True
break break
if action == 'Build_eNB': if action == 'Build_eNB':
RAN.BuildeNB() RAN.BuildeNB(HTML)
elif action == 'WaitEndBuild_eNB': elif action == 'WaitEndBuild_eNB':
RAN.WaitBuildeNBisFinished() RAN.WaitBuildeNBisFinished(HTML)
elif action == 'Initialize_eNB': elif action == 'Initialize_eNB':
check_eNB = False check_eNB = False
check_OAI_UE = False check_OAI_UE = False
RAN.pStatus=CiTestObj.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC) RAN.pStatus=CiTestObj.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC)
RAN.InitializeeNB(HTML, EPC)
RAN.InitializeeNB()
elif action == 'Terminate_eNB': elif action == 'Terminate_eNB':
RAN.TerminateeNB() RAN.TerminateeNB(HTML, EPC)
elif action == 'Initialize_UE': elif action == 'Initialize_UE':
CiTestObj.InitializeUE(HTML,COTS_UE) CiTestObj.InitializeUE(HTML,COTS_UE)
elif action == 'Terminate_UE': elif action == 'Terminate_UE':
...@@ -698,17 +689,17 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re ...@@ -698,17 +689,17 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
elif action == 'Initialize_OAI_UE': elif action == 'Initialize_OAI_UE':
CiTestObj.InitializeOAIUE(HTML,RAN,EPC,COTS_UE) CiTestObj.InitializeOAIUE(HTML,RAN,EPC,COTS_UE)
elif action == 'Terminate_OAI_UE': elif action == 'Terminate_OAI_UE':
CiTestObj.TerminateOAIUE(HTML,RAN,COTS_UE) CiTestObj.TerminateOAIUE(HTML,RAN,COTS_UE,EPC)
elif action == 'Initialize_CatM_module': elif action == 'Initialize_CatM_module':
CiTestObj.InitializeCatM(HTML) CiTestObj.InitializeCatM(HTML)
elif action == 'Terminate_CatM_module': elif action == 'Terminate_CatM_module':
CiTestObj.TerminateCatM(HTML) CiTestObj.TerminateCatM(HTML)
elif action == 'Attach_CatM_module': elif action == 'Attach_CatM_module':
CiTestObj.AttachCatM(HTML,RAN,COTS_UE) CiTestObj.AttachCatM(HTML,RAN,COTS_UE,EPC)
elif action == 'Detach_CatM_module': elif action == 'Detach_CatM_module':
CiTestObj.TerminateCatM(HTML) CiTestObj.TerminateCatM(HTML)
elif action == 'Ping_CatM_module': elif action == 'Ping_CatM_module':
CiTestObj.PingCatM(HTML,RAN,EPC,COTS_UE) CiTestObj.PingCatM(HTML,RAN,EPC,COTS_UE,EPC)
elif action == 'Ping': elif action == 'Ping':
CiTestObj.Ping(HTML,RAN,EPC,COTS_UE) CiTestObj.Ping(HTML,RAN,EPC,COTS_UE)
elif action == 'Iperf': elif action == 'Iperf':
...@@ -716,21 +707,21 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re ...@@ -716,21 +707,21 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
elif action == 'Reboot_UE': elif action == 'Reboot_UE':
CiTestObj.RebootUE(HTML,RAN,EPC) CiTestObj.RebootUE(HTML,RAN,EPC)
elif action == 'Initialize_HSS': elif action == 'Initialize_HSS':
EPC.InitializeHSS() EPC.InitializeHSS(HTML)
elif action == 'Terminate_HSS': elif action == 'Terminate_HSS':
EPC.TerminateHSS() EPC.TerminateHSS(HTML)
elif action == 'Initialize_MME': elif action == 'Initialize_MME':
EPC.InitializeMME() EPC.InitializeMME(HTML)
elif action == 'Terminate_MME': elif action == 'Terminate_MME':
EPC.TerminateMME() EPC.TerminateMME(HTML)
elif action == 'Initialize_SPGW': elif action == 'Initialize_SPGW':
EPC.InitializeSPGW() EPC.InitializeSPGW(HTML)
elif action == 'Terminate_SPGW': elif action == 'Terminate_SPGW':
EPC.TerminateSPGW() EPC.TerminateSPGW(HTML)
elif action == 'Deploy_EPC': elif action == 'Deploy_EPC':
EPC.DeployEpc() EPC.DeployEpc(HTML)
elif action == 'Undeploy_EPC': elif action == 'Undeploy_EPC':
EPC.UndeployEpc() EPC.UndeployEpc(HTML)
elif action == 'Initialize_FlexranCtrl': elif action == 'Initialize_FlexranCtrl':
CiTestObj.InitializeFlexranCtrl(HTML,RAN,EPC) CiTestObj.InitializeFlexranCtrl(HTML,RAN,EPC)
elif action == 'Terminate_FlexranCtrl': elif action == 'Terminate_FlexranCtrl':
...@@ -745,11 +736,11 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re ...@@ -745,11 +736,11 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
elif action == 'Run_PhySim': elif action == 'Run_PhySim':
HTML=ldpc.Run_PhySim(HTML,CONST,id) HTML=ldpc.Run_PhySim(HTML,CONST,id)
elif action == 'Build_Image': elif action == 'Build_Image':
CONTAINERS.BuildImage() CONTAINERS.BuildImage(HTML)
elif action == 'Deploy_Object': elif action == 'Deploy_Object':
CONTAINERS.DeployObject() CONTAINERS.DeployObject(HTML, EPC)
elif action == 'Undeploy_Object': elif action == 'Undeploy_Object':
CONTAINERS.UndeployObject() CONTAINERS.UndeployObject(HTML, RAN)
else: else:
sys.exit('Invalid class (action) from xml') sys.exit('Invalid class (action) from xml')
if not RAN.prematureExit: if not RAN.prematureExit:
......
...@@ -42,10 +42,8 @@ from multiprocessing import Process, Lock, SimpleQueue ...@@ -42,10 +42,8 @@ from multiprocessing import Process, Lock, SimpleQueue
# OAI Testing modules # OAI Testing modules
#----------------------------------------------------------- #-----------------------------------------------------------
import sshconnection as SSH import sshconnection as SSH
import epc
import helpreadme as HELP import helpreadme as HELP
import constants as CONST import constants as CONST
import html
#----------------------------------------------------------- #-----------------------------------------------------------
# Class Declaration # Class Declaration
...@@ -91,8 +89,6 @@ class RANManagement(): ...@@ -91,8 +89,6 @@ class RANManagement():
self.flexranCtrlIpAddress = '' self.flexranCtrlIpAddress = ''
self.testCase_id = '' self.testCase_id = ''
self.epcPcapFile = '' self.epcPcapFile = ''
self.htmlObj = None
self.epcObj = None
self.runtime_stats= '' self.runtime_stats= ''
...@@ -101,7 +97,7 @@ class RANManagement(): ...@@ -101,7 +97,7 @@ class RANManagement():
# RAN management functions # RAN management functions
#----------------------------------------------------------- #-----------------------------------------------------------
def BuildeNB(self): def BuildeNB(self, HTML):
if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '': if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '':
HELP.GenericHelp(CONST.Version) HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter') sys.exit('Insufficient Parameter')
...@@ -141,10 +137,7 @@ class RANManagement(): ...@@ -141,10 +137,7 @@ class RANManagement():
# Worakround for some servers, we need to erase completely the workspace # Worakround for some servers, we need to erase completely the workspace
if self.Build_eNB_forced_workspace_cleanup: if self.Build_eNB_forced_workspace_cleanup:
mySSH.command('echo ' + lPassWord + ' | sudo -S rm -Rf ' + lSourcePath, '\$', 15) mySSH.command('echo ' + lPassWord + ' | sudo -S rm -Rf ' + lSourcePath, '\$', 15)
if self.htmlObj is not None: self.testCase_id = HTML.testCase_id
self.testCase_id = self.htmlObj.testCase_id
else:
self.testCase_id = '000000'
# on RedHat/CentOS .git extension is mandatory # on RedHat/CentOS .git extension is mandatory
result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository) result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository)
if result is not None: if result is not None:
...@@ -185,8 +178,7 @@ class RANManagement(): ...@@ -185,8 +178,7 @@ class RANManagement():
mismatch = True mismatch = True
if not mismatch: if not mismatch:
mySSH.close() mySSH.close()
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.Build_eNB_args, 'OK', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow(self.Build_eNB_args, 'OK', CONST.ALL_PROCESSES_OK)
return return
mySSH.command('echo ' + lPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30) mySSH.command('echo ' + lPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30)
...@@ -213,15 +205,14 @@ class RANManagement(): ...@@ -213,15 +205,14 @@ class RANManagement():
mySSH.command('echo ' + lPassWord + ' | sudo -S ls', '\$', 5) mySSH.command('echo ' + lPassWord + ' | sudo -S ls', '\$', 5)
mySSH.command('echo $USER; nohup sudo -E ./my-lte-softmodem-build.sh' + ' > ' + lSourcePath + '/cmake_targets/compile_oai_enb.log ' + ' 2>&1 &', lUserName, 5) mySSH.command('echo $USER; nohup sudo -E ./my-lte-softmodem-build.sh' + ' > ' + lSourcePath + '/cmake_targets/compile_oai_enb.log ' + ' 2>&1 &', lUserName, 5)
mySSH.close() mySSH.close()
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.Build_eNB_args, 'OK', CONST.ALL_PROCESSES_OK)
self.htmlObj.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
mySSH.command('stdbuf -o0 ./build_oai ' + self.Build_eNB_args + ' 2>&1 | stdbuf -o0 tee compile_oai_enb.log', 'Bypassing the Tests|build have failed', 1500) mySSH.command('stdbuf -o0 ./build_oai ' + self.Build_eNB_args + ' 2>&1 | stdbuf -o0 tee compile_oai_enb.log', 'Bypassing the Tests|build have failed', 1500)
mySSH.close() mySSH.close()
self.checkBuildeNB(lIpAddr, lUserName, lPassWord, lSourcePath, self.testCase_id) self.checkBuildeNB(lIpAddr, lUserName, lPassWord, lSourcePath, self.testCase_id, HTML)
def WaitBuildeNBisFinished(self): def WaitBuildeNBisFinished(self, HTML):
if self.eNB_serverId[self.eNB_instance] == '0': if self.eNB_serverId[self.eNB_instance] == '0':
lIpAddr = self.eNBIPAddress lIpAddr = self.eNBIPAddress
lUserName = self.eNBUserName lUserName = self.eNBUserName
...@@ -254,11 +245,10 @@ class RANManagement(): ...@@ -254,11 +245,10 @@ class RANManagement():
count -= 1 count -= 1
time.sleep(30) time.sleep(30)
mySSH.close() mySSH.close()
self.checkBuildeNB(lIpAddr, lUserName, lPassWord, lSourcePath, self.backgroundBuildTestId[int(self.eNB_instance)]) self.checkBuildeNB(lIpAddr, lUserName, lPassWord, lSourcePath, self.backgroundBuildTestId[int(self.eNB_instance)], HTML)
def checkBuildeNB(self, lIpAddr, lUserName, lPassWord, lSourcePath, testcaseId): def checkBuildeNB(self, lIpAddr, lUserName, lPassWord, lSourcePath, testcaseId, HTML):
if self.htmlObj is not None: HTML.testCase_id=testcaseId
self.htmlObj.testCase_id=testcaseId
mySSH = SSH.SSHConnection() mySSH = SSH.SSHConnection()
mySSH.open(lIpAddr, lUserName, lPassWord) mySSH.open(lIpAddr, lUserName, lPassWord)
...@@ -312,184 +302,14 @@ class RANManagement(): ...@@ -312,184 +302,14 @@ class RANManagement():
#generate logging info depending on buildStatus and air interface #generate logging info depending on buildStatus and air interface
if buildStatus: if buildStatus:
logging.info('\u001B[1m Building OAI ' + self.air_interface[self.eNB_instance] + ' Pass\u001B[0m') logging.info('\u001B[1m Building OAI ' + self.air_interface[self.eNB_instance] + ' Pass\u001B[0m')
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.Build_eNB_args, 'OK', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow(self.Build_eNB_args, 'OK', CONST.ALL_PROCESSES_OK)
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')
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.Build_eNB_args, 'KO', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow(self.Build_eNB_args, 'KO', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTabFooter(False)
self.htmlObj.CreateHtmlTabFooter(False)
sys.exit(1)
def BuildImage(self):
if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '':
HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter')
if self.eNB_serverId[self.eNB_instance] == '0':
lIpAddr = self.eNBIPAddress
lUserName = self.eNBUserName
lPassWord = self.eNBPassword
lSourcePath = self.eNBSourceCodePath
elif self.eNB_serverId[self.eNB_instance] == '1':
lIpAddr = self.eNB1IPAddress
lUserName = self.eNB1UserName
lPassWord = self.eNB1Password
lSourcePath = self.eNB1SourceCodePath
elif self.eNB_serverId[self.eNB_instance] == '2':
lIpAddr = self.eNB2IPAddress
lUserName = self.eNB2UserName
lPassWord = self.eNB2Password
lSourcePath = self.eNB2SourceCodePath
if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '':
HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter')
logging.debug('Building on server: ' + lIpAddr)
mySSH = SSH.SSHConnection()
mySSH.open(lIpAddr, lUserName, lPassWord)
imageNames = []
result = re.search('eNB', self.imageKind)
if result is not None:
imageNames.append(('oai-enb', 'eNB'))
else:
result = re.search('gNB', self.imageKind)
if result is not None:
imageNames.append(('oai-gnb', 'gNB'))
else:
result = re.search('all', self.imageKind)
if result is not None:
imageNames.append(('oai-enb', 'eNB'))
imageNames.append(('oai-gnb', 'gNB'))
if len(imageNames) == 0:
imageNames.append(('oai-enb', 'eNB'))
# Workaround for some servers, we need to erase completely the workspace
if self.Build_eNB_forced_workspace_cleanup:
mySSH.command('echo ' + lPassWord + ' | sudo -S rm -Rf ' + lSourcePath, '\$', 15)
if self.htmlObj is not None:
self.testCase_id = self.htmlObj.testCase_id
else:
self.testCase_id = '000000'
# on RedHat/CentOS .git extension is mandatory
result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository)
if result is not None:
full_ran_repo_name = self.ranRepository
else:
full_ran_repo_name = self.ranRepository + '.git'
mySSH.command('mkdir -p ' + lSourcePath, '\$', 5)
mySSH.command('cd ' + lSourcePath, '\$', 5)
mySSH.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + full_ran_repo_name + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600)
# Raphael: here add a check if git clone or git fetch went smoothly
mySSH.command('git config user.email "jenkins@openairinterface.org"', '\$', 5)
mySSH.command('git config user.name "OAI Jenkins"', '\$', 5)
mySSH.command('echo ' + lPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30)
mySSH.command('mkdir -p cmake_targets/log', '\$', 5)
# if the commit ID is provided use it to point to it
if self.ranCommitID != '':
mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 5)
# if the branch is not develop, then it is a merge request and we need to do
# the potential merge. Note that merge conflicts should already been checked earlier
imageTag = 'develop'
if (self.ranAllowMerge):
imageTag = 'ci-temp'
if self.ranTargetBranch == '':
if (self.ranBranch != 'develop') and (self.ranBranch != 'origin/develop'):
mySSH.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5)
else:
logging.debug('Merging with the target branch: ' + self.ranTargetBranch)
mySSH.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5)
# Let's remove any previous run artifacts if still there
mySSH.command('docker image prune --force', '\$', 5)
mySSH.command('docker image rm ran-build:' + imageTag, '\$', 5)
for image,pattern in imageNames:
mySSH.command('docker image rm ' + image + ':' + imageTag, '\$', 5)
# Build the shared image
mySSH.command('docker build --target ran-build --tag ran-build:' + imageTag + ' --file docker/Dockerfile.ran.ubuntu18 --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > cmake_targets/log/ran-build.log 2>&1', '\$', 800)
# Build the target image(s)
previousImage='ran-build:' + imageTag
danglingShaOnes=[]
for image,pattern in imageNames:
mySSH.command('docker build --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + '.ubuntu18 . > cmake_targets/log/' + image + '.log 2>&1', '\$', 600)
# Retrieving the dangling image(s) for the log collection
mySSH.command('docker images --filter "dangling=true" --filter "since=' + previousImage + '" -q | sed -e "s#^#sha=#"', '\$', 5)
result = re.search('sha=(?P<imageShaOne>[a-zA-Z0-9\-\_]+)', mySSH.getBefore())
if result is not None:
danglingShaOnes.append((image, result.group('imageShaOne')))
previousImage=image + ':' + imageTag
imageTag = 'ci-temp'
# First verify if images were properly created.
status = True
mySSH.command('docker image inspect --format=\'Size = {{.Size}} bytes\' ran-build:' + imageTag, '\$', 5)
if mySSH.getBefore().count('No such object') != 0:
logging.error('Could not build properly ran-build')
status = False
else:
result = re.search('Size = (?P<size>[0-9\-]+) bytes', mySSH.getBefore())
if result is not None:
imageSize = float(result.group('size'))
imageSize = imageSize / 1000
if imageSize < 1000:
logging.debug('\u001B[1m ran-build size is ' + ('%.0f' % imageSize) + ' kbytes\u001B[0m')
else:
imageSize = imageSize / 1000
if imageSize < 1000:
logging.debug('\u001B[1m ran-build size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m')
else:
imageSize = imageSize / 1000
logging.debug('\u001B[1m ran-build size is ' + ('%.3f' % imageSize) + ' Gbytes\u001B[0m')
else:
logging.debug('ran-build size is unknown')
for image,pattern in imageNames:
mySSH.command('docker image inspect --format=\'Size = {{.Size}} bytes\' ' + image + ':' + imageTag, '\$', 5)
if mySSH.getBefore().count('No such object') != 0:
logging.error('Could not build properly ' + image)
status = False
else:
result = re.search('Size = (?P<size>[0-9\-]+) bytes', mySSH.getBefore())
if result is not None:
imageSize = float(result.group('size'))
imageSize = imageSize / 1000
if imageSize < 1000:
logging.debug('\u001B[1m ' + image + ' size is ' + ('%.0f' % imageSize) + ' kbytes\u001B[0m')
else:
imageSize = imageSize / 1000
if imageSize < 1000:
logging.debug('\u001B[1m ' + image + ' size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m')
else:
imageSize = imageSize / 1000
logging.debug('\u001B[1m ' + image + ' size is ' + ('%.3f' % imageSize) + ' Gbytes\u001B[0m')
else:
logging.debug('ran-build size is unknown')
if not status:
mySSH.close()
logging.error('\u001B[1m Building OAI Images Failed\u001B[0m')
if self.htmlObj is not None:
self.htmlObj.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
# Recover build logs, for the moment only possible when build is successful def InitializeeNB(self, HTML, EPC):
mySSH.command('docker create --name test ran-build:' + imageTag, '\$', 5)
mySSH.command('mkdir -p cmake_targets/log/ran-build', '\$', 5)
mySSH.command('docker cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/ran-build', '\$', 5)
mySSH.command('docker rm -f test', '\$', 5)
for image,shaone in danglingShaOnes:
mySSH.command('mkdir -p cmake_targets/log/' + image, '\$', 5)
mySSH.command('docker create --name test ' + shaone, '\$', 5)
mySSH.command('docker cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/' + image, '\$', 5)
mySSH.command('docker rm -f test', '\$', 5)
mySSH.command('docker image prune --force', '\$', 5)
mySSH.command('cd cmake_targets', '\$', 5)
mySSH.command('mkdir -p build_log_' + self.testCase_id, '\$', 5)
mySSH.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5)
mySSH.close()
logging.info('\u001B[1m Building OAI Image(s) Pass\u001B[0m')
if self.htmlObj is not None:
self.htmlObj.CreateHtmlTestRow(self.imageKind, 'OK', CONST.ALL_PROCESSES_OK)
def InitializeeNB(self):
if self.eNB_serverId[self.eNB_instance] == '0': if self.eNB_serverId[self.eNB_instance] == '0':
lIpAddr = self.eNBIPAddress lIpAddr = self.eNBIPAddress
lUserName = self.eNBUserName lUserName = self.eNBUserName
...@@ -510,23 +330,19 @@ class RANManagement(): ...@@ -510,23 +330,19 @@ class RANManagement():
sys.exit('Insufficient Parameter') sys.exit('Insufficient Parameter')
logging.debug('Starting eNB/gNB on server: ' + lIpAddr) logging.debug('Starting eNB/gNB on server: ' + lIpAddr)
if self.htmlObj is not None: self.testCase_id = HTML.testCase_id
self.testCase_id = self.htmlObj.testCase_id
else:
self.testCase_id = '000000'
mySSH = SSH.SSHConnection() mySSH = SSH.SSHConnection()
if (self.pStatus < 0): if (self.pStatus < 0):
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.air_interface[self.eNB_instance] + ' ' + self.Initialize_eNB_args, 'KO', self.pStatus)
self.htmlObj.CreateHtmlTestRow(self.air_interface[self.eNB_instance] + ' ' + self.Initialize_eNB_args, 'KO', self.pStatus) HTML.CreateHtmlTabFooter(False)
self.htmlObj.CreateHtmlTabFooter(False)
sys.exit(1) sys.exit(1)
# If tracer options is on, running tshark on EPC side and capture traffic b/ EPC and eNB # If tracer options is on, running tshark on EPC side and capture traffic b/ EPC and eNB
result = re.search('T_stdout', str(self.Initialize_eNB_args)) result = re.search('T_stdout', str(self.Initialize_eNB_args))
if (result is not None) and (self.epcObj is not None): if (result is not None):
localEpcIpAddr = self.epcObj.IPAddress localEpcIpAddr = EPC.IPAddress
localEpcUserName = self.epcObj.UserName localEpcUserName = EPC.UserName
localEpcPassword = self.epcObj.Password localEpcPassword = EPC.Password
mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword) mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword)
mySSH.command('ip addr show | awk -f /tmp/active_net_interfaces.awk | egrep -v "lo|tun"', '\$', 5) mySSH.command('ip addr show | awk -f /tmp/active_net_interfaces.awk | egrep -v "lo|tun"', '\$', 5)
result = re.search('interfaceToUse=(?P<eth_interface>[a-zA-Z0-9\-\_]+)done', mySSH.getBefore()) result = re.search('interfaceToUse=(?P<eth_interface>[a-zA-Z0-9\-\_]+)done', mySSH.getBefore())
...@@ -574,8 +390,7 @@ class RANManagement(): ...@@ -574,8 +390,7 @@ class RANManagement():
mySSH.command('echo ' + lPassWord + ' | sudo -S uhd_find_devices', '\$', 60) mySSH.command('echo ' + lPassWord + ' | sudo -S uhd_find_devices', '\$', 60)
# Make a copy and adapt to EPC / eNB IP addresses # Make a copy and adapt to EPC / eNB IP addresses
mySSH.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5) mySSH.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5)
if self.epcObj is not None: localMmeIpAddr = EPC.MmeIPAddress
localMmeIpAddr = self.epcObj.MmeIPAddress
mySSH.command('sed -i -e \'s/CI_MME_IP_ADDR/' + localMmeIpAddr + '/\' ' + ci_full_config_file, '\$', 2); mySSH.command('sed -i -e \'s/CI_MME_IP_ADDR/' + localMmeIpAddr + '/\' ' + ci_full_config_file, '\$', 2);
mySSH.command('sed -i -e \'s/CI_ENB_IP_ADDR/' + lIpAddr + '/\' ' + ci_full_config_file, '\$', 2); mySSH.command('sed -i -e \'s/CI_ENB_IP_ADDR/' + lIpAddr + '/\' ' + ci_full_config_file, '\$', 2);
mySSH.command('sed -i -e \'s/CI_GNB_IP_ADDR/' + lIpAddr + '/\' ' + ci_full_config_file, '\$', 2); mySSH.command('sed -i -e \'s/CI_GNB_IP_ADDR/' + lIpAddr + '/\' ' + ci_full_config_file, '\$', 2);
...@@ -627,14 +442,13 @@ class RANManagement(): ...@@ -627,14 +442,13 @@ class RANManagement():
mySSH.close() mySSH.close()
doLoop = False doLoop = False
logging.error('\u001B[1;37;41m eNB/gNB/ocp-eNB logging system did not show got sync! \u001B[0m') logging.error('\u001B[1;37;41m eNB/gNB/ocp-eNB logging system did not show got sync! \u001B[0m')
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.air_interface[self.eNB_instance] + ' -O ' + config_file + extra_options, 'KO', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow(self.air_interface[self.eNB_instance] + ' -O ' + config_file + extra_options, 'KO', CONST.ALL_PROCESSES_OK)
# In case of T tracer recording, we need to kill tshark on EPC side # In case of T tracer recording, we need to kill tshark on EPC side
result = re.search('T_stdout', str(self.Initialize_eNB_args)) result = re.search('T_stdout', str(self.Initialize_eNB_args))
if (result is not None) and (self.epcObj is not None): if (result is not None):
localEpcIpAddr = self.epcObj.IPAddress localEpcIpAddr = EPC.IPAddress
localEpcUserName = self.epcObj.UserName localEpcUserName = EPC.UserName
localEpcPassword = self.epcObj.Password localEpcPassword = EPC.Password
mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword) mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword)
logging.debug('\u001B[1m Stopping tshark \u001B[0m') logging.debug('\u001B[1m Stopping tshark \u001B[0m')
mySSH.command('echo ' + localEpcPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5) mySSH.command('echo ' + localEpcPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5)
...@@ -685,8 +499,7 @@ class RANManagement(): ...@@ -685,8 +499,7 @@ class RANManagement():
self.eNBstatuses[int(self.eNB_instance)] = int(self.eNB_serverId[self.eNB_instance]) self.eNBstatuses[int(self.eNB_instance)] = int(self.eNB_serverId[self.eNB_instance])
mySSH.close() mySSH.close()
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.air_interface[self.eNB_instance] + ' -O ' + config_file + extra_options, 'OK', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow(self.air_interface[self.eNB_instance] + ' -O ' + config_file + extra_options, 'OK', CONST.ALL_PROCESSES_OK)
logging.debug('\u001B[1m Initialize eNB/gNB/ocp-eNB Completed\u001B[0m') logging.debug('\u001B[1m Initialize eNB/gNB/ocp-eNB Completed\u001B[0m')
def CheckeNBProcess(self, status_queue): def CheckeNBProcess(self, status_queue):
...@@ -721,7 +534,7 @@ class RANManagement(): ...@@ -721,7 +534,7 @@ class RANManagement():
except: except:
os.kill(os.getppid(),signal.SIGUSR1) os.kill(os.getppid(),signal.SIGUSR1)
def TerminateeNB(self): def TerminateeNB(self, HTML, EPC):
if self.eNB_serverId[self.eNB_instance] == '0': if self.eNB_serverId[self.eNB_instance] == '0':
lIpAddr = self.eNBIPAddress lIpAddr = self.eNBIPAddress
lUserName = self.eNBUserName lUserName = self.eNBUserName
...@@ -762,10 +575,10 @@ class RANManagement(): ...@@ -762,10 +575,10 @@ class RANManagement():
mySSH.close() mySSH.close()
# If tracer options is on, stopping tshark on EPC side # If tracer options is on, stopping tshark on EPC side
result = re.search('T_stdout', str(self.Initialize_eNB_args)) result = re.search('T_stdout', str(self.Initialize_eNB_args))
if (result is not None) and (self.epcObj is not None): if (result is not None):
localEpcIpAddr = self.epcObj.IPAddress localEpcIpAddr = EPC.IPAddress
localEpcUserName = self.epcObj.UserName localEpcUserName = EPC.UserName
localEpcPassword = self.epcObj.Password localEpcPassword = EPC.Password
mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword) mySSH.open(localEpcIpAddr, localEpcUserName, localEpcPassword)
logging.debug('\u001B[1m Stopping tshark \u001B[0m') logging.debug('\u001B[1m Stopping tshark \u001B[0m')
mySSH.command('echo ' + localEpcPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5) mySSH.command('echo ' + localEpcPassword + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5)
...@@ -789,9 +602,8 @@ class RANManagement(): ...@@ -789,9 +602,8 @@ class RANManagement():
mySSH.close() mySSH.close()
mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/' + extracted_log_file, '.') mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/' + extracted_log_file, '.')
logging.debug('\u001B[1m Analyzing eNB replay logfile \u001B[0m') logging.debug('\u001B[1m Analyzing eNB replay logfile \u001B[0m')
logStatus = self.AnalyzeLogFile_eNB(extracted_log_file) logStatus = self.AnalyzeLogFile_eNB(extracted_log_file, HTML)
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
self.eNBLogFiles[int(self.eNB_instance)] = '' self.eNBLogFiles[int(self.eNB_instance)] = ''
else: else:
analyzeFile = False analyzeFile = False
...@@ -803,27 +615,23 @@ class RANManagement(): ...@@ -803,27 +615,23 @@ class RANManagement():
copyin_res = mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/' + fileToAnalyze, '.') copyin_res = mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/' + fileToAnalyze, '.')
if (copyin_res == -1): if (copyin_res == -1):
logging.debug('\u001B[1;37;41m Could not copy ' + nodeB_prefix + 'NB logfile to analyze it! \u001B[0m') logging.debug('\u001B[1;37;41m Could not copy ' + nodeB_prefix + 'NB logfile to analyze it! \u001B[0m')
if self.htmlObj is not None: HTML.htmleNBFailureMsg='Could not copy ' + nodeB_prefix + 'NB logfile to analyze it!'
self.htmlObj.htmleNBFailureMsg='Could not copy ' + nodeB_prefix + 'NB logfile to analyze it!' HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ENB_PROCESS_NOLOGFILE_TO_ANALYZE)
self.htmlObj.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
if self.eNB_serverId[self.eNB_instance] != '0': if self.eNB_serverId[self.eNB_instance] != '0':
mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './' + fileToAnalyze, self.eNBSourceCodePath + '/cmake_targets/') mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './' + fileToAnalyze, self.eNBSourceCodePath + '/cmake_targets/')
logging.debug('\u001B[1m Analyzing ' + nodeB_prefix + 'NB logfile \u001B[0m ' + fileToAnalyze) logging.debug('\u001B[1m Analyzing ' + nodeB_prefix + 'NB logfile \u001B[0m ' + fileToAnalyze)
logStatus = self.AnalyzeLogFile_eNB(fileToAnalyze) logStatus = self.AnalyzeLogFile_eNB(fileToAnalyze, HTML)
if (logStatus < 0): if (logStatus < 0):
if self.htmlObj is not None: HTML.CreateHtmlTestRow('N/A', 'KO', logStatus)
self.htmlObj.CreateHtmlTestRow('N/A', 'KO', logStatus)
self.preamtureExit = True self.preamtureExit = True
self.eNBmbmsEnables[int(self.eNB_instance)] = False self.eNBmbmsEnables[int(self.eNB_instance)] = False
return return
else: else:
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
else: else:
if self.htmlObj is not None: HTML.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
self.htmlObj.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
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
...@@ -837,7 +645,7 @@ class RANManagement(): ...@@ -837,7 +645,7 @@ class RANManagement():
mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap enb_*txt', '\$', 5) mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap enb_*txt', '\$', 5)
mySSH.close() mySSH.close()
def AnalyzeLogFile_eNB(self, eNBlogFile): def AnalyzeLogFile_eNB(self, eNBlogFile, HTML):
if (not os.path.isfile('./' + eNBlogFile)): if (not os.path.isfile('./' + eNBlogFile)):
return -1 return -1
enb_log_file = open('./' + eNBlogFile, 'r') enb_log_file = open('./' + eNBlogFile, 'r')
...@@ -1206,8 +1014,7 @@ class RANManagement(): ...@@ -1206,8 +1014,7 @@ class RANManagement():
logging.debug('\u001B[1;37;41m ' + rlcMsg + ' \u001B[0m') logging.debug('\u001B[1;37;41m ' + rlcMsg + ' \u001B[0m')
htmleNBFailureMsg += rlcMsg + '\n' htmleNBFailureMsg += rlcMsg + '\n'
global_status = CONST.ENB_PROCESS_REALTIME_ISSUE global_status = CONST.ENB_PROCESS_REALTIME_ISSUE
if self.htmlObj is not None: HTML.htmleNBFailureMsg=htmleNBFailureMsg
self.htmlObj.htmleNBFailureMsg=htmleNBFailureMsg
# Runtime statistics for console output and HTML # Runtime statistics for console output and HTML
if runTime != '': if runTime != '':
logging.debug(runTime) logging.debug(runTime)
......
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