From d02a65c82476ec5fa89ebcdbc975239ad1026ce0 Mon Sep 17 00:00:00 2001
From: Robert Schmidt <robert.schmidt@openairinterface.org>
Date: Mon, 27 Dec 2021 15:55:42 +0100
Subject: [PATCH] Tentatively analyze log files of RFsims

---
 ci-scripts/cls_containerize.py | 21 +++++++++++++++++++--
 ci-scripts/main.py             |  2 +-
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py
index 60e755e9cde..9248eba4b88 100644
--- a/ci-scripts/cls_containerize.py
+++ b/ci-scripts/cls_containerize.py
@@ -700,7 +700,7 @@ class Containerize():
 		logging.debug(cmd)
 		networkNames = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10)
 
-	def UndeployGenObject(self, HTML):
+	def UndeployGenObject(self, HTML, RAN):
 		self.exitStatus = 0
 		ymlPath = self.yamlPath[0].split('/')
 		logPath = '../cmake_targets/log/' + ymlPath[1]
@@ -731,7 +731,24 @@ class Containerize():
 				logging.debug(cmd)
 				deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=30)
 		if anyLogs:
-			cmd = 'mkdir -p '+ logPath + ' && mv ' + self.yamlPath[0] + '/*.log ' + logPath
+			cmd = 'mkdir -p '+ logPath + ' && cp ' + self.yamlPath[0] + '/*.log ' + logPath
+			logging.debug(cmd)
+			deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10)
+
+			# Analyzing log file!
+			filename = self.yamlPath[0] + '/rfsim?g_oai_?nb.log'
+			logging.debug('\u001B[1m Analyzing xNB logfile \u001B[0m ' + filename)
+			cmd = 'ls ' + filename
+			logfileLs = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=5)
+			logging.debug(logfileLs)
+			# For the moment just assume this exists
+			logStatus = RAN.AnalyzeLogFile_eNB(filename, HTML)
+			if (logStatus < 0):
+				HTML.CreateHtmlTestRow(RAN.runtime_stats, 'KO', logStatus)
+			else:
+				HTML.CreateHtmlTestRow(RAN.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
+
+			cmd = 'rm ' + self.yamlPath[0] + '/*.log'
 			logging.debug(cmd)
 			deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10)
 			if self.tsharkStarted:
diff --git a/ci-scripts/main.py b/ci-scripts/main.py
index 3a5a69573d8..5b5eec285cc 100644
--- a/ci-scripts/main.py
+++ b/ci-scripts/main.py
@@ -909,7 +909,7 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
 					if CONTAINERS.exitStatus==1:
 						RAN.prematureExit = True
 				elif action == 'UndeployGenObject':
-					CONTAINERS.UndeployGenObject(HTML)
+					CONTAINERS.UndeployGenObject(HTML, RAN)
 					if CONTAINERS.exitStatus==1:
 						RAN.prematureExit = True
 				elif action == 'PingFromContainer':
-- 
GitLab