diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2015-11-27 09:41:01 +0100 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2015-11-27 09:41:01 +0100 |
commit | 4fb5c1ca8deb15d308d3bb7b89931770171f8d4f (patch) | |
tree | 7c14a4d824b181c830c2548f13ba5cb32a5672c2 /testcases/Dashboard/vPing2Dashboard.py | |
parent | 0030d1a79c8221c5f0d4cc3270037bb15ec535e0 (diff) |
Clean Functest repo, dashboard fully migrated to Releng
JIRA: RELENG-7
Change-Id: Iddbed5922097a54ba0d56ce59b8ab93264e90603
Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Diffstat (limited to 'testcases/Dashboard/vPing2Dashboard.py')
-rw-r--r-- | testcases/Dashboard/vPing2Dashboard.py | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/testcases/Dashboard/vPing2Dashboard.py b/testcases/Dashboard/vPing2Dashboard.py deleted file mode 100644 index 43008a620..000000000 --- a/testcases/Dashboard/vPing2Dashboard.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/python -# -# Copyright (c) 2015 Orange -# morgan.richomme@orange.com -# -# 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 -# -# This script is used to build json files for the dashboard -# for the vPing test case -# -# v0.1: basic example -# -import logging -import argparse -import pprint -import json -import dashboard_utils -import os -import yaml - -pp = pprint.PrettyPrinter(indent=4) - -parser = argparse.ArgumentParser() -parser.add_argument("repo_path", help="Path to the repository") -parser.add_argument("-d", "--debug", help="Debug mode", action="store_true") -args = parser.parse_args() - -""" logging configuration """ -logger = logging.getLogger('config_functest') -logger.setLevel(logging.DEBUG) - -if not os.path.exists(args.repo_path): - logger.error("Repo directory not found '%s'" % args.repo_path) - exit(-1) - -with open(args.repo_path+"testcases/config_functest.yaml") as f: - functest_yaml = yaml.safe_load(f) -f.close() - -""" global variables """ -# Directories -HOME = os.environ['HOME']+"/" -REPO_PATH = args.repo_path -TEST_DB = functest_yaml.get("results").get("test_db_url") - - -def format_vPing_for_dashboard(criteria): - # Get results - myDataResults = dashboard_utils.get_results(TEST_DB, criteria) - - # Depending on the use case, json for dashboarding is customized - # depending on the graph you want to show - - test_data = [{'description': 'vPing results for Dashboard'}] - - # Graph 1: Duration = f(time) - # *************************** - new_element = [] - for data in myDataResults: - new_element.append({'x': data['creation_date'], - 'y': data['details']['duration']}) - - test_data.append({'name': "vPing duration", - 'info': {'type': "graph", - 'xlabel': 'time', - 'ylabel': 'duration (s)'}, - 'data_set': new_element}) - - # Graph 2: bar - # ************ - nbTest = 0 - nbTestOk = 0 - - for data in myDataResults: - nbTest += 1 - if data['details']['status'] == "OK": - nbTestOk += 1 - - test_data.append({'name': "vPing status", - 'info': {"type": "bar"}, - 'data_set': [{'Nb tests': nbTest, - 'Nb Success': nbTestOk}]}) - - # Generate json file - fileName = criteria.format() - logger.debug("Generate json file:" + fileName) - - with open(fileName, "w") as outfile: - json.dump(test_data, outfile, indent=4) |