fix(ci): better shutdown of container when using USRP
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
This commit is contained in:
@@ -586,11 +586,20 @@ class Containerize():
|
|||||||
mySSH.command('cd ' + lSourcePath + '/' + self.yamlPath[self.eNB_instance], '\$', 5)
|
mySSH.command('cd ' + lSourcePath + '/' + self.yamlPath[self.eNB_instance], '\$', 5)
|
||||||
# Currently support only one
|
# Currently support only one
|
||||||
mySSH.command('docker-compose --file ci-docker-compose.yml config', '\$', 5)
|
mySSH.command('docker-compose --file ci-docker-compose.yml config', '\$', 5)
|
||||||
|
containerName = ''
|
||||||
|
containerToKill = False
|
||||||
result = re.search('container_name: (?P<container_name>[a-zA-Z0-9\-\_]+)', mySSH.getBefore())
|
result = re.search('container_name: (?P<container_name>[a-zA-Z0-9\-\_]+)', mySSH.getBefore())
|
||||||
if self.eNB_logFile[self.eNB_instance] == '':
|
if self.eNB_logFile[self.eNB_instance] == '':
|
||||||
self.eNB_logFile[self.eNB_instance] = 'enb_' + HTML.testCase_id + '.log'
|
self.eNB_logFile[self.eNB_instance] = 'enb_' + HTML.testCase_id + '.log'
|
||||||
if result is not None:
|
if result is not None:
|
||||||
containerName = result.group('container_name')
|
containerName = result.group('container_name')
|
||||||
|
containerToKill = True
|
||||||
|
if containerToKill:
|
||||||
|
mySSH.command('docker inspect ' + containerName, '\$', 30)
|
||||||
|
result = re.search('Error: No such object: ' + containerName, mySSH.getBefore())
|
||||||
|
if result is not None:
|
||||||
|
containerToKill = False
|
||||||
|
if containerToKill:
|
||||||
mySSH.command('docker kill --signal INT ' + containerName, '\$', 30)
|
mySSH.command('docker kill --signal INT ' + containerName, '\$', 30)
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
mySSH.command('docker logs ' + containerName + ' > ' + lSourcePath + '/cmake_targets/' + self.eNB_logFile[self.eNB_instance], '\$', 30)
|
mySSH.command('docker logs ' + containerName + ' > ' + lSourcePath + '/cmake_targets/' + self.eNB_logFile[self.eNB_instance], '\$', 30)
|
||||||
@@ -603,20 +612,26 @@ class Containerize():
|
|||||||
mySSH.close()
|
mySSH.close()
|
||||||
|
|
||||||
# Analyzing log file!
|
# Analyzing log file!
|
||||||
copyin_res = mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/' + self.eNB_logFile[self.eNB_instance], '.')
|
if containerToKill:
|
||||||
|
copyin_res = mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/' + self.eNB_logFile[self.eNB_instance], '.')
|
||||||
|
else:
|
||||||
|
copyin_res = 0
|
||||||
nodeB_prefix = 'e'
|
nodeB_prefix = 'e'
|
||||||
if (copyin_res == -1):
|
if (copyin_res == -1):
|
||||||
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)
|
||||||
else:
|
else:
|
||||||
logging.debug('\u001B[1m Analyzing ' + nodeB_prefix + 'NB logfile \u001B[0m ' + self.eNB_logFile[self.eNB_instance])
|
if containerToKill:
|
||||||
logStatus = RAN.AnalyzeLogFile_eNB(self.eNB_logFile[self.eNB_instance], HTML)
|
logging.debug('\u001B[1m Analyzing ' + nodeB_prefix + 'NB logfile \u001B[0m ' + self.eNB_logFile[self.eNB_instance])
|
||||||
|
logStatus = RAN.AnalyzeLogFile_eNB(self.eNB_logFile[self.eNB_instance], HTML)
|
||||||
|
else:
|
||||||
|
logStatus = 0
|
||||||
if (logStatus < 0):
|
if (logStatus < 0):
|
||||||
HTML.CreateHtmlTestRow(RAN.runtime_stats, 'KO', logStatus)
|
HTML.CreateHtmlTestRow(RAN.runtime_stats, 'KO', logStatus)
|
||||||
else:
|
else:
|
||||||
HTML.CreateHtmlTestRow(RAN.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
|
HTML.CreateHtmlTestRow(RAN.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
|
||||||
# all the xNB run logs shall be on the server 0 for logCollecting
|
# all the xNB run logs shall be on the server 0 for logCollecting
|
||||||
if self.eNB_serverId[self.eNB_instance] != '0':
|
if containerToKill and self.eNB_serverId[self.eNB_instance] != '0':
|
||||||
mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './' + self.eNB_logFile[self.eNB_instance], self.eNBSourceCodePath + '/cmake_targets/')
|
mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './' + self.eNB_logFile[self.eNB_instance], self.eNBSourceCodePath + '/cmake_targets/')
|
||||||
logging.info('\u001B[1m Undeploying OAI Object Pass\u001B[0m')
|
logging.info('\u001B[1m Undeploying OAI Object Pass\u001B[0m')
|
||||||
|
|
||||||
|
|||||||
@@ -532,6 +532,7 @@ class EPCManagement():
|
|||||||
logging.debug('Terminating OAI CN5G')
|
logging.debug('Terminating OAI CN5G')
|
||||||
mySSH.command('cd /opt/oai-cn5g-fed/docker-compose', '\$', 5)
|
mySSH.command('cd /opt/oai-cn5g-fed/docker-compose', '\$', 5)
|
||||||
mySSH.command('./core-network.sh stop nrf spgwu', '\$', 60)
|
mySSH.command('./core-network.sh stop nrf spgwu', '\$', 60)
|
||||||
|
mySSH.command('docker volume prune --force || true', '\$', 60)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
mySSH.command('tshark -r /tmp/oai-cn5g.pcap | egrep --colour=never "Tracking area update" ','\$', 30)
|
mySSH.command('tshark -r /tmp/oai-cn5g.pcap | egrep --colour=never "Tracking area update" ','\$', 30)
|
||||||
result = re.search('Tracking area update request', mySSH.getBefore())
|
result = re.search('Tracking area update request', mySSH.getBefore())
|
||||||
@@ -760,6 +761,7 @@ class EPCManagement():
|
|||||||
nbContainers += 1
|
nbContainers += 1
|
||||||
|
|
||||||
mySSH.command('docker-compose down', '\$', 60)
|
mySSH.command('docker-compose down', '\$', 60)
|
||||||
|
mySSH.command('docker volume prune --force || true', '\$', 60)
|
||||||
mySSH.command('docker inspect --format=\'{{.State.Health.Status}}\' ' + listOfContainers, '\$', 10)
|
mySSH.command('docker inspect --format=\'{{.State.Health.Status}}\' ' + listOfContainers, '\$', 10)
|
||||||
noMoreContainerNb = mySSH.getBefore().count('No such object')
|
noMoreContainerNb = mySSH.getBefore().count('No such object')
|
||||||
mySSH.command('docker inspect --format=\'{{.Name}}\' prod-oai-public-net prod-oai-private-net', '\$', 10)
|
mySSH.command('docker inspect --format=\'{{.Name}}\' prod-oai-public-net prod-oai-private-net', '\$', 10)
|
||||||
|
|||||||
Reference in New Issue
Block a user