exclude-no-code-change: 'false'
- comment-added-contains-event:
comment-contains-value: 'recheck'
+ custom-url: '* $JOB_NAME $BUILD_URL'
+ silent-start: true
projects:
- project-compare-type: 'PLAIN'
project-pattern: 'openstack/bifrost'
multiple => true,
}
+ # disable selinux in case of RHEL
+ if ($::osfamily == 'RedHat') {
+ class { 'selinux':
+ mode => 'disabled',
+ }
+ }
+
+ # update hosts
create_resources('host', hiera_hash('hosts'))
}
#! /usr/bin/env python
+import urlparse
from ConfigParser import SafeConfigParser, NoOptionError
"""
def __init__(self):
- self._default_config_location = "../etc/config.ini"
+ self._default_config_location = "/etc/dashboard/config.ini"
self.es_url = 'http://localhost:9200'
self.es_creds = None
self.kibana_url = None
self.js_path = None
+ self.index_url = None
def _get_str_parameter(self, section, param):
try:
obj.es_creds = obj._get_str_parameter("elastic", "creds")
obj.kibana_url = obj._get_str_parameter("kibana", "url")
obj.js_path = obj._get_str_parameter("kibana", "js_path")
+ index = obj._get_str_parameter("elastic", "index")
+ obj.index_url = urlparse.urljoin(obj.es_url, index)
return obj
return "elastic_url = %s \n" \
"elastic_creds = %s \n" \
"kibana_url = %s \n" \
+ "index_url = %s \n" \
"js_path = %s \n" % (self.es_url,
self.es_creds,
self.kibana_url,
+ self.index_url,
self.js_path)
import yaml
-with open('./functest/testcases.yaml') as f:
+with open('/etc/dashboard/testcases.yaml') as f:
testcases_yaml = yaml.safe_load(f)
f.close()
import json
import utility
-from common import elastic_access
+from dashboard.common import elastic_access
class DashboardAssembler(object):
#! /usr/bin/env python
import json
-import urlparse
import argparse
-from common import elastic_access
-from common import logger_utils
-from conf import config
-from conf import testcases
+from dashboard.common import elastic_access
+from dashboard.common import logger_utils
+from dashboard.conf import config
+from dashboard.conf import testcases
from dashboard_assembler import DashboardAssembler
from visualization_assembler import VisualizationAssembler
}
})
- elastic_data = elastic_access.get_docs(
- urlparse.urljoin(CONF.es_url, '/testapi/results'),
- CONF.es_creds,
- query)
+ elastic_data = elastic_access.get_docs(CONF.index_url,
+ CONF.es_creds,
+ query)
pods_and_scenarios = {}
from jinja2 import Environment, PackageLoader
-env = Environment(loader=PackageLoader('elastic2kibana', 'templates'))
+env = Environment(loader=PackageLoader('dashboard', 'elastic2kibana/templates'))
env.filters['jsonify'] = json.dumps
import json
import utility
-from common import elastic_access
+from dashboard.common import elastic_access
class VisStateBuilder(object):
+++ /dev/null
-from elastic2kibana.main import main
-
-if __name__ == '__main__':
- main()
}
}
return True
-
-
-def format_qpi(testcase):
- """
- Look for these and leave any of those:
- details.index
-
- If none are present, then return False
- """
- details = testcase['details']
- if 'index' not in details:
- return False
-
- for key, value in details.items():
- if key != 'index':
- del details[key]
-
- return True
import os
import subprocess
import traceback
-import urlparse
import uuid
import argparse
-from common import logger_utils, elastic_access
-from conf import testcases
-from conf.config import APIConfig
-from mongo2elastic import format
+from dashboard.common import elastic_access
+from dashboard.common import logger_utils
+from dashboard.conf import testcases
+from dashboard.conf.config import APIConfig
+from dashboard.mongo2elastic import format
logger = logger_utils.DashboardLogger('mongo2elastic').get
self._remove()
exit(-1)
- def get_existed_docs(self):
+ def get_exists(self):
if self.days == 0:
body = '''{{
"query": {{
def main():
- base_elastic_url = urlparse.urljoin(CONF.es_url, '/testapi/results')
- days = args.latest_days
- es_creds = CONF.es_creds
-
for project, case_dicts in testcases.testcases_yaml.items():
for case_dict in case_dicts:
case = case_dict.get('name')
DocumentsPublisher(project,
case,
fmt,
- days,
- base_elastic_url,
- es_creds).export().get_existed_docs().publish()
+ args.latest_days,
+ CONF.index_url,
+ CONF.es_creds).export().get_exists().publish()
+++ /dev/null
-from mongo2elastic.main import main
-
-if __name__ == '__main__':
- main()
--- /dev/null
+#! /usr/bin/env python
+
+
+def format_qpi(testcase):
+ """
+ Look for these and leave any of those:
+ details.index
+
+ If none are present, then return False
+ """
+ details = testcase['details']
+ if 'index' not in details:
+ return False
+
+ for key, value in details.items():
+ if key != 'index':
+ del details[key]
+
+ return True
# the CONF object in config.ini must be updated
[elastic]
url = http://localhost:9200
+index = testapi/results
creds =
[kibana]
--- /dev/null
+#!/bin/bash
+
+usage="
+Script to install dashboard automatically.
+This script should be run under root.
+
+usage:
+ bash $(basename "$0") [-h|--help] [-t <test_name>]
+
+where:
+ -h|--help show this help text
+ -p|--project project dashboard
+ <project_name>"
+
+# Parse parameters
+while [[ $# > 0 ]]
+ do
+ key="$1"
+ case $key in
+ -h|--help)
+ echo "$usage"
+ exit 0
+ shift
+ ;;
+ -p|--project)
+ PROJECT="$2"
+ shift
+ ;;
+ *)
+ echo "unknown option $1 $2"
+ exit 1
+ ;;
+ esac
+ shift # past argument or value
+done
+
+if [[ $(whoami) != "root" ]]; then
+ echo "Error: This script must be run as root!"
+ exit 1
+fi
+
+if [ -z ${PROJECT+x} ]; then
+ echo "project must be specified"
+ exit 1
+fi
+
+if [ $PROJECT != "functest" ] && [ $PROJECT != "qtip" ];then
+ echo "unsupported project $PROJECT"
+ exit 1
+fi
+
+cp -f dashboard/$PROJECT/format.py dashboard/mongo2elastic
+cp -f dashboard/$PROJECT/testcases.yaml etc/
+python setup.py install
--- /dev/null
+[metadata]
+name = dashboard
+summary = Test Result Collector
+description-file =
+ README.rst
+author = SerenaFeng
+author-email = feng.xiaowei@zte.com.cn
+#home-page = http://www.opnfv.org/
+classifier =
+ Environment :: opnfv
+ Intended Audience :: Information Technology
+ Intended Audience :: System Administrators
+ License :: OSI Approved :: Apache Software License
+ Operating System :: POSIX :: Linux
+ Programming Language :: Python
+ Programming Language :: Python :: 2
+ Programming Language :: Python :: 2.7
+
+[global]
+setup-hooks =
+ pbr.hooks.setup_hook
+
+[files]
+packages =
+ dashboard
+package_data =
+ dashboard =
+ elastic2kibana/templates/*.*
+data_files =
+ /etc/dashboard =
+ etc/config.ini
+ etc/testcases.yaml
+
+[entry_points]
+console_scripts =
+ dashboard_mongo2elastic = dashboard.mongo2elastic.main:main
+ dashboard_elastic2kibana = dashboard.elastic2kibana.main:main
+
+[egg_info]
+tag_build =
+tag_date = 0
+tag_svn_revision = 0
+
--- /dev/null
+import setuptools
+
+__author__ = 'serena'
+
+
+setuptools.setup(
+ setup_requires=['pbr>=1.8'],
+ pbr=True)
items = {}
scenario_result_criteria = {}
+ scenario_file_name = (conf.REPORTING_PATH +
+ "/functest/release/" + version +
+ "/scenario_history.txt")
+
# For all the scenarios get results
for s, s_result in scenario_results.items():
logger.info("---------------------------------")
scenario_criteria = conf.MAX_SCENARIO_CRITERIA
s_score = str(scenario_score) + "/" + str(scenario_criteria)
- s_score_percent = 0.0
- try:
- s_score_percent = float(scenario_score) / float(scenario_criteria) * 100
- except:
- logger.error("cannot calculate the score percent")
+ s_score_percent = utils.getScenarioPercent(scenario_score,
+ scenario_criteria)
s_status = "KO"
if scenario_score < scenario_criteria:
f.write(info)
# Save daily results in a file
- path_validation_file = (conf.REPORTING_PATH +
- "/functest/release/" + version +
- "/scenario_history.txt")
- with open(path_validation_file, "a") as f:
+ with open(scenario_file_name, "a") as f:
info = (reportingDate + "," + s + "," + installer +
"," + s_score + "," +
str(round(s_score_percent)) + "\n")
version=version,
date=reportingDate)
- with open(conf.REPORTING_PATH + "/functest/release/" + version +
- "/index-status-" + installer + ".html", "wb") as fh:
- fh.write(outputText)
+ # 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, "a")
+ logger.info("Generate CSV...")
+ with open(scenario_file_name, "r") as f:
+ for line in f:
+ if installer in line:
+ logger.debug("Add new line... %s" % line)
+ scenario_installer_file.write(line)
+ scenario_installer_file.close
+
+ with open(conf.REPORTING_PATH + "/functest/release/" + version +
+ "/index-status-" + installer + ".html", "wb") as fh:
+ fh.write(outputText)
+ logger.info("CSV generated...")
- # 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
+ # Generate outputs for export
+ # pdf
+ logger.info("Generate 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)
+ logger.info("PDF generated...")
+ except IOError:
+ logger.info("pdf generated anyway...")
+ except:
+ logger.error("impossible to generate PDF")
print 'Impossible to get jenkins url:'
return jenkins_url
+
+def getScenarioPercent(scenario_score,scenario_criteria):
+ score = 0.0
+ try:
+ score = float(scenario_score) / float(scenario_criteria) * 100
+ except:
+ print 'Impossible to calculate the percentage score'
+ return score
From within your environment, just run:
- python setup.py install
+ ./install.sh
How to run
^^^^^^^^^^
RUN git config --global http.sslVerify false
RUN git clone https://gerrit.opnfv.org/gerrit/releng /home/releng
-WORKDIR /home/releng/utils/test/result_collection_api/
+WORKDIR /home/releng/utils/test/testapi/
RUN pip install -r requirements.txt
RUN python setup.py install
CMD ["bash", "docker/start-server.sh"]
--- /dev/null
+#!/bin/bash
+
+usage="
+Script to install opnfv_tesgtapi automatically.
+This script should be run under root.
+
+usage:
+ bash $(basename "$0") [-h|--help] [-t <test_name>]
+
+where:
+ -h|--help show this help text"
+
+if [[ $(whoami) != "root" ]]; then
+ echo "Error: This script must be run as root!"
+ exit 1
+fi
+
+cp -fr 3rd_party/static opnfv_testapi/tornado_swagger
+python setup.py install
+rm -fr opnfv_testapi/tornado_swagger/static