summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerena Feng <feng.xiaowei@zte.com.cn>2017-12-19 07:34:20 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-12-19 07:34:20 +0000
commitc2907beb200142f57568371205092a700a49541d (patch)
tree882f32c2fe71c0e4bac091ae17d5cc258aea9e22
parent691d69df901b68ea5e85ca254bd7f2c270393182 (diff)
parent3f672f0e918c5c461008a7fc0e53e63b79083d34 (diff)
Merge "remove deprecated dashboard code"
-rw-r--r--dashboard/README.rst0
-rw-r--r--dashboard/backup-db.sh33
-rw-r--r--dashboard/dashboard/__init__.py0
-rw-r--r--dashboard/dashboard/common/__init__.py0
-rw-r--r--dashboard/dashboard/common/elastic_access.py51
-rw-r--r--dashboard/dashboard/common/logger_utils.py64
-rw-r--r--dashboard/dashboard/conf/__init__.py0
-rw-r--r--dashboard/dashboard/conf/config.py86
-rw-r--r--dashboard/dashboard/conf/testcases.py24
-rw-r--r--dashboard/dashboard/elastic2kibana/__init__.py0
-rw-r--r--dashboard/dashboard/elastic2kibana/dashboard_assembler.py59
-rw-r--r--dashboard/dashboard/elastic2kibana/main.py155
-rw-r--r--dashboard/dashboard/elastic2kibana/templates/dashboard.json61
-rw-r--r--dashboard/dashboard/elastic2kibana/templates/duration.json45
-rw-r--r--dashboard/dashboard/elastic2kibana/templates/qpi.json45
-rw-r--r--dashboard/dashboard/elastic2kibana/templates/success_percentage.json45
-rw-r--r--dashboard/dashboard/elastic2kibana/templates/tests_failures.json45
-rw-r--r--dashboard/dashboard/elastic2kibana/templates/visualization.json32
-rw-r--r--dashboard/dashboard/elastic2kibana/utility.py16
-rw-r--r--dashboard/dashboard/elastic2kibana/visualization_assembler.py84
-rw-r--r--dashboard/dashboard/functest/__init__.py0
-rw-r--r--dashboard/dashboard/functest/format.py192
-rw-r--r--dashboard/dashboard/functest/testcases.yaml139
-rw-r--r--dashboard/dashboard/mongo2elastic/__init__.py0
-rw-r--r--dashboard/dashboard/mongo2elastic/main.py259
-rw-r--r--dashboard/dashboard/qtip/__init__.py0
-rw-r--r--dashboard/dashboard/qtip/format.py19
-rw-r--r--dashboard/dashboard/qtip/testcases.yaml29
-rw-r--r--dashboard/etc/config.ini10
-rwxr-xr-xdashboard/install.sh54
-rw-r--r--dashboard/kibana_cleanup.py46
-rw-r--r--dashboard/setup.cfg44
-rw-r--r--dashboard/setup.py8
33 files changed, 0 insertions, 1645 deletions
diff --git a/dashboard/README.rst b/dashboard/README.rst
deleted file mode 100644
index e69de29..0000000
--- a/dashboard/README.rst
+++ /dev/null
diff --git a/dashboard/backup-db.sh b/dashboard/backup-db.sh
deleted file mode 100644
index 35c3fbe..0000000
--- a/dashboard/backup-db.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-# SPDX-license-identifier: Apache-2.0
-##############################################################################
-# Copyright (c) 2016 Orange and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-echo "Backup Test collection DB"
-now=$(date +"%m_%d_%Y_%H_%M_%S")
-echo $now
-echo " ------------- "
-TARGET_DIR=./$now
-TEST_RESULT_DB_BACKUP="test_collection_db."$now".tar.gz"
-
-echo "Create Directory for backup"
-mkdir -p $TARGET_DIR
-
-echo "Export results"
-mongoexport --db test_results_collection -c results --out $TARGET_DIR/backup-results.json
-echo "Export test cases"
-mongoexport --db test_results_collection -c testcases --out $TARGET_DIR/backup-cases.json
-echo "Export projects"
-mongoexport --db test_results_collection -c projects --out $TARGET_DIR/backup-projects.json
-echo "Export pods"
-mongoexport --db test_results_collection -c pods --out $TARGET_DIR/backup-pod.json
-
-echo "Create tar.gz"
-#tar -cvzf $TEST_RESULT_DB_BACKUP $TARGET_DIR
-
-echo "Delete temp directory"
-#rm -Rf $TARGET_DIR
diff --git a/dashboard/dashboard/__init__.py b/dashboard/dashboard/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/dashboard/dashboard/__init__.py
+++ /dev/null
diff --git a/dashboard/dashboard/common/__init__.py b/dashboard/dashboard/common/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/dashboard/dashboard/common/__init__.py
+++ /dev/null
diff --git a/dashboard/dashboard/common/elastic_access.py b/dashboard/dashboard/common/elastic_access.py
deleted file mode 100644
index eb29ce8..0000000
--- a/dashboard/dashboard/common/elastic_access.py
+++ /dev/null
@@ -1,51 +0,0 @@
-import json
-import urlparse
-
-import urllib3
-
-http = urllib3.PoolManager()
-
-
-def _request(method, url, creds=None, body=None):
- headers = urllib3.make_headers(basic_auth=creds)
- return http.request(method, url, headers=headers, body=body)
-
-
-def _post(url, creds=None, body=None):
- return _request('POST', url, creds=creds, body=body)
-
-
-def _get(url, creds=None, body=None):
- return json.loads(_request('GET', url, creds=creds, body=body).data)
-
-
-def delete_docs(url, creds=None, body=None):
- return _request('DELETE', url, creds=creds, body=body)
-
-
-def publish_docs(url, creds=None, body=None):
- result = _post(url, creds=creds, body=(json.dumps(body)))
- return result.status, result.data
-
-
-def _get_docs_nr(url, creds=None, body=None):
- res_data = _get('{}/_search?size=0'.format(url), creds=creds, body=body)
- print(type(res_data), res_data)
- return res_data['hits']['total']
-
-
-def get_docs(url, creds=None, body=None, field='_source'):
-
- docs_nr = _get_docs_nr(url, creds=creds, body=body)
- res_data = _get('{}/_search?size={}'.format(url, docs_nr),
- creds=creds, body=body)
-
- docs = []
- for hit in res_data['hits']['hits']:
- docs.append(hit[field])
- return docs
-
-
-def publish_kibana(url, creds, type, id, body):
- url = urlparse.urljoin(url, '/.kibana/{}/{}'.format(type, id))
- publish_docs(url, creds, body)
diff --git a/dashboard/dashboard/common/logger_utils.py b/dashboard/dashboard/common/logger_utils.py
deleted file mode 100644
index 58e343d..0000000
--- a/dashboard/dashboard/common/logger_utils.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env python
-#
-# feng.xiaowei@zte.com.cn
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Logging levels:
-# Level Numeric value
-# CRITICAL 50
-# ERROR 40
-# WARNING 30
-# INFO 20
-# DEBUG 10
-# NOTSET 0
-#
-# Usage:
-# import functest_logger as fl
-# logger = fl.Logger("script_name").getLogger()
-# logger.info("message to be shown with - INFO - ")
-# logger.debug("message to be shown with - DEBUG -")
-
-import logging
-import os
-
-
-class Logger(object):
- file_path = '/var/log'
- formatter = logging.Formatter('%(asctime)s - %(name)s - '
- '%(levelname)s - %(message)s')
-
- def __init__(self, logger_name):
-
- IF_DEBUG = os.getenv('IF_DEBUG')
-
- self.logger_name = logger_name
- self.logger = logging.getLogger(logger_name)
- self.logger.propagate = 0
- self.logger.setLevel(logging.DEBUG)
-
- ch = logging.StreamHandler()
- ch.setFormatter(self.formatter)
- if IF_DEBUG is not None and IF_DEBUG.lower() == "true":
- ch.setLevel(logging.DEBUG)
- else:
- ch.setLevel(logging.INFO)
- self.logger.addHandler(ch)
-
- hdlr = logging.FileHandler('%s/%s.log' % (self.file_path, logger_name))
- hdlr.setFormatter(self.formatter)
- hdlr.setLevel(logging.DEBUG)
- self.logger.addHandler(hdlr)
-
- @property
- def get(self):
- return self.logger
-
-
-class DashboardLogger(Logger):
- file_path = '/var/log/kibana_dashboard'
-
- def __init__(self, logger_name):
- super(DashboardLogger, self).__init__(logger_name)
diff --git a/dashboard/dashboard/conf/__init__.py b/dashboard/dashboard/conf/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/dashboard/dashboard/conf/__init__.py
+++ /dev/null
diff --git a/dashboard/dashboard/conf/config.py b/dashboard/dashboard/conf/config.py
deleted file mode 100644
index 6114e90..0000000
--- a/dashboard/dashboard/conf/config.py
+++ /dev/null
@@ -1,86 +0,0 @@
-#! /usr/bin/env python
-
-import urlparse
-from ConfigParser import SafeConfigParser, NoOptionError
-
-
-class ParseError(Exception):
- """
- Custom exception class for config file
- """
-
- def __init__(self, message):
- self.msg = message
-
- def __str__(self):
- return 'error parsing config file : %s' % self.msg
-
-
-class APIConfig:
- """
- The purpose of this class is to load values correctly from the config file.
- Each key is declared as an attribute in __init__() and linked in parse()
- """
-
- def __init__(self):
- 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:
- return self._parser.get(section, param)
- except NoOptionError:
- raise ParseError("[%s.%s] parameter not found" % (section, param))
-
- def _get_int_parameter(self, section, param):
- try:
- return int(self._get_str_parameter(section, param))
- except ValueError:
- raise ParseError("[%s.%s] not an int" % (section, param))
-
- def _get_bool_parameter(self, section, param):
- result = self._get_str_parameter(section, param)
- if str(result).lower() == 'true':
- return True
- if str(result).lower() == 'false':
- return False
-
- raise ParseError(
- "[%s.%s : %s] not a boolean" % (section, param, result))
-
- @staticmethod
- def parse(config_location=None):
- obj = APIConfig()
-
- if config_location is None:
- config_location = obj._default_config_location
-
- obj._parser = SafeConfigParser()
- obj._parser.read(config_location)
- if not obj._parser:
- raise ParseError("%s not found" % config_location)
-
- # Linking attributes to keys from file with their sections
- obj.es_url = obj._get_str_parameter("elastic", "url")
- 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
-
- def __str__(self):
- 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)
diff --git a/dashboard/dashboard/conf/testcases.py b/dashboard/dashboard/conf/testcases.py
deleted file mode 100644
index 98ce209..0000000
--- a/dashboard/dashboard/conf/testcases.py
+++ /dev/null
@@ -1,24 +0,0 @@
-import yaml
-
-
-with open('/etc/dashboard/testcases.yaml') as f:
- testcases_yaml = yaml.safe_load(f)
-f.close()
-
-
-def compose_format(fmt):
- return 'format_' + fmt.strip()
-
-
-def get_format(project, case):
- testcases = testcases_yaml.get(project)
- if isinstance(testcases, list):
- for case_dict in testcases:
- if case_dict['name'] == case:
- return compose_format(case_dict['format'])
- return None
-
-
-if __name__ == '__main__':
- fmt = get_format('functest', 'vping_ssh')
- print(fmt)
diff --git a/dashboard/dashboard/elastic2kibana/__init__.py b/dashboard/dashboard/elastic2kibana/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/dashboard/dashboard/elastic2kibana/__init__.py
+++ /dev/null
diff --git a/dashboard/dashboard/elastic2kibana/dashboard_assembler.py b/dashboard/dashboard/elastic2kibana/dashboard_assembler.py
deleted file mode 100644
index 651168b..0000000
--- a/dashboard/dashboard/elastic2kibana/dashboard_assembler.py
+++ /dev/null
@@ -1,59 +0,0 @@
-import json
-
-import utility
-from dashboard.common import elastic_access
-
-
-class DashboardAssembler(object):
- def __init__(self,
- project,
- case,
- family,
- installer,
- pod,
- visualizations,
- es_url,
- es_creds):
- super(DashboardAssembler, self).__init__()
- self.project = project
- self.case = case
- self.test_family = family
- self.installer = installer
- self.pod = pod
- self.visualizations = visualizations
- self.es_url = es_url
- self.es_creds = es_creds
- self._assemble()
- self._publish()
-
- def _assemble(self):
- db = {
- "query": {
- "project_name": self.project,
- "case_name": self.case,
- "installer": self.installer,
- "metric": self.visualizations[0].vis_state_title,
- "pod": self.pod
- },
- "test_family": self.test_family,
- "ids": [visualization.id for visualization in self.visualizations]
- }
- template = utility.env.get_template('dashboard.json')
- self.dashboard = json.loads(template.render(db=db))
- utility.dumps(self.dashboard,
- ['description',
- 'uiStateJSON',
- 'panelsJSON',
- 'optionsJSON'])
- utility.dumps_2depth(self.dashboard,
- 'kibanaSavedObjectMeta',
- 'searchSourceJSON')
- self.id = self.dashboard['title'].replace(' ', '-').replace('/', '-')
- return self
-
- def _publish(self):
- elastic_access.publish_kibana(self.es_url,
- self.es_creds,
- 'dashboard',
- self.id,
- self.dashboard)
diff --git a/dashboard/dashboard/elastic2kibana/main.py b/dashboard/dashboard/elastic2kibana/main.py
deleted file mode 100644
index 112d222..0000000
--- a/dashboard/dashboard/elastic2kibana/main.py
+++ /dev/null
@@ -1,155 +0,0 @@
-#! /usr/bin/env python
-import json
-
-import argparse
-
-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
-
-logger = logger_utils.DashboardLogger('elastic2kibana').get
-
-parser = argparse.ArgumentParser()
-parser.add_argument("-c", "--config-file",
- dest='config_file',
- help="Config file location")
-
-args = parser.parse_args()
-CONF = config.APIConfig().parse(args.config_file)
-
-_installers = {'fuel', 'apex', 'compass', 'joid'}
-
-
-class KibanaConstructor(object):
- def __init__(self):
- super(KibanaConstructor, self).__init__()
- self.js_dict = {}
-
- def construct(self):
- for project, case_dicts in testcases.testcases_yaml.items():
- for case in case_dicts:
- self._construct_by_case(project, case)
- return self
-
- def _construct_by_case(self, project, case):
- case_name = case.get('name')
- vis_ps = case.get('visualizations')
- family = case.get('test_family')
- for vis_p in vis_ps:
- self._construct_by_vis(project, case_name, family, vis_p)
-
- def _construct_by_vis(self, project, case, family, vis_p):
- for installer in _installers:
- pods_and_scenarios = self._get_pods_and_scenarios(project,
- case,
- installer)
- for pod, scenarios in pods_and_scenarios.iteritems():
- visualizations = self._construct_visualizations(project,
- case,
- installer,
- pod,
- scenarios,
- vis_p,
- CONF.es_url,
- CONF.es_creds)
- dashboard = DashboardAssembler(project,
- case,
- family,
- installer,
- pod,
- visualizations,
- CONF.es_url,
- CONF.es_creds)
- self._set_js_dict(case,
- pod,
- installer,
- family,
- vis_p.get('name'),
- dashboard.id)
-
- @staticmethod
- def _construct_visualizations(project,
- case,
- installer,
- pod,
- scenarios,
- vis_p,
- es_url,
- es_creds):
- visualizations = []
- for scenario in scenarios:
- visualizations.append(VisualizationAssembler(project,
- case,
- installer,
- pod,
- scenario,
- vis_p,
- es_url,
- es_creds))
- return visualizations
-
- def _set_js_dict(self, case, pod, installer, family, metric, id):
- test_label = '{} {}'.format(case, metric)
- if family not in self.js_dict:
- self.js_dict[family] = {}
-
- js_test_family = self.js_dict[family]
-
- if test_label not in js_test_family:
- js_test_family[test_label] = {}
-
- js_test_label = js_test_family[test_label]
-
- if installer not in js_test_label:
- js_test_label[installer] = {}
-
- js_installer = js_test_label[installer]
- js_installer[pod] = CONF.kibana_url + '#/dashboard/' + id
-
- def config_js(self):
- with open(CONF.js_path, 'w+') as conf_js_fdesc:
- conf_js_fdesc.write('var kibana_dashboard_links = ')
- conf_js_fdesc.write(str(self.js_dict).replace("u'", "'"))
-
- def _get_pods_and_scenarios(self, project, case, installer):
- query = json.JSONEncoder().encode({
- "query": {
- "bool": {
- "must": [
- {"match_all": {}}
- ],
- "filter": [
- {"match": {"installer": installer}},
- {"match": {"project_name": project}},
- {"match": {"case_name": case}}
- ]
- }
- }
- })
-
- elastic_data = elastic_access.get_docs(CONF.index_url,
- CONF.es_creds,
- query)
-
- pods_and_scenarios = {}
-
- for data in elastic_data:
- pod = data['pod_name']
- if pod in pods_and_scenarios:
- pods_and_scenarios[pod].add(data['scenario'])
- else:
- pods_and_scenarios[pod] = {data['scenario']}
-
- if 'all' in pods_and_scenarios:
- pods_and_scenarios['all'].add(data['scenario'])
- else:
- pods_and_scenarios['all'] = {data['scenario']}
-
- return pods_and_scenarios
-
-
-def main():
- KibanaConstructor().construct().config_js()
diff --git a/dashboard/dashboard/elastic2kibana/templates/dashboard.json b/dashboard/dashboard/elastic2kibana/templates/dashboard.json
deleted file mode 100644
index cc80995..0000000
--- a/dashboard/dashboard/elastic2kibana/templates/dashboard.json
+++ /dev/null
@@ -1,61 +0,0 @@
-{% set db = db|default({}) -%}
-
-
-{% macro calc_col(index) -%}
- {% if index is divisibleby 2 %}
- 7
- {% else %}
- 1
- {% endif %}
-{%- endmacro %}
-
-{% macro calc_row(index) -%}
-{% set num = (index - 1)//2 %}
- {{1 + num * 3}}
-{%- endmacro %}
-
-{
- "description": "Kibana dashboard for {{db.query}}",
- "hits": 0,
- "kibanaSavedObjectMeta": {
- "searchSourceJSON": {
- "filter": [
- {
- "query": {
- "query_string": {
- "analyze_wildcard": true,
- "query": "*"
- }
- }
- }
- ]
- }
- },
- "metadata": {
- "label": "{{db.query.case_name}} {{db.query.metric}}",
- "test_family": "{{db.test_family}}"
- },
- "optionsJSON": {
- "darkTheme": false
- },
- "panelsJSON": [
- {% for id in db.ids %}
- {
- "col": {{calc_col(loop.index)}},
- "id": "{{id}}",
- "panelIndex": {{loop.index}},
- "row": {{calc_row(loop.index)}},
- "size_x": 6,
- "size_y": 3,
- "type": "visualization"
- }
- {% if not loop.last %}
- ,
- {% endif %}
- {% endfor %}
- ],
- "scenario": 1,
- "timeRestore": false,
- "title": "{{db.query.project_name}} {{db.query.case_name}} {{db.query.installer}} {{db.query.metric}} {{db.query.pod}}",
- "uiStateJSON": {}
-}
diff --git a/dashboard/dashboard/elastic2kibana/templates/duration.json b/dashboard/dashboard/elastic2kibana/templates/duration.json
deleted file mode 100644
index f50a668..0000000
--- a/dashboard/dashboard/elastic2kibana/templates/duration.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{% set aggs = aggs|default([]) -%}
-
-{
- "title": "duration",
- "type": "line",
- "listeners": {},
- "params": {
- "addLegend": true,
- "shareYAxis": true,
- "addTooltip": true,
- "smoothLines": false,
- "scale": "linear",
- "interpolate": "linear",
- "times": [],
- "addTimeMarker": false,
- "defaultYExtents": false,
- "setYExtents": false,
- "yAxis": {},
- "mode": "stacked"
- },
- "aggs": [
- {% for agg in aggs %}
- {
- "id": {{agg.id }},
- "type": "avg",
- "schema": "metric",
- "params": {
- "field": "{{agg.field}}"
- }
- },
- {% endfor %}
- {
- "id": {{ aggs|length + 1 }},
- "type": "date_histogram",
- "schema": "segment",
- "params": {
- "field": "start_date",
- "interval": "auto",
- "customInterval": "2h",
- "min_doc_count": 1,
- "extended_bounds": {}
- }
- }
- ]
-}
diff --git a/dashboard/dashboard/elastic2kibana/templates/qpi.json b/dashboard/dashboard/elastic2kibana/templates/qpi.json
deleted file mode 100644
index a46f315..0000000
--- a/dashboard/dashboard/elastic2kibana/templates/qpi.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{% set aggs = aggs|default([]) -%}
-
-{
- "title": "qpi",
- "type": "line",
- "listeners": {},
- "params": {
- "addLegend": true,
- "shareYAxis": true,
- "addTooltip": true,
- "smoothLines": false,
- "scale": "linear",
- "interpolate": "linear",
- "times": [],
- "addTimeMarker": false,
- "defaultYExtents": false,
- "setYExtents": false,
- "yAxis": {},
- "mode": "stacked"
- },
- "aggs": [
- {% for agg in aggs %}
- {
- "id": {{agg.id }},
- "type": "avg",
- "schema": "metric",
- "params": {
- "field": "{{agg.field}}"
- }
- },
- {% endfor %}
- {
- "id": {{ aggs|length + 1 }},
- "type": "date_histogram",
- "schema": "segment",
- "params": {
- "field": "start_date",
- "interval": "auto",
- "customInterval": "2h",
- "min_doc_count": 1,
- "extended_bounds": {}
- }
- }
- ]
-}
diff --git a/dashboard/dashboard/elastic2kibana/templates/success_percentage.json b/dashboard/dashboard/elastic2kibana/templates/success_percentage.json
deleted file mode 100644
index 9930708..0000000
--- a/dashboard/dashboard/elastic2kibana/templates/success_percentage.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{% set aggs = aggs|default([]) -%}
-
-{
- "title": "success_percentage",
- "type": "line",
- "listeners": {},
- "params": {
- "addLegend": true,
- "shareYAxis": true,
- "addTooltip": true,
- "smoothLines": false,
- "scale": "linear",
- "interpolate": "linear",
- "times": [],
- "addTimeMarker": false,
- "defaultYExtents": false,
- "setYExtents": false,
- "yAxis": {},
- "mode": "stacked"
- },
- "aggs": [
- {% for agg in aggs %}
- {
- "id": {{agg.id }},
- "type": "avg",
- "schema": "metric",
- "params": {
- "field": "{{agg.field}}"
- }
- },
- {% endfor %}
- {
- "id": {{ aggs|length + 1 }},
- "type": "date_histogram",
- "schema": "segment",
- "params": {
- "field": "start_date",
- "interval": "auto",
- "customInterval": "2h",
- "min_doc_count": 1,
- "extended_bounds": {}
- }
- }
- ]
-}
diff --git a/dashboard/dashboard/elastic2kibana/templates/tests_failures.json b/dashboard/dashboard/elastic2kibana/templates/tests_failures.json
deleted file mode 100644
index 01f9ba8..0000000
--- a/dashboard/dashboard/elastic2kibana/templates/tests_failures.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{% set aggs = aggs|default([]) -%}
-
-{
- "title": "tests_failures",
- "type": "histogram",
- "listeners": {},
- "params": {
- "addLegend": true,
- "shareYAxis": true,
- "addTooltip": true,
- "smoothLines": false,
- "scale": "linear",
- "interpolate": "linear",
- "times": [],
- "addTimeMarker": false,
- "defaultYExtents": false,
- "setYExtents": false,
- "yAxis": {},
- "mode": "grouped"
- },
- "aggs": [
- {% for agg in aggs %}
- {
- "id": {{agg.id }},
- "type": "sum",
- "schema": "metric",
- "params": {
- "field": "{{agg.field}}"
- }
- },
- {% endfor %}
- {
- "id": {{ aggs|length + 1 }},
- "type": "date_histogram",
- "schema": "segment",
- "params": {
- "field": "start_date",
- "interval": "auto",
- "customInterval": "2h",
- "min_doc_count": 1,
- "extended_bounds": {}
- }
- }
- ]
-}
diff --git a/dashboard/dashboard/elastic2kibana/templates/visualization.json b/dashboard/dashboard/elastic2kibana/templates/visualization.json
deleted file mode 100644
index d51d417..0000000
--- a/dashboard/dashboard/elastic2kibana/templates/visualization.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{% set vis = vis|default({}) -%}
-
-
-{
- "description": "Kibana visualization for {{ vis.filters }}",
- "kibanaSavedObjectMeta": {
- "searchSourceJSON": {
- "filter": [
- {% for key, value in vis.filters.iteritems() if key != "metric" %}
- {% if not (key == "pod_name" and value == "all") %}
- {
- "match": {
- "{{ key }}": {
- "query": "{{ value }}",
- "type": "phrase"
- }
- }
- }
- {% if not loop.last %}
- ,
- {% endif %}
- {% endif %}
- {% endfor %}
- ]
- }
- },
- "scenario": 1,
- "title": "{{vis.filters.project_name}} {{vis.filters.case_name}} {{vis.filters.installer}} {{vis.filters.metric}} {{vis.filters.pod_name}} {{vis.filters.scenario}}",
- "uiStateJSON": {},
- "visState": {{ vis.visState }}
-}
-
diff --git a/dashboard/dashboard/elastic2kibana/utility.py b/dashboard/dashboard/elastic2kibana/utility.py
deleted file mode 100644
index 40d9202..0000000
--- a/dashboard/dashboard/elastic2kibana/utility.py
+++ /dev/null
@@ -1,16 +0,0 @@
-import json
-
-from jinja2 import Environment, PackageLoader
-
-env = Environment(loader=PackageLoader('dashboard',
- 'elastic2kibana/templates'))
-env.filters['jsonify'] = json.dumps
-
-
-def dumps(a_dict, items):
- for key in items:
- a_dict[key] = json.dumps(a_dict[key])
-
-
-def dumps_2depth(a_dict, key1, key2):
- a_dict[key1][key2] = json.dumps(a_dict[key1][key2])
diff --git a/dashboard/dashboard/elastic2kibana/visualization_assembler.py b/dashboard/dashboard/elastic2kibana/visualization_assembler.py
deleted file mode 100644
index d7e6e54..0000000
--- a/dashboard/dashboard/elastic2kibana/visualization_assembler.py
+++ /dev/null
@@ -1,84 +0,0 @@
-import json
-
-import utility
-from dashboard.common import elastic_access
-
-
-class VisStateBuilder(object):
- def __init__(self, vis_p):
- super(VisStateBuilder, self).__init__()
- self.vis_p = vis_p
-
- def build(self):
- name = self.vis_p.get('name')
- fields = self.vis_p.get('fields')
-
- aggs = []
- index = 1
- for field in fields:
- aggs.append({
- "id": index,
- "field": field.get("field")
- })
- index += 1
-
- template = utility.env.get_template('{}.json'.format(name))
- vis = template.render(aggs=aggs)
- return json.loads(vis)
-
-
-class VisualizationAssembler(object):
- def __init__(self,
- project,
- case,
- installer,
- pod,
- scenario,
- vis_p,
- es_url,
- es_creds):
- super(VisualizationAssembler, self).__init__()
- self.project = project
- self.case = case
- self.installer = installer
- self.pod = pod
- self.scenario = scenario
- self.vis_p = vis_p
- self.es_url = es_url
- self.es_creds = es_creds
- self._assemble()
- self._publish()
-
- def _assemble(self):
- visState = VisStateBuilder(self.vis_p).build()
- self.vis_state_title = visState['title']
-
- vis = {
- "visState": json.dumps(visState),
- "filters": {
- "project_name": self.project,
- "case_name": self.case,
- "installer": self.installer,
- "metric": self.vis_state_title,
- "pod_name": self.pod,
- "scenario": self.scenario
- }
- }
-
- template = utility.env.get_template('visualization.json')
-
- self.visualization = json.loads(template.render(vis=vis))
- utility.dumps(self.visualization,
- ['visState', 'description', 'uiStateJSON'])
- utility.dumps_2depth(self.visualization,
- 'kibanaSavedObjectMeta',
- 'searchSourceJSON')
- title = self.visualization['title']
- self.id = title.replace(' ', '-').replace('/', '-')
-
- def _publish(self):
- elastic_access.publish_kibana(self.es_url,
- self.es_creds,
- 'visualization',
- self.id,
- self.visualization)
diff --git a/dashboard/dashboard/functest/__init__.py b/dashboard/dashboard/functest/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/dashboard/dashboard/functest/__init__.py
+++ /dev/null
diff --git a/dashboard/dashboard/functest/format.py b/dashboard/dashboard/functest/format.py
deleted file mode 100644
index 75d361f..0000000
--- a/dashboard/dashboard/functest/format.py
+++ /dev/null
@@ -1,192 +0,0 @@
-#! /usr/bin/env python
-
-
-def _convert_value(value):
- return value if value != '' else 0
-
-
-def _convert_duration(duration):
- if ((isinstance(duration, str) or
- isinstance(duration, unicode)) and ':' in duration):
- hours, minutes, seconds = duration.split(":")
- hours = _convert_value(hours)
- minutes = _convert_value(minutes)
- seconds = _convert_value(seconds)
- int_duration = 3600 * int(hours) + 60 * int(minutes) + float(seconds)
- else:
- int_duration = duration
- return int_duration
-
-
-def format_normal(testcase):
- """
- Look for these and leave any of those:
- details.duration
- details.tests
- details.failures
-
- If none are present, then return False
- """
- found = False
- testcase_details = testcase['details']
- fields = ['duration', 'tests', 'failures']
- if isinstance(testcase_details, dict):
- for key, value in testcase_details.items():
- if key in fields:
- found = True
- if key == 'duration':
- testcase_details[key] = _convert_duration(value)
- else:
- del testcase_details[key]
-
- if 'tests' in testcase_details and 'failures' in testcase_details:
- testcase_tests = float(testcase_details['tests'])
- testcase_failures = float(testcase_details['failures'])
- if testcase_tests != 0:
- testcase_details['success_percentage'] = 100 * \
- (testcase_tests - testcase_failures) / testcase_tests
- else:
- testcase_details['success_percentage'] = 0
-
- return found
-
-
-def format_rally(testcase):
- """
- Structure:
- details.[{summary.duration}]
- details.[{summary.nb success}]
- details.[{summary.nb tests}]
-
- Find data for these fields
- -> details.duration
- -> details.tests
- -> details.success_percentage
- """
- details = testcase['details']
- summary = None
- for item in details:
- if 'summary' in item:
- summary = item['summary']
-
- if not summary:
- return False
-
- testcase['details'] = {
- 'duration': summary['duration'],
- 'tests': summary['nb tests'],
- 'success_percentage': summary['nb success']
- }
- return True
-
-
-def _get_statistics(orig_data, stat_fields, stat_values=None):
- test_results = {}
- for stat_data in orig_data:
- for field in stat_fields:
- stat_value = stat_data[field]
- if stat_value in test_results:
- test_results[stat_value] += 1
- else:
- test_results[stat_value] = 1
-
- if stat_values is not None:
- for stat_value in stat_values:
- if stat_value not in test_results:
- test_results[stat_value] = 0
-
- return test_results
-
-
-def format_onos(testcase):
- """
- Structure:
- details.FUNCvirNet.duration
- details.FUNCvirNet.status.[{Case result}]
- details.FUNCvirNetL3.duration
- details.FUNCvirNetL3.status.[{Case result}]
-
- Find data for these fields
- -> details.FUNCvirNet.duration
- -> details.FUNCvirNet.tests
- -> details.FUNCvirNet.failures
- -> details.FUNCvirNetL3.duration
- -> details.FUNCvirNetL3.tests
- -> details.FUNCvirNetL3.failures
- """
- testcase_details = testcase['details']
-
- if ('FUNCvirNet' not in testcase_details or
- 'FUNCvirNetL3' not in testcase_details):
- return False
-
- funcvirnet_details = testcase_details['FUNCvirNet']['status']
- funcvirnet_stats = _get_statistics(
- funcvirnet_details, ('Case result',), ('PASS', 'FAIL'))
- funcvirnet_passed = funcvirnet_stats['PASS']
- funcvirnet_failed = funcvirnet_stats['FAIL']
- funcvirnet_all = funcvirnet_passed + funcvirnet_failed
-
- funcvirnetl3_details = testcase_details['FUNCvirNetL3']['status']
- funcvirnetl3_stats = _get_statistics(
- funcvirnetl3_details, ('Case result',), ('PASS', 'FAIL'))
- funcvirnetl3_passed = funcvirnetl3_stats['PASS']
- funcvirnetl3_failed = funcvirnetl3_stats['FAIL']
- funcvirnetl3_all = funcvirnetl3_passed + funcvirnetl3_failed
-
- testcase_details['FUNCvirNet'] = {
- 'duration':
- _convert_duration(testcase_details['FUNCvirNet']['duration']),
- 'tests': funcvirnet_all,
- 'failures': funcvirnet_failed
- }
- testcase_details['FUNCvirNetL3'] = {
- 'duration':
- _convert_duration(testcase_details['FUNCvirNetL3']['duration']),
- 'tests': funcvirnetl3_all,
- 'failures': funcvirnetl3_failed
- }
- return True
-
-
-def format_vims(testcase):
- """
- Structure:
- details.sig_test.result.[{result}]
- details.sig_test.duration
- details.vIMS.duration
- details.orchestrator.duration
-
- Find data for these fields
- -> details.sig_test.duration
- -> details.sig_test.tests
- -> details.sig_test.failures
- -> details.sig_test.passed
- -> details.sig_test.skipped
- -> details.vIMS.duration
- -> details.orchestrator.duration
- """
- testcase_details = testcase['details']
- test_results = _get_statistics(testcase_details['sig_test']['result'],
- ('result',),
- ('Passed', 'Skipped', 'Failed'))
- passed = test_results['Passed']
- skipped = test_results['Skipped']
- failures = test_results['Failed']
- all_tests = passed + skipped + failures
- testcase['details'] = {
- 'sig_test': {
- 'duration': testcase_details['sig_test']['duration'],
- 'tests': all_tests,
- 'failures': failures,
- 'passed': passed,
- 'skipped': skipped
- },
- 'vIMS': {
- 'duration': testcase_details['vIMS']['duration']
- },
- 'orchestrator': {
- 'duration': testcase_details['orchestrator']['duration']
- }
- }
- return True
diff --git a/dashboard/dashboard/functest/testcases.yaml b/dashboard/dashboard/functest/testcases.yaml
deleted file mode 100644
index 85cb8b2..0000000
--- a/dashboard/dashboard/functest/testcases.yaml
+++ /dev/null
@@ -1,139 +0,0 @@
----
-functest:
- -
- name: tempest_smoke_serial
- format: normal
- test_family: VIM
- visualizations:
- -
- name: duration
- fields:
- - field: details.duration
- -
- name: tests_failures
- fields:
- - field: details.tests
- - field: details.failures
- -
- name: success_percentage
- fields:
- - field: details.success_percentage
- -
- name: rally_sanity
- test_family: VIM
- format: rally
- visualizations:
- -
- name: duration
- fields:
- - field: details.duration
- -
- name: tests_failures
- fields:
- - field: details.tests
- -
- name: success_percentage
- fields:
- - field: details.success_percentage
- -
- name: vping_ssh
- format: normal
- test_family: VIM
- visualizations:
- -
- name: duration
- fields:
- - field: details.duration
- -
- name: vping_userdata
- format: normal
- test_family: VIM
- visualizations:
- -
- name: duration
- fields:
- - field: details.duration
- -
- name: odl
- test_family: Controller
- format: odl
- visualizations:
- -
- name: tests_failures
- fields:
- - field: details.tests
- - field: details.failures
- -
- name: success_percentage
- fields:
- - field: details.success_percentage
- -
- name: onos
- format: onos
- test_family: Controller
- visualizations:
- -
- name: duration
- label: FUNCvirNet
- fields:
- - field: details.FUNCvirNet.duration
- -
- name: duration
- label: FUNCvirNetL3
- fields:
- - field: details.FUNCvirNetL3.duration
- -
- name: tests_failures
- label: FUNCvirNet
- fields:
- - field: details.FUNCvirNet.tests
- - field: details.FUNCvirNet.failures
- -
- name: tests_failures
- label: FUNCvirNetL3
- fields:
- - field: details.FUNCvirNetL3.tests
- - field: details.FUNCvirNetL3.failures
- -
- name: vims
- format: vims
- test_family: Features
- visualizations:
- -
- name: duration
- fields:
- - field: details.vIMS.duration
- - field: details.orchestrator.duration
- - field: details.sig_test.duration
- -
- name: tests_failures
- fields:
- - field: details.sig_test.tests
- - field: details.sig_test.failures
- - field: details.sig_test.passed
- - field: details.sig_test.skipped
-promise:
- -
- name: promise
- format: normal
- test_family: Features
- visualizations:
- -
- name: duration
- fields:
- - field: details.duration
- -
- name: tests_failures
- fields:
- - field: details.tests
- - field: details.failures
-doctor:
- -
- name: doctor-notification
- test_family: Features
- format: normal
- visualizations:
- -
- name: duration
- fields:
- - field: details.duration
diff --git a/dashboard/dashboard/mongo2elastic/__init__.py b/dashboard/dashboard/mongo2elastic/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/dashboard/dashboard/mongo2elastic/__init__.py
+++ /dev/null
diff --git a/dashboard/dashboard/mongo2elastic/main.py b/dashboard/dashboard/mongo2elastic/main.py
deleted file mode 100644
index e33252d..0000000
--- a/dashboard/dashboard/mongo2elastic/main.py
+++ /dev/null
@@ -1,259 +0,0 @@
-#! /usr/bin/env python
-
-import datetime
-import json
-import os
-import subprocess
-import traceback
-import uuid
-
-import argparse
-
-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
-
-parser = argparse.ArgumentParser()
-parser.add_argument("-c", "--config-file",
- dest='config_file',
- help="Config file location")
-parser.add_argument('-ld', '--latest-days',
- default=0,
- type=int,
- metavar='N',
- help='get entries old at most N days from mongodb and'
- ' parse those that are not already in elasticsearch.'
- ' If not present, will get everything from mongodb,'
- ' which is the default')
-
-args = parser.parse_args()
-CONF = APIConfig().parse(args.config_file)
-
-
-tmp_docs_file = './mongo-{}.json'.format(uuid.uuid4())
-
-
-class DocumentVerification(object):
-
- def __init__(self, doc):
- super(DocumentVerification, self).__init__()
- self.doc = doc
- self.doc_id = doc['_id'] if '_id' in doc else None
- self.skip = False
-
- def mandatory_fields_exist(self):
- mandatory_fields = ['installer',
- 'pod_name',
- 'version',
- 'case_name',
- 'project_name',
- 'details',
- 'start_date',
- 'scenario']
- for key, value in self.doc.items():
- if key in mandatory_fields:
- if value is None:
- logger.info("Skip testcase '%s' because field "
- "'%s' missing" % (self.doc_id, key))
- self.skip = True
- else:
- mandatory_fields.remove(key)
- else:
- del self.doc[key]
-
- if len(mandatory_fields) > 0:
- logger.info("Skip testcase '%s' because field(s) '%s' missing" %
- (self.doc_id, mandatory_fields))
- self.skip = True
-
- return self
-
- def modify_start_date(self):
- field = 'start_date'
- if field in self.doc:
- self.doc[field] = self._fix_date(self.doc[field])
-
- return self
-
- def modify_scenario(self):
- scenario = 'scenario'
- version = 'version'
-
- if (scenario not in self.doc) or \
- (scenario in self.doc and self.doc[scenario] is None):
- self.doc[scenario] = self.doc[version]
-
- return self
-
- def is_skip(self):
- return self.skip
-
- def _fix_date(self, date_string):
- if date_string == 'None':
- return None
- if isinstance(date_string, dict):
- return date_string['$date']
- if 'T' not in date_string:
- date_string = date_string[:-3].replace(' ', 'T')
- if not date_string.endswith('Z'):
- date_string += 'Z'
-
- return date_string
-
-
-class DocumentPublisher(object):
-
- def __init__(self, doc, fmt, exist_docs, creds, elastic_url):
- self.doc = doc
- self.fmt = fmt
- self.creds = creds
- self.exist_docs = exist_docs
- self.elastic_url = elastic_url
- self.is_formatted = True
-
- def format(self):
- try:
- if self._verify_document() and self.fmt:
- self.is_formatted = vars(format)[self.fmt](self.doc)
- else:
- self.is_formatted = False
- except Exception:
- logger.error("Fail in format testcase[%s]\nerror message: %s" %
- (self.doc, traceback.format_exc()))
- self.is_formatted = False
- finally:
- return self
-
- def publish(self):
- if self.is_formatted and self.doc not in self.exist_docs:
- self._publish()
-
- def _publish(self):
- status, data = elastic_access.publish_docs(
- self.elastic_url, self.creds, self.doc)
- if status > 300:
- logger.error('Publish record[{}] failed, due to [{}]'
- .format(self.doc,
- json.loads(data)['error']['reason']))
-
- def _fix_date(self, date_string):
- if isinstance(date_string, dict):
- return date_string['$date']
- else:
- return date_string[:-3].replace(' ', 'T') + 'Z'
-
- def _verify_document(self):
- return not (DocumentVerification(self.doc)
- .modify_start_date()
- .modify_scenario()
- .mandatory_fields_exist()
- .is_skip())
-
-
-class DocumentsPublisher(object):
-
- def __init__(self, project, case, fmt, days, elastic_url, creds):
- self.project = project
- self.case = case
- self.fmt = fmt
- self.days = days
- self.elastic_url = elastic_url
- self.creds = creds
- self.existed_docs = []
-
- def export(self):
- if self.days > 0:
- past_time = datetime.datetime.today(
- ) - datetime.timedelta(days=self.days)
- query = '''{{
- "project_name": "{}",
- "case_name": "{}",
- "start_date": {{"$gt" : "{}"}}
- }}'''.format(self.project, self.case, past_time)
- else:
- query = '''{{
- "project_name": "{}",
- "case_name": "{}"
- }}'''.format(self.project, self.case)
- cmd = ['mongoexport',
- '--db', 'test_results_collection',
- '--collection', 'results',
- '--query', '{}'.format(query),
- '--out', '{}'.format(tmp_docs_file)]
- try:
- subprocess.check_call(cmd)
- return self
- except Exception as err:
- logger.error("export mongodb failed: %s" % err)
- self._remove()
- exit(-1)
-
- def get_exists(self):
- if self.days == 0:
- body = '''{{
- "query": {{
- "bool": {{
- "must": [
- {{ "match": {{ "project_name": "{}" }} }},
- {{ "match": {{ "case_name": "{}" }} }}
- ]
- }}
- }}
- }}'''.format(self.project, self.case)
- elif self.days > 0:
- body = '''{{
- "query": {{
- "bool": {{
- "must": [
- {{ "match": {{ "project_name": "{}" }} }},
- {{ "match": {{ "case_name": "{}" }} }}
- ],
- "filter": {{
- "range": {{
- "start_date": {{ "gte": "now-{}d" }}
- }}
- }}
- }}
- }}
- }}'''.format(self.project, self.case, self.days)
- else:
- raise Exception('Update days must be non-negative')
- self.existed_docs = elastic_access.get_docs(
- self.elastic_url, self.creds, body)
- return self
-
- def publish(self):
- fdocs = None
- try:
- with open(tmp_docs_file) as fdocs:
- for doc_line in fdocs:
- DocumentPublisher(json.loads(doc_line),
- self.fmt,
- self.existed_docs,
- self.creds,
- self.elastic_url).format().publish()
- finally:
- if fdocs:
- fdocs.close()
- self._remove()
-
- def _remove(self):
- if os.path.exists(tmp_docs_file):
- os.remove(tmp_docs_file)
-
-
-def main():
- for project, case_dicts in testcases.testcases_yaml.items():
- for case_dict in case_dicts:
- case = case_dict.get('name')
- fmt = testcases.compose_format(case_dict.get('format'))
- DocumentsPublisher(project,
- case,
- fmt,
- args.latest_days,
- CONF.index_url,
- CONF.es_creds).export().get_exists().publish()
diff --git a/dashboard/dashboard/qtip/__init__.py b/dashboard/dashboard/qtip/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/dashboard/dashboard/qtip/__init__.py
+++ /dev/null
diff --git a/dashboard/dashboard/qtip/format.py b/dashboard/dashboard/qtip/format.py
deleted file mode 100644
index b78fa5b..0000000
--- a/dashboard/dashboard/qtip/format.py
+++ /dev/null
@@ -1,19 +0,0 @@
-#! /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
diff --git a/dashboard/dashboard/qtip/testcases.yaml b/dashboard/dashboard/qtip/testcases.yaml
deleted file mode 100644
index dfa9cc2..0000000
--- a/dashboard/dashboard/qtip/testcases.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
----
-qtip:
- -
- name: compute_test_suite
- format: qpi
- test_family: compute
- visualizations:
- -
- name: qpi
- fields:
- - field: details.index
- -
- name: network_test_suite
- test_family: network
- format: qpi
- visualizations:
- -
- name: qpi
- fields:
- - field: details.index
- -
- name: storage_test_suite
- format: qpi
- test_family: storage
- visualizations:
- -
- name: qpi
- fields:
- - field: details.index
diff --git a/dashboard/etc/config.ini b/dashboard/etc/config.ini
deleted file mode 100644
index 77adc16..0000000
--- a/dashboard/etc/config.ini
+++ /dev/null
@@ -1,10 +0,0 @@
-# to add a new parameter in the config file,
-# the CONF object in config.ini must be updated
-[elastic]
-url = http://localhost:9200
-index = testapi/results
-creds =
-
-[kibana]
-url = http://10.63.243.17:5601/app/kibana
-js_path = /usr/share/nginx/html/kibana_dashboards/conf.js
diff --git a/dashboard/install.sh b/dashboard/install.sh
deleted file mode 100755
index 9fd60d9..0000000
--- a/dashboard/install.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/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
diff --git a/dashboard/kibana_cleanup.py b/dashboard/kibana_cleanup.py
deleted file mode 100644
index 7e3662c..0000000
--- a/dashboard/kibana_cleanup.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#! /usr/bin/env python
-import logging
-import urlparse
-
-import argparse
-
-from dashboard.common import elastic_access
-
-logger = logging.getLogger('clear_kibana')
-logger.setLevel(logging.DEBUG)
-file_handler = logging.FileHandler('/var/log/{}.log'.format('clear_kibana'))
-file_handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: '
- '%(message)s'))
-logger.addHandler(file_handler)
-
-
-def delete_all(url, es_creds):
- ids = elastic_access.get_docs(url, es_creds, body=None, field='_id')
- for id in ids:
- del_url = '/'.join([url, id])
- elastic_access.delete_docs(del_url, es_creds)
-
-
-if __name__ == '__main__':
- parser = argparse.ArgumentParser(
- description=('Delete saved kibana searches, '
- 'visualizations and dashboards'))
- parser.add_argument('-e', '--elasticsearch-url',
- default='http://localhost:9200',
- help=('the url of elasticsearch, '
- 'defaults to http://localhost:9200'))
-
- parser.add_argument('-u', '--elasticsearch-username', default=None,
- help=('The username with password for elasticsearch '
- 'in format username:password'))
-
- args = parser.parse_args()
- base_elastic_url = args.elasticsearch_url
- es_creds = args.elasticsearch_username
-
- urls = (urlparse.urljoin(base_elastic_url, '/.kibana/visualization'),
- urlparse.urljoin(base_elastic_url, '/.kibana/dashboard'),
- urlparse.urljoin(base_elastic_url, '/.kibana/search'))
-
- for url in urls:
- delete_all(url, es_creds)
diff --git a/dashboard/setup.cfg b/dashboard/setup.cfg
deleted file mode 100644
index 859dcc0..0000000
--- a/dashboard/setup.cfg
+++ /dev/null
@@ -1,44 +0,0 @@
-[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/
-license = Apache-2.0
-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
-
diff --git a/dashboard/setup.py b/dashboard/setup.py
deleted file mode 100644
index 59637a5..0000000
--- a/dashboard/setup.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import setuptools
-
-__author__ = 'serena'
-
-
-setuptools.setup(
- setup_requires=['pbr>=1.8'],
- pbr=True)