feat(ci): adding RAN containers analysis

Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
This commit is contained in:
Raphael Defosseux
2022-01-19 14:38:57 +01:00
parent 64058d84b3
commit edb876460f
+29 -10
View File
@@ -730,20 +730,34 @@ class Containerize():
cmd = 'cd ' + self.yamlPath[0] + ' && docker logs ' + cName + ' > ' + cName + '.log 2>&1' cmd = 'cd ' + self.yamlPath[0] + ' && docker logs ' + cName + ' > ' + cName + '.log 2>&1'
logging.debug(cmd) logging.debug(cmd)
deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=30) deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=30)
fullStatus = True
if anyLogs: if anyLogs:
cmd = 'mkdir -p '+ logPath + ' && cp ' + self.yamlPath[0] + '/*.log ' + logPath cmd = 'mkdir -p '+ logPath + ' && cp ' + self.yamlPath[0] + '/*.log ' + logPath
logging.debug(cmd) logging.debug(cmd)
deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10)
# Analyzing log file! # Analyzing log file!
filename = self.yamlPath[0] + '/rfsim?g-oai-*.log' # 4g/enb, 5g/gnb, 5g/-du/-cu listOfPossibleRanContainers = ['enb', 'gnb', 'cu', 'du']
logging.debug('\u001B[1m Analyzing xNB logfile \u001B[0m ' + filename) for container in listOfPossibleRanContainers:
# For the moment just assume this exists filename = self.yamlPath[0] + '/rfsim?g-oai-' + container + '.log'
logStatus = RAN.AnalyzeLogFile_eNB(filename, HTML) cmd = 'ls ' + filename
if (logStatus < 0): containerStatus = True
HTML.CreateHtmlTestRow(RAN.runtime_stats, 'KO', logStatus) try:
else: lsStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10)
HTML.CreateHtmlTestRow(RAN.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK) filename = str(lsStatus).strip()
except:
containerStatus = False
if not containerStatus:
continue
logging.debug('\u001B[1m Analyzing xNB logfile ' + filename + ' \u001B[0m')
# For the moment just assume this exists
logStatus = RAN.AnalyzeLogFile_eNB(filename, HTML)
if (logStatus < 0):
fullStatus = False
HTML.CreateHtmlTestRow(RAN.runtime_stats, 'KO', logStatus)
else:
HTML.CreateHtmlTestRow(RAN.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
cmd = 'rm ' + self.yamlPath[0] + '/*.log' cmd = 'rm ' + self.yamlPath[0] + '/*.log'
logging.debug(cmd) logging.debug(cmd)
@@ -761,6 +775,7 @@ class Containerize():
logging.debug(cmd) logging.debug(cmd)
copyStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) copyStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10)
logging.debug('\u001B[1m Undeploying \u001B[0m')
cmd = 'cd ' + self.yamlPath[0] + ' && docker-compose -f docker-compose-ci.yml down' cmd = 'cd ' + self.yamlPath[0] + ' && docker-compose -f docker-compose-ci.yml down'
logging.debug(cmd) logging.debug(cmd)
try: try:
@@ -777,8 +792,12 @@ class Containerize():
logging.debug(cmd) logging.debug(cmd)
deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=100) deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=100)
HTML.CreateHtmlTestRow('n/a', 'OK', CONST.ALL_PROCESSES_OK) if fullStatus:
logging.info('\u001B[1m Undeploying OAI Object(s) PASS\u001B[0m') HTML.CreateHtmlTestRow('n/a', 'OK', CONST.ALL_PROCESSES_OK)
logging.info('\u001B[1m Undeploying OAI Object(s) PASS\u001B[0m')
else:
HTML.CreateHtmlTestRow('n/a', 'KO', CONST.ALL_PROCESSES_OK)
logging.info('\u001B[1m Undeploying OAI Object(s) FAIL\u001B[0m')
def PingFromContainer(self, HTML): def PingFromContainer(self, HTML):
self.exitStatus = 0 self.exitStatus = 0