summaryrefslogtreecommitdiffstats
path: root/utils/test/reporting
diff options
context:
space:
mode:
Diffstat (limited to 'utils/test/reporting')
-rw-r--r--utils/test/reporting/functest/img/gauge_0.pngbin0 -> 3644 bytes
-rw-r--r--utils/test/reporting/functest/img/gauge_100.pngbin0 -> 3191 bytes
-rw-r--r--utils/test/reporting/functest/img/gauge_16.7.pngbin0 -> 3170 bytes
-rw-r--r--utils/test/reporting/functest/img/gauge_25.pngbin0 -> 3108 bytes
-rw-r--r--utils/test/reporting/functest/img/gauge_33.3.pngbin0 -> 3081 bytes
-rw-r--r--utils/test/reporting/functest/img/gauge_41.7.pngbin0 -> 3169 bytes
-rw-r--r--utils/test/reporting/functest/img/gauge_50.pngbin0 -> 3123 bytes
-rw-r--r--utils/test/reporting/functest/img/gauge_58.3.pngbin0 -> 3161 bytes
-rw-r--r--utils/test/reporting/functest/img/gauge_66.7.pngbin0 -> 3069 bytes
-rw-r--r--utils/test/reporting/functest/img/gauge_75.pngbin0 -> 3030 bytes
-rw-r--r--utils/test/reporting/functest/img/gauge_8.3.pngbin0 -> 2993 bytes
-rw-r--r--utils/test/reporting/functest/img/gauge_83.3.pngbin0 -> 3122 bytes
-rw-r--r--utils/test/reporting/functest/img/gauge_91.7.pngbin0 -> 3008 bytes
-rwxr-xr-xutils/test/reporting/functest/reporting-status.py45
-rw-r--r--utils/test/reporting/functest/reportingConf.py4
-rw-r--r--utils/test/reporting/functest/reportingUtils.py20
-rw-r--r--utils/test/reporting/functest/scenarioResult.py11
-rw-r--r--utils/test/reporting/functest/template/index-status-tmpl.html42
-rw-r--r--utils/test/reporting/yardstick/img/gauge_0.pngbin0 -> 3644 bytes
-rw-r--r--utils/test/reporting/yardstick/img/gauge_100.pngbin0 -> 3191 bytes
-rw-r--r--utils/test/reporting/yardstick/img/gauge_16.7.pngbin0 -> 3170 bytes
-rw-r--r--utils/test/reporting/yardstick/img/gauge_25.pngbin0 -> 3108 bytes
-rw-r--r--utils/test/reporting/yardstick/img/gauge_33.3.pngbin0 -> 3081 bytes
-rw-r--r--utils/test/reporting/yardstick/img/gauge_41.7.pngbin0 -> 3169 bytes
-rw-r--r--utils/test/reporting/yardstick/img/gauge_50.pngbin0 -> 3123 bytes
-rw-r--r--utils/test/reporting/yardstick/img/gauge_58.3.pngbin0 -> 3161 bytes
-rw-r--r--utils/test/reporting/yardstick/img/gauge_66.7.pngbin0 -> 3069 bytes
-rw-r--r--utils/test/reporting/yardstick/img/gauge_75.pngbin0 -> 3030 bytes
-rw-r--r--utils/test/reporting/yardstick/img/gauge_8.3.pngbin0 -> 2993 bytes
-rw-r--r--utils/test/reporting/yardstick/img/gauge_83.3.pngbin0 -> 3122 bytes
-rw-r--r--utils/test/reporting/yardstick/img/gauge_91.7.pngbin0 -> 3008 bytes
-rw-r--r--utils/test/reporting/yardstick/reporting-status.py35
-rw-r--r--utils/test/reporting/yardstick/reportingConf.py5
-rw-r--r--utils/test/reporting/yardstick/reportingUtils.py48
-rw-r--r--utils/test/reporting/yardstick/scenarioResult.py12
-rw-r--r--utils/test/reporting/yardstick/scenarios.py20
-rw-r--r--utils/test/reporting/yardstick/template/index-status-tmpl.html14
37 files changed, 203 insertions, 53 deletions
diff --git a/utils/test/reporting/functest/img/gauge_0.png b/utils/test/reporting/functest/img/gauge_0.png
new file mode 100644
index 000000000..ecefc0e66
--- /dev/null
+++ b/utils/test/reporting/functest/img/gauge_0.png
Binary files differ
diff --git a/utils/test/reporting/functest/img/gauge_100.png b/utils/test/reporting/functest/img/gauge_100.png
new file mode 100644
index 000000000..e199e1561
--- /dev/null
+++ b/utils/test/reporting/functest/img/gauge_100.png
Binary files differ
diff --git a/utils/test/reporting/functest/img/gauge_16.7.png b/utils/test/reporting/functest/img/gauge_16.7.png
new file mode 100644
index 000000000..3e3993c3b
--- /dev/null
+++ b/utils/test/reporting/functest/img/gauge_16.7.png
Binary files differ
diff --git a/utils/test/reporting/functest/img/gauge_25.png b/utils/test/reporting/functest/img/gauge_25.png
new file mode 100644
index 000000000..4923659b9
--- /dev/null
+++ b/utils/test/reporting/functest/img/gauge_25.png
Binary files differ
diff --git a/utils/test/reporting/functest/img/gauge_33.3.png b/utils/test/reporting/functest/img/gauge_33.3.png
new file mode 100644
index 000000000..364574b4a
--- /dev/null
+++ b/utils/test/reporting/functest/img/gauge_33.3.png
Binary files differ
diff --git a/utils/test/reporting/functest/img/gauge_41.7.png b/utils/test/reporting/functest/img/gauge_41.7.png
new file mode 100644
index 000000000..8c3e910fa
--- /dev/null
+++ b/utils/test/reporting/functest/img/gauge_41.7.png
Binary files differ
diff --git a/utils/test/reporting/functest/img/gauge_50.png b/utils/test/reporting/functest/img/gauge_50.png
new file mode 100644
index 000000000..2874b9fcf
--- /dev/null
+++ b/utils/test/reporting/functest/img/gauge_50.png
Binary files differ
diff --git a/utils/test/reporting/functest/img/gauge_58.3.png b/utils/test/reporting/functest/img/gauge_58.3.png
new file mode 100644
index 000000000..beedc8aa9
--- /dev/null
+++ b/utils/test/reporting/functest/img/gauge_58.3.png
Binary files differ
diff --git a/utils/test/reporting/functest/img/gauge_66.7.png b/utils/test/reporting/functest/img/gauge_66.7.png
new file mode 100644
index 000000000..93f44d133
--- /dev/null
+++ b/utils/test/reporting/functest/img/gauge_66.7.png
Binary files differ
diff --git a/utils/test/reporting/functest/img/gauge_75.png b/utils/test/reporting/functest/img/gauge_75.png
new file mode 100644
index 000000000..9fc261ff8
--- /dev/null
+++ b/utils/test/reporting/functest/img/gauge_75.png
Binary files differ
diff --git a/utils/test/reporting/functest/img/gauge_8.3.png b/utils/test/reporting/functest/img/gauge_8.3.png
new file mode 100644
index 000000000..59f86571e
--- /dev/null
+++ b/utils/test/reporting/functest/img/gauge_8.3.png
Binary files differ
diff --git a/utils/test/reporting/functest/img/gauge_83.3.png b/utils/test/reporting/functest/img/gauge_83.3.png
new file mode 100644
index 000000000..27ae4ec54
--- /dev/null
+++ b/utils/test/reporting/functest/img/gauge_83.3.png
Binary files differ
diff --git a/utils/test/reporting/functest/img/gauge_91.7.png b/utils/test/reporting/functest/img/gauge_91.7.png
new file mode 100644
index 000000000..280865714
--- /dev/null
+++ b/utils/test/reporting/functest/img/gauge_91.7.png
Binary files differ
diff --git a/utils/test/reporting/functest/reporting-status.py b/utils/test/reporting/functest/reporting-status.py
index 0b80fe49a..90699bd61 100755
--- a/utils/test/reporting/functest/reporting-status.py
+++ b/utils/test/reporting/functest/reporting-status.py
@@ -24,6 +24,7 @@ logger = utils.getLogger("Status")
# Initialization
testValid = []
otherTestCases = []
+reportingDate = datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
# init just tempest to get the list of scenarios
# as all the scenarios run Tempest
@@ -82,18 +83,26 @@ for version in conf.versions:
# For all the scenarios get results
for s, s_result in scenario_results.items():
+ logger.info("---------------------------------")
+ logger.info("installer %s, version %s, scenario %s:" %
+ (installer, version, s))
+ logger.debug("Scenario results: %s" % s_result)
+
# Green or Red light for a given scenario
nb_test_runnable_for_this_scenario = 0
scenario_score = 0
-
+ # url of the last jenkins log corresponding to a given
+ # scenario
+ s_url = ""
+ if len(s_result) > 0:
+ build_tag = s_result[len(s_result)-1]['build_tag']
+ logger.debug("Build tag: %s" % build_tag)
+ s_url = s_url = utils.getJenkinsUrl(build_tag)
+ logger.info("last jenkins url: %s" % s_url)
testCases2BeDisplayed = []
# Check if test case is runnable / installer, scenario
# for the test case used for Scenario validation
try:
- logger.info("---------------------------------")
- logger.info("installer %s, version %s, scenario %s:" %
- (installer, version, s))
-
# 1) Manage the test cases for the scenario validation
# concretely Tiers 0-3
for test_case in testValid:
@@ -175,6 +184,8 @@ for version in conf.versions:
scenario_criteria = conf.MAX_SCENARIO_CRITERIA
s_score = str(scenario_score) + "/" + str(scenario_criteria)
+ s_score_percent = float(
+ scenario_score) / float(scenario_criteria) * 100
s_status = "KO"
if scenario_score < scenario_criteria:
logger.info(">>>> scenario not OK, score = %s/%s" %
@@ -183,7 +194,8 @@ for version in conf.versions:
else:
logger.info(">>>>> scenario OK, save the information")
s_status = "OK"
- path_validation_file = (conf.REPORTING_PATH + "/release/" + version +
+ path_validation_file = (conf.REPORTING_PATH +
+ "/release/" + version +
"/validated_scenario_history.txt")
with open(path_validation_file, "a") as f:
time_format = "%Y-%m-%d %H:%M"
@@ -191,11 +203,25 @@ for version in conf.versions:
";" + installer + ";" + s + "\n")
f.write(info)
- scenario_result_criteria[s] = sr.ScenarioResult(s_status, s_score)
+ # Save daily results in a file
+ path_validation_file = (conf.REPORTING_PATH +
+ "/release/" + version +
+ "/scenario_history.txt")
+ with open(path_validation_file, "a") as f:
+ info = (reportingDate + "," + s + "," + installer +
+ "," + s_score + "," +
+ str(round(s_score_percent)) + "\n")
+ f.write(info)
+
+ scenario_result_criteria[s] = sr.ScenarioResult(s_status,
+ s_score,
+ s_score_percent,
+ s_url)
logger.info("--------------------------")
templateLoader = jinja2.FileSystemLoader(conf.REPORTING_PATH)
- templateEnv = jinja2.Environment(loader=templateLoader, autoescape=True)
+ templateEnv = jinja2.Environment(
+ loader=templateLoader, autoescape=True)
TEMPLATE_FILE = "/template/index-status-tmpl.html"
template = templateEnv.get_template(TEMPLATE_FILE)
@@ -205,7 +231,8 @@ for version in conf.versions:
items=items,
installer=installer,
period=conf.PERIOD,
- version=version)
+ version=version,
+ date=reportingDate)
with open(conf.REPORTING_PATH + "/release/" + version +
"/index-status-" + installer + ".html", "wb") as fh:
diff --git a/utils/test/reporting/functest/reportingConf.py b/utils/test/reporting/functest/reportingConf.py
index b0e4cf7a1..e1c4b61a8 100644
--- a/utils/test/reporting/functest/reportingConf.py
+++ b/utils/test/reporting/functest/reportingConf.py
@@ -12,10 +12,10 @@
installers = ["apex", "compass", "fuel", "joid"]
# list of test cases declared in testcases.yaml but that must not be
# taken into account for the scoring
-blacklist = ["ovno", "security_scan", 'odl-sfc']
+blacklist = ["ovno", "security_scan"]
# versions = ["brahmaputra", "master"]
versions = ["master", "colorado"]
-PERIOD = 50
+PERIOD = 10
MAX_SCENARIO_CRITERIA = 50
# get the last 5 test results to determinate the success criteria
NB_TESTS = 5
diff --git a/utils/test/reporting/functest/reportingUtils.py b/utils/test/reporting/functest/reportingUtils.py
index f02620430..9ba02e821 100644
--- a/utils/test/reporting/functest/reportingUtils.py
+++ b/utils/test/reporting/functest/reportingUtils.py
@@ -139,7 +139,7 @@ def getResult(testCase, installer, scenario, version):
# print "Nb test OK (last 10 days):"+ str(nbTestOk)
# check that we have at least 4 runs
if len(scenario_results) < 1:
- # No results available
+ # No results available
test_result_indicator = -1
elif nbTestOk < 1:
test_result_indicator = 0
@@ -158,3 +158,21 @@ def getResult(testCase, installer, scenario, version):
else:
test_result_indicator = 2
return test_result_indicator
+
+
+def getJenkinsUrl(build_tag):
+ # e.g. jenkins-functest-apex-apex-daily-colorado-daily-colorado-246
+ # id = 246
+ # note it is linked to jenkins format
+ # if this format changes...function to be adapted....
+ url_base = "https://build.opnfv.org/ci/view/functest/job/"
+ jenkins_url = ""
+ try:
+ build_id = [int(s) for s in build_tag.split("-") if s.isdigit()]
+ jenkins_path = filter(lambda c: not c.isdigit(), build_tag)
+ url_id = jenkins_path[8:-1] + "/" + str(build_id[0])
+ jenkins_url = url_base + url_id + "/console"
+ except:
+ print 'Impossible to get jenkins url:'
+
+ return jenkins_url
diff --git a/utils/test/reporting/functest/scenarioResult.py b/utils/test/reporting/functest/scenarioResult.py
index 743346adc..5a54eed96 100644
--- a/utils/test/reporting/functest/scenarioResult.py
+++ b/utils/test/reporting/functest/scenarioResult.py
@@ -9,12 +9,21 @@
class ScenarioResult(object):
- def __init__(self, status, score=0):
+
+ def __init__(self, status, score=0, score_percent=0, url_lastrun=''):
self.status = status
self.score = score
+ self.score_percent = score_percent
+ self.url_lastrun = url_lastrun
def getStatus(self):
return self.status
def getScore(self):
return self.score
+
+ def getScorePercent(self):
+ return self.score_percent
+
+ def getUrlLastRun(self):
+ return self.url_lastrun
diff --git a/utils/test/reporting/functest/template/index-status-tmpl.html b/utils/test/reporting/functest/template/index-status-tmpl.html
index da2213bc0..67c23491a 100644
--- a/utils/test/reporting/functest/template/index-status-tmpl.html
+++ b/utils/test/reporting/functest/template/index-status-tmpl.html
@@ -18,7 +18,7 @@
<body>
<div class="container">
<div class="masthead">
- <h3 class="text-muted">Functest status page ({{version}})</h3>
+ <h3 class="text-muted">Functest status page ({{version}}, {{date}})</h3>
<nav>
<ul class="nav nav-justified">
<li class="active"><a href="http://testresults.opnfv.org/reporting/index.html">Home</a></li>
@@ -47,12 +47,34 @@
</tr>
{% for scenario,iteration in scenario_stats.iteritems() -%}
<tr class="tr-ok">
- <td>{{scenario}}</td>
- <td>{%if scenario_results[scenario].getStatus() is sameas "OK" -%}
- <img src="../../img/icon-ok.png">
- {%- else -%}
- <img src="../../img/icon-nok.png">
- {%- endif %}</td>
+ <td><a href={{scenario_results[scenario].getUrlLastRun()}}>{{scenario}}</a></td>
+ <td>{%if scenario_results[scenario].getScorePercent() < 8.3 -%}
+ <img src="../../img/gauge_0.png">
+ {%elif scenario_results[scenario].getScorePercent() < 16.7 -%}
+ <img src="../../img/gauge_8.3.png">
+ {%elif scenario_results[scenario].getScorePercent() < 25 -%}
+ <img src="../../img/gauge_16.7.png">
+ {%elif scenario_results[scenario].getScorePercent() < 33.3 -%}
+ <img src="../../img/gauge_25.png">
+ {%elif scenario_results[scenario].getScorePercent() < 41.7 -%}
+ <img src="../../img/gauge_33.3.png">
+ {%elif scenario_results[scenario].getScorePercent() < 50 -%}
+ <img src="../../img/gauge_41.7.png">
+ {%elif scenario_results[scenario].getScorePercent() < 58.3 -%}
+ <img src="../../img/gauge_50.png">
+ {%elif scenario_results[scenario].getScorePercent() < 66.7 -%}
+ <img src="../../img/gauge_58.3.png">
+ {%elif scenario_results[scenario].getScorePercent() < 75 -%}
+ <img src="../../img/gauge_66.7.png">
+ {%elif scenario_results[scenario].getScorePercent() < 83.3 -%}
+ <img src="../../img/gauge_75.png">
+ {%elif scenario_results[scenario].getScorePercent() < 91.7 -%}
+ <img src="../../img/gauge_83.3.png">
+ {%elif scenario_results[scenario].getScorePercent() < 100 -%}
+ <img src="../../img/gauge_91.7.png">
+ {%- else -%}
+ <img src="../../img/gauge_100.png">
+ {%- endif %}</td>
<td>{{scenario_results[scenario].getScore()}}</td>
<td>{{iteration}}</td>
</tr>
@@ -78,14 +100,14 @@
{% if test.getCriteria() > -1 -%}
{{test.getDisplayName() }}
{%- endif %}
- {% if test.getTier() > 3 -%}
+ {% if test.getTier() > 3 -%}
*
{%- endif %}
- </th>
+ </th>
{%- endfor %}
</tr>
<tr class="tr-weather-weather">
- {% for test in items[scenario] -%}
+ {% for test in items[scenario] -%}
{% if test.getCriteria() > 2 -%}
<td><img src="../../img/weather-clear.png"></td>
{%- elif test.getCriteria() > 1 -%}
diff --git a/utils/test/reporting/yardstick/img/gauge_0.png b/utils/test/reporting/yardstick/img/gauge_0.png
new file mode 100644
index 000000000..ecefc0e66
--- /dev/null
+++ b/utils/test/reporting/yardstick/img/gauge_0.png
Binary files differ
diff --git a/utils/test/reporting/yardstick/img/gauge_100.png b/utils/test/reporting/yardstick/img/gauge_100.png
new file mode 100644
index 000000000..e199e1561
--- /dev/null
+++ b/utils/test/reporting/yardstick/img/gauge_100.png
Binary files differ
diff --git a/utils/test/reporting/yardstick/img/gauge_16.7.png b/utils/test/reporting/yardstick/img/gauge_16.7.png
new file mode 100644
index 000000000..3e3993c3b
--- /dev/null
+++ b/utils/test/reporting/yardstick/img/gauge_16.7.png
Binary files differ
diff --git a/utils/test/reporting/yardstick/img/gauge_25.png b/utils/test/reporting/yardstick/img/gauge_25.png
new file mode 100644
index 000000000..4923659b9
--- /dev/null
+++ b/utils/test/reporting/yardstick/img/gauge_25.png
Binary files differ
diff --git a/utils/test/reporting/yardstick/img/gauge_33.3.png b/utils/test/reporting/yardstick/img/gauge_33.3.png
new file mode 100644
index 000000000..364574b4a
--- /dev/null
+++ b/utils/test/reporting/yardstick/img/gauge_33.3.png
Binary files differ
diff --git a/utils/test/reporting/yardstick/img/gauge_41.7.png b/utils/test/reporting/yardstick/img/gauge_41.7.png
new file mode 100644
index 000000000..8c3e910fa
--- /dev/null
+++ b/utils/test/reporting/yardstick/img/gauge_41.7.png
Binary files differ
diff --git a/utils/test/reporting/yardstick/img/gauge_50.png b/utils/test/reporting/yardstick/img/gauge_50.png
new file mode 100644
index 000000000..2874b9fcf
--- /dev/null
+++ b/utils/test/reporting/yardstick/img/gauge_50.png
Binary files differ
diff --git a/utils/test/reporting/yardstick/img/gauge_58.3.png b/utils/test/reporting/yardstick/img/gauge_58.3.png
new file mode 100644
index 000000000..beedc8aa9
--- /dev/null
+++ b/utils/test/reporting/yardstick/img/gauge_58.3.png
Binary files differ
diff --git a/utils/test/reporting/yardstick/img/gauge_66.7.png b/utils/test/reporting/yardstick/img/gauge_66.7.png
new file mode 100644
index 000000000..93f44d133
--- /dev/null
+++ b/utils/test/reporting/yardstick/img/gauge_66.7.png
Binary files differ
diff --git a/utils/test/reporting/yardstick/img/gauge_75.png b/utils/test/reporting/yardstick/img/gauge_75.png
new file mode 100644
index 000000000..9fc261ff8
--- /dev/null
+++ b/utils/test/reporting/yardstick/img/gauge_75.png
Binary files differ
diff --git a/utils/test/reporting/yardstick/img/gauge_8.3.png b/utils/test/reporting/yardstick/img/gauge_8.3.png
new file mode 100644
index 000000000..59f86571e
--- /dev/null
+++ b/utils/test/reporting/yardstick/img/gauge_8.3.png
Binary files differ
diff --git a/utils/test/reporting/yardstick/img/gauge_83.3.png b/utils/test/reporting/yardstick/img/gauge_83.3.png
new file mode 100644
index 000000000..27ae4ec54
--- /dev/null
+++ b/utils/test/reporting/yardstick/img/gauge_83.3.png
Binary files differ
diff --git a/utils/test/reporting/yardstick/img/gauge_91.7.png b/utils/test/reporting/yardstick/img/gauge_91.7.png
new file mode 100644
index 000000000..280865714
--- /dev/null
+++ b/utils/test/reporting/yardstick/img/gauge_91.7.png
Binary files differ
diff --git a/utils/test/reporting/yardstick/reporting-status.py b/utils/test/reporting/yardstick/reporting-status.py
index d7a4e2986..60f1523bb 100644
--- a/utils/test/reporting/yardstick/reporting-status.py
+++ b/utils/test/reporting/yardstick/reporting-status.py
@@ -16,6 +16,7 @@ import yaml
import reportingUtils as utils
import reportingConf as conf
import scenarioResult as sr
+from scenarios import config as cf
# Logger
logger = utils.getLogger("Yardstick-Status")
@@ -26,6 +27,7 @@ logger.info("* Data retention = %s days *" % conf.PERIOD)
logger.info("* *")
logger.info("*******************************************")
+
# For all the versions
for version in conf.versions:
# For all the installers
@@ -40,28 +42,35 @@ for version in conf.versions:
scenario_results[k] += stable_result[k]
scenario_result_criteria = {}
+ for s in scenario_results.keys():
+ if cf.has_key(installer) and cf[installer].has_key(s):
+ scenario_results.pop(s)
+
# From each scenarios get results list
for s, s_result in scenario_results.items():
logger.info("---------------------------------")
logger.info("installer %s, version %s, scenario %s:" % (installer, version, s))
- s_status = 'KO'
- scenario_criteria = len(s_result)
- scenario_score = 0
-
+ ten_criteria = len(s_result)
+ ten_score = 0
for v in s_result:
- if v['criteria'] == 'SUCCESS':
- scenario_score += 1
+ ten_score += v
- if scenario_score == scenario_criteria and scenario_criteria == 4:
- s_status = 'OK'
- logger.info(">>>>> scenario OK, save the information")
- else:
- logger.info(">>>> scenario not OK, score = %s/%s" % (scenario_score, scenario_criteria))
+ four_result = s_result[:conf.LASTEST_TESTS]
+ four_criteria = len(four_result)
+ four_score = 0
+ for v in four_result:
+ four_score += v
- s_score = str(scenario_score) + '/' + str(scenario_criteria)
- scenario_result_criteria[s] = sr.ScenarioResult(s_status, s_score)
+ s_status = str(utils.get_status(four_result, s_result))
+ s_four_score = str(four_score) + '/' + str(four_criteria)
+ s_ten_score = str(ten_score) + '/' + str(ten_criteria)
+ scenario_result_criteria[s] = sr.ScenarioResult(s_status, s_four_score, s_ten_score)
+ if '100' == s_status:
+ logger.info(">>>>> scenario OK, save the information")
+ else:
+ logger.info(">>>> scenario not OK, last 4 iterations = %s, last 10 days = %s" % (s_four_score, s_ten_score))
logger.info("--------------------------")
templateLoader = jinja2.FileSystemLoader(conf.REPORTING_PATH)
diff --git a/utils/test/reporting/yardstick/reportingConf.py b/utils/test/reporting/yardstick/reportingConf.py
index 447b428a8..2db41f0e1 100644
--- a/utils/test/reporting/yardstick/reportingConf.py
+++ b/utils/test/reporting/yardstick/reportingConf.py
@@ -13,8 +13,8 @@ installers = ["apex", "compass", "fuel", "joid"]
versions = ["master", "colorado"]
-# get data in the past 7 days
-PERIOD = 7
+# get data in the past 10 days
+PERIOD = 10
# get the lastest 4 test results to determinate the success criteria
LASTEST_TESTS = 4
@@ -22,6 +22,7 @@ LASTEST_TESTS = 4
REPORTING_PATH = "."
URL_BASE = 'http://testresults.opnfv.org/test/api/v1/results'
+TEST_CONF = "https://git.opnfv.org/cgit/yardstick/plain/tests/ci/report_config.yaml"
# LOG_LEVEL = "ERROR"
LOG_LEVEL = "INFO"
diff --git a/utils/test/reporting/yardstick/reportingUtils.py b/utils/test/reporting/yardstick/reportingUtils.py
index 06bcd4926..71eb9196c 100644
--- a/utils/test/reporting/yardstick/reportingUtils.py
+++ b/utils/test/reporting/yardstick/reportingUtils.py
@@ -45,17 +45,59 @@ def getScenarioStatus(installer, version):
print 'Got an error code:', e
scenario_results = {}
+ result_dict = {}
if test_results is not None:
for r in test_results:
- if r['stop_date'] != 'None':
+ if r['stop_date'] != 'None' and r['criteria'] is not None:
if not r['scenario'] in scenario_results.keys():
scenario_results[r['scenario']] = []
scenario_results[r['scenario']].append(r)
for k,v in scenario_results.items():
- scenario_results[k] = v[:conf.LASTEST_TESTS]
+ # scenario_results[k] = v[:conf.LASTEST_TESTS]
+ s_list = []
+ for element in v:
+ if element['criteria'] == 'SUCCESS':
+ s_list.append(1)
+ else:
+ s_list.append(0)
+ result_dict[k] = s_list
- return scenario_results
+ # return scenario_results
+ return result_dict
+
+def subfind(given_list, pattern_list):
+ for i in range(len(given_list)):
+ if given_list[i] == pattern_list[0] and given_list[i:i + conf.LASTEST_TESTS] == pattern_list:
+ return True
+ return False
+
+def get_percent(status):
+
+ if status * 100 % 6:
+ return round(float(status) * 100 / 6, 1)
+ else:
+ return status * 100 / 6
+
+def get_status(four_list, ten_list):
+ four_score = 0
+ ten_score = 0
+
+ for v in four_list:
+ four_score += v
+ for v in ten_list:
+ ten_score += v
+
+ if four_score == conf.LASTEST_TESTS:
+ status = 6
+ elif subfind(ten_list, [1, 1, 1, 1]):
+ status = 5
+ elif ten_score == 0:
+ status = 0
+ else:
+ status = four_score + 1
+
+ return get_percent(status)
def _test():
diff --git a/utils/test/reporting/yardstick/scenarioResult.py b/utils/test/reporting/yardstick/scenarioResult.py
index 743346adc..61ffb2ce7 100644
--- a/utils/test/reporting/yardstick/scenarioResult.py
+++ b/utils/test/reporting/yardstick/scenarioResult.py
@@ -9,12 +9,16 @@
class ScenarioResult(object):
- def __init__(self, status, score=0):
+ def __init__(self, status, four_days_score='', ten_days_score=''):
self.status = status
- self.score = score
+ self.four_days_score = four_days_score
+ self.ten_days_score = ten_days_score
def getStatus(self):
return self.status
- def getScore(self):
- return self.score
+ def getTenDaysScore(self):
+ return self.ten_days_score
+
+ def getFourDaysScore(self):
+ return self.four_days_score
diff --git a/utils/test/reporting/yardstick/scenarios.py b/utils/test/reporting/yardstick/scenarios.py
new file mode 100644
index 000000000..590fea2a4
--- /dev/null
+++ b/utils/test/reporting/yardstick/scenarios.py
@@ -0,0 +1,20 @@
+import yaml
+import os
+import requests
+
+import reportingConf as conf
+
+
+response = requests.get(conf.TEST_CONF)
+yaml_file = yaml.safe_load(response.text)
+reporting = yaml_file.get('reporting')
+
+config = {}
+
+for element in reporting:
+ name = element['name']
+ scenarios = element['scenario']
+ for s in scenarios:
+ if not config.has_key(name):
+ config[name] = {}
+ config[name][s] = True
diff --git a/utils/test/reporting/yardstick/template/index-status-tmpl.html b/utils/test/reporting/yardstick/template/index-status-tmpl.html
index ff1a619f1..602ce8a74 100644
--- a/utils/test/reporting/yardstick/template/index-status-tmpl.html
+++ b/utils/test/reporting/yardstick/template/index-status-tmpl.html
@@ -40,21 +40,19 @@
<div class="panel-heading"><h4><b>List of last scenarios ({{version}}) run over the last {{period}} days </b></h4></div>
<table class="table">
<tr>
- <th width="60%">Scenario</th>
+ <th width="40%">Scenario</th>
<th width="20%">Status</th>
- <th width="20%">Score</th>
+ <th width="20%">Last 4 Iterations</th>
+ <th width="20%">Last 10 Days</th>
</tr>
{% for scenario,result in scenario_results.iteritems() -%}
<tr class="tr-ok">
<td>{{scenario}}</td>
<td>
- {%if scenario_results[scenario].getStatus() is sameas "OK" -%}
- <img src="../../img/icon-ok.png">
- {%- else -%}
- <img src="../../img/icon-nok.png">
- {%- endif %}
+ <img src="../../img/gauge_{{ scenario_results[scenario].getStatus() }}.png">
</td>
- <td>{{scenario_results[scenario].getScore()}}</td>
+ <td>{{scenario_results[scenario].getFourDaysScore()}}</td>
+ <td>{{scenario_results[scenario].getTenDaysScore()}}</td>
</tr>
{%- endfor %}
</table>