Commit 50db6707 authored by Mohammed Ismail's avatar Mohammed Ismail

[CI] update on report for the RHEL build

Signed-off-by: default avatarMohammed Ismail <mohammed.ismail@openairinterface.org>
parent 5f7eef9c
...@@ -153,7 +153,7 @@ class HtmlReport(): ...@@ -153,7 +153,7 @@ class HtmlReport():
buildSummaryDone = True buildSummaryDone = True
with open(cwd + '/ds_tester_results_oai_cn5g.html', 'r') as originalEpcReport: with open(cwd + '/ds_tester_results_oai_cn5g.html', 'r') as originalEpcReport:
for line in originalEpcReport: for line in originalEpcReport:
result = re.search('DS Tester Summary', line) result = re.search('Deployment Summary', line)
if (result is not None) and buildSummaryDone: if (result is not None) and buildSummaryDone:
newEpcReport.write(buildSummary) newEpcReport.write(buildSummary)
buildSummaryDone = False buildSummaryDone = False
...@@ -366,12 +366,13 @@ class HtmlReport(): ...@@ -366,12 +366,13 @@ class HtmlReport():
self.file.write(' </div>\n') self.file.write(' </div>\n')
def buildSummaryHeader(self): def buildSummaryHeader(self):
self.file.write(' <h2>Docker Image Build Summary</h2>\n') self.file.write(' <h2>Docker / Podman Image Build Summary</h2>\n')
self.file.write(' <table class="table-bordered" width = "100%" align = "center" border = "1">\n') self.file.write(' <table class="table-bordered" width = "100%" align = "center" border = "1">\n')
self.file.write(' <tr bgcolor="#33CCFF" >\n') self.file.write(' <tr bgcolor="#33CCFF" >\n')
self.file.write(' <th>Stage Name</th>\n') self.file.write(' <th>Stage Name</th>\n')
self.file.write(' <th>Image Kind</th>\n') self.file.write(' <th>Image Kind</th>\n')
self.file.write(' <th>OAI AMF cNF</th>\n') self.file.write(' <th>OAI AMF <font color="Gold">Ubuntu18</font> Image</th>\n')
self.file.write(' <th>OAI AMF <font color="Gold">RHEL8</font> Image</th>\n')
self.file.write(' </tr>\n') self.file.write(' </tr>\n')
def buildSummaryFooter(self): def buildSummaryFooter(self):
...@@ -401,42 +402,43 @@ class HtmlReport(): ...@@ -401,42 +402,43 @@ class HtmlReport():
def analyze_docker_build_git_part(self, nfType): def analyze_docker_build_git_part(self, nfType):
if nfType != 'AMF': if nfType != 'AMF':
self.file.write(' <td>N/A</td>\n') self.file.write(' <td>N/A</td>\n')
self.file.write(' <td>Wrong NF Type for this Report</td>\n') self.file.write(' <td colspan="2">Wrong NF Type for this Report</td>\n')
return return
logFileName = 'amf_docker_image_build.log'
self.file.write(' <td>Builder Image</td>\n') self.file.write(' <td>Builder Image</td>\n')
cwd = os.getcwd() cwd = os.getcwd()
if os.path.isfile(cwd + '/archives/' + logFileName): variants = ['docker', 'podman']
status = False for variant in variants:
section_start_pattern = 'git config --global http' logFileName = 'amf_' + variant + '_image_build.log'
section_end_pattern = 'WORKDIR /openair-amf/build/scripts' if os.path.isfile(cwd + '/archives/' + logFileName):
section_status = False status = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile: section_start_pattern = 'git config --global http'
for line in logfile: section_end_pattern = 'WORKDIR /openair-amf/build/scripts'
result = re.search(section_start_pattern, line) section_status = False
if result is not None: with open(cwd + '/archives/' + logFileName, 'r') as logfile:
section_status = True for line in logfile:
result = re.search(section_end_pattern, line) result = re.search(section_start_pattern, line)
if result is not None: if result is not None:
section_status = False section_status = True
status = True result = re.search(section_end_pattern, line)
logfile.close() if result is not None:
section_status = False
if status: status = True
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>' logfile.close()
cell_msg += 'OK:\n'
cell_msg += ' -- All Git Operations went successfully</b></pre></td>\n' if status:
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>'
cell_msg += 'OK:\n'
cell_msg += ' -- All Git Operations went successfully</b></pre></td>\n'
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO::\n'
cell_msg += ' -- Some Git Operations went WRONG</b></pre></td>\n'
else: else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>' cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO::\n' cell_msg += 'KO: logfile (' + logFileName + ') not found</b></pre></td>\n'
cell_msg += ' -- Some Git Operations went WRONG</b></pre></td>\n'
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO: logfile (' + logFileName + ') not found</b></pre></td>\n'
self.file.write(cell_msg) self.file.write(cell_msg)
def installLibsPackagesRow(self): def installLibsPackagesRow(self):
self.file.write(' <tr>\n') self.file.write(' <tr>\n')
...@@ -447,108 +449,110 @@ class HtmlReport(): ...@@ -447,108 +449,110 @@ class HtmlReport():
def analyze_install_log(self, nfType): def analyze_install_log(self, nfType):
if nfType != 'AMF': if nfType != 'AMF':
self.file.write(' <td>N/A</td>\n') self.file.write(' <td>N/A</td>\n')
self.file.write(' <td>Wrong NF Type for this Report</td>\n') self.file.write(' <td colspan="2">Wrong NF Type for this Report</td>\n')
return return
logFileName = 'amf_docker_image_build.log'
self.file.write(' <td>Builder Image</td>\n') self.file.write(' <td>Builder Image</td>\n')
cwd = os.getcwd() cwd = os.getcwd()
if os.path.isfile(cwd + '/archives/' + logFileName): variants = ['docker', 'podman']
status = False for variant in variants:
section_start_pattern = 'build_amf --install-deps --force' logFileName = 'spgwu_' + variant + '_image_build.log'
section_end_pattern = 'build_amf --clean --Verbose --build-type Release --jobs' if os.path.isfile(cwd + '/archives/' + logFileName):
section_status = False status = False
package_install = False section_start_pattern = 'build_amf --install-deps --force'
fmt_build_start = False section_end_pattern = 'build_amf --clean --Verbose --build-type Release --jobs'
fmt_build_status = False section_status = False
folly_build_start = False package_install = False
folly_build_status = False fmt_build_start = False
spdlog_build_start = False fmt_build_status = False
spdlog_build_status = False folly_build_start = False
pistache_build_start = False folly_build_status = False
pistache_build_status = False spdlog_build_start = False
json_build_start = False spdlog_build_status = False
json_build_status = False pistache_build_start = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile: pistache_build_status = False
for line in logfile: json_build_start = False
result = re.search(section_start_pattern, line) json_build_status = False
if result is not None: with open(cwd + '/archives/' + logFileName, 'r') as logfile:
section_status = True for line in logfile:
result = re.search(section_end_pattern, line) result = re.search(section_start_pattern, line)
if result is not None:
section_status = False
if section_status:
result = re.search('AMF deps installation successful', line)
if result is not None:
status = True
result = re.search('Install fmt from source', line)
if result is not None:
package_install = True
fmt_build_start = True
result = re.search('Installing: /usr/local/lib/pkgconfig/fmt.pc', line)
if result is not None:
fmt_build_status = True
result = re.search('Cloning into \'folly\'', line)
if result is not None:
folly_build_start = True
result = re.search('Installing: /usr/local/lib/libfollybenchmark.a', line)
if result is not None: if result is not None:
folly_build_status = True section_status = True
result = re.search('Install spdlog from', line) result = re.search(section_end_pattern, line)
if result is not None: if result is not None:
spdlog_build_start = True section_status = False
result = re.search('Install Pistache from', line) if section_status:
if result is not None: result = re.search('AMF deps installation successful', line)
spdlog_build_status = True if result is not None:
pistache_build_start = True status = True
result = re.search('Installing: /usr/local/lib/libpistache.a', line) result = re.search('Install fmt from source', line)
if result is not None: if result is not None:
pistache_build_status = True package_install = True
result = re.search('Install Nlohmann Json', line) fmt_build_start = True
if result is not None: result = re.search('Installing: /usr/local/lib/pkgconfig/fmt.pc', line)
json_build_status = True if result is not None:
result = re.search('Installing: /usr/local/lib/cmake/nlohmann_json/nlohmann_jsonTargets.cmake', line) fmt_build_status = True
if result is not None: result = re.search('Cloning into \'folly\'', line)
json_build_status = True if result is not None:
logfile.close() folly_build_start = True
if status: result = re.search('Installing: /usr/local/lib/libfollybenchmark.a', line)
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>' if result is not None:
cell_msg += 'OK:\n' folly_build_status = True
result = re.search('Install spdlog from', line)
if result is not None:
spdlog_build_start = True
result = re.search('Install Pistache from', line)
if result is not None:
spdlog_build_status = True
pistache_build_start = True
result = re.search('Installing: /usr/local/lib/libpistache.a', line)
if result is not None:
pistache_build_status = True
result = re.search('Install Nlohmann Json', line)
if result is not None:
json_build_status = True
result = re.search('Installing: /usr/local/lib/cmake/nlohmann_json/nlohmann_jsonTargets.cmake', line)
if result is not None:
json_build_status = True
logfile.close()
if status:
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>'
cell_msg += 'OK:\n'
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO:\n'
cell_msg += ' -- build_amf --install-deps --force\n'
if package_install:
cell_msg += ' ** Packages Installation: OK\n'
else:
cell_msg += ' ** Packages Installation: KO\n'
if fmt_build_status:
cell_msg += ' ** fmt Installation: OK\n'
else:
cell_msg += ' ** fmt Installation: KO\n'
if folly_build_status:
cell_msg += ' ** folly Installation: OK\n'
else:
cell_msg += ' ** folly Installation: KO\n'
if spdlog_build_status:
cell_msg += ' ** spdlog Installation: OK\n'
else:
cell_msg += ' ** spdlog Installation: KO\n'
if pistache_build_status:
cell_msg += ' ** pistache Installation: OK\n'
else:
cell_msg += ' ** pistache Installation: KO\n'
if json_build_status:
cell_msg += ' ** Nlohmann Json Installation: OK\n'
else:
cell_msg += ' ** Nlohmann Json Installation: KO\n'
cell_msg += '</b></pre></td>\n'
else: else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>' cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO:\n' cell_msg += 'KO: logfile (' + logFileName + ') not found</b></pre></td>\n'
cell_msg += ' -- build_amf --install-deps --force\n'
if package_install:
cell_msg += ' ** Packages Installation: OK\n'
else:
cell_msg += ' ** Packages Installation: KO\n'
if fmt_build_status:
cell_msg += ' ** fmt Installation: OK\n'
else:
cell_msg += ' ** fmt Installation: KO\n'
if folly_build_status:
cell_msg += ' ** folly Installation: OK\n'
else:
cell_msg += ' ** folly Installation: KO\n'
if spdlog_build_status:
cell_msg += ' ** spdlog Installation: OK\n'
else:
cell_msg += ' ** spdlog Installation: KO\n'
if pistache_build_status:
cell_msg += ' ** pistache Installation: OK\n'
else:
cell_msg += ' ** pistache Installation: KO\n'
if json_build_status:
cell_msg += ' ** Nlohmann Json Installation: OK\n'
else:
cell_msg += ' ** Nlohmann Json Installation: KO\n'
cell_msg += '</b></pre></td>\n'
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO: logfile (' + logFileName + ') not found</b></pre></td>\n'
self.file.write(cell_msg) self.file.write(cell_msg)
def buildCompileRows(self): def buildCompileRows(self):
self.file.write(' <tr>\n') self.file.write(' <tr>\n')
...@@ -563,47 +567,48 @@ class HtmlReport(): ...@@ -563,47 +567,48 @@ class HtmlReport():
if nfType != 'AMF': if nfType != 'AMF':
if imageKind: if imageKind:
self.file.write(' <td>N/A</td>\n') self.file.write(' <td>N/A</td>\n')
self.file.write(' <td>Wrong NF Type for this Report</td>\n') self.file.write(' <td colspan="2">Wrong NF Type for this Report</td>\n')
return return
if nfType == 'AMF':
logFileName = 'amf_docker_image_build.log'
if imageKind: if imageKind:
self.file.write(' <td>Builder Image</td>\n') self.file.write(' <td>Builder Image</td>\n')
cwd = os.getcwd() cwd = os.getcwd()
if os.path.isfile(cwd + '/archives/' + logFileName): variants = ['docker', 'podman']
status = False for variant in variants:
if nfType == 'AMF': logFileName = 'spgwu_' + variant + '_image_build.log'
section_start_pattern = 'build_amf --clean --Verbose --build-type Release --jobs' if os.path.isfile(cwd + '/archives/' + logFileName):
section_end_pattern = 'FROM ubuntu:bionic as oai-amf$' status = False
pass_pattern = 'amf installed' if nfType == 'AMF':
section_status = False section_start_pattern = 'build_amf --clean --Verbose --build-type Release --jobs'
with open(cwd + '/archives/' + logFileName, 'r') as logfile: section_end_pattern = 'FROM ubuntu:bionic as oai-amf$'
for line in logfile: pass_pattern = 'amf installed'
result = re.search(section_start_pattern, line) section_status = False
if result is not None: with open(cwd + '/archives/' + logFileName, 'r') as logfile:
section_status = True for line in logfile:
result = re.search(section_end_pattern, line) result = re.search(section_start_pattern, line)
if result is not None:
section_status = False
if section_status:
result = re.search(pass_pattern, line)
if result is not None: if result is not None:
status = True section_status = True
logfile.close() result = re.search(section_end_pattern, line)
if status: if result is not None:
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>' section_status = False
cell_msg += 'OK:\n' if section_status:
result = re.search(pass_pattern, line)
if result is not None:
status = True
logfile.close()
if status:
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>'
cell_msg += 'OK:\n'
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO:\n'
cell_msg += ' -- ' + section_start_pattern + '</b></pre></td>\n'
else: else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>' cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO:\n' cell_msg += 'KO: logfile (' + logFileName + ') not found</b></pre></td>\n'
cell_msg += ' -- ' + section_start_pattern + '</b></pre></td>\n'
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO: logfile (' + logFileName + ') not found</b></pre></td>\n'
self.file.write(cell_msg) self.file.write(cell_msg)
def analyze_compile_log(self, nfType, imageKind): def analyze_compile_log(self, nfType, imageKind):
if nfType != 'AMF': if nfType != 'AMF':
...@@ -612,59 +617,59 @@ class HtmlReport(): ...@@ -612,59 +617,59 @@ class HtmlReport():
self.file.write(' <td>Wrong NF Type for this Report</td>\n') self.file.write(' <td>Wrong NF Type for this Report</td>\n')
return return
if nfType == 'AMF':
logFileName = 'amf_docker_image_build.log'
if imageKind: if imageKind:
self.file.write(' <td>Builder Image</td>\n') self.file.write(' <td>Builder Image</td>\n')
cwd = os.getcwd() cwd = os.getcwd()
nb_errors = 0 variants = ['docker', 'podman']
nb_warnings = 0 for variant in variants:
logFileName = 'spgwu_' + variant + '_image_build.log'
if os.path.isfile(cwd + '/archives/' + logFileName): nb_errors = 0
if nfType == 'AMF': nb_warnings = 0
section_start_pattern = 'build_amf --clean --Verbose --build-type Release --jobs' if os.path.isfile(cwd + '/archives/' + logFileName):
section_end_pattern = 'FROM ubuntu:bionic as oai-amf$' if nfType == 'AMF':
section_status = False section_start_pattern = 'build_amf --clean --Verbose --build-type Release --jobs'
with open(cwd + '/archives/' + logFileName, 'r') as logfile: section_end_pattern = 'FROM ubuntu:bionic as oai-amf$'
for line in logfile: section_status = False
result = re.search(section_start_pattern, line) with open(cwd + '/archives/' + logFileName, 'r') as logfile:
if result is not None: for line in logfile:
section_status = True result = re.search(section_start_pattern, line)
result = re.search(section_end_pattern, line)
if result is not None:
section_status = False
if section_status:
result = re.search('error:', line)
if result is not None: if result is not None:
nb_errors += 1 section_status = True
result = re.search('warning:', line) result = re.search(section_end_pattern, line)
if result is not None: if result is not None:
correctLine = re.sub("^.*/openair-amf","/openair-amf",line.strip()) section_status = False
wordsList = correctLine.split(None,2) if section_status:
filename = re.sub(":[0-9]*:[0-9]*:","", wordsList[0]) result = re.search('error:', line)
linenumber = re.sub(filename + ':',"", wordsList[0]) if result is not None:
linenumber = re.sub(':[0-9]*:',"", linenumber) nb_errors += 1
error_warning_status = re.sub(':',"", wordsList[1]) result = re.search('warning:', line)
error_warning_msg = re.sub('^.*' + error_warning_status + ':', '', correctLine) if result is not None:
nb_warnings += 1 correctLine = re.sub("^.*/openair-amf","/openair-amf",line.strip())
self.warning_rows += '<tr><td>' + filename + '</td><td>' + linenumber + '</td><td>' + error_warning_status + '</td><td>' + error_warning_msg + '</td></tr>\n' wordsList = correctLine.split(None,2)
logfile.close() filename = re.sub(":[0-9]*:[0-9]*:","", wordsList[0])
if nb_warnings == 0 and nb_errors == 0: linenumber = re.sub(filename + ':',"", wordsList[0])
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>' linenumber = re.sub(':[0-9]*:',"", linenumber)
elif nb_warnings < 20 and nb_errors == 0: error_warning_status = re.sub(':',"", wordsList[1])
cell_msg = ' <td bgcolor="Orange"><pre style="border:none; background-color:Orange"><b>' error_warning_msg = re.sub('^.*' + error_warning_status + ':', '', correctLine)
nb_warnings += 1
self.warning_rows += '<tr><td>' + filename + '</td><td>' + linenumber + '</td><td>' + error_warning_status + '</td><td>' + error_warning_msg + '</td></tr>\n'
logfile.close()
if nb_warnings == 0 and nb_errors == 0:
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>'
elif nb_warnings < 20 and nb_errors == 0:
cell_msg = ' <td bgcolor="Orange"><pre style="border:none; background-color:Orange"><b>'
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
if nb_errors > 0:
cell_msg += str(nb_errors) + ' errors found in compile log\n'
cell_msg += str(nb_warnings) + ' warnings found in compile log</b></pre></td>\n'
self.nb_warnings = nb_warnings
else: else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>' cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
if nb_errors > 0: cell_msg += 'KO: logfile (' + logFileName + ') not found</b></pre></td>\n'
cell_msg += str(nb_errors) + ' errors found in compile log\n'
cell_msg += str(nb_warnings) + ' warnings found in compile log</b></pre></td>\n'
self.nb_warnings = nb_warnings
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO: logfile (' + logFileName + ') not found</b></pre></td>\n'
self.file.write(cell_msg) self.file.write(cell_msg)
def copyToTargetImage(self): def copyToTargetImage(self):
self.file.write(' <tr>\n') self.file.write(' <tr>\n')
...@@ -675,40 +680,42 @@ class HtmlReport(): ...@@ -675,40 +680,42 @@ class HtmlReport():
def analyze_copy_log(self, nfType): def analyze_copy_log(self, nfType):
if nfType != 'AMF': if nfType != 'AMF':
self.file.write(' <td>N/A</td>\n') self.file.write(' <td>N/A</td>\n')
self.file.write(' <td>Wrong NF Type for this Report</td>\n') self.file.write(' <td colspan="2">Wrong NF Type for this Report</td>\n')
return return
logFileName = 'amf_docker_image_build.log'
self.file.write(' <td>Target Image</td>\n') self.file.write(' <td>Target Image</td>\n')
cwd = os.getcwd() cwd = os.getcwd()
if os.path.isfile(cwd + '/archives/' + logFileName): variants = ['docker', 'podman']
section_start_pattern = 'FROM ubuntu:bionic as oai-amf$' for variant in variants:
section_end_pattern = 'WORKDIR /openair-amf/etc' logFileName = 'spgwu_' + variant + '_image_build.log'
section_status = False if os.path.isfile(cwd + '/archives/' + logFileName):
status = False section_start_pattern = 'FROM ubuntu:bionic as oai-amf$'
with open(cwd + '/archives/' + logFileName, 'r') as logfile: section_end_pattern = 'WORKDIR /openair-amf/etc'
for line in logfile: section_status = False
result = re.search(section_start_pattern, line) status = False
if result is not None: with open(cwd + '/archives/' + logFileName, 'r') as logfile:
section_status = True for line in logfile:
result = re.search(section_end_pattern, line) result = re.search(section_start_pattern, line)
if result is not None: if result is not None:
section_status = False section_status = True
status = True result = re.search(section_end_pattern, line)
logfile.close() if result is not None:
if status: section_status = False
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>' status = True
cell_msg += 'OK:\n' logfile.close()
if status:
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>'
cell_msg += 'OK:\n'
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO:\n'
cell_msg += '</b></pre></td>\n'
else: else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>' cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO:\n' cell_msg += 'KO: logfile (' + logFileName + ') not found</b></pre></td>\n'
cell_msg += '</b></pre></td>\n'
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO: logfile (' + logFileName + ') not found</b></pre></td>\n'
self.file.write(cell_msg) self.file.write(cell_msg)
def copyConfToolsToTargetImage(self): def copyConfToolsToTargetImage(self):
self.file.write(' <tr>\n') self.file.write(' <tr>\n')
...@@ -719,40 +726,42 @@ class HtmlReport(): ...@@ -719,40 +726,42 @@ class HtmlReport():
def analyze_copy_conf_tool_log(self, nfType): def analyze_copy_conf_tool_log(self, nfType):
if nfType != 'AMF': if nfType != 'AMF':
self.file.write(' <td>N/A</td>\n') self.file.write(' <td>N/A</td>\n')
self.file.write(' <td>Wrong NF Type for this Report</td>\n') self.file.write(' <td colspan="2">Wrong NF Type for this Report</td>\n')
return return
logFileName = 'amf_docker_image_build.log'
self.file.write(' <td>Target Image</td>\n') self.file.write(' <td>Target Image</td>\n')
cwd = os.getcwd() cwd = os.getcwd()
if os.path.isfile(cwd + '/archives/' + logFileName): variants = ['docker', 'podman']
section_start_pattern = 'WORKDIR /openair-amf/etc' for variant in variants:
section_end_pattern = 'Successfully tagged oai-amf' logFileName = 'spgwu_' + variant + '_image_build.log'
section_status = False if os.path.isfile(cwd + '/archives/' + logFileName):
status = False section_start_pattern = 'WORKDIR /openair-amf/etc'
with open(cwd + '/archives/' + logFileName, 'r') as logfile: section_end_pattern = 'Successfully tagged oai-amf'
for line in logfile: section_status = False
result = re.search(section_start_pattern, line) status = False
if result is not None: with open(cwd + '/archives/' + logFileName, 'r') as logfile:
section_status = True for line in logfile:
result = re.search(section_end_pattern, line) result = re.search(section_start_pattern, line)
if result is not None: if result is not None:
section_status = False section_status = True
status = True result = re.search(section_end_pattern, line)
logfile.close() if result is not None:
if status: section_status = False
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>' status = True
cell_msg += 'OK:\n' logfile.close()
if status:
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>'
cell_msg += 'OK:\n'
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO:\n'
cell_msg += '</b></pre></td>\n'
else: else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>' cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO:\n' cell_msg += 'KO: logfile (' + logFileName + ') not found</b></pre></td>\n'
cell_msg += '</b></pre></td>\n'
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO: logfile (' + logFileName + ') not found</b></pre></td>\n'
self.file.write(cell_msg) self.file.write(cell_msg)
def imageSizeRow(self): def imageSizeRow(self):
self.file.write(' <tr>\n') self.file.write(' <tr>\n')
...@@ -764,53 +773,54 @@ class HtmlReport(): ...@@ -764,53 +773,54 @@ class HtmlReport():
if nfType != 'AMF': if nfType != 'AMF':
if imageKind: if imageKind:
self.file.write(' <td>N/A</td>\n') self.file.write(' <td>N/A</td>\n')
self.file.write(' <td>Wrong NF Type for this Report</td>\n') self.file.write(' <td colspan="2">Wrong NF Type for this Report</td>\n')
return return
if nfType == 'AMF':
logFileName = 'amf_docker_image_build.log'
if imageKind: if imageKind:
self.file.write(' <td>Target Image</td>\n') self.file.write(' <td>Target Image</td>\n')
cwd = os.getcwd() cwd = os.getcwd()
if os.path.isfile(cwd + '/archives/' + logFileName): variants = ['docker', 'podman']
if nfType == 'AMF': for variant in variants:
section_start_pattern = 'Successfully tagged oai-amf' logFileName = 'spgwu_' + variant + '_image_build.log'
section_end_pattern = 'OAI-AMF DOCKER IMAGE BUILD' if os.path.isfile(cwd + '/archives/' + logFileName):
section_status = False if nfType == 'AMF':
status = False section_start_pattern = 'Successfully tagged oai-amf'
with open(cwd + '/archives/' + logFileName, 'r') as logfile: section_end_pattern = 'OAI-AMF DOCKER IMAGE BUILD'
for line in logfile: section_status = False
result = re.search(section_start_pattern, line) status = False
if result is not None: with open(cwd + '/archives/' + logFileName, 'r') as logfile:
section_status = True for line in logfile:
result = re.search(section_end_pattern, line) result = re.search(section_start_pattern, line)
if result is not None:
section_status = False
if section_status:
if nfType == 'AMF':
if self.git_pull_request:
result = re.search('oai-amf *ci-tmp', line)
else:
result = re.search('oai-amf *develop', line)
if result is not None: if result is not None:
result = re.search('ago *([0-9A-Z]+)', line) section_status = True
result = re.search(section_end_pattern, line)
if result is not None:
section_status = False
if section_status:
if nfType == 'AMF':
if self.git_pull_request:
result = re.search('oai-amf *ci-tmp', line)
else:
result = re.search('oai-amf *develop', line)
if result is not None: if result is not None:
size = result.group(1) result = re.search('ago *([0-9A-Z]+)', line)
status = True if result is not None:
logfile.close() size = result.group(1)
if status: status = True
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>' logfile.close()
cell_msg += 'OK: ' + size + '\n' if status:
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>'
cell_msg += 'OK: ' + size + '\n'
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO:\n'
cell_msg += '</b></pre></td>\n'
else: else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>' cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO:\n' cell_msg += 'KO: logfile (' + logFileName + ') not found</b></pre></td>\n'
cell_msg += '</b></pre></td>\n'
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO: logfile (' + logFileName + ') not found</b></pre></td>\n'
self.file.write(cell_msg) self.file.write(cell_msg)
def Usage(): def Usage():
print('----------------------------------------------------------------------------------------------------------------------') print('----------------------------------------------------------------------------------------------------------------------')
......
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