summaryrefslogtreecommitdiffstats
path: root/utils/test/reporting/functest
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-10-11 06:55:01 +0000
committerGerrit Code Review <gerrit@opnfv.org>2016-10-11 06:55:01 +0000
commit86e7153ddd6e6d7bf47955c8b82e7c5a8ede492e (patch)
tree3e115100d87b4328eff103ccce8d0d3c7218e6e8 /utils/test/reporting/functest
parent305b6650d3ed35dd0d15bb26243663f6fd759aa8 (diff)
parent7ce2f3e07d0b07db2cb3e768494254a478edb82d (diff)
Merge "Add export functions to reporting"
Diffstat (limited to 'utils/test/reporting/functest')
-rwxr-xr-xutils/test/reporting/functest/reporting-status.py44
-rw-r--r--utils/test/reporting/functest/template/index-status-tmpl.html3
2 files changed, 39 insertions, 8 deletions
diff --git a/utils/test/reporting/functest/reporting-status.py b/utils/test/reporting/functest/reporting-status.py
index 9df699629..b527b7861 100755
--- a/utils/test/reporting/functest/reporting-status.py
+++ b/utils/test/reporting/functest/reporting-status.py
@@ -8,6 +8,7 @@
#
import datetime
import jinja2
+import pdfkit
import requests
import sys
import time
@@ -186,8 +187,7 @@ for version in conf.versions:
s_score = str(scenario_score) + "/" + str(scenario_criteria)
s_score_percent = 0.0
try:
- s_score_percent = float(
- scenario_score) / float(scenario_criteria) * 100
+ s_score_percent = float(scenario_score) / float(scenario_criteria) * 100
except:
logger.error("cannot calculate the score percent")
@@ -200,7 +200,7 @@ for version in conf.versions:
logger.info(">>>>> scenario OK, save the information")
s_status = "OK"
path_validation_file = (conf.REPORTING_PATH +
- "/release/" + version +
+ "/functest/release/" + version +
"/validated_scenario_history.txt")
with open(path_validation_file, "a") as f:
time_format = "%Y-%m-%d %H:%M"
@@ -210,7 +210,7 @@ for version in conf.versions:
# Save daily results in a file
path_validation_file = (conf.REPORTING_PATH +
- "/release/" + version +
+ "/functest/release/" + version +
"/scenario_history.txt")
with open(path_validation_file, "a") as f:
info = (reportingDate + "," + s + "," + installer +
@@ -228,7 +228,7 @@ for version in conf.versions:
templateEnv = jinja2.Environment(
loader=templateLoader, autoescape=True)
- TEMPLATE_FILE = "/template/index-status-tmpl.html"
+ TEMPLATE_FILE = "/functest/template/index-status-tmpl.html"
template = templateEnv.get_template(TEMPLATE_FILE)
outputText = template.render(scenario_stats=scenario_stats,
@@ -239,6 +239,34 @@ for version in conf.versions:
version=version,
date=reportingDate)
- with open(conf.REPORTING_PATH + "/release/" + version +
- "/index-status-" + installer + ".html", "wb") as fh:
- fh.write(outputText)
+ with open(conf.REPORTING_PATH + "/functest/release/" + version +
+ "/index-status-" + installer + ".html", "wb") as fh:
+ fh.write(outputText)
+
+ # Generate outputs for export
+ # pdf
+ try:
+ pdf_path = ("http://testresults.opnfv.org/reporting/" +
+ "functest/release/" + version +
+ "/index-status-" + installer + ".html")
+ pdf_doc_name = (conf.REPORTING_PATH +
+ "/functest/release/" + version +
+ "/status-" + installer + ".pdf")
+ pdfkit.from_url(pdf_path, pdf_doc_name)
+ except IOError:
+ logger.info("pdf generated anyway...")
+ except:
+ logger.error("impossible to generate PDF")
+ # csv
+ # generate sub files based on scenario_history.txt
+ scenario_installer_file_name = (conf.REPORTING_PATH +
+ "/functest/release/" + version +
+ "/scenario_history_" +
+ installer + ".txt")
+ scenario_installer_file = open(scenario_installer_file_name, "w")
+
+ with open(path_validation_file, "r") as f:
+ for line in f:
+ if installer in line:
+ scenario_installer_file.write(line)
+ scenario_installer_file.close
diff --git a/utils/test/reporting/functest/template/index-status-tmpl.html b/utils/test/reporting/functest/template/index-status-tmpl.html
index 2beb9128e..e3c9c5fc0 100644
--- a/utils/test/reporting/functest/template/index-status-tmpl.html
+++ b/utils/test/reporting/functest/template/index-status-tmpl.html
@@ -148,6 +148,9 @@ $(document).ready(function (){
</div>
{%- endfor %}
see <a href="https://wiki.opnfv.org/pages/viewpage.action?pageId=6828617">Functest scoring wiki page</a> for details on scenario scoring
+ <div> <br>
+ <a href="./status-{{installer}}.pdf" class="myButtonPdf">Export to PDF</a> <a href="./scenario_history_{{installer}}.txt" class="myButtonCSV">Export to CSV</a>
+ </div>
</div>
<div class="col-md-1"></div>
</div>