summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-10-10 10:32:07 +0200
committerMorgan Richomme <morgan.richomme@orange.com>2016-10-10 10:34:48 +0200
commit7ce2f3e07d0b07db2cb3e768494254a478edb82d (patch)
tree8c43f1176d60d7e219637f8c7a6b559ad0aec4bf
parent54a2a98912a79aaaedd9a3a15b569c80455ed389 (diff)
Add export functions to reporting
JIRA: FUNCTEST-486 Change-Id: I84ad52f12097bbc5976c754d28ebc76d49b1eff2 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
-rw-r--r--utils/test/reporting/css/default.css84
-rwxr-xr-xutils/test/reporting/functest/reporting-status.py44
-rw-r--r--utils/test/reporting/functest/template/index-status-tmpl.html3
3 files changed, 123 insertions, 8 deletions
diff --git a/utils/test/reporting/css/default.css b/utils/test/reporting/css/default.css
index a9fa69db7..e32fa5fba 100644
--- a/utils/test/reporting/css/default.css
+++ b/utils/test/reporting/css/default.css
@@ -108,3 +108,87 @@ h2 {
stroke: steelblue;
stroke-width: 1.5px;
}
+
+.myButtonPdf {
+ -moz-box-shadow:inset 0px 1px 0px 0px #f29c93;
+ -webkit-box-shadow:inset 0px 1px 0px 0px #f29c93;
+ box-shadow:inset 0px 1px 0px 0px #f29c93;
+ background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #fe1a00), color-stop(1, #ce0100));
+ background:-moz-linear-gradient(top, #fe1a00 5%, #ce0100 100%);
+ background:-webkit-linear-gradient(top, #fe1a00 5%, #ce0100 100%);
+ background:-o-linear-gradient(top, #fe1a00 5%, #ce0100 100%);
+ background:-ms-linear-gradient(top, #fe1a00 5%, #ce0100 100%);
+ background:linear-gradient(to bottom, #fe1a00 5%, #ce0100 100%);
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fe1a00', endColorstr='#ce0100',GradientType=0);
+ background-color:#fe1a00;
+ -moz-border-radius:6px;
+ -webkit-border-radius:6px;
+ border-radius:6px;
+ border:1px solid #d83526;
+ display:inline-block;
+ cursor:pointer;
+ color:#ffffff;
+ font-family:Arial;
+ font-size:15px;
+ font-weight:bold;
+ padding:6px 24px;
+ text-decoration:none;
+ text-shadow:0px 1px 0px #b23e35;
+}
+.myButtonPdf:hover {
+ background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ce0100), color-stop(1, #fe1a00));
+ background:-moz-linear-gradient(top, #ce0100 5%, #fe1a00 100%);
+ background:-webkit-linear-gradient(top, #ce0100 5%, #fe1a00 100%);
+ background:-o-linear-gradient(top, #ce0100 5%, #fe1a00 100%);
+ background:-ms-linear-gradient(top, #ce0100 5%, #fe1a00 100%);
+ background:linear-gradient(to bottom, #ce0100 5%, #fe1a00 100%);
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ce0100', endColorstr='#fe1a00',GradientType=0);
+ background-color:#ce0100;
+}
+.myButtonPdf:active {
+ position:relative;
+ top:1px;
+}
+
+
+.myButtonCSV {
+ -moz-box-shadow:inset 0px 1px 0px 0px #bbdaf7;
+ -webkit-box-shadow:inset 0px 1px 0px 0px #bbdaf7;
+ box-shadow:inset 0px 1px 0px 0px #bbdaf7;
+ background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #79bbff), color-stop(1, #378de5));
+ background:-moz-linear-gradient(top, #79bbff 5%, #378de5 100%);
+ background:-webkit-linear-gradient(top, #79bbff 5%, #378de5 100%);
+ background:-o-linear-gradient(top, #79bbff 5%, #378de5 100%);
+ background:-ms-linear-gradient(top, #79bbff 5%, #378de5 100%);
+ background:linear-gradient(to bottom, #79bbff 5%, #378de5 100%);
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#79bbff', endColorstr='#378de5',GradientType=0);
+ background-color:#79bbff;
+ -moz-border-radius:6px;
+ -webkit-border-radius:6px;
+ border-radius:6px;
+ border:1px solid #84bbf3;
+ display:inline-block;
+ cursor:pointer;
+ color:#ffffff;
+ font-family:Arial;
+ font-size:15px;
+ font-weight:bold;
+ padding:6px 24px;
+ text-decoration:none;
+ text-shadow:0px 1px 0px #528ecc;
+}
+.myButtonCSV:hover {
+ background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #378de5), color-stop(1, #79bbff));
+ background:-moz-linear-gradient(top, #378de5 5%, #79bbff 100%);
+ background:-webkit-linear-gradient(top, #378de5 5%, #79bbff 100%);
+ background:-o-linear-gradient(top, #378de5 5%, #79bbff 100%);
+ background:-ms-linear-gradient(top, #378de5 5%, #79bbff 100%);
+ background:linear-gradient(to bottom, #378de5 5%, #79bbff 100%);
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#378de5', endColorstr='#79bbff',GradientType=0);
+ background-color:#378de5;
+}
+.myButtonCSV:active {
+ position:relative;
+ top:1px;
+}
+
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>