diff options
author | zhihui wu <zhihui.wu2006+zte@gmail.com> | 2017-03-15 01:28:02 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-03-15 01:28:02 +0000 |
commit | deb48720a34ff36d23d777b9a9a1b4f73c17d80d (patch) | |
tree | f704ac8a24c5e74c7982d0ad3c49cab9f355baa2 | |
parent | fef1092cdb5a28d8d39eff94dbbd0dd187a16971 (diff) | |
parent | 63c002a51ff072c911d3b89296b627b16983f5a0 (diff) |
Merge "Remove legacy code from stable branch" into stable/danube
118 files changed, 0 insertions, 5813 deletions
diff --git a/legacy/DO-NOT-DELETE b/legacy/DO-NOT-DELETE deleted file mode 100644 index fdecaad1..00000000 --- a/legacy/DO-NOT-DELETE +++ /dev/null @@ -1,2 +0,0 @@ -The legacy code is no longer maintained. But they should be kept until we finish -migration to new architecture. diff --git a/legacy/__init__.py b/legacy/__init__.py deleted file mode 100644 index 48893ae6..00000000 --- a/legacy/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## diff --git a/legacy/api/__init__.py b/legacy/api/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/legacy/api/__init__.py +++ /dev/null diff --git a/legacy/api/cmd/__init__.py b/legacy/api/cmd/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/legacy/api/cmd/__init__.py +++ /dev/null diff --git a/legacy/api/cmd/server.py b/legacy/api/cmd/server.py deleted file mode 100644 index eea45ad3..00000000 --- a/legacy/api/cmd/server.py +++ /dev/null @@ -1,31 +0,0 @@ -############################################################################## -# Copyright (c) 2016 ZTE Corp 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 -############################################################################## - -from flask import Flask -from flask_restful import Api -from flask_restful_swagger import swagger - -import legacy.api.router.mapper as mapper - -app = Flask(__name__) -api = swagger.docs(Api(app), apiVersion='0.1', description='QTIP API specs') - - -def add_routers(): - for (handler, url) in mapper.mappers: - api.add_resource(handler, url) - - -def main(): - add_routers() - app.run(host='0.0.0.0') - - -if __name__ == "__main__": - main() diff --git a/legacy/api/handler/__init__.py b/legacy/api/handler/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/legacy/api/handler/__init__.py +++ /dev/null diff --git a/legacy/api/handler/db.py b/legacy/api/handler/db.py deleted file mode 100644 index 24fc27a5..00000000 --- a/legacy/api/handler/db.py +++ /dev/null @@ -1,98 +0,0 @@ -############################################################################## -# Copyright (c) 2016 ZTE Corp 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 -############################################################################## -from datetime import datetime -from operator import add -import uuid - -jobs = {} -threads = {} - - -def create_job(args): - if len(filter(lambda x: jobs[x]['state'] == 'processing', jobs.keys())) > 0: - return None - else: - job = {'job_id': str(uuid.uuid4()), - 'installer_type': args["installer_type"], - 'installer_ip': args["installer_ip"], - 'pod_name': args["pod_name"], - 'suite_name': args["suite_name"], - 'max_minutes': args["max_minutes"], - 'type': args["type"], - 'testdb_url': args["testdb_url"], - 'node_name': args["node_name"], - 'start_time': str(datetime.now()), - 'end_time': None, - 'state': 'processing', - 'state_detail': [], - 'result': None, - 'result_detail': []} - jobs[job['job_id']] = job - return job['job_id'] - - -def delete_job(job_id): - if job_id in threads: - stop_thread(job_id) - if job_id in jobs: - jobs[job_id]['end_time'] = str(datetime.now()) - jobs[job_id]['state'] = 'terminated' - return True - else: - return False - - -def get_job_info(job_id): - if job_id in jobs: - return jobs[job_id] - else: - return None - - -def finish_job(job_id): - jobs[job_id]['end_time'] = str(datetime.now()) - jobs[job_id]['state'] = 'finished' - jobs[job_id]['result'] = reduce(add, map(lambda x: x['result'], - jobs[job_id]['result_detail'])) - del threads[job_id] - - -def update_job_state_detail(job_id, state_detail): - jobs[job_id]['state_detail'] = state_detail - - -def update_job_result_detail(job_id, benchmark, result): - result['benchmark'] = benchmark - jobs[job_id]['result_detail'].append(result) - - -def is_job_timeout(job_id): - period = datetime.now() - datetime.strptime(jobs[job_id]['start_time'], - "%Y-%m-%d %H:%M:%S.%f") - return True if jobs[job_id]['max_minutes'] * 60 < period.total_seconds()\ - else False - - -def start_thread(job_id, thread, thread_stop): - threads[job_id] = {'thread': thread, - 'thread_stop': thread_stop} - thread.start() - - -def stop_thread(job_id): - if threads[job_id]['thread'].isAlive(): - threads[job_id]['thread_stop'].set() - threads[job_id]['thread'].join() - if job_id in threads: - del threads[job_id] - - -def update_benchmark_state(job_id, benchmark, benchmark_state): - filter(lambda x: x["benchmark"] == benchmark, - get_job_info(job_id)["state_detail"])[0]['state'] = benchmark_state diff --git a/legacy/api/handler/job_handler.py b/legacy/api/handler/job_handler.py deleted file mode 100644 index 4ecc1cee..00000000 --- a/legacy/api/handler/job_handler.py +++ /dev/null @@ -1,174 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import threading -from copy import copy - -from flask_restful import Resource, reqparse -from flask_restful_swagger import swagger -from qtip.api.model.job_model import JobResponseModel -from qtip.utils import args_handler as args_handler -from werkzeug.exceptions import abort - -from legacy.api.handler import db, result_handler - - -class Job(Resource): - @swagger.operation( - notes='get a job by ID', - nickname='get', - parameters=[], - responseMessages=[ - { - "code": 200, - "message": "Job detail info." - }, - { - "code": 404, - "message": "Can't not find the job id XXXXXXX" - } - ] - ) - def get(self, id): - ret = db.get_job_info(id) - return ret if ret else abort(404, " Can't not find the job id %s" % id) - - @swagger.operation( - notes='delete a job by ID', - nickname='delete', - parameters=[], - responseMessages=[ - { - "code": 200, - "message": "Delete successfully" - }, - { - "code": 404, - "message": "Can not find job_id XXXXXXXXX" - } - ] - ) - def delete(self, id): - ret = db.delete_job(id) - return {'result': "Delete successfully"} if ret else abort(404, "Can not find job_id %s" % id) - - -class JobList(Resource): - @swagger.operation( - note='create a job with parameters', - nickname='create', - parameters=[ - { - "name": "body", - "description": """ -"installer_type": The installer type, for example fuel, compass.., - -"installer_ip": The installer ip of the pod, - -"max_minutes": If specified, the maximum duration in minutes -for any single test iteration, default is '60', - -"pod_name": If specified, the Pod name, default is 'default', - -"suite_name": If specified, Test suite name, for example 'compute', 'network', 'storage', -default is 'compute', - -"type": BM or VM,default is 'BM', - -"benchmark_name": If specified, benchmark name in suite, for example 'dhrystone_bm.yaml', -default is all benchmarks in suite with specified type, - -"testdb_url": test db http url, for example 'http://testresults.opnfv.org/test/api/v1', - -"node_name": node name reported to test db - """, - "required": True, - "type": "JobModel", - "paramType": "body" - } - ], - type=JobResponseModel.__name__, - responseMessages=[ - { - "code": 200, - "message": "Job submitted" - }, - { - "code": 400, - "message": "Missing configuration data" - }, - { - "code": 409, - "message": "It already has one job running now!" - } - ] - ) - def post(self): - parser = reqparse.RequestParser() - parser.add_argument('installer_type', type=str, required=True, help='installer_type is required') - parser.add_argument('installer_ip', type=str, required=True, help='installer_ip is required') - parser.add_argument('max_minutes', type=int, required=False, default=60, help='max_minutes should be integer') - parser.add_argument('pod_name', type=str, required=False, default='default', help='pod_name should be string') - parser.add_argument('suite_name', type=str, required=False, default='compute', help='suite_name should be string') - parser.add_argument('type', type=str, required=False, default='BM', help='type should be BM, VM and ALL') - parser.add_argument('benchmark_name', type=str, required=False, default='all', help='benchmark_name should be string') - parser.add_argument('testdb_url', type=str, required=False, default=None, - help='testdb_url should be test db http url,for example http://testresults.opnfv.org/test/api/v1') - parser.add_argument('node_name', type=str, required=False, default=None, help='node_name should be string') - args = parser.parse_args() - if not args_handler.check_suite(args["suite_name"]): - return abort(404, 'message:Test suite {0} does not exist under benchmarks/suite'.format(args["suite_name"])) - if not args_handler.check_lab_name(args["pod_name"]): - return abort(404, 'message: You have specified a lab {0}\ - that is not present in test_cases'.format(args['pod_name'])) - - job_id = db.create_job(args) - if not job_id: - return abort(409, 'message:It already has one job running now!') - - benchmarks = args_handler.get_files_in_suite(args["suite_name"], - args["type"].lower()) - test_cases = args_handler.get_files_in_test_plan(args["pod_name"], - args["suite_name"], - args["type"].lower()) - benchmarks_list = filter(lambda x: x in test_cases, benchmarks) - if args["benchmark_name"] in benchmarks_list: - benchmarks_list = [args["benchmark_name"]] - if (args["benchmark_name"] is not 'all') and args["benchmark_name"] not in benchmarks_list: - return abort(404, 'message: Benchmark name {0} does not exist in suit {1}'.format(args["benchmark_name"], - args["suite_name"])) - state_detail = map(lambda x: {'benchmark': x, 'state': 'idle'}, benchmarks_list) - db.update_job_state_detail(job_id, copy(state_detail)) - thread_stop = threading.Event() - post_thread = threading.Thread(target=self.thread_post, args=(args["installer_type"], - benchmarks_list, - args["pod_name"], - args["suite_name"], - job_id, - args["testdb_url"], - args["node_name"], - thread_stop)) - db.start_thread(job_id, post_thread, thread_stop) - return {'job_id': str(job_id)} - - def thread_post(self, installer_type, benchmarks_list, pod_name, suite_name, - job_id, testdb_url, node_name, stop_event): - for benchmark in benchmarks_list: - if db.is_job_timeout(job_id) or stop_event.is_set(): - break - db.update_benchmark_state(job_id, benchmark, 'processing') - result = args_handler.prepare_and_run_benchmark(installer_type, - '/home', - args_handler.get_benchmark_path(pod_name, - suite_name, - benchmark)) - db.update_job_result_detail(job_id, benchmark, copy(result)) - db.update_benchmark_state(job_id, benchmark, 'finished') - if (result_handler.dump_suite_result(suite_name) and testdb_url): - result_handler.push_suite_result_to_db(suite_name, testdb_url, installer_type, node_name) - db.finish_job(job_id) diff --git a/legacy/api/handler/result_handler.py b/legacy/api/handler/result_handler.py deleted file mode 100644 index 3d1d592e..00000000 --- a/legacy/api/handler/result_handler.py +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################## -# Copyright (c) 2016 ZTE Corp 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 -############################################################################## -import importlib -import json -from os.path import expanduser - -import qtip.utils.dashboard.pushtoDB as push_to_db -from qtip.utils import logger_utils - -logger = logger_utils.QtipLogger('suite_result').get - - -def get_benchmark_result(benchmark_name, suite_name): - benchmark_indices = importlib.import_module('scripts.ref_results' - '.{0}_benchmarks_indices'.format(suite_name)) - methodToCall = getattr(benchmark_indices, '{0}_index'.format(benchmark_name)) - return methodToCall() - - -def dump_suite_result(suite_name): - suite_dict = {} - suite_bench_list = {'compute': ['DPI', 'Dhrystone', 'Whetstone', 'SSL', 'RamSpeed'], - 'storage': ['FIO'], - 'network': ['IPERF']} - temp = 0 - l = len(suite_bench_list[suite_name]) - for benchmark in suite_bench_list[suite_name]: - try: - suite_dict[benchmark] = get_benchmark_result(benchmark.lower(), suite_name) - temp = temp + float(suite_dict[benchmark]['index']) - except OSError: - l = l - 1 - pass - - if l == 0: - logger.info("No {0} suite results found".format(suite_name)) - return False - else: - suite_index = temp / l - suite_dict_f = {'index': suite_index, - 'suite_results': suite_dict} - result_path = expanduser('~') + '/qtip/results' - with open('{0}/{1}_result.json'.format(result_path, suite_name), 'w+') as result_json: - json.dump(suite_dict_f, result_json, indent=4, sort_keys=True) - return True - - -def push_suite_result_to_db(suite_name, test_db_url, installer_type, node_name): - with open('results/{0}_result.json'.format(suite_name), 'r') as result_file: - j = json.load(result_file) - push_to_db.push_results_to_db(test_db_url, '{0}_test_suite'.format(suite_name), - j, installer_type, node_name) diff --git a/legacy/api/model/__init__.py b/legacy/api/model/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/legacy/api/model/__init__.py +++ /dev/null diff --git a/legacy/api/model/job_model.py b/legacy/api/model/job_model.py deleted file mode 100644 index 73baf660..00000000 --- a/legacy/api/model/job_model.py +++ /dev/null @@ -1,33 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -from flask_restful import fields -from flask_restful_swagger import swagger - - -@swagger.model -class JobModel: - resource_fields = { - 'installer_type': fields.String, - 'installer_ip': fields.String, - 'max_minutes': fields.Integer, - 'pod_name': fields.String, - 'suite_name': fields.String, - 'type': fields.String, - 'benchmark_name': fields.String, - 'testdb_url': fields.String, - 'node_name': fields.String - } - required = ['installer_type', 'installer_ip'] - - -@swagger.model -class JobResponseModel: - resource_fields = { - 'job_id': fields.String - } diff --git a/legacy/api/router/__init__.py b/legacy/api/router/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/legacy/api/router/__init__.py +++ /dev/null diff --git a/legacy/api/router/mapper.py b/legacy/api/router/mapper.py deleted file mode 100644 index 470d18e2..00000000 --- a/legacy/api/router/mapper.py +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -from legacy.api.handler.job_handler import Job, JobList - - -mappers = [ - (JobList, '/api/v1.0/jobs'), - (Job, '/api/v1.0/jobs/<string:id>'), -] diff --git a/legacy/api/router/mapper.py.orig b/legacy/api/router/mapper.py.orig deleted file mode 100644 index 1acb40b5..00000000 --- a/legacy/api/router/mapper.py.orig +++ /dev/null @@ -1,19 +0,0 @@ -<<<<<<< HEAD -from legacy.api.handler.job_handler import Job, JobList -======= -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -from legacy.api.handler import Job, JobList ->>>>>>> 615b529... Add licence header according to OPNFV contribution guidelines[1] by script[2] - - -mappers = [ - (JobList, '/api/v1.0/jobs'), - (Job, '/api/v1.0/jobs/<string:id>'), -] diff --git a/legacy/assets/perftest/common/git_proxy_pbook.yaml b/legacy/assets/perftest/common/git_proxy_pbook.yaml deleted file mode 100644 index e190162b..00000000 --- a/legacy/assets/perftest/common/git_proxy_pbook.yaml +++ /dev/null @@ -1,19 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -#git -- name: set git proxy(http) - shell: "git config --global http.proxy {{ http_proxy }}" - when: http_proxy is defined - ignore_errors: yes - -- name: set git proxy(https) - shell: "git config --global https.proxy {{https_proxy}}" - when: https_proxy is defined - ignore_errors: yes - diff --git a/legacy/assets/perftest/common/sys_proxy_pbook.yaml b/legacy/assets/perftest/common/sys_proxy_pbook.yaml deleted file mode 100644 index 543285e3..00000000 --- a/legacy/assets/perftest/common/sys_proxy_pbook.yaml +++ /dev/null @@ -1,61 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -#env -- name: insert shell proxy http - lineinfile: dest=/etc/profile.d/proxy.sh state=present create=yes owner=root group=root mode=0644 regexp="export http_proxy={{ http_proxy }}" - insertafter=EOF line="export http_proxy={{ http_proxy }}" - when: http_proxy is defined - ignore_errors: yes - -- name: insert shell proxy https - lineinfile: dest=/etc/profile.d/proxy.sh state=present create=yes owner=root group=root mode=0644 regexp="export https_proxy={{ https_proxy }}" - insertafter=EOF line="export https_proxy={{ https_proxy }}" - when: https_proxy is defined - ignore_errors: yes - -- name: insert no proxy - lineinfile: dest=/etc/profile.d/proxy.sh state=present create=yes owner=root group=root mode=0644 regexp="{{ no_proxy }}" - insertafter=EOF line="export no_proxy={{ no_proxy }}" - when: no_proxy is defined - ignore_errors: yes - -#wget -- name: insert wget proxy(http) - lineinfile: dest=/etc/wgetrc state=present regexp="http_proxy={{ http_proxy }}" - insertafter="^#http_proxy" line="http_proxy={{ http_proxy }}" - when: http_proxy is defined - ignore_errors: yes - -- name: insert wget proxy(https) - lineinfile: dest=/etc/wgetrc state=present regexp="https_proxy={{ https_proxy }}" - insertafter="^#https_proxy" line="https_proxy={{ https_proxy }}" - when: https_proxy is defined - ignore_errors: yes - -#yum -- name: insert yum proxy(http) - lineinfile: dest=/etc/yum.conf state=present regexp="proxy={{ http_proxy }}" - insertafter=EOF line="proxy={{ http_proxy }}" - when: ansible_os_family == "RedHat" and http_proxy is defined - ignore_errors: yes - -#apt - -- name: insert apt proxy(http) - lineinfile: dest=/etc/apt/apt.conf state=present create=yes regexp="Acquire::http::Proxy \"{{ http_proxy }}\";" - insertafter=EOF line="Acquire::http::Proxy \"{{ http_proxy }}\";" - when: ansible_os_family == "Debian" and http_proxy is defined - ignore_errors: yes - -- name: insert apt proxy(https) - lineinfile: dest=/etc/apt/apt.conf state=present create=yes regexp="Acquire::https::Proxy \"{{ https_proxy }}\";" - insertafter=EOF line="Acquire::https::Proxy \"{{ https_proxy }}\";" - when: ansible_os_family == "Debian" and https_proxy is defined - ignore_errors: yes - diff --git a/legacy/assets/perftest/dhrystone.yaml b/legacy/assets/perftest/dhrystone.yaml deleted file mode 100644 index dd098c5e..00000000 --- a/legacy/assets/perftest/dhrystone.yaml +++ /dev/null @@ -1,119 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## - - hosts: localhost - connection: local - gather_facts: no - - tasks: - - name: making dhrystone directory - file: path={{Dest_dir}}/dhrystone state=directory - - - name: making temporary dhrystone directory - file: path={{Dest_dir}}/dhrystone/dhrystone_temp state=directory - - - hosts: "{{role}}" - become: yes - remote_user: "{{username}}" - - tasks: - - name: checking home directory - shell: echo $HOME - register: home_dir - - - name: cleaning tempT - file: path={{home_dir.stdout}}/tempT state=absent - - - name: cleaning qtip_result - file: path={{home_dir.stdout}}/qtip_result state=absent - - - name: make directory - file: path={{home_dir.stdout}}/qtip_result state=directory - - - include: ./common/sys_proxy_pbook.yaml - - - include: ./common/sys_info_pbook.yaml - vars: - network: false - - - name: Installing UnixBench dependencies if CentOS - shell: yum install git gcc patch perl-Time-HiRes -y - when: ansible_os_family == "RedHat" - - - name: Installing UnixBench dependencies if Ubuntu - shell: apt-get install git gcc patch perl -y - when: ansible_os_family == "Debian" - - - include: ./common/git_proxy_pbook.yaml - - - name: Clone unixbench - git: repo=https://github.com/kdlucas/byte-unixbench.git - dest=$HOME/tempT - - - name: make - shell: sudo make --directory $HOME/tempT/UnixBench/ - - - name: Run dhrystone - shell: cd $HOME/tempT/UnixBench/&& sudo ./Run -v dhrystone - - - name: collecting and transforming result script copy - copy: src={{workingdir}}/qtip/utils/transform/ubench_transform.py dest={{home_dir.stdout}}/qtip_result/ - - - name: transforming result - shell: cd $HOME/qtip_result/ && sudo python ubench_transform.py - - - name: copying consolidated report script - copy: src={{workingdir}}/utils/transform/final_report.py dest={{home_dir.stdout}}/qtip_result/ - - - name: making consolidated report - shell: cd $HOME/qtip_result && sudo python final_report.py Dhrystone {{fname}} - - - name: making directory - file: path={{home_dir.stdout}}/qtip_result/log state=directory - - - name: copying result to temp directory - shell: sudo cp -r $HOME/tempT/UnixBench/results/* $HOME/qtip_result/log/ - - - name: registering files - shell: (cd $HOME/qtip_result/; find . -maxdepth 1 -name "*.json") | cut -d'/' -f2 - register: files_to_copy - - - name: copy results - fetch: src={{home_dir.stdout}}/qtip_result/{{item}} dest={{Dest_dir}}/dhrystone/dhrystone_temp - with_items: "{{files_to_copy.stdout_lines}}" - - - name: registering log files - shell: (cd $HOME/qtip_result/log/; find . -maxdepth 1 -name "*.log") | cut -d'/' -f2 - register: copy_log_results - - - name: copying log results - fetch: src={{home_dir.stdout}}/qtip_result/log/{{item}} dest={{Dest_dir}}/dhrystone/dhrystone_temp - with_items: "{{copy_log_results.stdout_lines}}" - - - name: cleaning tempT - file: path={{home_dir.stdout}}/tempT state=absent - - - name: cleaning_qtip_result - file: path={{home_dir.stdout}}/qtip_result state=absent - - - hosts: localhost - connection: local - gather_facts: no - - tasks: - - name: extracting_json - shell: (find {{Dest_dir}}/dhrystone/dhrystone_temp/ -name "*.json" | xargs cp -t {{Dest_dir}}/dhrystone/) - - - name: making_logs_folder - file: path={{Dest_dir}}/dhrystone/logs state=directory - - - name: extracting_log - shell: (find {{Dest_dir}}/dhrystone/dhrystone_temp/ -name "*.log" | xargs cp -t {{Dest_dir}}/dhrystone/logs) - - - name: removing dhrystone_temp - file: path={{Dest_dir}}/dhrystone/dhrystone_temp state=directory diff --git a/legacy/assets/perftest/dpi.yaml b/legacy/assets/perftest/dpi.yaml deleted file mode 100644 index 55a5dcb5..00000000 --- a/legacy/assets/perftest/dpi.yaml +++ /dev/null @@ -1,134 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## - - hosts: localhost - connection: local - gather_facts: no - - tasks: - - name: making dpi directory - file: path={{Dest_dir}}/dpi state=directory - - - name: making temporary whetstone directory - file: path={{Dest_dir}}/dpi/dpi_temp state=directory - - - hosts: "{{role}}" - become: yes - remote_user: "{{username}}" - - tasks: - - name: echo - shell: echo $USER - - - name: checking home directory - shell: echo $HOME - register: home_dir - - - name: cleaning - file: path={{home_dir.stdout}}/tempD state=absent - - - name: cleaning previous results - file: path={{home_dir.stdout}}/qtip_result state=absent - - - name: make qtip_result - file: path={{home_dir.stdout}}/qtip_result state=directory - - - include: ./common/sys_proxy_pbook.yaml - - - include: ./common/sys_info_pbook.yaml - vars: - network: false - - - name: Installing nDPI dependencies if CentOS - shell: sudo yum install git gcc patch perl-Time-HiRes autofconf automake libpcap-devel libtool -y - when: ansible_os_family == "RedHat" - - - name: Installing nDPI dependcies if Ubuntu - shell: sudo apt-get install git gcc patch autoconf automake libpcap-dev libtool -y - when: ansible_os_family == "Debian" - - - name: making nDPI temporary directory - file: path=$HOME/tempD state=directory - - - include: ./common/git_proxy_pbook.yaml - - - name: Clone nDPI - git: repo=https://github.com/ntop/nDPI.git - dest=$HOME/tempD/nDPI - - - name: autogen - shell: cd $HOME/tempD/nDPI && sudo ./autogen.sh - - - name: configure - shell: cd $HOME/tempD/nDPI && sudo ./configure - - - name: make - shell: cd $HOME/tempD/nDPI && sudo make - - - name: Fetching Test_pcap file - shell: cd $HOME/tempD/nDPI/example && wget http://build.opnfv.org/artifacts.opnfv.org/qtip/utilities/test.pcap - - - name: fetch Averaging script - copy: src=./etc/dpi_average.sh dest={{home_dir.stdout}}/tempD/nDPI/example mode=777 - - - name: Run nDPI benchmark - shell: cd $HOME/tempD/nDPI/example && sudo ./dpi_average.sh - - - name: copy result to temp_direc - shell: sudo cp $HOME/tempD/nDPI/example/dpi_dump.txt $HOME/qtip_result - - - name: fetch dpi result transform script - copy: src={{workingdir}}/qtip/utils/transform/dpi_transform.py dest={{home_dir.stdout}}/qtip_result - - - name: Transforming results - shell: cd $HOME/qtip_result && sudo python dpi_transform.py - - - name: copy report formation script - copy: src={{workingdir}}/qtip/utils/transform/final_report.py dest={{home_dir.stdout}}/qtip_result - - - name: consolidating report - shell: cd $HOME/qtip_result && sudo python final_report.py DPI {{fname}} - - - name: registering files - shell: (cd $HOME/qtip_result/; find . -maxdepth 1 -name "*.json") | cut -d'/' -f2 - register: files_to_copy - - - name: copy results - fetch: src={{home_dir.stdout}}/qtip_result/{{item}} dest={{Dest_dir}}/dpi/dpi_temp - with_items: "{{files_to_copy.stdout_lines}}" - - - name: registering log files - shell: (cd $HOME/qtip_result/; find . -maxdepth 1 -name "*.log") | cut -d'/' -f2 - register: copy_log_results - - - name: copying log results - fetch: src={{home_dir.stdout}}/qtip_result/{{item}} dest={{Dest_dir}}/dpi/dpi_temp - with_items: "{{copy_log_results.stdout_lines}}" - - - name: cleaning tempD - file: path={{home_dir.stdout}}/tempD state=absent - - - name: cleaning_qtip_result - file: path={{home_dir.stdout}}/qtip_result state=absent - - - hosts: localhost - connection: local - gather_facts: no - - tasks: - - name: extracting_json - shell: (find {{Dest_dir}}/dpi/dpi_temp/ -name "*.json" | xargs cp -t {{Dest_dir}}/dpi/) - - - name: making_logs_folder - file: path={{Dest_dir}}/dpi/logs state=directory - - - name: extracting_log - shell: (find {{Dest_dir}}/dpi/dpi_temp/ -name "*.log" | xargs cp -t {{Dest_dir}}/dpi/logs) - - - name: removing dpi_temp - file: path={{Dest_dir}}/dpi/dpi_temp state=absent diff --git a/legacy/assets/perftest/etc/fio_test_job b/legacy/assets/perftest/etc/fio_test_job deleted file mode 100644 index 6817abca..00000000 --- a/legacy/assets/perftest/etc/fio_test_job +++ /dev/null @@ -1,13 +0,0 @@ -[global] - -runtime= 600 -ioengine=libaio -iodepth=2 -direct=1 -bs=4k -rw=randrw - -[job1] -size=5G - - diff --git a/legacy/assets/perftest/etc/info_collect.py b/legacy/assets/perftest/etc/info_collect.py deleted file mode 100644 index 3dbe55c2..00000000 --- a/legacy/assets/perftest/etc/info_collect.py +++ /dev/null @@ -1,94 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import os -import pickle -import json -import sys - -os.system('inxi -b -c0 -n > $PWD/est_2') -est_ob = open("est_2", "r+") -est_ob2 = open("est_1", "w+") -in_string = est_ob.read().replace('\n', ' ') -cpu_idle = float(os.popen("""top -bn1 | grep "Cpu(s)" | awk '{print $8}'""").read().rstrip()) -cpu_usage = 100 - cpu_idle -est_ob2.write(in_string) -est_ob.close() -est_ob2.close() - -inxi_host = os.popen("""cat $PWD/est_1 | grep -o -P '(?<=Host:).*(?=Kernel)' """).read().lstrip().rstrip() -inxi_mem = os.popen("""cat $PWD/est_1 | grep -o -P '(?<=Memory:).*(?=MB)' """).read().lstrip().rstrip() + "MB" -inxi_cpu = os.popen("""cat $PWD/est_1 | grep -o -P '(?<=CPU).*(?=speed)' | cut -f2 -d':'""").read().lstrip().rstrip() -inxi_distro = os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=Distro:).*(?=Machine:)' """).read().rstrip().lstrip() -inxi_kernel = os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=Kernel:).*(?=Console:)' """).read().rstrip().lstrip() -inxi_HD = os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=HDD Total Size:).*(?=Info:)' """).read().rstrip().lstrip() -inxi_product = os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=product:).*(?=Mobo:)' """).read().rstrip().lstrip() - -info_dict = {'hostname': inxi_host, - 'product': inxi_product, - 'os': inxi_distro, - 'kernel': inxi_kernel, - 'cpu': inxi_cpu, - 'cpu_usage': '{0}%'.format(str(round(cpu_usage, 3))), - 'memory_usage': inxi_mem, - 'disk_usage': inxi_HD} -network_flag = str(sys.argv[1]).rstrip() - -if (network_flag == 'n'): - - info_dict['network_interfaces'] = {} - tem_2 = """ cat $PWD/est_1 | grep -o -P '(?<=Network:).*(?=Info:)'""" - print os.system(tem_2 + ' > Hello') - i = int(os.popen(tem_2 + " | grep -o 'Card' | wc -l ").read()) - print i - - for x in range(1, i + 1): - tem = """ cat $PWD/est_1 | grep -o -P '(?<=Card-""" + str(x) + """:).*(?=Card-""" + str(x + 1) + """)'""" - if i == 1: - tem = """ cat $PWD/est_1 | grep -o -P '(?<=Network:).*(?=Info:)'""" - inxi_card_1 = ((os.popen(tem + " | grep -o -P '(?<=Card:).*(?=Drives:)'|sed 's/ *driver:.*//'").read().rstrip().lstrip())) - print inxi_card_1 - info_dict['network_interfaces']['interface_' + str(x)] = {} - info_dict['network_interfaces']['interface_' + str(x)]['network_card'] = inxi_card_1 - inxi_card_2 = ((os.popen(tem + "| grep -o -P '(?<=Card:).*(?=Drives:)'|sed -e 's/^.*IF: //'").read())).rstrip().lstrip() - info_dict['network_interfaces']['interface_' + str(x)]['interface_info'] = inxi_card_2 - elif x < (i): - print "two" - inxi_card_1 = ((os.popen(tem + "| sed 's/ *driver:.*//'").read().rstrip().lstrip())) - info_dict['network_interfaces']['interface_' + str(x)] = {} - info_dict['network_interfaces']['interface_' + str(x)]['network_Card'] = inxi_card_1 - inxi_card_2 = ((os.popen(tem + "|sed -e 's/^.*IF: //'").read())).rstrip().lstrip() - info_dict['network_interfaces']['interface_' + str(x)]['interface_info'] = inxi_card_2 - elif x == i: - print "Three" - info_dict['network_interfaces']['interface_' + str(x)] = {} - inxi_card_1 = ((os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=Card-""" + str(x) + """:).*(?=Drives:)'| sed 's/ *driver:.*//' """).read().rstrip().lstrip())) - info_dict['network_interfaces']['interface_' + str(x)]['network_Card'] = inxi_card_1 - inxi_card_2 = ((os.popen(""" cat $PWD/est_1 | grep -o -P '(?<=Card-""" + str(x) + """:).*(?=Drives:)'| sed -e 's/^.*IF: //' """).read().rstrip().lstrip())) - info_dict['network_interfaces']['interface_' + str(x)]['interface_info'] = inxi_card_2 - else: - print "No network cards" - os.system("bwm-ng -o plain -c 1 | grep -v '=' | grep -v 'iface' | grep -v '-' > bwm_dump") - n_interface = int(os.popen(" cat bwm_dump | grep -v 'total' | wc -l ").read().rstrip()) - interface = {} - for x in range(1, n_interface): - interface_name = os.popen(" cat bwm_dump | awk 'NR==" + str(x) + "' | awk '{print $1}' ").read().rstrip().replace(':', '') - interface[str(interface_name)] = {} - interface[str(interface_name)]['Rx (KB/s)'] = os.popen(" cat bwm_dump | awk 'NR==" + str(x) + "' | awk '{print $2}' ").read().rstrip() - interface[str(interface_name)]['Tx (KB/s)'] = os.popen(" cat bwm_dump | awk 'NR==" + str(x) + "' | awk '{print $4}' ").read().rstrip() - interface[str(interface_name)]['Total (KB/s)'] = os.popen(" cat bwm_dump | awk 'NR== " + str(x) + "' | awk '{print $6}' ").read().rstrip() - - info_dict['interface_io'] = interface - -print info_dict - -with open('./sys_info_temp', 'w+')as out_info: - pickle.dump(info_dict, out_info) - -with open('temp', 'w+') as result_json: - json.dump(info_dict, result_json, indent=4, sort_keys=True) diff --git a/legacy/assets/perftest/fio.yaml b/legacy/assets/perftest/fio.yaml deleted file mode 100644 index e6d1072d..00000000 --- a/legacy/assets/perftest/fio.yaml +++ /dev/null @@ -1,120 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## - - hosts: localhost - connection: local - gather_facts: no - - tasks: - - name: making fio directory - file: path={{Dest_dir}}/fio state=directory - - - name: making temporary fio directory - file: path={{Dest_dir}}/fio/fio_temp state=directory - - - - hosts: "{{role}}" - become: yes - remote_user: "{{username}}" - - tasks: - - name: checking home directory - shell: echo $HOME - register: home_dir - - - name: cleaning fio directory - file: path={{home_dir.stdout}}/fio state=absent - - - name: cleaning previous results - file: path={{home_dir.stdout}}/qtip_result state=absent - - - name: making fio temporary directory - file: path={{home_dir.stdout}}/fio state=directory - - - name: making results temporary directory - file: path={{home_dir.stdout}}/qtip_result state=directory - - - include: ./common/sys_proxy_pbook.yaml - - - include: ./common/sys_info_pbook.yaml - vars: - network: false - - - name: Installing fio dependencies when CentOS - shell: sudo yum install wget gcc libaio-devel -y - when: ansible_os_family == "RedHat" - - - name: Installing fio dependencies when Ubuntu - shell: sudo apt-get install wget gcc libaio-dev -y - when: ansible_os_family == "Debian" - - - name: Fetching fio - shell: cd $HOME/fio/ && wget http://freecode.com/urls/3aa21b8c106cab742bf1f20d60629e3f -O fio.tar.gz - - - name: Untar fio - shell: cd $HOME/fio/ && sudo tar -zxvf fio.tar.gz - - - name: configure - shell: cd $HOME/fio/fio-2.1.10 && sudo ./configure && sudo make - - - name: Fetching fio job - copy: src=./etc/fio_test_job dest={{home_dir.stdout}}/fio/fio-2.1.10/ - - - name: Benchmarking block storage through fio - shell: cd $HOME/fio/fio-2.1.10 && sudo ./fio --output-format=json --output=$HOME/qtip_result/fio_result.json fio_test_job - - - name: Fetching result transformation script - copy: src={{workingdir}}/qtip/utils/transform/fio_transform.py dest={{home_dir.stdout}}/qtip_result - - - name: Transforming result - shell: cd $HOME/qtip_result && sudo python fio_transform.py - - - name: copy report formation script - copy: src={{workingdir}}/qtip/utils/transform/final_report.py dest={{home_dir.stdout}}/qtip_result - - - name: consolidating report - shell: cd $HOME/qtip_result && sudo python final_report.py FIO {{fname}} - - - name: registering files - shell: (cd $HOME/qtip_result/; find . -maxdepth 1 -name "*.json") | cut -d'/' -f2 - register: files_to_copy - - - name: copy results - fetch: src={{home_dir.stdout}}/qtip_result/{{item}} dest={{Dest_dir}}/fio/fio_temp - with_items: "{{files_to_copy.stdout_lines}}" - - - name: registering log files - shell: (cd $HOME/qtip_result/; find . -maxdepth 1 -name "*.log") | cut -d'/' -f2 - register: copy_log_results - - - name: copying log results - fetch: src={{home_dir.stdout}}/qtip_result/{{item}} dest={{Dest_dir}}/fio/fio_temp - with_items: "{{copy_log_results.stdout_lines}}" - - - name: cleaning fio - file: path={{home_dir.stdout}}/fio state=absent - - - name: cleaning_qtip_result - file: path={{home_dir.stdout}}/qtip_result state=absent - - - hosts: localhost - connection: local - gather_facts: no - - tasks: - - name: extracting_json - shell: (find {{Dest_dir}}/fio/fio_temp/ -name "*.json" | xargs cp -t {{Dest_dir}}/fio/) - - - name: making_logs_folder - file: path={{Dest_dir}}/fio/logs state=directory - - - name: extracting_log - shell: (find {{Dest_dir}}/fio/fio_temp/ -name "*.log" | xargs cp -t {{Dest_dir}}/fio/logs) - - - name: removing fio_log - file: path={{Dest_dir}}/fio/fio_temp state=absent diff --git a/legacy/assets/perftest/iperf.yaml b/legacy/assets/perftest/iperf.yaml deleted file mode 100644 index 6654c556..00000000 --- a/legacy/assets/perftest/iperf.yaml +++ /dev/null @@ -1,170 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## - - hosts: localhost - connection: local - gather_facts: no - - tasks: - - name: making Iperf directory - file: path={{Dest_dir}}/iperf state=directory - - - name: making temporary iperf directory - file: path={{Dest_dir}}/iperf/iperf_temp state=directory - - - - hosts: "{{role}}" - become: yes - remote_user: "{{username}}" - - tasks: - - name: Rolename - set_fact: - rolename: "{{role}}" - when: role is defined - - - name: installertype - set_fact: - installertype: "{{installer}}" - - - name: Get Hostname - shell: echo $HOSTNAME - register: hostID - - - name: echo - shell: echo index_var - - - name: checking home directory - shell: echo $HOME - register: home_dir - - - name: cleaning iperf directory - file: path={{home_dir.stdout}}/iperf state=absent - - - name: cleaning previous results - file: path={{home_dir.stdout}}/qtip_result state=absent - - - name: making Iperf temporary directory - file: path={{home_dir.stdout}}/iperf state=directory - - - name: making results temporary directory - file: path={{home_dir.stdout}}/qtip_result state=directory - - - include: ./common/sys_proxy_pbook.yaml - - - include: ./common/sys_info_pbook.yaml - vars: - network: true - - - name: Installing Epel-release when CentOS - shell: sudo yum install epel-release -y - when: ansible_os_family == "RedHat" - - - name: Allow iperf server port in iptables input rules - shell: iptables -A INPUT -p tcp --dport {{iperf_port}} -j ACCEPT - vars: - iperf_port: 5201 - ignore_errors: yes - when: rolename == "1-server" and installertype == 'fuel' - - - name: Installing IPERF when Ubuntu - shell: sudo apt-get install iperf3 -y - when: ansible_os_family == "Debian" - - - name: Installing Iperf3 - shell: sudo yum install iperf3 -y - when: ansible_os_family == "RedHat" - - - name: Running iperf on server - shell: iperf3 -s - async: 400 - poll: 0 - when: rolename == "1-server" - - - name: Running Iperf on Host - shell: iperf3 --time {{duration}} -b 0 G -c {{ip1}} -J -O10 >> {{home_dir.stdout}}/qtip_result/iperf_raw.json - ignore_errors: yes - with_items: - - "{{ip1}}" - when: rolename == "2-host" and "{{privateip1}}" == "NONE" - - - name: Running Iperf on Host - shell: iperf3 --time {{duration}} -b 0 G -c {{privateip1}} -J -O10 >> {{home_dir.stdout}}/qtip_result/iperf_raw.json - ignore_errors: yes - with_items: - - "{{ip1}}" - when: rolename == "2-host" and "{{privateip1}}" != "NONE" - - - name: Fetching result transformation script - copy: src={{workingdir}}/qtip/utils/transform/iperf_transform.py dest={{home_dir.stdout}}/qtip_result - - name: Transforming result - - shell: cd $HOME/qtip_result && sudo python iperf_transform.py - when: rolename =="2-host" and "{{ip2}}" == '' - - - name: copy report formation script - copy: src={{workingdir}}/qtip/utils/transform/final_report.py dest={{home_dir.stdout}}/qtip_result - when: rolename =="2-host" and "{{ip2}}" == '' - - - name: consolidating report - shell: cd $HOME/qtip_result && sudo python final_report.py IPERF {{fname}} - when: rolename =="2-host" and "{{ip2}}" == '' - - - name: Files to Copy - shell: (cd $HOME/qtip_result/; find . -maxdepth 1 -name "*.json") | cut -d'/' -f2 - register: files_to_copy - when: rolename =="2-host" and "{{ip2}}" == '' - - - name: copy results - fetch: src={{home_dir.stdout}}/qtip_result/{{item}} dest={{Dest_dir}}/iperf/iperf_temp - with_items: "{{files_to_copy.stdout_lines}}" - when: rolename =="2-host" and "{{ip2}}" == '' - - - name: registering log files - shell: (cd $HOME/qtip_result/; find . -maxdepth 1 -name "*.log") | cut -d'/' -f2 - register: copy_log_results - when: rolename =="2-host" and "{{ip2}}" == '' - - - name: copying log results - fetch: src={{home_dir.stdout}}/qtip_result/{{item}} dest={{Dest_dir}}/iperf/iperf_temp - with_items: "{{copy_log_results.stdout_lines}}" - when: rolename =="2-host" and "{{ip2}}" == '' - - - name: cleaning iperf directory - file: path={{home_dir.stdout}}/iperf state=absent - - - name: cleaning previous results - file: path={{home_dir.stdout}}/qtip_result state=absent - - - hosts: localhost - connection: local - gather_facts: no - - tasks: - - name: Rolename - set_fact: - rolename: "{{role}}" - when: role is defined - - - name: extracting_json - shell: (find {{Dest_dir}}/iperf/iperf_temp/ -name "*.json" | xargs cp -t {{Dest_dir}}/iperf/) - when: rolename == "2-host" - - - name: making_logs_folder - file: path={{Dest_dir}}/iperf/logs state=directory - - - name: extracting_log - shell: ( find {{Dest_dir}}/iperf/iperf_temp/ -name "*.log" | xargs cp -t {{Dest_dir}}/iperf/logs) - when: rolename == "2-host" - - - name: removing iperf_raw file - file: path={{Dest_dir}}/iperf/iperf_raw.json state=absent - when: rolename == "2-host" - - - name: removing iperf_temp - file: path={{Dest_dir}}/iperf/iperf_temp state=absent diff --git a/legacy/assets/perftest/ramspeed.yaml b/legacy/assets/perftest/ramspeed.yaml deleted file mode 100644 index 835d517a..00000000 --- a/legacy/assets/perftest/ramspeed.yaml +++ /dev/null @@ -1,123 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## - - hosts: localhost - connection: local - gather_facts: no - - tasks: - - name: making ramspeed directory - file: path={{Dest_dir}}/ramspeed state=directory - - - name: making temporary ramspeed directory - file: path={{Dest_dir}}/ramspeed/ramspeed_temp state=directory - - - - hosts: "{{role}}" - become: yes - remote_user: "{{username}}" - - tasks: - - name: checking home directory - shell: echo $HOME - register: home_dir - - - name: cleaning ramspeed directory - file: path={{home_dir.stdout}}/ramspeed state=absent - - - name: cleaning previous results - file: path={{home_dir.stdout}}/qtip_result state=absent - - - name: making ramspeed temporary directory - file: path={{home_dir.stdout}}/ramspeed state=directory - - - name: making results temporary directory - file: path={{home_dir.stdout}}/qtip_result state=directory - - - include: ./common/sys_proxy_pbook.yaml - - - include: ./common/sys_info_pbook.yaml - vars: - network: false - - - name: Installing RAM_Speed dependencies when CentOS - shell: sudo yum install wget gcc -y - when: ansible_os_family == "RedHat" - - - name: Installing RAM_Speed dependencies when Ubuntu - shell: sudo apt-get install wget gcc -y - when: ansible_os_family == "Debian" - - - name: make dummy file - shell: sudo touch $HOME/ramspeed/ramspeed.tar.gz - - - name: Fetching RAM_Speed - shell: cd $HOME/ramspeed/ && sudo wget -O ramspeed.tar.gz https://docs.google.com/uc?id=0B92Bp5LZTM7gRFctalZLMktTNDQ - - - name: Untar RAM_SPeed - shell: cd $HOME/ramspeed/ && sudo tar -zxvf ramspeed.tar.gz - - - name: configure - shell: cd $HOME/ramspeed/ramsmp-3.5.0 && ./build.sh - - - name: Benchmarking IntMem Bandwidth - shell: cd $HOME/ramspeed/ramsmp-3.5.0 && ./ramsmp -b 3 -l 5 -p 1 >> $HOME/qtip_result/Intmem - - - name: Benchmarking FloatMem Bandwidth - shell: cd $HOME/ramspeed/ramsmp-3.5.0 && ./ramsmp -b 6 -l 5 -p 1 >> $HOME/qtip_result/Floatmem - - - name: Fetching result transformation script - copy: src={{workingdir}}/qtip/utils/transform/ramspeed_transform.py dest={{home_dir.stdout}}/qtip_result - - - name: Transforming result - shell: cd $HOME/qtip_result && sudo python ramspeed_transform.py - - - name: copy report formation script - copy: src={{workingdir}}/qtip/utils/transform/final_report.py dest={{home_dir.stdout}}/qtip_result - - - name: consolidating report - shell: cd $HOME/qtip_result && sudo python final_report.py RamSpeed {{fname}} - - - name: registering files - shell: (cd $HOME/qtip_result/; find . -maxdepth 1 -name "*.json") | cut -d'/' -f2 - register: files_to_copy - - - name: copy results - fetch: src={{home_dir.stdout}}/qtip_result/{{item}} dest={{Dest_dir}}/ramspeed/ramspeed_temp - with_items: "{{files_to_copy.stdout_lines}}" - - - name: registering log files - shell: (cd $HOME/qtip_result/; find . -maxdepth 1 -name "*.log") | cut -d'/' -f2 - register: copy_log_results - - - name: copying log results - fetch: src={{home_dir.stdout}}/qtip_result/{{item}} dest={{Dest_dir}}/ramspeed/ramspeed_temp - with_items: "{{copy_log_results.stdout_lines}}" - - - name: cleaning ramspeed directory - file: path={{home_dir.stdout}}/ramspeed state=absent - - - name: cleaning previous results - file: path={{home_dir.stdout}}/qtip_result state=absent - - - hosts: localhost - connection: local - gather_facts: no - - tasks: - - name: extracting_json - shell: (find /{{Dest_dir}}/ramspeed/ramspeed_temp/ -name "*.json" | xargs cp -t {{Dest_dir}}/ramspeed/) - - - name: making_logs_folder - file: path={{Dest_dir}}/ramspeed/logs state=directory - - - name: extracting_log - shell: ( find {{Dest_dir}}/ramspeed/ramspeed_temp/ -name "*.log" | xargs cp -t {{Dest_dir}}/ramspeed/logs) - - - name: removing ramspeed_log - file: path={{Dest_dir}}/ramspeed/ramspeed_temp state=absent diff --git a/legacy/assets/perftest/ssl.yaml b/legacy/assets/perftest/ssl.yaml deleted file mode 100644 index db77a724..00000000 --- a/legacy/assets/perftest/ssl.yaml +++ /dev/null @@ -1,127 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## - - hosts: localhost - connection: local - gather_facts: no - - tasks: - - name: making ssl directory - file: path={{Dest_dir}}/ssl state=directory - - - name: making temporary ssl directory - file: path={{Dest_dir}}/ssl/ssl_temp state=directory - - - hosts: "{{role}}" - become: yes - remote_user: "{{username}}" - - tasks: - - name: checking home directory - shell: sudo echo $HOME - register: home_dir - - - name: cleaning Open_SSL directory - file: path={{home_dir.stdout}}/Open_SSL state=absent - - - name: cleaning_qtip_result - file: path={{home_dir.stdout}}/qtip_result state=absent - - - name: making OpenSSL temporary directory - file: path={{home_dir.stdout}}/Open_SSL state=directory - - - name: making results temporary directory - file: path={{home_dir.stdout}}/qtip_result state=directory - - - include: ./common/sys_proxy_pbook.yaml - - - include: ./common/sys_info_pbook.yaml - vars: - network: false - - - name: Installing OpenSSL dependencies when CentOS - shell: sudo yum install git wget gcc patch perl-Time-HiRes autofconf automake libpcap-devel libtool -y - when: ansible_os_family == "RedHat" - - - name: Installing OpenSSL dependencies when Ubuntu - shell: sudo apt-get install git gcc wget perl autoconf automake libpcap-dev libtool -y - when: ansible_os_family == "Debian" - - - name: Fetching OpenSSL - shell: cd $HOME/Open_SSL/ && sudo wget http://artifacts.opnfv.org/qtip/utilities/openssl-1.0.2f.tar.gz - - - name: Untar OpenSSL - shell: cd $HOME/Open_SSL/ && sudo tar -zxvf openssl-1.0.2f.tar.gz - - name: configure - shell: cd $HOME/Open_SSL/openssl-1.0.2f && sudo ./config - - - name: make - shell: cd $HOME/Open_SSL/openssl-1.0.2f && sudo make - - - name: make install - shell: cd $HOME/Open_SSL/openssl-1.0.2f && sudo make install - - - name: Benchmarking RSA signatures - shell: cd $HOME/Open_SSL/openssl-1.0.2f/apps && sudo ./openssl speed rsa >> $HOME/qtip_result/RSA_dump - - - name: Benchmaring AES-128-cbc cipher encryption throughput - shell: cd $HOME/Open_SSL/openssl-1.0.2f/apps && sudo ./openssl speed -evp aes-128-cbc >> $HOME/qtip_result/AES-128-CBC_dump - - - name: Fetching result transformation script - copy: src={{workingdir}}/qtip/utils/transform/ssl_transform.py dest={{home_dir.stdout}}/qtip_result - - - name: Transforming result - shell: cd $HOME/qtip_result && python ssl_transform.py - - - name: copy report formation script - copy: src={{workingdir}}/qtip/utils/transform/final_report.py dest={{home_dir.stdout}}/qtip_result - - - name: consolidating report - shell: cd $HOME/qtip_result && python final_report.py SSL {{fname}} - - - name: registering files - shell: (cd $HOME/qtip_result/; find . -maxdepth 1 -name "*.json") | cut -d'/' -f2 - register: files_to_copy - - - name: copy results - fetch: src={{home_dir.stdout}}/qtip_result/{{item}} dest={{Dest_dir}}/ssl/ssl_temp - with_items: "{{files_to_copy.stdout_lines}}" - - - name: registering log files - shell: (cd $HOME/qtip_result/; find . -maxdepth 1 -name "*.log") | cut -d'/' -f2 - register: copy_log_results - - - name: copying log results - fetch: src={{home_dir.stdout}}/qtip_result/{{item}} dest={{Dest_dir}}/ssl/ssl_temp - with_items: "{{copy_log_results.stdout_lines}}" - - - name: cleaning Open_SSL directory - file: path={{home_dir.stdout}}/Open_SSL state=absent - - - name: cleaning_qtip_result - file: path={{home_dir.stdout}}/qtip_result state=absent - - - hosts: localhost - connection: local - gather_facts: no - - tasks: - - name: echo - shell: echo $PWD - - - name: extracting_json - shell: (find {{Dest_dir}}/ssl/ssl_temp/ -name "*.json" | xargs cp -t {{Dest_dir}}/ssl/) - - - name: making_logs_folder - file: path={{Dest_dir}}/ssl/logs state=directory - - - name: extracting_log - shell: (find {{Dest_dir}}/ssl/ssl_temp/ -name "*.log" | xargs cp -t {{Dest_dir}}/ssl/logs) - - - name: removing ssl_temp - file: path={{Dest_dir}}/ssl/ssl_temp state=absent diff --git a/legacy/assets/perftest/summary b/legacy/assets/perftest/summary deleted file mode 100644 index 5891408c..00000000 --- a/legacy/assets/perftest/summary +++ /dev/null @@ -1,23 +0,0 @@ ---- - - test_cases: - - name: fio - description: Storage performance benchmark - - - name: iperf - description: Measures the network throughput - - - name: dpi - description: Traffic classification rate provides a measure for CPU performance - - - name: ssl - description: CPU performance benchmark - - - name: dhrystone - description: Evaluate CPU's integer operation performance - - - name: whetstone - description: Evaluate CPU's floating point performance - - - name: ramspeed - description: Measures the memory performance of a machine diff --git a/legacy/assets/perftest/whetstone.yaml b/legacy/assets/perftest/whetstone.yaml deleted file mode 100644 index 0037ded3..00000000 --- a/legacy/assets/perftest/whetstone.yaml +++ /dev/null @@ -1,119 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## - - hosts: localhost - connection: local - gather_facts: no - - tasks: - - name: making whetstone directory - file: path={{Dest_dir}}/whetstone state=directory - - - name: making temporary whetstone directory - file: path={{Dest_dir}}/whetstone/whetstone_temp state=directory - - - hosts: "{{role}}" - become: yes - remote_user: "{{username}}" - - tasks: - - name: storing_home - shell: echo $HOME - register: home_dir - - - name: cleaning tempT directory - file: path={{home_dir.stdout}}/tempT state=absent - - - name: cleaning qtip result directory - file: path={{home_dir.stdout}}/qtip_result state=absent - - - name: making qtip_result directory - file: path={{home_dir.stdout}}/qtip_result state=directory - - - include: ./common/sys_proxy_pbook.yaml - - - include: ./common/sys_info_pbook.yaml - vars: - network: false - - - name: Installing UnixBench dependencies if CentOS - shell: sudo yum install git gcc patch perl-Time-HiRes -y - when: ansible_os_family == "RedHat" - - - name: Installing UnixBench dependencies if Ubuntu - shell: sudo apt-get install git gcc patch perl -y - when: ansible_os_family == "Debian" - - - include: ./common/git_proxy_pbook.yaml - - - name: Clone unixbench - git: repo=https://github.com/kdlucas/byte-unixbench.git - dest=$HOME/tempT - - - name: make - shell: sudo make --directory $HOME/tempT/UnixBench/ - - - name: Run Whetstone - shell: cd $HOME/tempT/UnixBench/&&./Run -v whetstone - - - name: collecting and transforming result script copy - copy: src={{workingdir}}/qtip/utils/transform/ubench_transform.py dest={{home_dir.stdout}}/qtip_result/ - - - name: transforming result - shell: cd $HOME/qtip_result && sudo python ubench_transform.py - - - name: copying consolidated report script - copy: src={{workingdir}}/qtip/utils/transform/final_report.py dest={{home_dir.stdout}}/qtip_result/ - - - name: making consolidated report - shell: cd $HOME/qtip_result && sudo python final_report.py Whetstone {{fname}} - - - name: making directory - file: path={{home_dir.stdout}}/qtip_result/log state=directory - - - name: copying result to temp directory - shell: sudo cp -r $HOME/tempT/UnixBench/results/* $HOME/qtip_result/log - - - name: registering files - shell: (cd $HOME/qtip_result/; find . -maxdepth 1 -name "*.json") | cut -d'/' -f2 - register: files_to_copy - - - name: copy results - fetch: src={{home_dir.stdout}}/qtip_result/{{item}} dest={{Dest_dir}}/whetstone/whetstone_temp - with_items: "{{files_to_copy.stdout_lines}}" - - - name: registering log files - shell: (cd $HOME/qtip_result/log/; find . -maxdepth 1 -name "*.log") | cut -d'/' -f2 - register: copy_log_results - - - name: copying log results - fetch: src={{home_dir.stdout}}/qtip_result/log/{{item}} dest={{Dest_dir}}/whetstone/whetstone_temp - with_items: "{{copy_log_results.stdout_lines}}" - - - name: cleaning tempT directory - file: path={{home_dir.stdout}}/tempT state=absent - - - name: cleaning qtip result directory - file: path={{home_dir.stdout}}/qtip_result state=absent - - - hosts: localhost - connection: local - gather_facts: no - - tasks: - - name: extracting_json - shell: (find {{Dest_dir}}/whetstone/whetstone_temp/ -name "*.json" | xargs cp -t {{Dest_dir}}/whetstone/) - - - name: making_logs_folder - file: path={{Dest_dir}}/whetstone/logs state=directory - - - name: extracting_log - shell: (find {{Dest_dir}}/whetstone/whetstone_temp/ -name "*.log" | xargs cp -t {{Dest_dir}}/whetstone/logs) - - - name: removing whetstone_temp - file: path={{Dest_dir}}/whetstone/whetstone_temp state=absent diff --git a/legacy/assets/suite/compute b/legacy/assets/suite/compute deleted file mode 100644 index 3bf1b184..00000000 --- a/legacy/assets/suite/compute +++ /dev/null @@ -1,16 +0,0 @@ -{ - "bm": [ - "dhrystone_bm.yaml", - "whetstone_bm.yaml", - "ramspeed_bm.yaml", - "dpi_bm.yaml", - "ssl_bm.yaml" - ], - "vm": [ - "dhrystone_vm.yaml", - "whetstone_vm.yaml", - "ramspeed_vm.yaml", - "dpi_vm.yaml", - "ssl_vm.yaml" - ] -} diff --git a/legacy/assets/suite/compute.yaml b/legacy/assets/suite/compute.yaml deleted file mode 100644 index ead194a4..00000000 --- a/legacy/assets/suite/compute.yaml +++ /dev/null @@ -1,54 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -QPI: compute -description: sample performance index of computing - -formula: weighted arithmetic mean - -section: -- name: Integer - weight: 0.3 - formula: geometric mean - perftests: - - name: dhrystone - workloads: - - single_cpu - - multi_cpu -- name: Floating - weight: 0.3 - formula: geometric mean - perftests: - - name: whetstone - workloads: - - single_cpu - - multi_cpu -- name: Memory - weight: 0.2 - formula: geometric mean - perftests: - - name: ramspeed - workloads: - - int: [add, average, copy, scale, triad] - - float: [add, average, copy, scale, triad] -- name: DPI - weight: 0.1 - formula: geometric mean - perftests: - - name: dpi - workloads: - - bps - - pps -- name: SSL - weight: 0.1 - formula: geometric mean - perftests: - - name: ssl - workloads: - - aes_128_cbc: [512, 1024, 2048, 4096] - - rsa_sig: [16, 64, 256, 1024, 8192] diff --git a/legacy/assets/suite/network b/legacy/assets/suite/network deleted file mode 100644 index 58ce5cb9..00000000 --- a/legacy/assets/suite/network +++ /dev/null @@ -1,9 +0,0 @@ -{ - "bm": [ - "iperf_bm.yaml" - ], - "vm": [ - "iperf_vm.yaml", - "iperf_vm_2.yaml" - ] -} diff --git a/legacy/assets/suite/storage b/legacy/assets/suite/storage deleted file mode 100644 index f3068dd5..00000000 --- a/legacy/assets/suite/storage +++ /dev/null @@ -1,8 +0,0 @@ -{ - "bm": [ - "fio_bm.yaml" - ], - "vm": [ - "fio_vm.yaml" - ] -} diff --git a/legacy/assets/testplan/default/compute/dhrystone_bm.yaml b/legacy/assets/testplan/default/compute/dhrystone_bm.yaml deleted file mode 100644 index 54f27fb6..00000000 --- a/legacy/assets/testplan/default/compute/dhrystone_bm.yaml +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## - -Scenario: - benchmark: dhrystone - host: machine_1, machine_2 - server: - -Context: - Host_Machines: - machine_1: - ip: - pw: - role: host - machine_2: - ip: - pw: - role: host - - Virtual_Machines: - - -Test_Description: - Test_category: "Compute" - Benchmark: "dhrystone" - Overview: > - ''' This test will run the dhrystone benchmark in parallel on machine_1 and machine_2.\n - if you wish to add a virtual machine add the following information under the Virtual_Machine tag - - virtualmachine_1: - availability_zone: - public_network: - OS_image: - flavor: - role: ''' diff --git a/legacy/assets/testplan/default/compute/dhrystone_vm.yaml b/legacy/assets/testplan/default/compute/dhrystone_vm.yaml deleted file mode 100644 index 06377bea..00000000 --- a/legacy/assets/testplan/default/compute/dhrystone_vm.yaml +++ /dev/null @@ -1,53 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -Scenario: - benchmark: dhrystone - host: virtualmachine_1, virtualmachine_2 - server: blakc - -Context: - Host_Machines: - - Virtual_Machines: - virtualmachine_1: - availability_zone: compute1 - public_network: 'net04_ext' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - virtualmachine_2: - availability_zone: compute2 - public_network: 'net04_ext' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - -Test_Description: - Test_category: "Compute" - Benchmark: "dhrystone" - Overview: > - '''This test will run the dhrystone benchmark in parallel on machine_1 and machine_2.\n - if you wish to add a virtual machine add the following information under the Virtual_Machine tag - machine_1: - ip: 172.18.0.16 - pw: Op3nStack - role: host - machine_2: - ip: 172.18.0.15 - pw: Op3nStack - role: host - - virtualmachine_1: - availability_zone: - public_network: - OS_image: - flavor: - role: - ''' - diff --git a/legacy/assets/testplan/default/compute/dpi_bm.yaml b/legacy/assets/testplan/default/compute/dpi_bm.yaml deleted file mode 100644 index deb6a874..00000000 --- a/legacy/assets/testplan/default/compute/dpi_bm.yaml +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -Scenario: - benchmark: dpi - host: machine_1,machine_2 - -Context: - Host_Machines: - machine_1: - ip: - pw: - role: host - machine_2: - ip: - pw: - role: host - Virtual_Machines: -Test_Description: - Test_category: "Compute" - Benchmark: "dpi" - Overview: > - '''This test will run the DPI benchmark in serial on virutalmachine_1 and virtualmachine_2.\n - if you wish to add a host machine add the following information under the Host_Machine tag - virtualmachine_2: - availability_zone: compute1 - OS_image: QTIP_CentOS - public_network: 'provider_network' - - role: 1host - flavor: m1.large - machine_1: - ip: - pw: - role: - ''' - diff --git a/legacy/assets/testplan/default/compute/dpi_vm.yaml b/legacy/assets/testplan/default/compute/dpi_vm.yaml deleted file mode 100644 index 4fb16842..00000000 --- a/legacy/assets/testplan/default/compute/dpi_vm.yaml +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -Scenario: - benchmark: dpi - 1Run : virtualmachine_1, virtualmachine_2 - -Context: - Host_Machines: - - - Virtual_Machines: - virtualmachine_1: - availability_zone: compute1 - OS_image: QTIP_CentOS - public_network: 'net04_ext' - role: 1Run - flavor: m1.large - virtualmachine_2: - availability_zone: compute2 - OS_image: QTIP_CentOS - public_network: 'net04_ext' - role: 1Run - flavor: m1.large - -Test_Description: - Test_category: "Compute" - Benchmark: "dpi" - Overview: > - '''This test will run the DPI benchmark in parallel on virutalmachine_1 and virtualmachine_2.\n - if you wish to add a host machine add the following information under the Host_Machine tag - - machine_1: - ip: - pw: - role: - ''' - diff --git a/legacy/assets/testplan/default/compute/ramspeed_bm.yaml b/legacy/assets/testplan/default/compute/ramspeed_bm.yaml deleted file mode 100644 index c758c18d..00000000 --- a/legacy/assets/testplan/default/compute/ramspeed_bm.yaml +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -Scenario: - benchmark: ramspeed - host: machine_1, machine_2 - server: - -Context: - Host_Machines: - machine_1: - ip: - pw: - role: host - machine_2: - ip: - pw: - role: host - - Virtual_Machines: - - -Test_Description: - Test_category: "Compute" - Benchmark: "dhrystone" - Overview: > - ''' This test will run the dhrystone benchmark in parallel on machine_1 and machine_2.\n - if you wish to add a virtual machine add the following information under the Virtual_Machine tag - - virtualmachine_1: - availability_zone: - public_network: - OS_image: - flavor: - role: ''' - - diff --git a/legacy/assets/testplan/default/compute/ramspeed_vm.yaml b/legacy/assets/testplan/default/compute/ramspeed_vm.yaml deleted file mode 100644 index 5f7ab831..00000000 --- a/legacy/assets/testplan/default/compute/ramspeed_vm.yaml +++ /dev/null @@ -1,53 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -Scenario: - benchmark: ramspeed - host: virtualmachine_1, virtualmachine_2 - server: blakc - -Context: - Host_Machines: - - Virtual_Machines: - virtualmachine_1: - availability_zone: compute1 - public_network: 'net04_ext' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - virtualmachine_2: - availability_zone: compute2 - public_network: 'net04_ext' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - -Test_Description: - Test_category: "Compute" - Benchmark: "dhrystone" - Overview: > - '''This test will run the dhrystone benchmark in parallel on machine_1 and machine_2.\n - if you wish to add a virtual machine add the following information under the Virtual_Machine tag - machine_1: - ip: 172.18.0.16 - pw: Op3nStack - role: host - machine_2: - ip: 172.18.0.15 - pw: Op3nStack - role: host - - virtualmachine_1: - availability_zone: - public_network: - OS_image: - flavor: - role: - ''' - diff --git a/legacy/assets/testplan/default/compute/ssl_bm.yaml b/legacy/assets/testplan/default/compute/ssl_bm.yaml deleted file mode 100644 index bb2ee64a..00000000 --- a/legacy/assets/testplan/default/compute/ssl_bm.yaml +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -Scenario: - benchmark: ssl - host: machine_1,machine_2 - -Context: - Host_Machines: - machine_1: - ip: - pw: - role: host - machine_2: - ip: - pw: - role: host - Virtual_Machines: - - -Test_Description: - Test_category: "Compute" - Benchmark: "ssl" - Overview: > - '''This test will run the SSL benchmark in parallel on machine_1 and machine_1. - If you wish to add a virtual machine add the following information under the Virtual_Machine tag - - virtualmachine_1: - availability_zone: - public_network: - OS_image: - flavor: - role: - ''' diff --git a/legacy/assets/testplan/default/compute/ssl_vm.yaml b/legacy/assets/testplan/default/compute/ssl_vm.yaml deleted file mode 100644 index ca18393b..00000000 --- a/legacy/assets/testplan/default/compute/ssl_vm.yaml +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -Scenario: - benchmark: ssl - host: virtualmachine_1, virtualmachine_2 - -Context: - Host_Machines: - - Virtual_Machines: - virtualmachine_1: - availability_zone: compute1 - public_network: 'net04_ext' - OS_image: 'QTIP_CentOS' - flavor: 'm1.large' - role: host - virtualmachine_2: - availability_zone: compute2 - public_network: 'net04_ext' - OS_image: 'QTIP_CentOS' - flavor: 'm1.large' - role: host - - -Test_Description: - Test_category: "Compute" - Benchmark: "ssl" - Overview: > - '''This test will run the SSL benchmark in parallel on virtualmachine_1 and machine_1.\n - if you wish to add a virtual machine add the following information under the Virtual_Machine tag - - virtualmachine_1: - availability_zone: - public_network: - OS_image: - flavor: - role: - ''' diff --git a/legacy/assets/testplan/default/compute/whetstone_bm.yaml b/legacy/assets/testplan/default/compute/whetstone_bm.yaml deleted file mode 100644 index 1d3add50..00000000 --- a/legacy/assets/testplan/default/compute/whetstone_bm.yaml +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -Scenario: - benchmark: whetstone - host: machine_1, machine_2 - - -Context: - Host_Machines: - machine_1: - ip: - pw: - role: host - machine_2: - ip: - pw: - role: host - Virtual_Machines: - - - -Test_Description: - Test_category: "Compute" - Benchmark: "whetstone" - Overview: > - ''' This test will run the whetstone benchmark in parallel on machine_1 and machine_2.\n - if you wish to add a baremetal machine add the following information under the Virtual_Machine tag - - machine_3: - ip: - pw: - role: - ''' - - diff --git a/legacy/assets/testplan/default/compute/whetstone_vm.yaml b/legacy/assets/testplan/default/compute/whetstone_vm.yaml deleted file mode 100644 index 4e0e1d80..00000000 --- a/legacy/assets/testplan/default/compute/whetstone_vm.yaml +++ /dev/null @@ -1,52 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -Scenario: - benchmark: whetstone - host: virtualmachine_1, virtualmachine_1 - server: - -Context: - Host_Machines: - - Virtual_Machines: - virtualmachine_1: - availability_zone: compute1 - public_network: 'net04_ext' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - virtualmachine_2: - availability_zone: compute2 - public_network: 'net04_ext' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - - -Test_Description: - Test_category: "Compute" - Benchmark: "dhrystone" - Overview: > - '''This test will run the whetstone benchmark in parallel on machine_1 and machine_2.\n - if you wish to add a virtual machine add the following information under the Virtual_Machine tag - virtualmachine_1: - availability_zone: nova - public_network: 'net04_ext' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - - virtualmachine_1: - availability_zone: - public_network: - OS_image: - flavor: - role: - ''' - diff --git a/legacy/assets/testplan/default/network/iperf_bm.yaml b/legacy/assets/testplan/default/network/iperf_bm.yaml deleted file mode 100644 index 3b10a383..00000000 --- a/legacy/assets/testplan/default/network/iperf_bm.yaml +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -Scenario: - benchmark: iperf - topology: Client and Server on different baremetal Compute nodes - server: machine_1 - client: machine_2 - benchmark_details: - duration: 20 - protocol: tcp - bandwidthGbps: 10 - -Context: - Host_Machines: - machine_1: - ip: - pw: - role: 1-server - machine_2: - ip: - pw: - role: 2-host - - Virtual_Machines: - -Test_Description: - Test_category: "network" - Benchmark: "iperf" - Overview: > - '''This test will run the IPERF benchmark on virutalmachine_1 and virtualmachine_2. On the\n - same compute node - if you wish to add a host machine add the following information under the Host_Machine tag - virtualmachine_1: - availability_zone: compute1 - OS_image: QTIP_CentOS - public_network: 'net04_ext' - role: 1-server - flavor: m1.large - - virtualmachine_2: - availability_zone: compute2 - OS_image: QTIP_CentOS - public_network: 'net04_ext' - role: 2-host - flavor: m1.large - - machine_1: - ip: - pw: - role: - ''' - diff --git a/legacy/assets/testplan/default/network/iperf_vm.yaml b/legacy/assets/testplan/default/network/iperf_vm.yaml deleted file mode 100644 index e42dc0bb..00000000 --- a/legacy/assets/testplan/default/network/iperf_vm.yaml +++ /dev/null @@ -1,51 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -Scenario: - benchmark: iperf - topology: Client and Server on ONE compute - server : virtualmachine_1 - client: virtualmachine_2 - description: 'Leave the bandwidth as 0 to throttle maximum traffic' - benchmark_details: - duration: 20 - protocol: tcp - bandwidthGbps: 0 - -Context: - Host_Machines: - - Virtual_Machines: - virtualmachine_1: - availability_zone: compute1 - OS_image: QTIP_CentOS - public_network: 'net04_ext' - role: 1-server - flavor: m1.large - - virtualmachine_2: - availability_zone: compute1 - OS_image: QTIP_CentOS - public_network: 'net04_ext' - role: 2-host - flavor: m1.large - -Test_Description: - Test_category: "network" - Benchmark: "iperf" - Overview: > - '''This test will run the IPERF benchmark on virutalmachine_1 and virtualmachine_2. On the\n - same compute node - if you wish to add a host machine add the following information under the Host_Machine tag - - machine_1: - ip: - pw: - role: - ''' - diff --git a/legacy/assets/testplan/default/network/iperf_vm_2.yaml b/legacy/assets/testplan/default/network/iperf_vm_2.yaml deleted file mode 100644 index 8a1d1a0d..00000000 --- a/legacy/assets/testplan/default/network/iperf_vm_2.yaml +++ /dev/null @@ -1,52 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -Scenario: - benchmark: iperf - topology: Client and Server on two different compute nodes - server : virtualmachine_1 - client: virtualmachine_2 - description: 'Leave the bandwidth as 0 to throttle maximum traffic' - benchmark_details: - duration: 20 - protocol: tcp - bandwidthGbps: 0 - -Context: - Host_Machines: - - - Virtual_Machines: - virtualmachine_1: - availability_zone: compute1 - OS_image: QTIP_CentOS - public_network: 'net04_ext' - role: 1-server - flavor: m1.large - - virtualmachine_2: - availability_zone: compute2 - OS_image: QTIP_CentOS - public_network: 'net04_ext' - role: 2-host - flavor: m1.large - -Test_Description: - Test_category: "network" - Benchmark: "iperf" - Overview: > - '''This test will run the IPERF benchmark on virutalmachine_1 and virtualmachine_2. On the\n - same compute node - if you wish to add a host machine add the following information under the Host_Machine tag - - machine_1: - ip: - pw: - role: - ''' - diff --git a/legacy/assets/testplan/default/storage/fio_bm.yaml b/legacy/assets/testplan/default/storage/fio_bm.yaml deleted file mode 100644 index d226b1af..00000000 --- a/legacy/assets/testplan/default/storage/fio_bm.yaml +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -Scenario: - benchmark: fio - host: machine_1, machine_2 - server: - -Context: - Host_Machines: - machine_1: - ip: - pw: - role: host - machine_2: - ip: - pw: - role: host - - - Virtual_Machines: - - -Test_Description: - Test_category: "Storage" - Benchmark: "FIO" - Overview: > - '''This test will run the FIO benchmark in parallel on host machines "machine_1" and "machine_2".\n - The fio job specifications can be found in qtip/benchmarks/fio_jobs/test_job. - The job conists of an fio load of: - 1.50% rand read 50% rand write - 2.Asynch engine - 3.Direct IO. - 4.Queing depth of 2 - - if you wish to add another machine add the following information under the Host_Machines tag - machine_3: - ip: 172.18.0.16 - pw: Op3nStack - role: host - ''' - diff --git a/legacy/assets/testplan/default/storage/fio_vm.yaml b/legacy/assets/testplan/default/storage/fio_vm.yaml deleted file mode 100644 index b1cf3142..00000000 --- a/legacy/assets/testplan/default/storage/fio_vm.yaml +++ /dev/null @@ -1,52 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -Scenario: - benchmark: fio - host: virtualmachine_1, virtualmachine_2 - server: - -Context: - Host_Machines: - - Virtual_Machines: - virtualmachine_1: - availability_zone: compute1 - public_network: 'net04_ext' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - virtualmachine_2: - availability_zone: compute2 - public_network: 'net04_ext' - OS_image: QTIP_CentOS - flavor: m1.large - role: host - -Test_Description: - Test_category: "Storage" - Benchmark: "FIO" - Overview: > - '''This test will run the FIO benchmark in parallel on virtualmachine_1 and virtualmachine_2.\n - The fio job specifications can be found in qtip/benchmarks/fio_jobs/test_job. - The job conists of an fio load of: - 1.50% rand read 50% rand write - 2.Asynch engine - 3.Direct IO. - 4.Queing depth of 2 - - if you wish to add a virtual machine add the following information under the Virtual_Machine tag - - virtualmachine_3: - availability_zone: - public_network: - OS_image: - flavor: - role: - ''' - diff --git a/legacy/cli/helper.py b/legacy/cli/helper.py deleted file mode 100644 index acfecf8d..00000000 --- a/legacy/cli/helper.py +++ /dev/null @@ -1,14 +0,0 @@ -############################################################################## -# Copyright (c) 2016 ZTE Corp 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 -############################################################################## - -import os - - -def fetch_root(): - return os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, 'benchmarks/') diff --git a/legacy/config/SampleHeat.yaml b/legacy/config/SampleHeat.yaml deleted file mode 100644 index 05f4c0b5..00000000 --- a/legacy/config/SampleHeat.yaml +++ /dev/null @@ -1,74 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -heat_template_version: 2015-04-30 - -description: > - Used to run VMs for Qtip - -parameters: - image: - type: string - description: Name of the image - default: QTIP_CentOS - - external_net_name: - type: string - description: Name of the external network which management network will connect to - default: admin_floating_net - -resources: - flavor: - type: OS::Nova::Flavor - properties: - ram: 8192 - vcpus: 8 - disk: 80 - - network: - type: OS::Neutron::Net - properties: - name: qtip_net - - subnet: - type: OS::Neutron::Subnet - properties: - name: qtip_subnet - ip_version: 4 - cidr: 192.168.0.0/24 - network: { get_resource: network } - dns_nameservers: [8.8.8.8] - - management_router: - type: OS::Neutron::Router - properties: - name: qtip_router - external_gateway_info: - network: { get_param: external_net_name } - - management_router_interface: - type: OS::Neutron::RouterInterface - properties: - router: { get_resource: management_router } - subnet: { get_resource: subnet } - - security_group: - type: OS::Neutron::SecurityGroup - properties: - name: qtip_security_group - rules: - - port_range_min: 22 - port_range_max: 5201 - protocol: tcp - - port_range_min: 22 - port_range_max: 5201 - protocol: udp - - protocol: icmp - -outputs: - description: 'none' diff --git a/legacy/data/hosts b/legacy/data/hosts deleted file mode 100644 index 0a0ac539..00000000 --- a/legacy/data/hosts +++ /dev/null @@ -1,2 +0,0 @@ -[sample_group_name] -127.0.0.1 diff --git a/legacy/data/my_key.pem b/legacy/data/my_key.pem deleted file mode 100644 index d7c96f24..00000000 --- a/legacy/data/my_key.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAntmA9ybqcxQKr9R3iTbNr+89ZJwlt5+gLbT8VR9sUAYCEEJn -xX7DX5djpSdQ1OoxJun/HE0ByKPXCIqGq3sHnxQ/3Wh80UGlyiSXgS8/p8NlfgPr -DIDuVNhKJlsobsfTVXL789i512rqf2zFBWfoesFgZee6ACrSYN3hdNICFOwtbmHA -g+xEs00yGmbcFDuBQnDeR2yPpV6G4AtrU5zwliVj7fMzrB5w9De20ydbFqxjPdOD -gbfwrhQQs82pv7vfJCFByjsSlwP4mcznKgOt/aO2y/B1ZvL+dOsCi8D3H6Ggrg7R -wmiIRaCijYX4SycYxdn+RkZpp9g0AyR/potcKwIDAQABAoIBADncgF2Gj1/brQjf -G6ufiszLGFHNju+T9YSwqDlZeNqtVZMWnTYTNpdbTbCa4Zast7q1AXgNlNjA1VMH -IobUCbKobZr4tH6Eqx82tPkZfNZfFlkQlE25qRa+skPGcLPpldFKUPxBtXACQeio -dhvB/ay5Q6PbBKWK85bVO4qR9LApxHCDQgovGtasUF1/wu5z4vOCP3KLtlE268m+ -XJ/4IZX2erBOfxOGPqp+qDK8FTP1NcuGFEkhUa8Tr406CIXptTDyPc+bMZANIGDM -hhww6VR5aHxsHWgu1UITVZuDh5fJ8U6n2utqTm/QLT25DUPKoTJSAjLet7fnm4Cw -hee7GgECgYEAziiWq4peA9WrJYTlR8bNRLgsMjZx/AphyJQpFCQsgCMuB9wIluTT -5Di4jvdvKclsFTh6foxnltltX6O8tL+vrzfbK9fBB3A2T1V1sDMOznhI47Mmoqk6 -9le6aMmpTIhNFJMu1DpsuoxRLIJaNkWLCwWaIE1ZggqCgbjIdMOJt20CgYEAxUDo -DUf0zi/qYZVVTnziubcqu0kjUWhmeEiv08WFst8l2fAwHBILNms5ot4TY5MlFxta -vLsWaXC7o6tqofSHF52cD8AbUWEnvK2NtCA7gW+0xBtQEPqrtItA0YjblFXw7qwb -QUValSo535bFYJjp5foJxTZXg9rErF4iUgExqvcCgYBK5t5PNvePhxsmh5FSMb20 -oQGVwMhLHW6HlKUUJ0xvxdhcjKomQL9npOAROX8O/JqjXyDKR7L/UMH3RKM0PIzV -KYMc+8erLy7cRh17RiG0DGnXKOj5omjExfz5Q4OaRc9TkWIrQ4rrgD2h4T5rh3rM -J13nLJM/txfRj9Rs7/piRQKBgCm3RFwqr5c7gvIIRvZGaxyjpCHfodyBm8osdSLw -Two5LyQcK9CD8GMd4h6ToL4aTGnKmzH2zxKViNlgUzjVIgzYhDzAgAaB6Yl5mtJR -TsRc/3nJ3PD6Un3oRVkK/IUud7nCJDF1nWaWe47RsARx0mWUr6RJjdCQ368kaVW2 -cu6ZAoGBALD4Gw+AsH6/za7gmRIqlzBURHpHCgKutQKv3UbD1hVc5tDAoYwBjjod -AVY8N8+AmX/nmJOVcch/dAnICkLrZn5Bm/q52/3xCAlnGkwNHyW4G99lZCfNEQrx -sVAZ4FNrtMC9Xwtj0o73ojqKP4gxVkljbybnbuyNSXZo14EbXuJU ------END RSA PRIVATE KEY----- diff --git a/legacy/data/output/hosts b/legacy/data/output/hosts deleted file mode 100644 index 9b47df0e..00000000 --- a/legacy/data/output/hosts +++ /dev/null @@ -1,3 +0,0 @@ -[host] -10.20.0.29 -10.20.0.28 diff --git a/legacy/data/schema/test_bm_schema.yaml b/legacy/data/schema/test_bm_schema.yaml deleted file mode 100644 index af97da70..00000000 --- a/legacy/data/schema/test_bm_schema.yaml +++ /dev/null @@ -1,84 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -type: map -mapping: - Scenario: - type: map - mapping: - benchmark: - type: str - required: True - host: - type: str - server: - type: str - allowempty: True - client: - type: str - allowempty: True - topology: - type: str - allowempty: True - benchmark_details: - type: map - mapping: - duration: - type: int - protocol: - type: str - bandwidthGbps: - type: int - description: - type: str - 1Run: - type: str - - Context: - type: map - mapping: - Host_Machines: - type: map - required: True - mapping: - regex;(^machine): - type: map - mapping: - role: - type: str - ip: - type: str - allowempty: True - pw: - type: str - allowempty: True - Virtual_Machines: - type: map - allowempty: True - Proxy_Environment: - type: map - mapping: - http_proxy: - type: str - https_proxy: - type: str - no_proxy: - type: str - - Test_Description: - type: map - mapping: - Test_category: - type: str - allowempty: True - Benchmark: - type: str - allowempty: True - Overview: - type: str - allowempty: True diff --git a/legacy/data/schema/test_vm_schema.yaml b/legacy/data/schema/test_vm_schema.yaml deleted file mode 100644 index ca632e50..00000000 --- a/legacy/data/schema/test_vm_schema.yaml +++ /dev/null @@ -1,88 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -type: map -mapping: - Scenario: - type: map - mapping: - benchmark: - type: str - required: True - host: - type: str - server: - type: str - allowempty: True - 1Run: - type: str - client: - type: str - allowempty: True - topology: - type: str - allowempty: True - benchmark_details: - type: map - mapping: - duration: - type: int - protocol: - type: str - bandwidthGbps: - type: int - teststream: - type: str - description: - type: str - - Context: - type: map - mapping: - Host_Machines: - type: map - allowempty: True - Virtual_Machines: - type: map - required: True - mapping: - regex;(^virtualmachine): - type: map - mapping: - availability_zone: - type: str - OS_image: - type: str - public_network: - type: str - role: - type: str - flavor: - type: str - Proxy_Environment: - type: map - mapping: - http_proxy: - type: str - https_proxy: - type: str - no_proxy: - type: str - - Test_Description: - type: map - mapping: - Test_category: - type: str - allowempty: True - Benchmark: - type: str - allowempty: True - Overview: - type: str - allowempty: True diff --git a/legacy/data/test.retry b/legacy/data/test.retry deleted file mode 100644 index 7b9ad531..00000000 --- a/legacy/data/test.retry +++ /dev/null @@ -1 +0,0 @@ -127.0.0.1 diff --git a/legacy/data/test.yml b/legacy/data/test.yml deleted file mode 100644 index d27bce3c..00000000 --- a/legacy/data/test.yml +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -- hosts: sample_group_name - tasks: - - name: just an uname - command: uname -a diff --git a/legacy/data/testplan/bm_ping.yaml b/legacy/data/testplan/bm_ping.yaml deleted file mode 100644 index 39c05aad..00000000 --- a/legacy/data/testplan/bm_ping.yaml +++ /dev/null @@ -1,37 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -
-Scenario:
- benchmark: dhrystone
- host: machine_1
- server:
-
-Context:
- Host_Machines:
- machine_1:
- ip: 127.0.0.1
- pw:
- role: host
-
- Virtual_Machines:
-
-
-Test_Description:
- Test_category: "Compute"
- Benchmark: "dhrystone"
- Overview: >
- ''' This test will run the dhrystone benchmark in parallel on machine_1 and machine_2.\n
- if you wish to add a virtual machine add the following information under the Virtual_Machine tag
-
- virtualmachine_1:
- availability_zone:
- public_network:
- OS_image:
- flavor:
- role: '''
diff --git a/legacy/data/testplan/bm_with_proxy.yaml b/legacy/data/testplan/bm_with_proxy.yaml deleted file mode 100644 index ef9e651e..00000000 --- a/legacy/data/testplan/bm_with_proxy.yaml +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -
-Scenario:
- benchmark: dhrystone
- host: machine_1, machine_2
- server:
-
-Context:
- Host_Machines:
- machine_1:
- ip: 10.20.0.28
- pw:
- role: host
- machine_2:
- ip: 10.20.0.29
- pw:
- role: host
-
- Virtual_Machines:
-
- Proxy_Environment:
- http_proxy: http://10.20.0.1:8118
- https_proxy: http://10.20.0.1:8118
- no_proxy: localhost,127.0.0.1,10.20.*,192.168.*
-
-
-
-Test_Description:
- Test_category: "Compute"
- Benchmark: "dhrystone"
- Overview: >
- ''' This test will run the dhrystone benchmark in parallel on machine_1 and machine_2.\n
- if you wish to add a virtual machine add the following information under the Virtual_Machine tag
-
- virtualmachine_1:
- availability_zone:
- public_network:
- OS_image:
- flavor:
- role: '''
diff --git a/legacy/data/testplan/bm_without_proxy.yaml b/legacy/data/testplan/bm_without_proxy.yaml deleted file mode 100644 index 8a1f3b05..00000000 --- a/legacy/data/testplan/bm_without_proxy.yaml +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -
-Scenario:
- benchmark: dhrystone
- host: machine_1, machine_2
- server:
-
-Context:
- Host_Machines:
- machine_1:
- ip: 10.20.0.28
- pw:
- role: host
- machine_2:
- ip: 10.20.0.29
- pw:
- role: host
-
- Virtual_Machines:
-
-
-Test_Description:
- Test_category: "Compute"
- Benchmark: "dhrystone"
- Overview: >
- ''' This test will run the dhrystone benchmark in parallel on machine_1 and machine_2.\n
- if you wish to add a virtual machine add the following information under the Virtual_Machine tag
-
- virtualmachine_1:
- availability_zone:
- public_network:
- OS_image:
- flavor:
- role: '''
diff --git a/legacy/data/testplan/vm.yaml b/legacy/data/testplan/vm.yaml deleted file mode 100644 index 9ba13b30..00000000 --- a/legacy/data/testplan/vm.yaml +++ /dev/null @@ -1,56 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -Scenario:
- benchmark: iperf
- topology: Client and Server on ONE compute
- server : virtualmachine_1
- client: virtualmachine_2
- description: 'Leave the bandwidth as 0 to throttle maximum traffic'
- benchmark_details:
- duration: 20
- protocol: tcp
- bandwidthGbps: 0
-
-Context:
- Host_Machines:
-
- Virtual_Machines:
- virtualmachine_1:
- availability_zone: compute1
- OS_image: QTIP_CentOS
- public_network: 'admin-floating_net'
- role: 1-server
- flavor: m1.large
-
- virtualmachine_2:
- availability_zone: compute1
- OS_image: QTIP_CentOS
- public_network: 'admin-floating_net'
- role: 2-host
- flavor: m1.large
-
- Proxy_Environment:
- http_proxy: http://10.20.0.1:8118
- https_proxy: http://10.20.0.1:8118
- no_proxy: localhost,127.0.0.1,10.20.*,192.168.*
-
-Test_Description:
- Test_category: "network"
- Benchmark: "iperf"
- Overview: >
- '''This test will run the IPERF benchmark on virutalmachine_1 and virtualmachine_2. On the\n
- same compute node
- if you wish to add a host machine add the following information under the Host_Machine tag
-
- machine_1:
- ip:
- pw:
- role:
- '''
-
diff --git a/legacy/data/testplan/vm_error.yaml b/legacy/data/testplan/vm_error.yaml deleted file mode 100644 index d5cd6df6..00000000 --- a/legacy/data/testplan/vm_error.yaml +++ /dev/null @@ -1,50 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -Scenario:
- topology: Client and Server on ONE compute
- server : virtualmachine_1
- client: virtualmachine_2
- description: 'Leave the bandwidth as 0 to throttle maximum traffic'
- benchmark_details:
- duration: 20
- protocol: tcp
- bandwidthGbps: 0
-
-Context:
- Host_Machines:
-
- Virtual_Machines:
- virtualmachine_1:
- availability_zone: compute1
- OS_image: QTIP_CentOS
- public_network: 'admin-floating_net'
- role: 1-server
- flavor: m1.large
-
- virtualmachine_2:
- availability_zone: compute1
- OS_image: QTIP_CentOS
- public_network: 'admin-floating_net'
- role: 2-host
- flavor: m1.large
-
-Test_Description:
- Test_category: "network"
- Benchmark: "iperf"
- Overview: >
- '''This test will run the IPERF benchmark on virutalmachine_1 and virtualmachine_2. On the\n
- same compute node
- if you wish to add a host machine add the following information under the Host_Machine tag
-
- machine_1:
- ip:
- pw:
- role:
- '''
-
diff --git a/legacy/docker/README.md b/legacy/docker/README.md deleted file mode 100644 index 35ac0935..00000000 --- a/legacy/docker/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# QTIP The Indices for Performance - -[QTIP] is an [OPNFV] project. - -It aims to build a platform for creating and sharing indices of [NFVI] performance. - -See the [project vision](https://wiki.opnfv.org/display/qtip/Vision) for more details. - -[QTIP]: https://wiki.opnfv.org/display/qtip -[OPNFV]: https://www.opnfv.org -[NFVI]: https://en.wikipedia.org/wiki/Network_function_virtualization diff --git a/legacy/docker/cleanup_qtip_image.sh b/legacy/docker/cleanup_qtip_image.sh deleted file mode 100644 index 9c2b59db..00000000 --- a/legacy/docker/cleanup_qtip_image.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -if [[ ! -f ${QTIP_DIR}/openrc ]];then - source ${REPOS_DIR}/releng/utils/fetch_os_creds.sh \ - -d ${QTIP_DIR}/openrc \ - -i ${INSTALLER_TYPE} \ - -a ${INSTALLER_IP} -fi - -source ${QTIP_DIR}/openrc - -cleanup_image() -{ - echo - if ! glance image-list; then - return - fi - - echo "Deleting image QTIP_CentOS..." - glance image-delete $(glance image-list | grep -e QTIP_CentOS | awk '{print $2}') - -} - -cleanup_image diff --git a/legacy/docker/prepare_qtip_image.sh b/legacy/docker/prepare_qtip_image.sh deleted file mode 100644 index 4095c806..00000000 --- a/legacy/docker/prepare_qtip_image.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -IMGNAME='QTIP_CentOS.qcow2' -IMGPATH='/home/opnfv/imgstore' -IMGURL='http://build.opnfv.org/artifacts.opnfv.org/qtip/QTIP_CentOS.qcow2' - -load_image() -{ - if [[ -n $( glance image-list | grep -e QTIP_CentOS) ]]; then - return - fi - - test -d $IMGPATH || mkdir -p $IMGPATH - if [[ ! -f "$IMGPATH/$IMGNAME" ]];then - echo - echo "========== Downloading QTIP_CentOS image ==========" - cd $IMGPATH - wget -c --progress=dot:giga $IMGURL - fi - - echo - echo "========== Loading QTIP_CentOS image ==========" - output=$(glance image-create \ - --name QTIP_CentOS \ - --visibility public \ - --disk-format qcow2 \ - --container-format bare \ - --file $IMGPATH/$IMGNAME ) - echo "$output" - - IMAGE_ID=$(echo "$output" | grep " id " | awk '{print $(NF-1)}') - - if [ -z "$IMAGE_ID" ]; then - echo 'Failed uploading QTIP_CentOS image to cloud'. - exit 1 - fi - - echo "QTIP_CentOS image id: $IMAGE_ID" -} - -rm -rf ${QTIP_DIR}/openrc - -${REPOS_DIR}/releng/utils/fetch_os_creds.sh \ --d ${QTIP_DIR}/openrc \ --i ${INSTALLER_TYPE} \ --a ${INSTALLER_IP} - -source ${QTIP_DIR}/openrc - -load_image diff --git a/legacy/docker/push_db.sh b/legacy/docker/push_db.sh deleted file mode 100755 index 50341eac..00000000 --- a/legacy/docker/push_db.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -cd ${QTIP_DIR} && python qtip/utils/dashboard/pushtoDB.py diff --git a/legacy/docker/run_qtip.sh b/legacy/docker/run_qtip.sh deleted file mode 100755 index 98abf139..00000000 --- a/legacy/docker/run_qtip.sh +++ /dev/null @@ -1,39 +0,0 @@ -#! /bin/bash - -QTIP=qtip/run.py - -run_test_suite() -{ - if [ "$TEST_CASE" == "compute" ]; then - cd ${QTIP_DIR} && python ${QTIP} -l default -f compute - cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py compute - elif [ "$TEST_CASE" == "storage" ]; then - cd ${QTIP_DIR} && python ${QTIP} -l default -f storage - cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py storage - elif [ "$TEST_CASE" == "network" ]; then - cd ${QTIP_DIR} && python ${QTIP} -l default -f network - cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py network - elif [ "$TEST_CASE" == "all" ]; then - cd ${QTIP_DIR} && python ${QTIP} -l default -f compute - cd ${QTIP_DIR} && python ${QTIP} -l default -f storage - cd ${QTIP_DIR} && python ${QTIP} -l default -f network - - cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py compute - cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py storage - cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py network - fi -} - -rm -f ${QTIP_DIR}/config/QtipKey* - -echo "Generating ssh keypair" -ssh-keygen -t rsa -N "" -f ${QTIP_DIR}/config/QtipKey -q - -source ${QTIP_DIR}/docker/prepare_qtip_image.sh - -run_test_suite - -source ${QTIP_DIR}/docker/cleanup_qtip_image.sh - -echo "Remove ssh keypair" -rm -f ${QTIP_DIR}/config/QtipKey* diff --git a/legacy/docs/download/sample_config.yaml b/legacy/docs/download/sample_config.yaml deleted file mode 100644 index 72c16bf4..00000000 --- a/legacy/docs/download/sample_config.yaml +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################## -# Copyright (c) 2016 ZTE Corporation 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 -############################################################################## - ## This is a sample Config.yaml file - -#Scenario would define the test case scenario. -#The benchmark key contains the benchmark to run such as dhrystone,whetstone,dpi,ssh etc. -# Host and server list the different machines on which the benchmark would run. -# On machines listed within hosts, the benchmarks would run in parallel. -# On machines listed within server, the benchmarks would run when the benechmarks running on hosts have been completed. -# This has been used to control the folow of the testcase. For example, running the testcases on a vm vs hostmachin, we would like to run the test case serially. It should run first on the host machine and then on the vm. This testcase flow control could be used for other testcases to be developed such as those for networking. -Scenario: - benchmark: dhrystone - host: machine_1, machine_2, virtualmachine_1 - server: - - -#Context would define the environment on which to run: -#Host Machine keys would contain Host_Machines/ Baremetal machines to run the benchmarks on -#e.g in Host Machine , machine_1 and machine_2 are the bare metal machines. For each baremetal machine its IP(which should be reachable from the location on which you run QTIP), passwords and its role(host or server). If your installer is 'fuel' or 'compass' and you left baremetal machine IP empty,qtip will get compute node ip from installer automaticly. -Context: - Host_Machines: - machine_1: - ip: 172.18.0.16 - pw: Op3nStack - role: host - Virtual_Machines: - virtualmachine_1: - availability_zone: nova - public_network: 'net04_ext' - OS_image: QTIP_CentOS - flavor: m1.large - role: server -#Proxy_Environment key was optional.If all the Machines could access the public network, no need to define Proxy_Environment.Could be used later for getting http,https proxy infos which would be setted on all the Host_Manchines and Virtual_Machines. - Proxy_Environment: - http_proxy: http://10.20.0.1:8118 - https_proxy: http://10.20.0.1:8118 - no_proxy: localhost,127.0.0.1,10.20.*,192.168.* - -# A general description of the testcase. Could be used later for reports. -Test_Description: - Test_category: "Compute" - Benchmark: "dhrystone" - Overview: > - ''' This test will run the dhrystone benchmark in serial on machine_1 and machine_2.\n - if you wish to add a virtual machine add the following information under the Virtual_Machine tag - - virtualmachine_1: - availability_zone: - public_network: - OS_image: - flavor: - role: ''' diff --git a/legacy/docs/overview/index.rst b/legacy/docs/overview/index.rst deleted file mode 100644 index 9a387360..00000000 --- a/legacy/docs/overview/index.rst +++ /dev/null @@ -1,14 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) 2016 ZTE Corp. - - - -##################### -QTIP Project Overview -##################### - -.. toctree:: - :maxdepth: 2 - - ./overview.rst diff --git a/legacy/docs/overview/overview.rst b/legacy/docs/overview/overview.rst deleted file mode 100644 index 4fd42356..00000000 --- a/legacy/docs/overview/overview.rst +++ /dev/null @@ -1,21 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) 2015 Dell Inc. -.. (c) 2016 ZTE Corp. - -******** -Overview -******** - -.. _QTIP: https://wiki.opnfv.org/platform_performance_benchmarking - -QTIP_ is an OPNFV Project. - -QTIP aims to benchmark OPNFV platforms through a "Bottom up" approach, testing -bare-metal components first. - -The overall problem this project tries to solve is the general -characterization of an OPNFV platform. It will focus on general performance -questions that are common to the platform itself, or applicable to multiple -OPNFV use cases. QTIP will provide the capability to quantify a platform's -performance behavior in a standardized, rigorous, and open way. diff --git a/legacy/run.py b/legacy/run.py deleted file mode 100644 index a2c26eda..00000000 --- a/legacy/run.py +++ /dev/null @@ -1,18 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Dell Inc and others. -# Copyright (c) 2016 ZTE corp. 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 -############################################################################## -from utils.cli import Cli - - -def main(): - Cli() - - -if __name__ == "__main__": - main() diff --git a/legacy/scripts/__init__.py b/legacy/scripts/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/legacy/scripts/__init__.py +++ /dev/null diff --git a/legacy/scripts/cleanup_creds.sh b/legacy/scripts/cleanup_creds.sh deleted file mode 100755 index b4eee924..00000000 --- a/legacy/scripts/cleanup_creds.sh +++ /dev/null @@ -1,11 +0,0 @@ -#! /bin/bash - -DEST_IP=$1 -HOSTNAME=$(hostname) -sshoptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" - -case "$INSTALLER_TYPE" in - fuel) - ssh $sshoptions -i ./config/QtipKey root@$DEST_IP "sed -i '/root@$HOSTNAME/d' /root/.ssh/authorized_keys" - ;; -esac diff --git a/legacy/scripts/get_env_info.sh b/legacy/scripts/get_env_info.sh deleted file mode 100755 index cd49ac87..00000000 --- a/legacy/scripts/get_env_info.sh +++ /dev/null @@ -1,37 +0,0 @@ -#! /bin/bash - -usage() { - echo "usage $0 -n <installer_type> -i <installer_ip> -k <key incase of apex>" -} - - - -while getopts ":n:i:k:" optchar; do - case "${optchar}" in - n) - export INSTALLER_TYPE=${OPTARG};; - - i) - export INSTALLER_IP=${OPTARG};; - - k) - export APEX_KEY=${OPTARG};; - - *) - echo "Incorrect usage" - usage ;; - esac -done - -if [ $INSTALLER_TYPE == "apex" ] - then - if [ -z $APEX_KEY ] - then - echo "Please provide the the key to access the APEX Instack VM" - usage - exit 1 - fi -fi - - -${REPOS_DIR}/releng/utils/fetch_os_creds.sh -d ${QTIP_DIR}/opnfv-creds.sh diff --git a/legacy/scripts/ref_results/__init__.py b/legacy/scripts/ref_results/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/legacy/scripts/ref_results/__init__.py +++ /dev/null diff --git a/legacy/scripts/ref_results/compute_benchmarks_indices.py b/legacy/scripts/ref_results/compute_benchmarks_indices.py deleted file mode 100644 index 936b58df..00000000 --- a/legacy/scripts/ref_results/compute_benchmarks_indices.py +++ /dev/null @@ -1,168 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -from index_calculation import generic_index as get_index -from index_calculation import get_reference -from result_accum import result_concat as concat - - -def dpi_index(): - dpi_dict = concat('results/dpi/') - dpi_bm_ref = get_reference('compute', 'dpi_bm') - dpi_bm_index = get_index(dpi_dict, 'dpi_bm', dpi_bm_ref, 'details', 'bps') - - dpi_vm_ref = get_reference('compute', 'dpi_vm') - dpi_vm_index = get_index(dpi_dict, 'dpi_vm', dpi_vm_ref, 'details', 'bps') - dpi_index = (dpi_bm_index + dpi_vm_index) / 2 - dpi_dict_i = {} - dpi_dict_i['index'] = dpi_index - dpi_dict_i['results'] = dpi_dict - return dpi_dict_i - - -def dhrystone_index(): - - dhrystone_dict = concat('results/dhrystone/') - dhrystone_single_bm_ref = get_reference('compute', 'dhrystone_bm', 'single_cpu') - dhrystone_single_bm_index = get_index(dhrystone_dict, 'dhrystone_bm', dhrystone_single_bm_ref, 'details', 'single', 'score') - - dhrystone_multi_bm_ref = get_reference('compute', 'dhrystone_bm', 'multi_cpu') - dhrystone_multi_bm_index = get_index(dhrystone_dict, 'dhrystone_bm', dhrystone_multi_bm_ref, 'details', 'multi', 'score') - - dhrystone_bm_index = (dhrystone_single_bm_index + dhrystone_multi_bm_index) / 2 - - dhrystone_single_vm_ref = get_reference('compute', 'dhrystone_vm', 'single_cpu') - dhrystone_single_vm_index = get_index(dhrystone_dict, 'dhrystone_vm', dhrystone_single_vm_ref, 'details', 'single', 'score') - - dhrystone_multi_vm_ref = get_reference('compute', 'dhrystone_vm', 'multi_cpu') - dhrystone_multi_vm_index = get_index(dhrystone_dict, 'dhrystone_vm', dhrystone_multi_vm_ref, 'details', 'multi', 'score') - - dhrystone_vm_index = (dhrystone_single_vm_index + dhrystone_multi_vm_index) / 2 - - dhrystone_index = (dhrystone_bm_index + dhrystone_vm_index) / 2 - dhrystone_dict_i = {} - dhrystone_dict_i['index'] = dhrystone_index - dhrystone_dict_i['results'] = dhrystone_dict - return dhrystone_dict_i - - -def whetstone_index(): - - whetstone_dict = concat('results/whetstone/') - whetstone_single_bm_ref = get_reference('compute', 'whetstone_bm', 'single_cpu') - whetstone_single_bm_index = get_index(whetstone_dict, 'whetstone_bm', whetstone_single_bm_ref, 'details', 'single', 'score') - - whetstone_multi_bm_ref = get_reference('compute', 'whetstone_bm', 'multi_cpu') - whetstone_multi_bm_index = get_index(whetstone_dict, 'whetstone_bm', whetstone_multi_bm_ref, 'details', 'multi', 'score') - - whetstone_bm_index = (whetstone_single_bm_index + whetstone_multi_bm_index) / 2 - - whetstone_single_vm_ref = get_reference('compute', 'whetstone_vm', 'single_cpu') - whetstone_single_vm_index = get_index(whetstone_dict, 'whetstone_vm', whetstone_single_vm_ref, 'details', 'single', 'score') - - whetstone_multi_vm_ref = get_reference('compute', 'whetstone_vm', 'multi_cpu') - whetstone_multi_vm_index = get_index(whetstone_dict, 'whetstone_vm', whetstone_multi_vm_ref, 'details', 'multi', 'score') - - whetstone_vm_index = (whetstone_single_vm_index + whetstone_multi_vm_index) / 2 - - whetstone_index = (whetstone_bm_index + whetstone_vm_index) / 2 - whetstone_dict_i = {} - whetstone_dict_i['index'] = whetstone_index - whetstone_dict_i['results'] = whetstone_dict - return whetstone_dict_i - - -def ramspeed_index(): - - ramspeed_dict = concat('results/ramspeed/') - ramspeed_int_bm_ref = get_reference('compute', 'ramspeed_bm', 'INTmem', 'Average (MB/s)') - ramspeed_int_bm_index = get_index(ramspeed_dict, 'ramspeed_bm', ramspeed_int_bm_ref, 'details', 'int_bandwidth', 'average') - - ramspeed_float_bm_ref = get_reference('compute', 'ramspeed_bm', 'FLOATmem', 'Average (MB/s)') - ramspeed_float_bm_index = get_index(ramspeed_dict, 'ramspeed_bm', ramspeed_float_bm_ref, 'details', 'float_bandwidth', 'average') - - ramspeed_bm_index = (ramspeed_int_bm_index + ramspeed_float_bm_index) / 2 - - ramspeed_int_vm_ref = get_reference('compute', 'ramspeed_vm', 'INTmem', 'Average (MB/s)') - ramspeed_int_vm_index = get_index(ramspeed_dict, 'ramspeed_vm', ramspeed_int_vm_ref, 'details', 'int_bandwidth', 'average') - - ramspeed_float_vm_ref = get_reference('compute', 'ramspeed_vm', 'FLOATmem', 'Average (MB/s)') - ramspeed_float_vm_index = get_index(ramspeed_dict, 'ramspeed_vm', ramspeed_float_vm_ref, 'details', 'float_bandwidth', 'average') - - ramspeed_vm_index = (ramspeed_int_vm_index + ramspeed_float_vm_index) / 2 - - ramspeed_index = (ramspeed_vm_index + ramspeed_bm_index) / 2 - - ramspeed_dict_i = {} - ramspeed_dict_i['index'] = ramspeed_index - ramspeed_dict_i['results'] = ramspeed_dict - return ramspeed_dict_i - - -def ssl_index(): - - ssl_dict = concat('results/ssl/') - - ssl_RSA512b_bm_ref = get_reference('compute', 'ssl_bm', 'RSA', '512b') - ssl_RSA1024b_bm_ref = get_reference('compute', 'ssl_bm', 'RSA', '1024b') - ssl_RSA2048b_bm_ref = get_reference('compute', 'ssl_bm', 'RSA', '2048b') - ssl_RSA4096b_bm_ref = get_reference('compute', 'ssl_bm', 'RSA', '4096b') - - ssl_AES16B_bm_ref = get_reference('compute', 'ssl_bm', 'AES', '16B') - ssl_AES64B_bm_ref = get_reference('compute', 'ssl_bm', 'AES', '64B') - ssl_AES256B_bm_ref = get_reference('compute', 'ssl_bm', 'AES', '256B') - ssl_AES1024B_bm_ref = get_reference('compute', 'ssl_bm', 'AES', '1024B') - ssl_AES8192B_bm_ref = get_reference('compute', 'ssl_bm', 'AES', '8192B') - - ssl_RSA512b_bm_index = get_index(ssl_dict, "ssl_bm", ssl_RSA512b_bm_ref, 'details', 'rsa_sig', '512_bits') - ssl_RSA1024b_bm_index = get_index(ssl_dict, "ssl_bm", ssl_RSA1024b_bm_ref, 'details', 'rsa_sig', '1024_bits') - ssl_RSA2048b_bm_index = get_index(ssl_dict, "ssl_bm", ssl_RSA2048b_bm_ref, 'details', 'rsa_sig', '2048_bits') - ssl_RSA4096b_bm_index = get_index(ssl_dict, "ssl_bm", ssl_RSA4096b_bm_ref, 'details', 'rsa_sig', '4096_bits') - ssl_RSA_bm_index = (ssl_RSA512b_bm_index + ssl_RSA1024b_bm_index + ssl_RSA2048b_bm_index + ssl_RSA4096b_bm_index) / 4 - - ssl_AES16B_bm_index = get_index(ssl_dict, "ssl_bm", ssl_AES16B_bm_ref, 'details', 'aes_128_cbc', '16B_block') - ssl_AES64B_bm_index = get_index(ssl_dict, "ssl_bm", ssl_AES64B_bm_ref, 'details', 'aes_128_cbc', '64B_block') - ssl_AES256B_bm_index = get_index(ssl_dict, "ssl_bm", ssl_AES256B_bm_ref, 'details', 'aes_128_cbc', '256B_block') - ssl_AES1024B_bm_index = get_index(ssl_dict, "ssl_bm", ssl_AES1024B_bm_ref, 'details', 'aes_128_cbc', '1024B_block') - ssl_AES8192B_bm_index = get_index(ssl_dict, "ssl_bm", ssl_AES8192B_bm_ref, 'details', 'aes_128_cbc', '8192B_block') - ssl_AES_bm_index = (ssl_AES16B_bm_index + ssl_AES64B_bm_index + ssl_AES256B_bm_index + ssl_AES1024B_bm_index + ssl_AES8192B_bm_index) / 5 - - ssl_bm_index = (ssl_RSA_bm_index + ssl_AES_bm_index) / 2 - - ssl_RSA512b_vm_ref = get_reference('compute', 'ssl_vm', 'RSA', '512b') - ssl_RSA1024b_vm_ref = get_reference('compute', 'ssl_vm', 'RSA', '1024b') - ssl_RSA2048b_vm_ref = get_reference('compute', 'ssl_vm', 'RSA', '2048b') - ssl_RSA4096b_vm_ref = get_reference('compute', 'ssl_vm', 'RSA', '4096b') - - ssl_AES16B_vm_ref = get_reference('compute', 'ssl_vm', 'AES', '16B') - ssl_AES64B_vm_ref = get_reference('compute', 'ssl_vm', 'AES', '64B') - ssl_AES256B_vm_ref = get_reference('compute', 'ssl_vm', 'AES', '256B') - ssl_AES1024B_vm_ref = get_reference('compute', 'ssl_vm', 'AES', '1024B') - ssl_AES8192B_vm_ref = get_reference('compute', 'ssl_vm', 'AES', '8192B') - - ssl_RSA512b_vm_index = get_index(ssl_dict, "ssl_vm", ssl_RSA512b_vm_ref, 'details', 'rsa_sig', '512_bits') - ssl_RSA1024b_vm_index = get_index(ssl_dict, "ssl_vm", ssl_RSA1024b_vm_ref, 'details', 'rsa_sig', '1024_bits') - ssl_RSA2048b_vm_index = get_index(ssl_dict, "ssl_vm", ssl_RSA2048b_vm_ref, 'details', 'rsa_sig', '2048_bits') - ssl_RSA4096b_vm_index = get_index(ssl_dict, "ssl_vm", ssl_RSA4096b_vm_ref, 'details', 'rsa_sig', '4096_bits') - ssl_RSA_vm_index = (ssl_RSA512b_vm_index + ssl_RSA1024b_vm_index + ssl_RSA2048b_vm_index + ssl_RSA4096b_vm_index) / 4 - - ssl_AES16B_vm_index = get_index(ssl_dict, "ssl_vm", ssl_AES16B_vm_ref, 'details', 'aes_128_cbc', '16B_block') - ssl_AES64B_vm_index = get_index(ssl_dict, "ssl_vm", ssl_AES64B_vm_ref, 'details', 'aes_128_cbc', '64B_block') - ssl_AES256B_vm_index = get_index(ssl_dict, "ssl_vm", ssl_AES256B_vm_ref, 'details', 'aes_128_cbc', '256B_block') - ssl_AES1024B_vm_index = get_index(ssl_dict, "ssl_vm", ssl_AES1024B_vm_ref, 'details', 'aes_128_cbc', '1024B_block') - ssl_AES8192B_vm_index = get_index(ssl_dict, "ssl_vm", ssl_AES8192B_vm_ref, 'details', 'aes_128_cbc', '8192B_block') - ssl_AES_vm_index = (ssl_AES16B_vm_index + ssl_AES64B_vm_index + ssl_AES256B_vm_index + ssl_AES1024B_vm_index + ssl_AES8192B_vm_index) / 5 - - ssl_vm_index = (ssl_RSA_vm_index + ssl_AES_vm_index) / 2 - - ssl_index = (ssl_bm_index + ssl_vm_index) / 2 - - ssl_dict_i = {} - ssl_dict_i['index'] = ssl_index - ssl_dict_i['results'] = ssl_dict - return ssl_dict_i diff --git a/legacy/scripts/ref_results/index_calculation.py b/legacy/scripts/ref_results/index_calculation.py deleted file mode 100644 index 14c2d4d2..00000000 --- a/legacy/scripts/ref_results/index_calculation.py +++ /dev/null @@ -1,49 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import json - - -def compute_index(total_measured, ref_result, count): - try: - average = float(total_measured / count) - - except ZeroDivisionError: - average = 0 - index = average / ref_result - return index - - -def get_reference(*args): - - with open('scripts/ref_results/reference.json') as reference_file: - reference_djson = json.load(reference_file) - for arg in args: - ref_n = reference_djson.get(str(arg)) - reference_djson = reference_djson.get(str(arg)) - return ref_n - - -def generic_index(dict_gen, testcase, reference_num, *args): - c = len(args) - count = 0 - total = 0 - result = 0 - for k, v in dict_gen.iteritems(): - dict_temp = dict_gen[k] - if dict_gen[k]['name'] == '{0}.yaml'.format(testcase): - count = count + 1 - for arg in args: - if arg == args[c - 1]: - try: - result = float(dict_temp.get(str(arg))) - except ValueError: - result = float(dict_temp.get(str(arg))[:-1]) * 1000 - dict_temp = dict_temp.get(str(arg)) - total = total + result - return compute_index(total, reference_num, count) diff --git a/legacy/scripts/ref_results/network_benchmarks_indices.py b/legacy/scripts/ref_results/network_benchmarks_indices.py deleted file mode 100644 index 67980ee9..00000000 --- a/legacy/scripts/ref_results/network_benchmarks_indices.py +++ /dev/null @@ -1,28 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -from index_calculation import generic_index as get_index -from index_calculation import get_reference -from result_accum import result_concat as concat - - -def iperf_index(): - iperf_dict = concat('results/iperf/') - iperf_bm_ref = get_reference('network', 'iperf_bm', 'throughput received(b/s)') - iperf_bm_index = get_index(iperf_dict, 'iperf_bm', iperf_bm_ref, 'details', 'bandwidth', 'received_throughput') - iperf_vm_ref = get_reference('network', 'iperf_vm', 'throughput received(b/s)') - iperf_vm_index = get_index(iperf_dict, 'iperf_vm', iperf_vm_ref, 'details', 'bandwidth', 'received_throughput') - - iperf_vm_2_ref = get_reference('network', 'iperf_vm_2', 'throughput received(b/s)') - iperf_vm_2_index = get_index(iperf_dict, 'iperf_vm_2', iperf_vm_2_ref, 'details', 'bandwidth', 'received_throughput') - iperf_index = float(iperf_bm_index + iperf_vm_index + iperf_vm_2_index) / 3 - print iperf_index - iperf_dict_i = {} - iperf_dict_i['index'] = iperf_index - iperf_dict_i['results'] = iperf_dict - return iperf_dict_i diff --git a/legacy/scripts/ref_results/reference.json b/legacy/scripts/ref_results/reference.json deleted file mode 100644 index cfcbfc3b..00000000 --- a/legacy/scripts/ref_results/reference.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "compute": { - "dhrystone_bm": { - "multi_cpu": 103362.1, - "single_cpu": 3231.7 - }, - "dhrystone_vm": { - "multi_cpu": 10585.8, - "single_cpu": 2953.6 - }, - "dpi_bm": 8.12, - "dpi_vm": 22.12, - "ramspeed_bm": { - "FLOATmem": { - "Average (MB/s)": 9758.79 - }, - "INTmem": { - "Average (MB/s)": 12268.38 - } - }, - "ramspeed_vm": { - "FLOATmem": { - "Average (MB/s)": 9064.09 - }, - "INTmem": { - "Average (MB/s)": 12147.59 - } - }, - "ssl_bm": { - "AES": { - "1024B": 808861020, - "16B": 735490250, - "256B": 803323650, - "64B": 788429210, - "8192B": 807701160 - }, - "RSA": { - "1024b": 7931.44, - "2048b": 1544.3, - "4096b": 161.92, - "512b": 22148.9 - } - }, - "ssl_vm": { - "AES": { - "1024B": 808861020, - "16B": 735490250, - "256B": 803323650, - "64B": 788429210, - "8192B": 807701160 - }, - "RSA": { - "1024b": 7931.44, - "2048b": 1544.3, - "4096b": 161.92, - "512b": 22148.9 - } - }, - "whetstone_bm": { - "multi_cpu": 41483.3, - "single_cpu": 806.1 - }, - "whetstone_vm": { - "multi_cpu": 2950.6, - "single_cpu": 789.0 - } - }, - "network": { - "iperf_bm": { - "throughput received(b/s)": 944473000.0 - }, - "iperf_vm": { - "throughput received(b/s)": 14416700000.0 - }, - "iperf_vm_2": { - "throughput received(b/s)": 2461530000.0 - } - }, - "storage": { - "fio_bm": { - "read": { - "IOPS": 6693 - }, - "write": { - "IOPS": 6688 - } - }, - "fio_vm": { - "read": { - "IOPS": 2239 - }, - "write": { - "IOPS": 2237 - } - } - } -}
\ No newline at end of file diff --git a/legacy/scripts/ref_results/result_accum.py b/legacy/scripts/ref_results/result_accum.py deleted file mode 100644 index 6eb169e8..00000000 --- a/legacy/scripts/ref_results/result_accum.py +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import os -import json - - -def result_concat(targ_dir): - list_vm = [] - list_bm = [] - diction = {} - - for file in os.listdir(targ_dir): - if file.endswith(".json"): - if file.startswith("instance"): - print str(file) - list_vm.append(file) - else: - list_bm.append(file) - l = len(list_bm) - k = len(list_vm) - - for x in range(0, l): - file_t = list_bm[x] - with open(targ_dir + file_t) as result_file: - result_djson = json.load(result_file) - diction['Baremetal' + str(int(x + 1))] = result_djson - - for x in range(0, k): - file_t = list_vm[x] - with open(targ_dir + file_t) as result_file: - result_djson = json.load(result_file) - diction['Virtual Machine ' + str(x + 1)] = result_djson - return diction diff --git a/legacy/scripts/ref_results/storage_benchmarks_indices.py b/legacy/scripts/ref_results/storage_benchmarks_indices.py deleted file mode 100644 index e87fe36b..00000000 --- a/legacy/scripts/ref_results/storage_benchmarks_indices.py +++ /dev/null @@ -1,37 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -from index_calculation import generic_index as get_index -from index_calculation import get_reference -from result_accum import result_concat as concat - - -def fio_index(): - fio_dict = concat('results/fio/') - fio_r_bm_ref = get_reference('storage', 'fio_bm', 'read', 'IOPS') - fio_r_bm_index = get_index(fio_dict, 'fio_bm', fio_r_bm_ref, 'details', 'job_0', 'read', 'io_ps') - fio_w_bm_ref = get_reference('storage', 'fio_bm', 'write', 'IOPS') - fio_w_bm_index = get_index(fio_dict, 'fio_bm', fio_w_bm_ref, 'details', 'job_0', 'write', 'io_ps') - - fio_bm_index = (fio_r_bm_index + fio_w_bm_index) / 2 - - fio_r_vm_ref = get_reference('storage', 'fio_vm', 'read', 'IOPS') - fio_r_vm_index = get_index(fio_dict, 'fio_vm', fio_r_vm_ref, 'details', 'job_0', 'read', 'io_ps') - - fio_w_vm_ref = get_reference('storage', 'fio_vm', 'write', 'IOPS') - fio_w_vm_index = get_index(fio_dict, 'fio_vm', fio_w_vm_ref, 'details', 'job_0', 'write', 'io_ps') - - fio_vm_index = (fio_r_vm_index + fio_w_vm_index) / 2 - - fio_index = (fio_bm_index + fio_vm_index) / 2 - print fio_index - - fio_dict_i = {} - fio_dict_i['index'] = fio_index - fio_dict_i['results'] = fio_dict - return fio_dict_i diff --git a/legacy/scripts/ref_results/suite_result.py b/legacy/scripts/ref_results/suite_result.py deleted file mode 100644 index 66213391..00000000 --- a/legacy/scripts/ref_results/suite_result.py +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################## -# Copyright (c) 2016 ZTE Corp 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 -############################################################################## -import json -import importlib -import sys -from qtip.utils import logger_utils -from os.path import expanduser - -logger = logger_utils.QtipLogger('suite_result').get - - -def get_benchmark_result(benchmark_name, suite_name): - benchmark_indices = importlib.import_module('scripts.ref_results' - '.{0}_benchmarks_indices'.format(suite_name)) - methodToCall = getattr(benchmark_indices, '{0}_index'.format(benchmark_name)) - return methodToCall() - - -def get_suite_result(suite_name): - suite_dict = {} - suite_bench_list = {'compute': ['DPI', 'Dhrystone', 'Whetstone', 'SSL', 'RamSpeed'], - 'storage': ['FIO'], - 'network': ['IPERF']} - temp = 0 - l = len(suite_bench_list[suite_name]) - for benchmark in suite_bench_list[suite_name]: - try: - suite_dict[benchmark] = get_benchmark_result(benchmark.lower(), suite_name) - temp = temp + float(suite_dict[benchmark]['index']) - except OSError: - l = l - 1 - pass - - if l == 0: - logger.info("No {0} suite results found".format(suite_name)) - return False - else: - suite_index = temp / l - suite_dict_f = {'index': suite_index, - 'suite_results': suite_dict} - result_path = expanduser('~') + '/qtip/results' - with open('{0}/{1}_result.json'.format(result_path, suite_name), 'w+') as result_json: - json.dump(suite_dict_f, result_json, indent=4, sort_keys=True) - return True - - -def main(): - get_suite_result(sys.argv[1]) - - -if __name__ == "__main__": - main() diff --git a/legacy/scripts/ssh_exch.exp b/legacy/scripts/ssh_exch.exp deleted file mode 100644 index c52140b7..00000000 --- a/legacy/scripts/ssh_exch.exp +++ /dev/null @@ -1,9 +0,0 @@ -#1 /usr/bin/expect -set timeout 4 -set ip [lindex $argv 0] -set pswd [lindex $argv 1] -spawn ssh-copy-id -i QtipKey $ip -expect "Are you sure you want to continue connecting" {send "yes\r"} -expect "password:" { send "$pswd\r"} - -interact diff --git a/legacy/tests/__init__.py b/legacy/tests/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/legacy/tests/__init__.py +++ /dev/null diff --git a/legacy/tests/ansible_api_test.py b/legacy/tests/ansible_api_test.py deleted file mode 100644 index 6f286fc3..00000000 --- a/legacy/tests/ansible_api_test.py +++ /dev/null @@ -1,22 +0,0 @@ -############################################################################## -# Copyright (c) 2016 ZTE Corp 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 -############################################################################## - -from tests import BaseTest -from qtip.utils.ansible_api import AnsibleApi - - -class TestClass(BaseTest): - - def test_call_ansible_api_success(self): - ansible_api = AnsibleApi() - ret = ansible_api.execute_playbook(self.abspath('hosts'), - self.abspath('test.yml'), - self.abspath('QtipKey'), - {'keys': 'test'}) - assert ret == 3 diff --git a/legacy/tests/api/__init__.py b/legacy/tests/api/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/legacy/tests/api/__init__.py +++ /dev/null diff --git a/legacy/tests/api/test_server.py b/legacy/tests/api/test_server.py deleted file mode 100644 index bf316f5d..00000000 --- a/legacy/tests/api/test_server.py +++ /dev/null @@ -1,131 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import json -import time - -import mock -import pytest - -import qtip.api.cmd.server as server - - -def setup_module(): - server.add_routers() - - -@pytest.fixture -def app(): - return server.app - - -@pytest.fixture -def app_client(app): - client = app.test_client() - return client - - -def side_effect_sleep(sleep_time): - time.sleep(sleep_time) - - -def side_effect_pass(): - pass - - -class TestClass: - @pytest.mark.parametrize("body, expected", [ - ({'installer_type': 'fuel', - 'installer_ip': '10.20.0.2'}, - {'job_id': '', - 'installer_type': 'fuel', - 'installer_ip': '10.20.0.2', - 'pod_name': 'default', - 'suite_name': 'compute', - 'max_minutes': 60, - 'type': 'BM', - 'testdb_url': None, - 'node_name': None, - 'state': 'finished', - 'state_detail': [{'state': 'finished', 'benchmark': 'dhrystone_bm.yaml'}, - {'state': 'finished', 'benchmark': 'whetstone_bm.yaml'}, - {'state': 'finished', 'benchmark': 'ramspeed_bm.yaml'}, - {'state': 'finished', 'benchmark': 'dpi_bm.yaml'}, - {'state': 'finished', 'benchmark': 'ssl_bm.yaml'}], - 'result': 0}), - ({'installer_type': 'fuel', - 'installer_ip': '10.20.0.2', - 'pod_name': 'default', - 'max_minutes': 20, - 'suite_name': 'compute', - 'type': 'VM', - 'benchmark_name': 'dhrystone_vm.yaml', - 'testdb_url': 'http://testresults.opnfv.org/test/api/v1', - 'node_name': 'zte-pod2'}, - {'job_id': '', - 'installer_type': 'fuel', - 'installer_ip': '10.20.0.2', - 'pod_name': 'default', - 'suite_name': 'compute', - 'max_minutes': 20, - 'type': 'VM', - 'testdb_url': 'http://testresults.opnfv.org/test/api/v1', - 'node_name': 'zte-pod2', - 'state': 'finished', - 'state_detail': [{u'state': u'finished', u'benchmark': u'dhrystone_vm.yaml'}], - 'result': 0}) - ]) - @mock.patch('qtip.utils.args_handler.prepare_and_run_benchmark') - def test_post_get_delete_job_successful(self, mock_args_handler, app_client, body, expected): - mock_args_handler.return_value = {'result': 0, - 'detail': {'host': [(u'10.20.6.14', {'unreachable': 0, - 'skipped': 13, - 'ok': 27, - 'changed': 26, - 'failures': 0}), - ('localhost', {'unreachable': 0, - 'skipped': 0, - 'ok': 6, - 'changed': 6, - 'failures': 0}), - (u'10.20.6.13', {'unreachable': 0, - 'skipped': 13, - 'ok': 27, - 'changed': 26, - 'failures': 0})]}} - - reply = app_client.post("/api/v1.0/jobs", data=body) - print(reply.data) - id = json.loads(reply.data)['job_id'] - expected['job_id'] = id - post_process = '' - while post_process != 'finished': - get_reply = app_client.get("/api/v1.0/jobs/%s" % id) - reply_data = json.loads(get_reply.data) - post_process = reply_data['state'] - print(reply_data) - assert len(filter(lambda x: reply_data[x] == expected[x], expected.keys())) == len(expected) - delete_reply = app_client.delete("/api/v1.0/jobs/%s" % id) - assert "successful" in delete_reply.data - - @pytest.mark.parametrize("body, expected", [ - ([{'installer_type': 'fuel', - 'installer_ip': '10.20.0.2'}, - {'installer_type': 'compass', - 'installer_ip': '192.168.20.50'}], - ['job_id', - 'It already has one job running now!']) - ]) - @mock.patch('qtip.utils.args_handler.prepare_and_run_benchmark', - side_effect=[side_effect_sleep(0.5), side_effect_pass]) - def test_post_two_jobs_unsuccessful(self, mock_args_hanler, app_client, body, expected): - reply_1 = app_client.post("/api/v1.0/jobs", data=body[0]) - reply_2 = app_client.post("/api/v1.0/jobs", data=body[1]) - assert expected[0] in json.loads(reply_1.data).keys() - app_client.delete("/api/v1.0/jobs/%s" % json.loads(reply_1.data)['job_id']) - assert expected[1] in json.dumps(reply_2.data) diff --git a/legacy/tests/args_handler_test.py b/legacy/tests/args_handler_test.py deleted file mode 100644 index dceca1f5..00000000 --- a/legacy/tests/args_handler_test.py +++ /dev/null @@ -1,36 +0,0 @@ -############################################################################## -# Copyright (c) 2016 ZTE Corp 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 -############################################################################## -import pytest -import mock -import qtip.utils.args_handler - - -@pytest.mark.xfail(reason="to be fixed") -class TestClass: - @pytest.mark.parametrize("test_input, expected", [ - (['fuel', '/home', 'benchmarks/testplan/default/network/iperf_bm.yaml'], - ['fuel', '/home', "iperf", - [('1-server', ['10.20.0.23']), ('2-host', ['10.20.0.24'])], - "iperf_bm.yaml", - [('duration', 20), ('protocol', 'tcp'), ('bandwidthGbps', 10)], - [("10.20.0.24", [None]), ("10.20.0.23", [None])], {}]) - ]) - @mock.patch('qtip.utils.args_handler.Env_setup.call_ping_test') - @mock.patch('qtip.utils.args_handler.Env_setup.call_ssh_test') - @mock.patch('qtip.utils.args_handler.Env_setup.update_ansible') - @mock.patch('qtip.utils.args_handler.SpawnVM') - @mock.patch('qtip.utils.args_handler.Driver.drive_bench') - def test_prepare_and_run_benchmark_successful(self, mock_driver, mock_sqawn_vm, mock_env_setup_ping, - mock_env_setup_ssh, mock_update_ansible, test_input, expected): - mock_ips = mock.Mock(return_value=["10.20.0.23", "10.20.0.24"]) - qtip.utils.args_handler.Env_setup.fetch_compute_ips = mock_ips - qtip.utils.args_handler.prepare_and_run_benchmark(test_input[0], test_input[1], test_input[2]) - call = mock_driver.call_args - call_args, call_kwargs = call - assert sorted(map(sorted, call_args)) == sorted(map(sorted, expected)) diff --git a/legacy/tests/cli_test.py b/legacy/tests/cli_test.py deleted file mode 100644 index 5b7eac65..00000000 --- a/legacy/tests/cli_test.py +++ /dev/null @@ -1,52 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import pytest -import mock -import os -from qtip.utils.cli import Cli -from os.path import expanduser - - -@pytest.mark.skip("TODO(yujunz) recover test after refactoring") -class TestClass: - @pytest.mark.parametrize("test_input, expected", [ - (['-l', - 'zte', - '-f', - 'compute'], "You have specified a lab that is not present under benchmarks/testplan"), - (['-l', - 'default', - '-f', - 'test'], "This suite file test doesn't exist under benchmarks/suite/") - ]) - def test_cli_error(self, capfd, test_input, expected): - k = mock.patch.dict(os.environ, {'INSTALLER_TYPE': 'fuel', 'PWD': '/home'}) - with pytest.raises(SystemExit): - k.start() - Cli(test_input) - k.stop() - with open(expanduser('~') + "/qtip/logs/cli.log", "r") as file: - data = file.read() - assert expected in data - - @pytest.mark.parametrize("test_input, expected", [ - (['-l', - 'default', - '-f', - 'storage'], [('fuel', '/home', 'benchmarks/testplan/default/storage/fio_bm.yaml'), - ('fuel', '/home', 'benchmarks/testplan/default/storage/fio_vm.yaml')]) - ]) - @mock.patch('qtip.utils.cli.args_handler.prepare_and_run_benchmark') - def test_cli_successful(self, mock_args_handler, test_input, expected): - k = mock.patch.dict(os.environ, {'INSTALLER_TYPE': 'fuel', 'PWD': '/home'}) - k.start() - Cli(test_input) - k.stop() - call_list = map(lambda x: mock_args_handler.call_args_list[x][0], range(len(expected))) - assert sorted(call_list) == sorted(expected) diff --git a/legacy/tests/create_zones_test.py b/legacy/tests/create_zones_test.py deleted file mode 100644 index 1aa37477..00000000 --- a/legacy/tests/create_zones_test.py +++ /dev/null @@ -1,118 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import pytest -import mock -from mock import Mock, MagicMock -import os -from qtip.utils.create_zones import AvailabilityZone - -return_list = [] - - -def get_agg_mock(host): - agg = Mock() - agg.name = host - agg.id = host - return agg - - -class HyperMock(MagicMock): - def list(self): - mock_hypervisor = [Mock(service={'host': '10.20.0.4'}), Mock(service={'host': '10.20.0.5'})] - return mock_hypervisor - - -class AggMock(MagicMock): - def get_details(self, agg_id): - print "get_details:{0}".format(agg_id) - return Mock(hosts=[]) - - def create(self, host, agg): - print "create:{0}:{1}".format(host, agg) - return agg - - def list(self): - return return_list - - def delete(self, agg_id): - print "delete:{0}".format(agg_id) - pass - - def add_host(self, aggregate, host): - print "add_host:{0}:{1}".format(aggregate, host) - pass - - def remove_host(self, agg_id, host): - print "remove_host:{0}:{1}".format(agg_id, host) - pass - - -class NovaMock(MagicMock): - hypervisors = HyperMock() - aggregates = AggMock() - - -@pytest.mark.xfail(reason="unstable result") -class TestClass: - @pytest.mark.parametrize("test_input, expected", [ - (['compute1', 'compute2'], - ['create:compute1:compute1', - 'add_host:compute1:10.20.0.4', - 'create:compute2:compute2', - 'add_host:compute2:10.20.0.5']), - (['compute1'], - ['create:compute1:compute1', - 'add_host:compute1:10.20.0.4']), - ]) - @mock.patch('qtip.utils.create_zones.client', autospec=True) - @mock.patch('qtip.utils.create_zones.v2', autospec=True) - @mock.patch('qtip.utils.create_zones.session') - def test_create_zones_success(self, mock_keystone_session, mock_keystone_v2, mock_nova_client, test_input, expected, capfd): - nova_obj = NovaMock() - mock_nova_client.Client.return_value = nova_obj() - k = mock.patch.dict(os.environ, {'OS_AUTH_URL': 'http://172.10.0.5:5000', - 'OS_USERNAME': 'admin', - 'OS_PASSWORD': 'admin', - 'OS_TENANT_NAME': 'admin'}) - k.start() - azone = AvailabilityZone() - azone.create_aggs(test_input) - k.stop() - resout, reserr = capfd.readouterr() - for x in expected: - assert x in resout - - @pytest.mark.parametrize("test_input, expected", [ - ([get_agg_mock('10.20.0.4'), get_agg_mock('10.20.0.5')], - ['get_details:10.20.0.4', - 'delete:10.20.0.4', - 'get_details:10.20.0.5', - 'delete:10.20.0.5']), - ([], - []), - ]) - @mock.patch('qtip.utils.create_zones.client', autospec=True) - @mock.patch('qtip.utils.create_zones.v2', autospec=True) - @mock.patch('qtip.utils.create_zones.session') - def test_clean_all_aggregates(self, mock_keystone_session, mock_keystone_v2, mock_nova_client, test_input, expected, capfd): - global return_list - return_list = test_input - nova_obj = NovaMock() - mock_nova_client.Client.return_value = nova_obj() - k = mock.patch.dict(os.environ, {'OS_AUTH_URL': 'http://172.10.0.5:5000', - 'OS_USERNAME': 'admin', - 'OS_PASSWORD': 'admin', - 'OS_TENANT_NAME': 'admin'}) - k.start() - azone = AvailabilityZone() - azone.clean_all_aggregates() - k.stop() - resout, reserr = capfd.readouterr() - for x in expected: - assert x in resout diff --git a/legacy/tests/driver_test.py b/legacy/tests/driver_test.py deleted file mode 100644 index abe8cfbb..00000000 --- a/legacy/tests/driver_test.py +++ /dev/null @@ -1,103 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import pytest -import mock -from qtip.utils.driver import Driver -from os.path import expanduser - -HOME_DIR = expanduser('~') - - -class TestClass: - @pytest.mark.parametrize("test_input, expected", [ - (['fuel', - '/home', - "iperf", - [('host', ['10.20.0.13', '10.20.0.15'])], - "iperf_bm.yaml", - [('duration', 20), ('protocol', 'tcp'), ('bandwidthGbps', 0)], - [("10.20.0.13", [None]), ("10.20.0.15", [None])], - {'http_proxy': 'http://10.20.0.1:8118', - 'https_proxy': 'http://10.20.0.1:8118', - 'no_proxy': 'localhost,127.0.0.1,10.20.*,192.168.*'}], - [{'Dest_dir': HOME_DIR + '/qtip/results', - 'ip1': '', - 'ip2': '', - 'installer': 'fuel', - 'workingdir': '/home', - 'fname': 'iperf_bm.yaml', - 'username': 'root', - 'http_proxy': 'http://10.20.0.1:8118', - 'https_proxy': 'http://10.20.0.1:8118', - 'no_proxy': 'localhost,127.0.0.1,10.20.*,192.168.*', - 'duration': 20, - 'protocol': 'tcp', - 'bandwidthGbps': 0, - "role": "host"}]), - (['joid', - '/home', - "iperf", - [('1-server', ['10.20.0.13']), ('2-host', ['10.20.0.15'])], - "iperf_vm.yaml", - [('duration', 20), ('protocol', 'tcp'), ('bandwidthGbps', 0)], - [('1-server', '10.10.17.4'), ('2-host', '10.10.17.5')], - {}], - [{'Dest_dir': HOME_DIR + '/qtip/results', - 'ip1': '10.20.0.13', - 'ip2': '', - 'installer': 'joid', - 'privateip1': '10.10.17.4', - 'workingdir': '/home', - 'fname': 'iperf_vm.yaml', - 'username': 'ubuntu', - 'duration': 20, - 'protocol': 'tcp', - 'bandwidthGbps': 0, - "role": "1-server"}, - {'Dest_dir': HOME_DIR + '/qtip/results', - 'ip1': '10.20.0.13', - 'ip2': '', - 'installer': 'joid', - 'privateip1': '10.10.17.4', - 'workingdir': '/home', - 'fname': 'iperf_vm.yaml', - 'username': 'ubuntu', - 'duration': 20, - 'protocol': 'tcp', - 'bandwidthGbps': 0, - "role": "2-host"}]) - ]) - @mock.patch('qtip.utils.driver.AnsibleApi.execute_playbook') - @mock.patch('qtip.utils.driver.AnsibleApi.get_detail_playbook_stats') - def test_driver_success(self, mock_stats, mock_ansible, test_input, expected): - mock_ansible.return_value = True - mock_stats.return_value = [(u'10.20.6.14', {'unreachable': 0, - 'skipped': 13, - 'ok': 27, - 'changed': 26, - 'failures': 0}), - ('localhost', {'unreachable': 0, - 'skipped': 0, - 'ok': 6, - 'changed': 6, - 'failures': 0}), - (u'10.20.6.13', {'unreachable': 0, - 'skipped': 13, - 'ok': 27, - 'changed': 26, - 'failures': 0})] - dri = Driver() - result = dri.drive_bench(test_input[0], test_input[1], test_input[2], test_input[3], - test_input[4], test_input[5], test_input[6], test_input[7]) - call_list = mock_ansible.call_args_list - for call in call_list: - call_args, call_kwargs = call - real_call = call_args[3] - assert real_call == expected[call_list.index(call)] - assert result['result'] == 0 diff --git a/legacy/tests/env_setup_test.py b/legacy/tests/env_setup_test.py deleted file mode 100644 index dea48190..00000000 --- a/legacy/tests/env_setup_test.py +++ /dev/null @@ -1,120 +0,0 @@ -############################################################################## -# Copyright (c) 2016 ZTE 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 -############################################################################## - -import os -import pytest -import filecmp -from qtip.utils.env_setup import Env_setup -import mock - - -DATA_DIR = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, 'data') - - -def get_test_plan(name): - return os.path.join(DATA_DIR, 'testplan', name) - - -def get_output(name): - return os.path.join(DATA_DIR, 'output', name) - - -class TestClass: - @pytest.mark.parametrize("test_input, expected", [ - (get_test_plan("bm_with_proxy.yaml"), - ["dhrystone", - {}, - [], - {'http_proxy': 'http://10.20.0.1:8118', - 'https_proxy': 'http://10.20.0.1:8118', - 'no_proxy': 'localhost,127.0.0.1,10.20.*,192.168.*'}]), - (get_test_plan("bm_without_proxy.yaml"), - ["dhrystone", - {}, - [], - {}]), - (get_test_plan("vm.yaml"), - ["iperf", - {'availability_zone': ['compute1', 'compute1'], - 'OS_image': ['QTIP_CentOS', 'QTIP_CentOS'], - 'public_network': ['admin-floating_net', 'admin-floating_net'], - 'flavor': ['m1.large', 'm1.large'], - 'role': ['1-server', '2-host']}, - [('duration', 20), ('protocol', 'tcp'), ('bandwidthGbps', 0)], - {'http_proxy': 'http://10.20.0.1:8118', - 'https_proxy': 'http://10.20.0.1:8118', - 'no_proxy': 'localhost,127.0.0.1,10.20.*,192.168.*'}])]) - def test_parse_success(self, test_input, expected): - test_class = Env_setup() - mock_ips = mock.Mock(return_value=["10.20.0.28", "10.20.0.29"]) - test_class.fetch_compute_ips = mock_ips - benchmark, vm_para, details, proxy = \ - test_class.parse(test_input) - assert benchmark == expected[0] - assert vm_para == expected[1] - assert sorted(details) == sorted(expected[2]) - assert proxy == expected[3] - - def test_parse_vm_error(self): - test_class = Env_setup() - mock_ips = mock.Mock(return_value=["10.20.0.28", "10.20.0.29"]) - test_class.fetch_compute_ips = mock_ips - with pytest.raises(KeyError) as excinfo: - test_class.parse(get_test_plan("vm_error.yaml")) - assert "benchmark" in str(excinfo.value) - - def test_update_ansible(self): - test_class = Env_setup() - mock_ips = mock.Mock(return_value=["10.20.0.28", "10.20.0.29"]) - test_class.fetch_compute_ips = mock_ips - test_class.parse(get_test_plan("bm_without_proxy.yaml")) - test_class.update_ansible() - result = filecmp.cmp(get_output("hosts"), "config/hosts") - assert result - - @pytest.mark.skip("(yujunz) test hung") - def test_ping(self, capfd): - test_class = Env_setup() - mock_ips = mock.Mock(return_value=["127.0.0.1", "10.20.0.29"]) - test_class.fetch_compute_ips = mock_ips - test_class.parse(get_test_plan("bm_ping.yaml")) - test_class.call_ping_test() - resout, reserr = capfd.readouterr() - assert '127.0.0.1 is UP' in resout - - def test_check_machine_ips_without_ip(self): - test_class = Env_setup() - mock_ips = mock.Mock(return_value=["10.20.0.28", "10.20.0.29"]) - test_class.fetch_compute_ips = mock_ips - inputs = {"machine_1": {"ip": "", "pw": "", "role": "host"}, - "machine_2": {"ip": "", "pw": "", "role": "host"}} - test_class.check_machine_ips(inputs) - assert inputs["machine_1"]['ip'] in ["10.20.0.28", "10.20.0.29"] - assert inputs["machine_2"]['ip'] in ["10.20.0.28", "10.20.0.29"] - assert inputs["machine_1"]['ip'] != inputs["machine_2"]['ip'] - - def test_check_machine_ips_with_ip(self): - test_class = Env_setup() - mock_ips = mock.Mock(return_value=["10.20.0.28", "10.20.0.29"]) - test_class.fetch_compute_ips = mock_ips - inputs = {"machine_1": {"ip": "10.20.0.28", "pw": "", "role": "host"}, - "machine_2": {"ip": "10.20.0.29", "pw": "", "role": "host"}} - test_class.check_machine_ips(inputs) - assert inputs["machine_1"]['ip'] in ["10.20.0.28", "10.20.0.29"] - assert inputs["machine_2"]['ip'] in ["10.20.0.28", "10.20.0.29"] - assert inputs["machine_1"]['ip'] != inputs["machine_2"]['ip'] - - def test_check_machine_ips_with_invalid_ip(self): - test_class = Env_setup() - mock_ips = mock.Mock(return_value=["10.20.0.28", "10.20.0.29"]) - test_class.fetch_compute_ips = mock_ips - inputs = {"machine_1": {"ip": "10.20.0.3", "pw": "", "role": "host"}, - "machine_2": {"ip": "10.20.0.4", "pw": "", "role": "host"}} - with pytest.raises(RuntimeError): - test_class.check_machine_ips(inputs) diff --git a/legacy/tests/functional/__init__.py b/legacy/tests/functional/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/legacy/tests/functional/__init__.py +++ /dev/null diff --git a/legacy/tests/functional/yaml_schema_test.py b/legacy/tests/functional/yaml_schema_test.py deleted file mode 100644 index 3c7994a5..00000000 --- a/legacy/tests/functional/yaml_schema_test.py +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import os -import os.path -from pykwalify.core import Core - - -class TestClass: - def test_schema_success(self): - for root, dirs, files in os.walk("test_cases"): - for name in files: - print root + "/" + name - if "_bm" in name: - schema = "tests/schema/test_bm_schema.yaml" - if "_vm" in name: - schema = "tests/schema/test_vm_schema.yaml" - c = Core(source_file=root + "/" + name, schema_files=[schema]) - c.validate(raise_exception=True) diff --git a/legacy/tests/helper/perftest.yaml b/legacy/tests/helper/perftest.yaml deleted file mode 100644 index 57948b62..00000000 --- a/legacy/tests/helper/perftest.yaml +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################## -# Copyright (c) 2017 taseer94@gmail.com 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 -############################################################################## ---- - - tests: - - command: ['perftest', 'run'] - output: "Run a perftest\n" diff --git a/legacy/tests/helper/suite.yaml b/legacy/tests/helper/suite.yaml deleted file mode 100644 index 84bf9239..00000000 --- a/legacy/tests/helper/suite.yaml +++ /dev/null @@ -1,14 +0,0 @@ -############################################################################## -# Copyright (c) 2017 taseer94@gmail.com 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 -############################################################################## ---- - - tests: - - command: ['suite', 'run'] - output: "Run a suite\n" - diff --git a/legacy/tests/helper/version.yaml b/legacy/tests/helper/version.yaml deleted file mode 100644 index 59be4256..00000000 --- a/legacy/tests/helper/version.yaml +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################## -# Copyright (c) 2017 taseer94@gmail.com 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 -############################################################################## ---- - - tests: - - command: ['version', 'list'] - output: "Lists all the different versions\n" - - - command: ['version', 'install', 'Colorado'] - output: "Install: Colorado\n" - - - command: ['version', 'uninstall', 'Arno'] - output: "Uninstall: Arno\n" - diff --git a/legacy/tests/spawn_vm_test.py b/legacy/tests/spawn_vm_test.py deleted file mode 100644 index ac58db27..00000000 --- a/legacy/tests/spawn_vm_test.py +++ /dev/null @@ -1,64 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import pytest -import mock -from mock import Mock, MagicMock -import os -from qtip.utils.spawn_vm import SpawnVM - - -class KeystoneMock(MagicMock): - auth_token = Mock() - v2_0 = Mock() - - -class StackMock(MagicMock): - status = 'COMPLETE' - outputs = [{'output_key': 'availability_instance_1', - 'output_value': 'output_value_1'}, - {'output_key': 'instance_ip_1', - "output_value": "172.10.0.154"}, - {"output_key": "instance_PIP_1", - "output_value": "10.10.17.5"}] - - -class HeatMock(MagicMock): - def list(self): - return [] - - def get(self, stackname): - return StackMock() - - def create(self, stack_name, template): - pass - - -class TestClass: - @pytest.mark.parametrize("test_input, expected", [ - ({'availability_zone': ['compute1', 'compute1'], - 'OS_image': ['QTIP_CentOS', 'QTIP_CentOS'], - 'public_network': ['admin-floating_net', 'admin-floating_net'], - 'flavor': ['m1.large', 'm1.large'], - 'role': ['1-server', '2-host']}, - [('172.10.0.154', '')]), - ]) - @mock.patch('qtip.utils.spawn_vm.Env_setup') - @mock.patch('qtip.utils.spawn_vm.AvailabilityZone') - @mock.patch('qtip.utils.spawn_vm.keystoneclient.v2_0', autospec=True) - @mock.patch('qtip.utils.spawn_vm.heatclient.client', autospec=True) - def test_create_zones_success(self, mock_heat, mock_keystone, - mock_zone, mock_setup, test_input, expected): - open('./config/QtipKey.pub', 'a').close() - mock_heat.Client.return_value = Mock(stacks=HeatMock()) - k = mock.patch.dict(os.environ, {'INSTALLER_TYPE': 'fuel'}) - k.start() - SpawnVM(test_input) - k.stop() - os.remove('./config/QtipKey.pub') - mock_setup.ip_pw_list.append.assert_called_with(expected[0]) diff --git a/legacy/utils/__init__.py b/legacy/utils/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/legacy/utils/__init__.py +++ /dev/null diff --git a/legacy/utils/ansible_api.py b/legacy/utils/ansible_api.py deleted file mode 100644 index 9e1d249e..00000000 --- a/legacy/utils/ansible_api.py +++ /dev/null @@ -1,65 +0,0 @@ -############################################################################## -# Copyright (c) 2016 ZTE Corp 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 -############################################################################## -import os -from collections import namedtuple -from ansible.executor.playbook_executor import PlaybookExecutor -from ansible.inventory import Inventory -from ansible.parsing.dataloader import DataLoader -from ansible.vars import VariableManager -import logger_utils - -logger = logger_utils.QtipLogger('ansible_api').get - - -class AnsibleApi: - - def __init__(self): - self.variable_manager = VariableManager() - self.loader = DataLoader() - self.passwords = {} - self.pbex = None - - def _check_path(self, file_path): - if not os.path.exists(file_path): - logger.error('The playbook %s does not exist' % file_path) - return False - else: - return True - - def execute_playbook(self, hosts_file, playbook_path, pub_key_file, vars): - if not self._check_path(hosts_file): - return False - - inventory = Inventory(loader=self.loader, variable_manager=self.variable_manager, - host_list=hosts_file) - Options = namedtuple('Options', ['listtags', 'listtasks', 'listhosts', 'syntax', - 'connection', 'module_path', 'forks', 'remote_user', - 'private_key_file', 'ssh_common_args', 'ssh_extra_args', - 'sftp_extra_args', 'scp_extra_args', 'become', - 'become_method', 'become_user', 'verbosity', 'check']) - options = Options(listtags=False, listtasks=False, listhosts=False, syntax=False, - connection='ssh', module_path=None, forks=100, remote_user='root', - private_key_file=pub_key_file, ssh_common_args=None, - ssh_extra_args=None, sftp_extra_args=None, scp_extra_args=None, - become=True, become_method=None, become_user='root', verbosity=None, - check=False) - self.variable_manager.extra_vars = vars - - self.pbex = PlaybookExecutor(playbooks=[playbook_path], inventory=inventory, - variable_manager=self.variable_manager, loader=self.loader, - options=options, passwords=self.passwords) - - return self.pbex.run() - - def get_detail_playbook_stats(self): - if self.pbex: - stats = self.pbex._tqm._stats - return map(lambda x: (x, stats.summarize(x)), stats.processed.keys()) - else: - return None diff --git a/legacy/utils/args_handler.py b/legacy/utils/args_handler.py deleted file mode 100644 index 993b1035..00000000 --- a/legacy/utils/args_handler.py +++ /dev/null @@ -1,73 +0,0 @@ -############################################################################## -# Copyright (c) 2016 ZTE Corp 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 -############################################################################## -import os -from operator import add -import simplejson as json -from env_setup import Env_setup -from spawn_vm import SpawnVM -from driver import Driver - - -def get_files_in_suite(suite_name, case_type='all'): - benchmark_list = json.load(file('benchmarks/suite/{0}'.format(suite_name))) - return reduce(add, benchmark_list.values()) \ - if case_type == 'all' else benchmark_list[case_type] - - -def get_files_in_test_plan(lab, suite_name, case_type='all'): - test_case_all = os.listdir('benchmarks/testplan/{0}/{1}'.format(lab, suite_name)) - return test_case_all if case_type == 'all' else \ - filter(lambda x: case_type in x, test_case_all) - - -def get_benchmark_path(lab, suit, benchmark): - return 'benchmarks/testplan/{0}/{1}/{2}'.format(lab, suit, benchmark) - - -def check_suite(suite_name): - return True if os.path.isfile('benchmarks/suite/' + suite_name) else False - - -def check_lab_name(lab_name): - return True if os.path.isdir('benchmarks/testplan/' + lab_name) else False - - -def check_benchmark_name(lab, file, benchmark): - return os.path.isfile('benchmarks/testplan/' + lab + '/' + file + '/' + benchmark) - - -def _get_f_name(test_case_path): - return test_case_path.split('/')[-1] - - -def prepare_ansible_env(benchmark_test_case): - env_setup = Env_setup() - [benchmark, vm_info, benchmark_details, proxy_info] = env_setup.parse(benchmark_test_case) - SpawnVM(vm_info) if len(vm_info) else None - env_setup.call_ping_test() - env_setup.call_ssh_test() - env_setup.update_ansible() - return benchmark, benchmark_details, proxy_info, env_setup - - -def run_benchmark(installer_type, pwd, benchmark, benchmark_details, - proxy_info, env_setup, benchmark_test_case): - driver = Driver() - result = driver.drive_bench(installer_type, pwd, benchmark, - env_setup.roles_dict.items(), - _get_f_name(benchmark_test_case), - benchmark_details, env_setup.ip_pw_dict.items(), proxy_info) - env_setup.cleanup_authorized_keys() - return result - - -def prepare_and_run_benchmark(installer_type, pwd, benchmark_test_case): - benchmark, benchmark_details, proxy_info, env_setup = prepare_ansible_env(benchmark_test_case) - return run_benchmark(installer_type, pwd, benchmark, benchmark_details, - proxy_info, env_setup, benchmark_test_case) diff --git a/legacy/utils/cli.py b/legacy/utils/cli.py deleted file mode 100644 index 5e566f27..00000000 --- a/legacy/utils/cli.py +++ /dev/null @@ -1,76 +0,0 @@ -############################################################################## -# 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 -############################################################################## - -import sys -import os -import args_handler -import argparse -import logger_utils - -logger = logger_utils.QtipLogger('cli').get - - -class Cli: - - @staticmethod - def _parse_args(args): - parser = argparse.ArgumentParser() - parser.add_argument('-l ', '--lab', required=True, help='Name of Lab ' - 'on which being tested, These can' - 'be found in the benchmarks/testplan/ directory. Please ' - 'ensure that you have edited the respective files ' - 'before using them. For testing other than through Jenkins' - ' The user should list default after -l . all the fields in' - ' the files are necessary and should be filled') - parser.add_argument('-f', '--file', required=True, help='File in ' - 'benchmarks/suite/ with the list of tests. there are three files' - '\n compute ' - '\n storage ' - '\n network ' - 'They contain all the tests that will be run. They are listed by suite.' - 'Please ensure there are no empty lines') - parser.add_argument('-b', '--benchmark', help='Name of the benchmark.' - 'Can be found in benchmarks/suite/file_name') - - return parser.parse_args(args) - - def __init__(self, args=sys.argv[1:]): - - args = self._parse_args(args) - if not args_handler.check_suite(args.file): - logger.error("ERROR: This suite file %s doesn't exist under benchmarks/suite/.\ - Please enter correct file." % str(args.file)) - sys.exit(1) - - if not args_handler.check_lab_name(args.lab): - logger.error("You have specified a lab that is not present under benchmarks/testplan/.\ - Please enter correct file. If unsure how to proceed, use -l default.") - sys.exit(1) - suite = args.file - benchmarks = args_handler.get_files_in_suite(suite) - test_cases = args_handler.get_files_in_test_plan(args.lab, suite) - benchmarks_list = filter(lambda x: x in test_cases, benchmarks) - - if args.benchmark: - if not args_handler.check_benchmark_name(args.lab, args.file, args.benchmark): - logger.error("You have specified an incorrect benchmark.\ - Please enter the correct one.") - sys.exit(1) - else: - logger.info("Starting with " + args.benchmark) - args_handler.prepare_and_run_benchmark( - os.environ['INSTALLER_TYPE'], os.environ['PWD'], - args_handler.get_benchmark_path(args.lab.lower(), args.file, args.benchmark)) - else: - map(lambda x: args_handler.prepare_and_run_benchmark( - os.environ['INSTALLER_TYPE'], os.environ['PWD'], - args_handler.get_benchmark_path(args.lab.lower(), suite, x)), benchmarks_list) - - logger.info("{0} is not a Template in the Directory Enter a Valid file name.\ - or use qtip.py -h for list".format(filter(lambda x: x not in test_cases, benchmarks))) diff --git a/legacy/utils/create_zones.py b/legacy/utils/create_zones.py deleted file mode 100644 index 5e378c83..00000000 --- a/legacy/utils/create_zones.py +++ /dev/null @@ -1,86 +0,0 @@ -##############################################################################
-# Copyright (c) 2016 Dell Inc, ZTE 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
-##############################################################################
-from keystoneclient.auth.identity import v2
-from keystoneclient import session
-from novaclient import client
-import os
-import random
-import logger_utils
-
-logger = logger_utils.QtipLogger('create_zones').get
-
-
-class AvailabilityZone:
-
- def __init__(self):
- self._keystone_client = None
- self._nova_client = None
-
- def _get_keystone_client(self):
- """returns a keystone client instance"""
-
- if self._keystone_client is None:
- '''
- self._keystone_client = keystoneclient.v2_0.client.Client(
- auth_url=os.environ.get('OS_AUTH_URL'),
- username=os.environ.get('OS_USERNAME'),
- password=os.environ.get('OS_PASSWORD'),
- tenant_name=os.environ.get('OS_TENANT_NAME'))
- '''
- auth = v2.Password(auth_url=os.environ.get('OS_AUTH_URL'),
- username=os.environ.get('OS_USERNAME'),
- password=os.environ.get('OS_PASSWORD'),
- tenant_name=os.environ.get('OS_TENANT_NAME'))
-
- sess = session.Session(auth=auth)
- else:
- return self._keystone_client
-
- return sess
-
- def _get_nova_client(self):
- if self._nova_client is None:
- keystone = self._get_keystone_client()
- self._nova_client = client.Client('2', session=keystone)
- return self._nova_client
-
- def clean_all_aggregates(self):
- logger.info("clean all aggregates")
- nova = self._get_nova_client()
- agg_list = nova.aggregates.list()
-
- for agg in agg_list:
- agg_info = nova.aggregates.get_details(agg.id)
- agg_hosts = agg_info.hosts
- if len(agg_hosts):
- for host in agg_hosts:
- nova.aggregates.remove_host(agg.id, host)
- nova.aggregates.delete(agg.id)
-
- def create_aggs(self, args):
- azone_list = list(set(args))
- azone_list.sort()
-
- nova = self._get_nova_client()
- hyper_list = nova.hypervisors.list()
-
- if len(azone_list) > len(hyper_list):
- logger.error("required available zones > compute nodes")
- return None
-
- compute_nodes = map(lambda x: x.service['host'], hyper_list)
- sample_nodes = random.sample(compute_nodes, len(azone_list))
- sample_nodes.sort()
-
- for index, item in enumerate(azone_list):
- logger.info("create aggregates: %s" % str(item))
- agg_id = nova.aggregates.create(item, item)
-
- logger.info("add host: %s" % sample_nodes[index])
- nova.aggregates.add_host(aggregate=agg_id, host=sample_nodes[index])
diff --git a/legacy/utils/dashboard/__init__.py b/legacy/utils/dashboard/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/legacy/utils/dashboard/__init__.py +++ /dev/null diff --git a/legacy/utils/dashboard/pushtoDB.py b/legacy/utils/dashboard/pushtoDB.py deleted file mode 100644 index ce54aebd..00000000 --- a/legacy/utils/dashboard/pushtoDB.py +++ /dev/null @@ -1,82 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import requests -import json -import datetime -import os -import sys -from qtip.utils import logger_utils - -logger = logger_utils.QtipLogger('push_db').get - -TEST_DB = 'http://testresults.opnfv.org/test/api/v1' - -suite_list = [('compute_result.json', 'compute_test_suite'), - ('network_result.json', 'network_test_suite'), - ('storage_result.json', 'storage_test_suite')] -payload_list = {} - - -def push_results_to_db(db_url, case_name, payload, installer, pod_name): - - url = db_url + "/results" - creation_date = str(datetime.datetime.utcnow().isoformat()) - - params = {"project_name": "qtip", "case_name": case_name, - "pod_name": pod_name, "installer": installer, "start_date": creation_date, - "version": "test", "details": payload} - - headers = {'Content-Type': 'application/json'} - logger.info('pod_name:{0},installer:{1},creation_data:{2}'.format(pod_name, - installer, - creation_date)) - # temporary code, will be deleted after Bigergia dashboard is ready - try: - qtip_testapi_url = "http://testapi.qtip.openzero.net/results" - qtip_testapi_r = requests.post(qtip_testapi_url, data=json.dumps(params), headers=headers) - logger.info('Pushing Results to qtip_testapi: %s'.format(qtip_testapi_r)) - except: - logger.info("Pushing Results to qtip_testapi Error:{0}".format(sys.exc_info()[0])) - - try: - r = requests.post(url, data=json.dumps(params), headers=headers) - logger.info(r) - return True - except: - logger.info("Error:{0}".format(sys.exc_info()[0])) - return False - - -def populate_payload(suite_list): - - global payload_list - for k, v in suite_list: - - if os.path.isfile('results/' + str(k)): - payload_list[k] = v - - -def main(): - - global payload_list - populate_payload(suite_list) - if payload_list: - logger.info(payload_list) - for suite, case in payload_list.items(): - with open('results/' + suite, 'r') as result_file: - j = json.load(result_file) - push_results_to_db(TEST_DB, case, j, - os.environ['INSTALLER_TYPE'], - os.environ['NODE_NAME']) - elif not payload_list: - logger.info('Results not found') - - -if __name__ == "__main__": - main() diff --git a/legacy/utils/driver.py b/legacy/utils/driver.py deleted file mode 100644 index 9894e0f5..00000000 --- a/legacy/utils/driver.py +++ /dev/null @@ -1,92 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Dell Inc, ZTE 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 -############################################################################## -import logger_utils -from operator import add -from ansible_api import AnsibleApi -from os.path import expanduser - -logger = logger_utils.QtipLogger('driver').get - - -class Driver: - - def __init__(self): - - logger.info("Class driver initialized\n") - self.installer_username = {'fuel': 'root', - 'joid': 'ubuntu', - 'apex': 'heat-admin'} - - @staticmethod - def merge_two_dicts(x, y): - ''' - It is from http://stackoverflow.com/questions/38987/ - how-can-i-merge-two-python-dictionaries-in-a-single-expression - ''' - z = x.copy() - z.update(y) - return z - - def get_common_var_json(self, installer_type, pwd, benchmark_fname, - benchmark_detail, pip_dict, proxy_info): - common_json = {'Dest_dir': expanduser('~') + '/qtip/results', - 'ip1': '', - 'ip2': '', - 'installer': str(installer_type), - 'workingdir': str(pwd), - 'fname': str(benchmark_fname), - 'username': self.installer_username[str(installer_type)]} - common_json.update(benchmark_detail) if benchmark_detail else None - common_json.update(proxy_info) if proxy_info else None - return common_json - - def get_special_var_json(self, role, roles, benchmark_detail, pip_dict): - special_json = {} - index = roles.index(role) + 1 - private_ip = pip_dict[0][1] if pip_dict[0][1][0] else 'NONE' - map(lambda x: special_json.update({'ip' + str(index): x}), role[1])\ - if benchmark_detail and (role[0] == '1-server') else None - map(lambda x: special_json.update({'privateip' + str(index): private_ip}), role[1])\ - if benchmark_detail and (role[0] == '1-server') else None - special_json = self.get_special_var_json(filter(lambda x: x[0] == '1-server', roles)[0], - roles, - benchmark_detail, - pip_dict) if role[0] == '2-host' else special_json - special_json.update({'role': role[0]}) - return special_json - - def run_ansible_playbook(self, benchmark, extra_vars): - logger.info(extra_vars) - ansible_api = AnsibleApi() - ansible_api.execute_playbook('./config/hosts', - './benchmarks/perftest/{0}.yaml'.format(benchmark), - './config/QtipKey', extra_vars) - return self.get_ansible_result(extra_vars['role'], ansible_api.get_detail_playbook_stats()) - - def drive_bench(self, installer_type, pwd, benchmark, roles, benchmark_fname, - benchmark_detail=None, pip_dict=None, proxy_info=None): - roles = sorted(roles) - pip_dict = sorted(pip_dict) - var_json = self.get_common_var_json(installer_type, pwd, benchmark_fname, - benchmark_detail, pip_dict, proxy_info) - result = map(lambda role: self.run_ansible_playbook - (benchmark, self.merge_two_dicts(var_json, - self.get_special_var_json(role, roles, - benchmark_detail, - pip_dict))), roles) - return reduce(self._merge_ansible_result, result) - - def get_ansible_result(self, role, stats): - result = reduce(add, map(lambda x: x[1]['failures'] + x[1]['unreachable'], stats)) - return {'result': result, - 'detail': {role: stats}} - - def _merge_ansible_result(self, result_1, result_2): - return {'result': result_1['result'] + result_2['result'], - 'detail': self.merge_two_dicts(result_1['detail'], result_2['detail'])} diff --git a/legacy/utils/env_setup.py b/legacy/utils/env_setup.py deleted file mode 100644 index 7bbedfcf..00000000 --- a/legacy/utils/env_setup.py +++ /dev/null @@ -1,214 +0,0 @@ -############################################################################## -# Copyright (c) 2016 Dell Inc, ZTE 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 -############################################################################## -import os -import random -import socket -import sys -import time -from collections import defaultdict -from os.path import expanduser -import paramiko -import yaml -import logger_utils - -logger = logger_utils.QtipLogger('env_setup').get - - -class Env_setup: - - roles_ip_list = [] # ROLE and its corresponding IP address list - ip_pw_list = [] # IP and password, this will be used to ssh - roles_dict = defaultdict(list) - ip_pw_dict = defaultdict(list) - ip_pip_list = [] - vm_parameters = defaultdict(list) - benchmark_details = defaultdict() - benchmark = '' - - def __init__(self): - print '\nParsing class initiated\n' - self.roles_ip_list[:] = [] - self.ip_pw_list[:] = [] - self.roles_dict.clear() - self.ip_pw_dict.clear() - self.ip_pip_list[:] = [] - self.proxy_info = {} - self.vm_parameters.clear() - self.benchmark_details.clear() - self.benchmark = '' - - @staticmethod - def write_to_file(role): - f_name_2 = open('./config/hosts', 'w') - print role.items() - for k in role: - f_name_2.write('[' + k + ']\n') - num = len(role[k]) - for x in range(num): - f_name_2.write(role[k][x] + '\n') - f_name_2.close() - - @staticmethod - def ssh_test(hosts): - for ip, pw in hosts: - logger.info('Beginning SSH Test: %s \n' % ip) - os.system('ssh-keyscan %s >> /root/.ssh/known_hosts' % ip) - time.sleep(2) - - ssh_cmd = './scripts/qtip_creds.sh %s' % ip - logger.info("run command: %s " % ssh_cmd) - os.system(ssh_cmd) - - ssh = paramiko.SSHClient() - ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) - ssh.connect(ip, key_filename='./config/QtipKey') - - for attempts in range(100): - try: - stdin, stdout, stderr = ssh.exec_command('uname') - if not stderr.readlines(): - logger.info('SSH successful') - break - except socket.error: - logger.error('SSH is still unavailable, retry!') - time.sleep(2) - if attempts == 99: - logger.error("Try 99 times, SSH failed: %s" % ip) - - @staticmethod - def ping_test(lister, attempts=30): - for k, v in lister.iteritems(): - time.sleep(10) - for val in v: - ipvar = val - ping_cmd = 'ping -D -c1 {0}'.format(ipvar) - for i in range(attempts): - if os.system(ping_cmd) != 0: - print '\nWaiting for machine\n' - time.sleep(10) - else: - break - print ('\n\n %s is UP \n\n ' % ipvar) - - @staticmethod - def fetch_compute_ips(): - logger.info("Fetch compute ips through installer") - ips = [] - - installer_type = str(os.environ['INSTALLER_TYPE'].lower()) - installer_ip = str(os.environ['INSTALLER_IP']) - if installer_type not in ["fuel", "compass"]: - raise RuntimeError("%s is not supported" % installer_type) - if not installer_ip: - raise RuntimeError("undefine environment variable INSTALLER_IP") - - cmd = "bash ./scripts/fetch_compute_ips.sh -i %s -a %s" % \ - (installer_type, installer_ip) - logger.info(cmd) - os.system(cmd) - with open(expanduser('~') + "/qtip/ips.log", "r") as file: - data = file.read() - if data: - ips.extend(data.rstrip('\n').split('\n')) - logger.info("All compute ips: %s" % ips) - return ips - - def check_machine_ips(self, host_tag): - logger.info("Check machine ips") - ips = self.fetch_compute_ips() - ips_num = len(ips) - num = len(host_tag) - if num > ips_num: - err = "host num %s > compute ips num %s" % (num, ips_num) - raise RuntimeError(err) - - for x in range(num): - hostlabel = 'machine_' + str(x + 1) - if host_tag[hostlabel]['ip']: - if host_tag[hostlabel]['ip'] in ips: - info = "%s's ip %s is defined by test case yaml file" % \ - (hostlabel, host_tag[hostlabel]['ip']) - logger.info(info) - else: - err = "%s is not in %s" % (host_tag[hostlabel]['ip'], ips) - raise RuntimeError(err) - else: - host_tag[hostlabel]['ip'] = random.choice(ips) - info = "assign ip %s to %s" % (host_tag[hostlabel]['ip'], hostlabel) - ips.remove(host_tag[hostlabel]['ip']) - - def get_host_machine_info(self, host_tag): - num = len(host_tag) - offset = len(self.roles_ip_list) - self.check_machine_ips(host_tag) - for x in range(num): - hostlabel = 'machine_' + str(x + 1) - self.roles_ip_list.insert( - offset, (host_tag[hostlabel]['role'], host_tag[hostlabel]['ip'])) - self.ip_pw_list.insert( - offset, (host_tag[hostlabel]['ip'], host_tag[hostlabel]['pw'])) - - def get_virtual_machine_info(self, virtual_tag): - - num = len(virtual_tag) - for x in range(num): - host_label = 'virtualmachine_' + str(x + 1) - for k, v in virtual_tag[host_label].iteritems(): - self.vm_parameters[k].append(v) - - def get_bench_mark_details(self, detail_dic): - - print detail_dic - for k, v in detail_dic.items(): - self.benchmark_details[k] = v - - def parse(self, config_file_path): - try: - f_name = open(config_file_path, 'r+') - doc = yaml.safe_load(f_name) - f_name.close() - if doc['Scenario']['benchmark']: - self.benchmark = doc['Scenario']['benchmark'] - if doc['Context']['Virtual_Machines']: - self.get_virtual_machine_info(doc['Context']['Virtual_Machines']) - if doc['Context']['Host_Machines']: - self.get_host_machine_info(doc['Context']['Host_Machines']) - if doc.get('Scenario', {}).get('benchmark_details', {}): - self.get_bench_mark_details(doc.get('Scenario', {}).get('benchmark_details', {})) - if 'Proxy_Environment' in doc['Context'].keys(): - self.proxy_info['http_proxy'] = doc['Context']['Proxy_Environment']['http_proxy'] - self.proxy_info['https_proxy'] = doc['Context']['Proxy_Environment']['https_proxy'] - self.proxy_info['no_proxy'] = doc['Context']['Proxy_Environment']['no_proxy'] - for k, v in self.roles_ip_list: - self.roles_dict[k].append(v) - for k, v in self.ip_pw_list: - self.ip_pw_dict[k].append(v) - return ( - self.benchmark, - self.vm_parameters, - self.benchmark_details.items(), - self.proxy_info) - except KeyboardInterrupt: - print 'ConfigFile Closed: exiting!' - sys.exit(0) - - def update_ansible(self): - self.write_to_file(self.roles_dict) - - def call_ping_test(self): - self.ping_test(self.roles_dict) - - def call_ssh_test(self): - self.ssh_test(self.ip_pw_list) - - def cleanup_authorized_keys(self): - for ip, pw in self.ip_pw_list: - cmd = './scripts/cleanup_creds.sh %s' % ip - logger.info("cleanup authorized_keys: %s " % cmd) - os.system(cmd) diff --git a/legacy/utils/report/__init__.py b/legacy/utils/report/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/legacy/utils/report/__init__.py +++ /dev/null diff --git a/legacy/utils/report/get_indices.py b/legacy/utils/report/get_indices.py deleted file mode 100644 index 42db6584..00000000 --- a/legacy/utils/report/get_indices.py +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import json - - -def get_index(suite): - with open('../../results/' + suite + '.json') as result_file: - result_djson = json.load(result_file) - index = result_djson['index'] - return index diff --git a/legacy/utils/report/get_results.py b/legacy/utils/report/get_results.py deleted file mode 100644 index 6df88235..00000000 --- a/legacy/utils/report/get_results.py +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import os -import json - - -def report_concat(targ_dir, testcase): - machine_temp = [] - machines = [] - - for file in os.listdir(targ_dir): - if file.endswith(".json"): - machine_temp.append(file) - - l = len(machine_temp) - - for x in range(0, l): - file_t = machine_temp[x] - with open(targ_dir + file_t) as result_file: - result_djson = json.load(result_file) - if result_djson['1 Testcase Name'] == str(testcase): - machines.append(result_djson) - return machines - - -def space_count(l): - spc = '' - for x in range(l): - spc = spc + ' ' - return spc - - -def custom_dict(list1, list2, k): - string_1 = '' - for num_1 in range(0, len(list1)): - string_1 = string_1 + space_count(k) + str(list1[num_1][0]) + "=" + str(list2[num_1]) + "\n" - return string_1 - - -def generate_result(dict_a, k): - list_1 = [] - list_2 = [] - count = 0 - for i, j in sorted(dict_a.iteritems()): - list_1.append([]) - list_1[count].append(i) - if (str(type(dict_a.get(i)))) == "<type 'dict'>": - list_2.append(str("\n" + generate_result(dict_a.get(i), int(k + 1)))) - else: - list_2.append(dict_a.get(i)) - count = count + 1 - return custom_dict(list_1, list_2, k) diff --git a/legacy/utils/report/qtip_graph.py b/legacy/utils/report/qtip_graph.py deleted file mode 100644 index 68ed660f..00000000 --- a/legacy/utils/report/qtip_graph.py +++ /dev/null @@ -1,38 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import matplotlib -import matplotlib.pyplot as plt -import numpy as np - -matplotlib.use('Agg') - - -def plot_indices(a, b, c): - N = 3 - ind = np.arange(N) - y_axis = (a, b, c) - width = 0.35 - f = plt.figure() - ax = f.gca() - ax.set_autoscale_on(True) - my_bars = ax.bar(ind, y_axis, width, color='b') - ax.set_ylabel('Index Score*') - ax.set_xlabel('Suite') - ax.set_title(' QTIP benchmark scores') - ax.axis('on') - my_bars = ax.bar(ind, y_axis, width) - ax.set_xticks(ind + width / 2) - ax.set_xticklabels(['Compute', 'Storage', 'Network']) - ax.axis([0, 3, 0, 1.25]) - f.text(0.7, 0.01, '* With Comparison to Refernece POD', fontsize=9) - - for rect in my_bars: - height = rect.get_height() - ax.text(rect.get_x() + rect.get_width() / 2., 1.05 * height, height, ha='center', va='bottom') - f.savefig('qtip_graph.jpeg') diff --git a/legacy/utils/report/qtip_report.py b/legacy/utils/report/qtip_report.py deleted file mode 100644 index 1097df5f..00000000 --- a/legacy/utils/report/qtip_report.py +++ /dev/null @@ -1,117 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image -from reportlab.lib.styles import getSampleStyleSheet -from reportlab.lib.units import inch -from reportlab.lib.pagesizes import letter -import qtip_graph as graph -import get_indices as results -from get_results import report_concat -from get_results import generate_result - - -def dump_result(Stor, directory, testcase): - try: - lower_s = testcase.lower() - Stor.append(Paragraph(testcase, Style['h3'])) - l1 = report_concat(directory, lower_s) - l = 1 - for a in l1: - Stor.append(Paragraph(testcase + " result_" + str(l), Style['h5'])) - raw_string = generate_result(a, 0) - replaced_string = raw_string.replace('\n', '<br/> ').replace(' ', ' ') - Stor.append(Paragraph(replaced_string, Style['BodyText'])) - l = l + 1 - except OSError: - print "Results for {0} not found".format(testcase) - - -doc = SimpleDocTemplate("../../results/QTIP_results.pdf", pagesize=letter, - rightMargin=72, leftMargin=72, - topMargin=72, bottomMargin=18) -Stor = [] -Style = getSampleStyleSheet() -Title = "QTIP Benchmark Suite" -Stor.append(Paragraph(Title, Style['Title'])) -H1 = "Results" -Stor.append(Spacer(0, 36)) -Stor.append(Paragraph(H1, Style['h2'])) -compute = 0 -storage = 0 -network = 0 -try: - compute = results.get_index('compute_result') -except IOError: - pass - -try: - storage = results.get_index('storage_result') -except IOError: - pass -try: - network = results.get_index('network_result') -except IOError: - pass - -Stor.append(Paragraph("Compute Suite: %f" % compute, Style['h5'])) -Stor.append(Paragraph("Storage Suite: %f" % storage, Style['h5'])) -Stor.append(Paragraph("Network Suite: %f" % network, Style['h5'])) -graph.plot_indices(compute, storage, network) -qtip_graph = ('qtip_graph.jpeg') -im = Image(qtip_graph, 5 * inch, 4 * inch) -Stor.append(im) -Stor.append(Spacer(0, 12)) -Stor.append(Paragraph("Reference POD", Style['h5'])) -ptext = "The Dell OPNFV Lab POD3 has been taken as the reference POD against which the reference results have been collected. The POD consists of 6 identical servers. The details of such a server are:" -Stor.append(Paragraph(ptext, Style['Normal'])) -ptext = "<bullet>•</bullet>Server Type: Dell PowerEdge R630 Server" -Stor.append(Paragraph(ptext, Style['Bullet'])) -ptext = "<bullet>•</bullet>CPU: Intel Xeon E5-2698 @ 2300 MHz" -Stor.append(Paragraph(ptext, Style["Bullet"])) -ptext = "<bullet>•</bullet>RAM: 128GB" -Stor.append(Paragraph(ptext, Style["Bullet"])) -ptext = "<bullet>•</bullet>Storage SSD: 420GB" -Stor.append(Paragraph(ptext, Style["Bullet"])) -ptext = "<bullet>•</bullet>Network Card: Intel 2P X520/2P I350 rNDC" -Stor.append(Paragraph(ptext, Style["Bullet"])) -ptext = "Servers interconnected through a DELL S4810 switch using a 10Gbps physical link" -Stor.append(Paragraph(ptext, Style["Bullet"])) -Stor.append(Spacer(0, 12)) -ptext = "For Further Details of the Reference POD hardware, please visit: https://wiki.opnfv.org/reference_pod_hardware_details" -Stor.append(Paragraph(ptext, Style['Normal'])) -Stor.append(Spacer(0, 12)) -ptext = "For Details of the Reference POD Results, please visit: https://wiki.opnfv.org/reference_pod_qtip_results" -Stor.append(Spacer(0, 12)) -Stor.append(Paragraph(ptext, Style['Normal'])) -Stor.append(Paragraph("RAW Results", Style['h1'])) -Stor.append(Paragraph("Compute Results", Style['h2'])) - -dump_result(Stor, "../../results/dhrystone/", "Dhrystone_bm") -dump_result(Stor, "../../results/dhrystone/", "Dhrystone_vm") - -dump_result(Stor, "../../results/whetstone/", "Whetstone_bm") -dump_result(Stor, "../../results/whetstone/", "Whetstone_vm") - -dump_result(Stor, "../../results/ramspeed/", "Ramspeed_bm") -dump_result(Stor, "../../results/ramspeed/", "Ramspeed_vm") - -dump_result(Stor, "../../results/ssl/", "SSL_bm") -dump_result(Stor, "../../results/ssl/", "SSL_vm") - -Stor.append(Paragraph("Network Results", Style['h2'])) -dump_result(Stor, "../../results/iperf/", "IPERF_bm") -dump_result(Stor, "../../results/iperf/", "IPERF_vm") -dump_result(Stor, "../../results/iperf/", "IPERF_vm_2") - -Stor.append(Paragraph("Storage Results", Style['h2'])) -dump_result(Stor, "../../results/fio/", "fio_bm") -dump_result(Stor, "../../results/fio/", "fio_vm") - - -doc.build(Stor) diff --git a/legacy/utils/spawn_vm.py b/legacy/utils/spawn_vm.py deleted file mode 100644 index f38c9a3a..00000000 --- a/legacy/utils/spawn_vm.py +++ /dev/null @@ -1,206 +0,0 @@ -##############################################################################
-# Copyright (c) 2016 Dell Inc, ZTE 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
-##############################################################################
-import os
-import sys
-import yaml
-import heatclient.client
-import keystoneclient
-import time
-from env_setup import Env_setup
-from create_zones import AvailabilityZone
-import logger_utils
-
-logger = logger_utils.QtipLogger('spawn_vm').get
-
-
-class SpawnVM(Env_setup):
-
- def __init__(self, vm_info):
- logger.info('vm_info: %s' % vm_info)
- vm_role_ip_dict = vm_info.copy()
- self._keystone_client = None
- self._heat_client = None
- self._glance_client = None
- self._nova_client = None
- self.azone = AvailabilityZone()
- # TODO: it should clean up aggregates and stack after test case finished.
- self.azone.clean_all_aggregates()
- self.azone.create_aggs(vm_info['availability_zone'])
- self.heat_template = self.generate_heat_template(vm_info)
- self.create_stack(vm_role_ip_dict)
-
- @staticmethod
- def get_public_network():
-
- """
- TODO: GET THE NAMES OF THE PUBLIC NETWORKS for OTHER PROJECTS
- """
- installer = os.environ['INSTALLER_TYPE']
-
- if installer.lower() == 'fuel':
- return 'admin_floating_net'
- if installer.lower() == 'apex':
- return 'external'
- if installer.lower() == 'compass':
- return 'ext-net'
- if installer.lower() == 'joid':
- return 'ext-net'
-
- def generate_heat_template(self, vm_params):
- logger.info('Generating Heat Template')
- heat_dict = {}
- try:
- with open('./config/SampleHeat.yaml', 'r+') as H_temp:
- heat_dict = yaml.safe_load(H_temp)
- except yaml.YAMLError as exc:
- if hasattr(exc, 'problem_mark'):
- mark = exc.problem_mark
- logger.error(
- 'Error in qtip/config/SampleHeat.yaml at: (%s,%s)' % (mark.line + 1,
- mark.column + 1))
- logger.error('EXITING PROGRAM. Correct File and restart')
- sys.exit(1)
-
- fopen = open('./config/QtipKey.pub', 'r')
- fopenstr = fopen.read()
- fopenstr = fopenstr.rstrip()
- scriptcmd = '#!/bin/bash \n echo {0} >> foo.txt \n echo {1} >> /root/.ssh/authorized_keys'.format(
- fopenstr, fopenstr)
-
- netName = self.get_public_network()
- heat_dict['heat_template_version'] = '2015-04-30'
-
- heat_dict['parameters']['public_network'] = {
- 'type': 'string',
- 'default': netName
- }
-
- for x in range(1, len(vm_params['availability_zone']) + 1):
- avail_zone = vm_params['availability_zone'][x - 1]
-
- heat_dict['parameters']['availability_zone_' + str(x)] = \
- {'description': 'Availability Zone of the instance',
- 'default': avail_zone,
- 'type': 'string'}
-
- heat_dict['resources']['public_port_' + str(x)] = \
- {'type': 'OS::Neutron::Port',
- 'properties': {'network': {'get_resource': 'network'},
- 'security_groups': [{'get_resource': 'security_group'}],
- 'fixed_ips': [{'subnet_id': {'get_resource': 'subnet'}}]}}
-
- heat_dict['resources']['floating_ip_' + str(x)] = {
- 'type': 'OS::Neutron::FloatingIP',
- 'properties': {'floating_network': {'get_param': 'external_net_name'}}}
-
- heat_dict['resources']['floating_ip_assoc_' + str(x)] = {
- 'type': 'OS::Neutron::FloatingIPAssociation',
- 'properties': {
- 'floatingip_id': {'get_resource': 'floating_ip_' + str(x)},
- 'port_id': {'get_resource': 'public_port_' + str(x)}}}
-
- heat_dict['resources']['my_instance_' + str(x)] = \
- {'type': 'OS::Nova::Server',
- 'properties': {'image': {'get_param': 'image'},
- 'networks':
- [{'port': {'get_resource': 'public_port_' + str(x)}}],
- 'flavor': {'get_resource': 'flavor'},
- 'availability_zone': avail_zone,
- 'security_groups': [{'get_resource': 'security_group'}],
- 'name': 'instance' + str(x),
- 'user_data_format': 'RAW',
- 'user_data': scriptcmd}}
-
- heat_dict['outputs']['instance_PIP_' + str(x)] = {
- 'description': 'IP address of the instance',
- 'value': {'get_attr': ['my_instance_' + str(x), 'first_address']}}
-
- heat_dict['outputs']['instance_ip_' + str(x)] = {
- 'description': 'IP address of the instance',
- 'value': {'get_attr': ['floating_ip_' + str(x), 'floating_ip_address']}}
-
- heat_dict['outputs']['availability_instance_' + str(x)] = {
- 'description': 'Availability Zone of the Instance',
- 'value': {'get_param': 'availability_zone_' + str(x)}}
-
- del heat_dict['outputs']['description']
- logger.info(heat_dict)
-
- return heat_dict
-
- def _get_keystone_client(self):
- """returns a keystone client instance"""
-
- if self._keystone_client is None:
- self._keystone_client = keystoneclient.v2_0.client.Client(
- auth_url=os.environ.get('OS_AUTH_URL'),
- username=os.environ.get('OS_USERNAME'),
- password=os.environ.get('OS_PASSWORD'),
- tenant_name=os.environ.get('OS_TENANT_NAME'))
- return self._keystone_client
-
- def _get_heat_client(self):
- """returns a heat client instance"""
- if self._heat_client is None:
- keystone = self._get_keystone_client()
- heat_endpoint = keystone.service_catalog.url_for(
- service_type='orchestration')
- self._heat_client = heatclient.client.Client(
- '1', endpoint=heat_endpoint, token=keystone.auth_token)
- return self._heat_client
-
- def create_stack(self, vm_role_ip_dict):
- stackname = 'QTIP'
- heat = self._get_heat_client()
-
- self.delete_stack(stackname)
-
- logger.info('Start to create stack %s' % stackname)
- heat.stacks.create(stack_name=stackname, template=self.heat_template)
-
- stack_status = "IN_PROGRESS"
- while stack_status != 'COMPLETE':
- if stack_status == 'IN_PROGRESS':
- logger.debug('Create in Progress')
- if stack_status == 'CREATE_FAILED':
- raise RuntimeError("Stack %s created failed!" % stackname)
- stack_status = heat.stacks.get(stackname).status
- time.sleep(15)
- logger.info('Stack %s Created Complete!' % stackname)
-
- stack_outputs = heat.stacks.get(stackname).outputs
-
- for vm in range(len(vm_role_ip_dict['OS_image'])):
- for i in stack_outputs:
- instanceKey = "instance_ip_" + str(vm + 1)
- privateIPkey = 'instance_PIP_' + str(vm + 1)
- if i['output_key'] == instanceKey:
- Env_setup.roles_dict[vm_role_ip_dict['role'][vm]] \
- .append(str(i['output_value']))
- Env_setup.ip_pw_list.append((str(i['output_value']), ''))
-
- if i['output_key'] == privateIPkey:
- Env_setup.ip_pw_dict[vm_role_ip_dict['role'][vm]] = str(i['output_value'])
-
- logger.info('Getting Public IP(s): %s' % Env_setup.ip_pw_list)
-
- def delete_stack(self, stack_name):
- heat = self._get_heat_client()
-
- stacks = heat.stacks.list()
- exists = map(lambda x: x.stack_name, stacks)
- if stack_name in exists:
- logger.info("Delete stack %s" % stack_name)
- heat.stacks.delete(stack_name)
- while stack_name in exists:
- time.sleep(10)
- stacks = heat.stacks.list()
- exists = map(lambda x: x.stack_name, stacks)
- logger.debug("exists_stacks: %s" % exists)
- logger.info("%s doesn't exist" % stack_name)
diff --git a/legacy/utils/transform/__init__.py b/legacy/utils/transform/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/legacy/utils/transform/__init__.py +++ /dev/null diff --git a/legacy/utils/transform/dpi_transform.py b/legacy/utils/transform/dpi_transform.py deleted file mode 100644 index bc837311..00000000 --- a/legacy/utils/transform/dpi_transform.py +++ /dev/null @@ -1,55 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import os -import pickle -import datetime - -sum_dpi_pps = float(0) -sum_dpi_bps = float(0) - -for x in range(1, 11): - dpi_result_pps = float( - os.popen( - "cat $HOME/qtip_result/dpi_dump.txt | grep 'nDPI throughput:' | awk 'NR=='" + - str(x) + - " | awk '{print $3}'").read().lstrip()) - dpi_result_bps = float( - os.popen( - "cat $HOME/qtip_result/dpi_dump.txt | grep 'nDPI throughput:' | awk 'NR=='" + - str(x) + - " | awk '{print $7}'").read().rstrip()) - - if (dpi_result_pps > 100): - dpi_result_pps = dpi_result_pps / 1000 - - if (dpi_result_bps > 100): - dpi_result_bps = dpi_result_bps / 1000 - - sum_dpi_pps += dpi_result_pps - sum_dpi_bps += dpi_result_bps - -dpi_result_pps = sum_dpi_pps / 10 -dpi_result_bps = sum_dpi_bps / 10 - -host = os.popen("hostname").read().rstrip() -log_time_stamp = str(datetime.datetime.utcnow().isoformat()) - -os.popen( - "cat $HOME/qtip_result/dpi_dump.txt > $HOME/qtip_result/" + - host + - "-" + - log_time_stamp + - ".log") - -home_dir = str(os.popen("echo $HOME").read().rstrip()) -host = os.popen("echo $HOSTNAME") -result = {'pps': round(dpi_result_pps, 3), - 'bps': round(dpi_result_bps, 3)} -with open('./result_temp', 'w+') as result_file: - pickle.dump(result, result_file) diff --git a/legacy/utils/transform/final_report.py b/legacy/utils/transform/final_report.py deleted file mode 100644 index 1d7c3001..00000000 --- a/legacy/utils/transform/final_report.py +++ /dev/null @@ -1,32 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import pickle -import json -import datetime -import os -import sys - -home_dir = str((os.popen("echo $HOME").read().rstrip())) - -with open('./sys_info_temp', 'r') as sys_info_f: - sys_info_dict = pickle.load(sys_info_f) -with open('./result_temp', 'r') as result_f: - result_dict = pickle.load(result_f) - -host_name = (os.popen("hostname").read().rstrip()) -benchmark_name = str(sys.argv[1]) -testcase_name = str(sys.argv[2]) -report_time_stamp = str(datetime.datetime.utcnow().isoformat()) -final_dict = {"name": testcase_name, - "time": report_time_stamp, - "system_information": sys_info_dict, - "details": result_dict} - -with open('./' + host_name + '-' + report_time_stamp + '.json', 'w+') as result_json: - json.dump(final_dict, result_json, indent=4, sort_keys=True) diff --git a/legacy/utils/transform/fio_transform.py b/legacy/utils/transform/fio_transform.py deleted file mode 100644 index e8de2f9a..00000000 --- a/legacy/utils/transform/fio_transform.py +++ /dev/null @@ -1,37 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import json -import pickle -import os -import datetime - - -def get_fio_job_result(fio_job_data): - return {'read': {'io_bytes': fio_job_data["read"]["io_bytes"], - 'io_ps': fio_job_data["read"]["iops"], - 'io_runtime_millisec': fio_job_data["read"]["runtime"], - 'mean_io_latenchy_microsec': fio_job_data["read"]["lat"]["mean"]}, - 'write': {'io_bytes': fio_job_data["write"]["io_bytes"], - 'io_ps': fio_job_data["write"]["iops"], - 'io_runtime_millisec': fio_job_data["write"]["runtime"], - 'mean_io_latenchy_microsec': fio_job_data["write"]["lat"]["mean"]}} - - -with open("fio_result.json") as fio_raw: - fio_data = json.load(fio_raw) - -fio_result_dict = {} -for x, result in enumerate(map(get_fio_job_result, fio_data["jobs"])): - fio_result_dict['job_{0}'.format(x)] = result - -host_name = (os.popen("hostname").read().rstrip()) -report_time = str(datetime.datetime.utcnow().isoformat()) -os.system("mv fio_result.json " + str(host_name) + "-" + report_time + ".log") -with open('./result_temp', 'w + ')as out_fio_result: - pickle.dump(fio_result_dict, out_fio_result) diff --git a/legacy/utils/transform/iperf_transform.py b/legacy/utils/transform/iperf_transform.py deleted file mode 100644 index c5eef6f5..00000000 --- a/legacy/utils/transform/iperf_transform.py +++ /dev/null @@ -1,35 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import json
-import datetime
-import pickle
-with open('iperf_raw.json', 'r') as ifile:
- raw_iperf_data = json.loads(ifile.read().rstrip())
-
-bits_sent = raw_iperf_data['end']['sum_sent']['bits_per_second']
-bits_received = raw_iperf_data['end']['sum_received']['bits_per_second']
-total_byte_sent = raw_iperf_data['end']['sum_sent']['bytes']
-total_byte_received = raw_iperf_data['end']['sum_received']['bytes']
-cpu_host_total_percent = raw_iperf_data['end']['cpu_utilization_percent']['host_total']
-cpu_remote_total_percent = raw_iperf_data['end']['cpu_utilization_percent']['remote_total']
-
-time_stamp = str(datetime.datetime.utcnow().isoformat())
-
-result = {'version': raw_iperf_data['start']['version'],
- 'bandwidth': {'sender_throughput': bits_sent,
- 'received_throughput': bits_received},
- 'cpu': {'cpu_host': cpu_host_total_percent,
- 'cpu_remote': cpu_remote_total_percent}
- }
-
-with open('iperf_raw-' + time_stamp + '.log', 'w+') as ofile:
- ofile.write(json.dumps(raw_iperf_data))
-
-with open('./result_temp', 'w+') as result_file:
- pickle.dump(result, result_file)
diff --git a/legacy/utils/transform/ramspeed_transform.py b/legacy/utils/transform/ramspeed_transform.py deleted file mode 100644 index 9aa713ff..00000000 --- a/legacy/utils/transform/ramspeed_transform.py +++ /dev/null @@ -1,49 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import os -import pickle -import datetime - -intmem_copy = os.popen("cat Intmem | grep 'BatchRun Copy' | awk '{print $4}'").read().rstrip() -intmem_scale = os.popen("cat Intmem | grep 'BatchRun Scale' | awk '{print $4}'").read().rstrip() -intmem_add = os.popen("cat Intmem | grep 'BatchRun Add' | awk '{print $4}'").read().rstrip() -intmem_triad = os.popen("cat Intmem | grep 'BatchRun Triad' | awk '{print $4}'").read().rstrip() -intmem_average = os.popen("cat Intmem | grep 'BatchRun AVERAGE' | awk '{print $4}'").read().rstrip() - -print intmem_copy -print intmem_average - -floatmem_copy = os.popen("cat Floatmem | grep 'BatchRun Copy' | awk '{print $4}'").read().rstrip() -floatmem_scale = os.popen("cat Floatmem | grep 'BatchRun Scale' | awk '{print $4}'").read().rstrip() -floatmem_add = os.popen("cat Floatmem | grep 'BatchRun Add' | awk '{print $4}'").read().rstrip() -floatmem_triad = os.popen("cat Floatmem | grep 'BatchRun Triad' | awk '{print $4}'").read().rstrip() -floatmem_average = os.popen("cat Floatmem | grep 'BatchRun AVERAGE' | awk '{print $4}'").read().rstrip() - -print floatmem_copy -print floatmem_average - -hostname = os.popen("hostname").read().rstrip() -time_stamp = str(datetime.datetime.utcnow().isoformat()) - -os.system("mv Intmem " + hostname + "-" + time_stamp + ".log") -os.system("cp Floatmem >> " + hostname + "-" + time_stamp + ".log") - -result = {"int_bandwidth": {"copy": intmem_copy, - "add": intmem_add, - "scale": intmem_scale, - "triad": intmem_triad, - "average": intmem_average}, - "float_bandwidth": {"copy": floatmem_copy, - "add": floatmem_add, - "scale": floatmem_scale, - "triad": floatmem_triad, - "average": floatmem_average}} - -with open('./result_temp', 'w+') as result_file: - pickle.dump(result, result_file) diff --git a/legacy/utils/transform/ssl_transform.py b/legacy/utils/transform/ssl_transform.py deleted file mode 100644 index 24b696e5..00000000 --- a/legacy/utils/transform/ssl_transform.py +++ /dev/null @@ -1,62 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import os -import pickle -import datetime - -openssl_version = os.popen("cat RSA_dump | head -1").read().rstrip() -rsa_512_sps = os.popen( - "cat RSA_dump | grep '512 bits ' | awk '{print $6}' ").read().rstrip() -rsa_512_vps = os.popen( - "cat RSA_dump | grep '512 bits ' | awk '{print $7}' ").read().rstrip() -rsa_1024_sps = os.popen( - "cat RSA_dump | grep '1024 bits ' | awk '{print $6}' ").read().rstrip() -rsa_1024_vps = os.popen( - "cat RSA_dump | grep '1024 bits ' | awk '{print $7}' ").read().rstrip() -rsa_2048_sps = os.popen( - "cat RSA_dump | grep '2048 bits ' | awk '{print $6}' ").read().rstrip() -rsa_2048_vps = os.popen( - "cat RSA_dump | grep '2048 bits ' | awk '{print $7}' ").read().rstrip() -rsa_4096_sps = os.popen( - "cat RSA_dump | grep '4096 bits ' | awk '{print $6}' ").read().rstrip() -rsa_4096_vps = os.popen( - "cat RSA_dump | grep '4096 bits ' | awk '{print $7}' ").read().rstrip() - -aes_16B = os.popen( - "cat AES-128-CBC_dump | grep 'aes-128-cbc ' | awk '{print $2}' ").read().rstrip() -aes_64B = os.popen( - "cat AES-128-CBC_dump | grep 'aes-128-cbc ' | awk '{print $3}' ").read().rstrip() -aes_256B = os.popen( - "cat AES-128-CBC_dump | grep 'aes-128-cbc ' | awk '{print $4}' ").read().rstrip() -aes_1024B = os.popen( - "cat AES-128-CBC_dump | grep 'aes-128-cbc ' | awk '{print $5}' ").read().rstrip() -aes_8192B = os.popen( - "cat AES-128-CBC_dump | grep 'aes-128-cbc ' | awk '{print $6}' ").read().rstrip() - -hostname = os.popen("hostname").read().rstrip() -time_stamp = str(datetime.datetime.utcnow().isoformat()) - -os.system("mv RSA_dump " + hostname + "-" + time_stamp + ".log") -os.system("cat AES-128-CBC_dump >> " + hostname + "-" + time_stamp + ".log") - -result = {"version": [openssl_version], - "rsa_sig": {"512_bits": rsa_512_sps, - "1024_bits": rsa_1024_sps, - "2048_bits": rsa_2048_sps, - "4096_bits": rsa_4096_sps, - "unit": "sig/sec"}, - "aes_128_cbc": {"16B_block": aes_16B, - "64B_block": aes_64B, - "256B_block": aes_256B, - "1024B_block": aes_1024B, - "8192B_block": aes_8192B, - "unit": "B/sec"}} - -with open('./result_temp', 'w+') as result_file: - pickle.dump(result, result_file) diff --git a/legacy/utils/transform/ubench_transform.py b/legacy/utils/transform/ubench_transform.py deleted file mode 100644 index fe687118..00000000 --- a/legacy/utils/transform/ubench_transform.py +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation 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 -############################################################################## -import os -import json -import pickle - -total_cpu = os.popen( - "cat $HOME/tempT/UnixBench/results/* | grep 'of tests' | awk '{print $1;}' | awk 'NR==1'").read().rstrip() - -cpu_1 = os.popen( - "cat $HOME/tempT/UnixBench/results/* | grep 'of tests' | awk '{print $6;}' | awk 'NR==1'").read().rstrip() - - -cpu_2 = os.popen( - "cat $HOME/tempT/UnixBench/results/* | grep 'of tests' | awk '{print $6;}' | awk 'NR==2'").read().rstrip() - - -index_1 = os.popen( - "cat $HOME/tempT/UnixBench/results/* | grep 'Index Score (Partial Only) ' | awk '{print $7;}' | awk 'NR==1'").read().rstrip() -index_2 = os.popen( - "cat $HOME/tempT/UnixBench/results/* | grep 'Index Score (Partial Only) ' | awk '{print $7;}' | awk 'NR==2'").read().rstrip() - - -result = {"n_cpu": total_cpu, - "single": {"n_para_test": cpu_1, - "score": index_1}, - "multi": {"n_para_test": cpu_2, - "score": index_2} - } - -with open('result_temp', 'w+') as result_file: - pickle.dump(result, result_file) -print json.dumps(result, indent=4, sort_keys=True) -# print result.items() |