diff options
-rw-r--r-- | dashboard/pushtoDB.py | 56 | ||||
-rw-r--r-- | dashboard/qtip2dashboard.py | 97 | ||||
-rw-r--r-- | data/my_key.pem | 50 | ||||
-rw-r--r-- | data/opnfv-creds.sh | 16 | ||||
-rw-r--r-- | data/pushtoDB.py | 23 | ||||
-rw-r--r-- | func/cli.py | 8 |
6 files changed, 198 insertions, 52 deletions
diff --git a/dashboard/pushtoDB.py b/dashboard/pushtoDB.py new file mode 100644 index 00000000..e9e05ba2 --- /dev/null +++ b/dashboard/pushtoDB.py @@ -0,0 +1,56 @@ +import requests
+import json
+import datetime
+import os
+TEST_DB = 'http://213.77.62.197'
+
+suite_list = ['compute_result.json','network_result.json','storage_result.json']
+payload_list = []
+
+def push_results_to_db(db_url, case_name, payload,logger=None, pod_name="dell-us-testing-1"):
+
+ url = db_url + "/results"
+ creation_date= str(datetime.datetime.utcnow().isoformat())
+ installer = os.environ['INSTALLER_TYPE']
+ #pod_name = os.environ['NODE_NAME']
+ print url
+ print case_name
+ print logger
+ print pod_name
+
+ params = {"project_name": "qtip", "case_name": case_name,
+ "pod_name": pod_name, "installer": installer, "creation_date": creation_date,
+ "version": "test" , "details": payload}
+
+ headers = {'Content-Type': 'application/json'}
+ print params
+ '''
+ try:
+ r = requests.post(url, data=json.dumps(params), headers=headers)
+ print r
+ return True
+ except:
+ print "Error:", sys.exc_info()[0]
+ return False
+ '''
+def populate_payload(suite_list):
+
+ global payload_list
+ for suites in suite_list:
+ if os.path.isfile('results/'+suites):
+ payload_list.append(suites)
+
+ print payload_list
+
+def main():
+
+ global payload_list
+ populate_payload(suite_list)
+ for pay in payload_list:
+ with open('results/'+pay,'r') as result_file:
+ j=result_file.read().rstrip()
+
+ push_results_to_db(TEST_DB, 'Compute benchmark suite',j)
+
+if __name__ == "__main__":
+ main()
\ No newline at end of file diff --git a/dashboard/qtip2dashboard.py b/dashboard/qtip2dashboard.py new file mode 100644 index 00000000..008f7371 --- /dev/null +++ b/dashboard/qtip2dashboard.py @@ -0,0 +1,97 @@ +#!/usr/bin/python + +############################################################################## +# Copyright (c) 2015 Dell Inc 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 +############################################################################## + + +def get_qtip_cases(): + """ + get the list of the supported test cases + TODO: update the list when adding a new test case for the dashboard + """ + return ["compute_test_suite","storage_test_suite","network_test_suite"] + + +def check_qtip_case_exist(case): + """ + check if the testcase exists + if the test case is not defined or not declared in the list + return False + """ + qtip_cases = get_qtip_cases() + + if (case is None or case not in qtip_cases): + return False + else: + return True + + +def format_qtip_for_dashboard(case, results): + """ + generic method calling the method corresponding to the test case + check that the testcase is properly declared first + then build the call to the specific method + """ + if check_qtip_case_exist(case): + res = format_common_for_dashboard(case, results) + else: + res = [] + print "Test cases not declared" + return res + +def format_common_for_dashboard(case, results): + """ + Common post processing + """ + test_data_description = case + " results for Dashboard" + test_data = [{'description': test_data_description}] + + graph_name = '' + if "network_test_suite" in case: + graph_name = "Throughput index" + else: + graph_name = "Index" + + # Graph 1: Rx fps = f(time) + # ******************************** + new_element = [] + for data in results: + new_element.append({'x': data['creation_date'], + 'y1': data['details']['index'], + }) + + test_data.append({'name': graph_name, + 'info': {'type': "graph", + 'xlabel': 'time', + 'y1label': 'Index Number'}, + 'data_set': new_element}) + + return test_data + + + + +############################ For local test ################################ +import os + +def _test(): + ans = [{'creation_date': '2015-09-12', 'project_name': 'qtip', 'version': 'test', 'pod_name': 'dell-us-testing-1', 'case_name': 'compute_test_suite', 'installer': 'fuel', 'details': {'index': '0.9'}}, + {'creation_date': '2015-09-33', 'project_name': 'qtip', 'version': 'test', 'pod_name': 'dell-us-testing-1', 'case_name': 'compute_test_suite', 'installer': 'fuel', 'details': {'index': '0.8'}}] + + result = format_qtip_for_dashboard("compute_test_suite", ans) + print result + + result = format_qtip_for_dashboard("storage_test_suite", ans) + print result + + result = format_qtip_for_dashboard("network_test_suite", ans) + print result + +if __name__ == '__main__': + _test()
\ No newline at end of file diff --git a/data/my_key.pem b/data/my_key.pem index c7f92edb..66bd451b 100644 --- a/data/my_key.pem +++ b/data/my_key.pem @@ -1,27 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEAy5MGVdCDzTpjM5fWf/Iz0lhqnjNNIK/D5empQk9OU3ihlbvV -vjacFdWvXuJqrUJ5dyoqyXvPdcHkbgP9AR5g+gNE+0pxXXkuOAkseTC8Bi1D+Hu+ -6z1oXygvXPVuIRIIvW6z8al/bpr0bdzwPyAwxalcS+ghM9upeCqHoS1hbkwdzxbr -iUKrHLeJ6dMQshcVnW8aKmA6UP9qHBY9UlIvoOvjQ7duEIe4fwvOrv8ENmtr7dUJ -c01XV/YhpCOX3l+VnzNtjot7ByTgyTQmxneeGbd2bb+MIfc/7S0C1riB1NyfCso3 -BrczKg19iViB3srDImd+87A1sbCmyCw0bLj9zQIDAQABAoIBABikUmb+14V3JNzw -60EPk2BJ3ZYKxbJINGFXOGrTaLrH5l9WnlfpClnGRPUqWRlh64wWKZm8B+/MKZd7 -mhuRjtGUpbv5VeGnsoWL7rs4v/nLbufcKs8U3tZt6dXJy6vrH+22Qcfl6Yv868uE -q/woLF8w0gBKOAKr+0aVd1d2Q83y50EvFv0izcRLD6HmDAoncy6WgPPPQfQYe4w9 -BrrEqcK/XrndCRSo338JlCOgHDF19Ne2oV3B7Y5z5NqZyVxsDWJgPitUkXwgZMZL -a7KiuaesCMlwQ6fS24O0NVXOU144WoXvdvEa1gHW5zukhn2s0x/dhq6goPiRvVm+ -YcIePo0CgYEA+uf3SlA9M9bZUHCDe8JgvrBGncuLsqctl2xYXVwl61GYtDzMU8rt -3f0Rqm/FlMhEqXXu222ndyFT14ucA6otMgguwwDR4tt5lDsNEVuAwHXIaJ7KSc41 -wbfA8V+/mgqFVdpWfD/viLToeU8rO6LjTdn0Z/d0TRvjlBeoceK39tsCgYEAz7UP -rsTa55H/ybkm29PhJr7kihuB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XLPMXY7zSJxGWlWL6i8A30tRfkSABf +mV4SfBv7f4T32JJvRZvNPdwGXoKJJKL+bykF22Xq2BWwgjZg0ubOWPY2e4ut5gsQ +4Nv6Okvd0nMNBjev7MPNXgiRalYSts+H4diy/u8RwRQ3jAMmY4B8/Q== -----END RSA PRIVATE KEY----- diff --git a/data/opnfv-creds.sh b/data/opnfv-creds.sh new file mode 100644 index 00000000..9266c19a --- /dev/null +++ b/data/opnfv-creds.sh @@ -0,0 +1,16 @@ +#!/bin/sh +export LC_ALL=C +export OS_NO_CACHE='true' +export OS_TENANT_NAME='admin' +export OS_USERNAME='admin' +export OS_PASSWORD='admin' +export OS_AUTH_URL='http://172.18.0.69:5000/v2.0' +export OS_AUTH_STRATEGY='keystone' +export OS_REGION_NAME='RegionOne' +export CINDER_ENDPOINT_TYPE='internalURL' +export GLANCE_ENDPOINT_TYPE='internalURL' +export KEYSTONE_ENDPOINT_TYPE='internalURL' +export NOVA_ENDPOINT_TYPE='internalURL' +export NEUTRON_ENDPOINT_TYPE='internalURL' +export OS_ENDPOINT_TYPE='internalURL' +export MURANO_REPO_URL='http://storage.apps.openstack.org/' diff --git a/data/pushtoDB.py b/data/pushtoDB.py deleted file mode 100644 index fab78520..00000000 --- a/data/pushtoDB.py +++ /dev/null @@ -1,23 +0,0 @@ -import requests
-import json
-import os
-TEST_DB = 'http://213.77.62.197'
-
-
-
-def push_results_to_db(db_url=TEST_DB, case_name, logger=None, pod_name='dell-us-testing-bm-1', payload):
- url = db_url + "/results"
- installer = get_installer_type(logger)
- params = {"project_name": "functest", "case_name": case_name,
- "pod_name": os.environ[''], "installer": installer,
- "version": git_version, "details": payload}
-
- headers = {'Content-Type': 'application/json'}
- try:
- r = requests.post(url, data=json.dumps(params), headers=headers)
- logger.debug(r)
- return True
- except:
- print "Error:", sys.exc_info()[0]
- return False
-
diff --git a/func/cli.py b/func/cli.py index 833e3740..8433e483 100644 --- a/func/cli.py +++ b/func/cli.py @@ -24,9 +24,9 @@ class cli(): _benchmarks[items]=_benchmarks[items].rstrip() return _benchmarks def _getsuite(self, filepath): - for suites in range (len(filepath)): - xindex= filepath[suites].find('.') - filepath[suites]=filepath[suites][0:xindex] +# for suites in range (len(filepath)): + # xindex= filepath[suites].find('.') + # filepath[suites]=filepath[suites][0:xindex] return filepath def __init__(self): @@ -63,4 +63,4 @@ class cli(): else: print (args.benchmark, ' is not a Template in the Directory - \ Enter a Valid file name. or use qtip.py -h for list') -
\ No newline at end of file + |