Commit 244ea8fc authored by Robert Schmidt's avatar Robert Schmidt

Use archiveArtifact() for TerminateeNB()

parent 5090ce6f
...@@ -206,7 +206,7 @@ def ExecuteActionWithParam(action, ctx): ...@@ -206,7 +206,7 @@ def ExecuteActionWithParam(action, ctx):
RAN.air_interface[RAN.eNB_instance] = 'lte-softmodem' RAN.air_interface[RAN.eNB_instance] = 'lte-softmodem'
else: else:
RAN.air_interface[RAN.eNB_instance] = air_interface.lower() +'-softmodem' RAN.air_interface[RAN.eNB_instance] = air_interface.lower() +'-softmodem'
success = RAN.TerminateeNB(HTML) success = RAN.TerminateeNB(ctx, HTML)
elif action == 'Initialize_UE' or action == 'Attach_UE' or action == 'Detach_UE' or action == 'Terminate_UE' or action == 'CheckStatusUE' or action == 'DataEnable_UE' or action == 'DataDisable_UE': elif action == 'Initialize_UE' or action == 'Attach_UE' or action == 'Detach_UE' or action == 'Terminate_UE' or action == 'CheckStatusUE' or action == 'DataEnable_UE' or action == 'DataDisable_UE':
CiTestObj.ue_ids = test.findtext('id').split(' ') CiTestObj.ue_ids = test.findtext('id').split(' ')
......
...@@ -46,6 +46,7 @@ import cls_cmd ...@@ -46,6 +46,7 @@ import cls_cmd
import sshconnection as SSH import sshconnection as SSH
import helpreadme as HELP import helpreadme as HELP
import constants as CONST import constants as CONST
from cls_ci_helper import archiveArtifact
#----------------------------------------------------------- #-----------------------------------------------------------
# Class Declaration # Class Declaration
...@@ -248,7 +249,7 @@ class RANManagement(): ...@@ -248,7 +249,7 @@ class RANManagement():
logging.debug('\u001B[1m Initialize eNB/gNB Completed\u001B[0m') logging.debug('\u001B[1m Initialize eNB/gNB Completed\u001B[0m')
return enbDidSync return enbDidSync
def TerminateeNB(self, HTML): def TerminateeNB(self, ctx, 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
...@@ -320,13 +321,11 @@ class RANManagement(): ...@@ -320,13 +321,11 @@ class RANManagement():
fileToAnalyze = self.eNBLogFiles[int(self.eNB_instance)] fileToAnalyze = self.eNBLogFiles[int(self.eNB_instance)]
self.eNBLogFiles[int(self.eNB_instance)] = '' self.eNBLogFiles[int(self.eNB_instance)] = ''
if analyzeFile: if analyzeFile:
#*stats.log files + pickle + png with cls_cmd.getConnection(lIpAddr) as cmd:
mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/*stats.log', '.') file = archiveArtifact(cmd, ctx, lSourcePath + '/cmake_targets/' + fileToAnalyze)
mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/*.pickle', '.') archiveArtifact(cmd, ctx, lSourcePath + '/cmake_targets/nrL1_stats.log')
mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/*.png', '.') archiveArtifact(cmd, ctx, lSourcePath + '/cmake_targets/nrMAC_stats.log')
# if file is None:
copyin_res = mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/' + fileToAnalyze, '.')
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')
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)
...@@ -339,8 +338,8 @@ class RANManagement(): ...@@ -339,8 +338,8 @@ class RANManagement():
mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './nrL1_stats.log', self.eNBSourceCodePath + '/cmake_targets/') mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './nrL1_stats.log', self.eNBSourceCodePath + '/cmake_targets/')
mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './nrMAC_stats.log', self.eNBSourceCodePath + '/cmake_targets/') mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './nrMAC_stats.log', self.eNBSourceCodePath + '/cmake_targets/')
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 ' + file)
logStatus = self.AnalyzeLogFile_eNB(fileToAnalyze, HTML, self.ran_checkers) logStatus = self.AnalyzeLogFile_eNB(file, HTML, self.ran_checkers)
if (logStatus < 0): if (logStatus < 0):
HTML.CreateHtmlTestRow('N/A', 'KO', logStatus) HTML.CreateHtmlTestRow('N/A', 'KO', logStatus)
#display rt stats for gNB only #display rt stats for gNB only
...@@ -698,11 +697,16 @@ class RANManagement(): ...@@ -698,11 +697,16 @@ class RANManagement():
datalog_rt_stats = yaml.load(f,Loader=yaml.FullLoader) datalog_rt_stats = yaml.load(f,Loader=yaml.FullLoader)
rt_keys = datalog_rt_stats['Ref'] #we use the keys from the Ref field rt_keys = datalog_rt_stats['Ref'] #we use the keys from the Ref field
if os.path.isfile('./nrL1_stats.log') and os.path.isfile('./nrMAC_stats.log'): # nrL1_stats.log/nrMAC_stats.log should be in the same directory as main log file
# currently the link is only implicit as below based on pattern matching
# I will rework this to give the file explicitly
l1_stats_fn = re.sub(r'enb_[0-9]+', 'nrL1_stats', eNBlogFile)
mac_stats_fn = re.sub(r'enb_[0-9]+', 'nrMAC_stats', eNBlogFile)
if os.path.isfile(l1_stats_fn) and os.path.isfile(mac_stats_fn):
# don't use CI-nrL1_stats.log, as this will increase the processing time for # don't use CI-nrL1_stats.log, as this will increase the processing time for
# no reason, we just need the last occurence # no reason, we just need the last occurence
nrL1_stats = open('./nrL1_stats.log', 'r') nrL1_stats = open(l1_stats_fn, 'r')
nrMAC_stats = open('./nrMAC_stats.log', 'r') nrMAC_stats = open(mac_stats_fn, 'r')
for line in nrL1_stats.readlines(): for line in nrL1_stats.readlines():
for k in rt_keys: for k in rt_keys:
result = re.search(k, line) result = re.search(k, line)
...@@ -722,7 +726,7 @@ class RANManagement(): ...@@ -722,7 +726,7 @@ class RANManagement():
nrL1_stats.close() nrL1_stats.close()
nrMAC_stats.close() nrMAC_stats.close()
else: else:
logging.debug("NR Stats files for RT analysis not found") logging.debug(f"NR Stats files for RT analysis not found: {l1_stats_fn}, {mac_stats_fn}")
#stdout log file and stat log files analysis completed #stdout log file and stat log files analysis completed
logging.debug(' File analysis (stdout, stats) completed') logging.debug(' File analysis (stdout, stats) completed')
......
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