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;
+}
+
#
import datetime
import jinja2
+import pdfkit
import requests
import sys
import time
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")
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"
# 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 +
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,
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