aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--legacy/assets/perftest/dhrystone.yaml119
-rw-r--r--legacy/assets/perftest/dpi.yaml134
-rw-r--r--legacy/assets/perftest/ramspeed.yaml123
-rw-r--r--legacy/assets/perftest/ssl.yaml127
-rw-r--r--legacy/assets/perftest/whetstone.yaml119
-rw-r--r--legacy/assets/suite/compute16
-rw-r--r--legacy/assets/suite/compute.yaml54
-rw-r--r--legacy/assets/suite/network9
-rw-r--r--legacy/assets/suite/storage8
-rw-r--r--legacy/assets/testplan/default/compute/dhrystone_bm.yaml41
-rw-r--r--legacy/assets/testplan/default/compute/dhrystone_vm.yaml53
-rw-r--r--legacy/assets/testplan/default/compute/dpi_bm.yaml42
-rw-r--r--legacy/assets/testplan/default/compute/dpi_vm.yaml43
-rw-r--r--legacy/assets/testplan/default/compute/ramspeed_bm.yaml42
-rw-r--r--legacy/assets/testplan/default/compute/ramspeed_vm.yaml53
-rw-r--r--legacy/assets/testplan/default/compute/ssl_bm.yaml39
-rw-r--r--legacy/assets/testplan/default/compute/ssl_vm.yaml44
-rw-r--r--legacy/assets/testplan/default/compute/whetstone_bm.yaml41
-rw-r--r--legacy/assets/testplan/default/compute/whetstone_vm.yaml52
-rw-r--r--legacy/data/hosts2
-rw-r--r--legacy/data/my_key.pem27
-rw-r--r--legacy/data/output/hosts3
-rw-r--r--legacy/data/schema/test_bm_schema.yaml84
-rw-r--r--legacy/data/schema/test_vm_schema.yaml88
-rw-r--r--legacy/data/test.retry1
-rw-r--r--legacy/data/test.yml12
-rw-r--r--legacy/data/testplan/bm_ping.yaml37
-rw-r--r--legacy/data/testplan/bm_with_proxy.yaml47
-rw-r--r--legacy/data/testplan/bm_without_proxy.yaml41
-rw-r--r--legacy/data/testplan/vm.yaml56
-rw-r--r--legacy/data/testplan/vm_error.yaml50
-rw-r--r--legacy/run.py18
-rwxr-xr-xlegacy/scripts/cleanup_creds.sh11
-rwxr-xr-xlegacy/scripts/get_env_info.sh37
-rw-r--r--legacy/scripts/ssh_exch.exp9
-rw-r--r--legacy/tests/ansible_api_test.py22
-rw-r--r--legacy/tests/args_handler_test.py36
-rw-r--r--legacy/tests/cli_test.py52
-rw-r--r--legacy/tests/driver_test.py103
-rw-r--r--legacy/tests/env_setup_test.py120
-rw-r--r--legacy/utils/ansible_api.py65
-rw-r--r--legacy/utils/args_handler.py73
-rw-r--r--legacy/utils/cli.py76
-rw-r--r--legacy/utils/driver.py92
-rw-r--r--legacy/utils/env_setup.py214
-rw-r--r--legacy/utils/transform/dpi_transform.py55
-rw-r--r--legacy/utils/transform/final_report.py32
-rw-r--r--legacy/utils/transform/ramspeed_transform.py49
-rw-r--r--legacy/utils/transform/ssl_transform.py62
-rw-r--r--legacy/utils/transform/ubench_transform.py40
-rw-r--r--qtip/cli/commands/cmd_project.py4
-rw-r--r--qtip/collector/calculator.py38
-rw-r--r--qtip/collector/parser/grep.py66
-rw-r--r--qtip/collector/parser/regex.yaml85
-rw-r--r--qtip/driver/__init__.py0
-rw-r--r--qtip/driver/ansible_api.py58
-rw-r--r--qtip/driver/ansible_driver.py102
-rw-r--r--qtip/driver/base.py20
-rw-r--r--qtip/driver/playbook/dpi/clean.yaml23
-rw-r--r--qtip/driver/playbook/dpi/dpi_average.sh10
-rw-r--r--qtip/driver/playbook/dpi/run.yaml42
-rw-r--r--qtip/driver/playbook/dpi/setup.yaml93
-rw-r--r--qtip/driver/playbook/inxi.yaml25
-rw-r--r--qtip/driver/playbook/openssl/clean.yaml23
-rw-r--r--qtip/driver/playbook/openssl/run.yaml45
-rw-r--r--qtip/driver/playbook/openssl/setup.yaml87
-rw-r--r--qtip/driver/playbook/prepare_env.yaml54
-rw-r--r--qtip/driver/playbook/ramspeed/clean.yaml23
-rw-r--r--qtip/driver/playbook/ramspeed/run.yaml40
-rw-r--r--qtip/driver/playbook/ramspeed/setup.yaml70
-rw-r--r--qtip/driver/playbook/unixbench/clean.yaml25
-rw-r--r--qtip/driver/playbook/unixbench/dhrystone.yaml41
-rw-r--r--qtip/driver/playbook/unixbench/run.yaml23
-rw-r--r--qtip/driver/playbook/unixbench/setup.yaml65
-rw-r--r--qtip/driver/playbook/unixbench/whetstone.yaml41
-rw-r--r--qtip/runner/runner.py107
-rwxr-xr-xqtip/scripts/cleanup_creds.sh20
-rwxr-xr-xqtip/scripts/generate_host_file.sh116
-rw-r--r--qtip/util/env.py213
-rw-r--r--resources/QPI/compute.yaml9
-rw-r--r--resources/ansible_roles/qtip-workspace/defaults/main.yml1
-rw-r--r--resources/ansible_roles/qtip-workspace/files/template/group_vars/all.yml1
-rw-r--r--resources/ansible_roles/qtip-workspace/files/template/hosts9
-rw-r--r--resources/ansible_roles/qtip-workspace/files/template/run.yml4
-rw-r--r--resources/ansible_roles/qtip-workspace/files/template/setup.yml10
-rw-r--r--resources/ansible_roles/qtip-workspace/files/template/teardown.yml7
-rw-r--r--resources/ansible_roles/qtip-workspace/files/template/templates/hosts9
-rw-r--r--resources/ansible_roles/qtip/tasks/calculate.yml1
-rw-r--r--resources/ansible_roles/qtip/tasks/teardown.yml1
-rw-r--r--tests/ci/run_ci.sh6
-rw-r--r--tests/unit/runner/runner_test.py16
-rw-r--r--tests/unit/util/env_test.py307
92 files changed, 43 insertions, 4670 deletions
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/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/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/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/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/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/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/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/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/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/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/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/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/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()
diff --git a/qtip/cli/commands/cmd_project.py b/qtip/cli/commands/cmd_project.py
index 0bf7d82f..42fd000d 100644
--- a/qtip/cli/commands/cmd_project.py
+++ b/qtip/cli/commands/cmd_project.py
@@ -37,8 +37,8 @@ def cli():
@cli.command(help="Create new testing project")
@click.option('--pod', default='unknown', help='Name of pod under test')
-@click.option('--installer', help='OPNFV installer', required=True)
-@click.option('--master-host', help='Installer hostname', required=True)
+@click.option('--installer', help='OPNFV installer', default='manual')
+@click.option('--master-host', help='Installer hostname', default='dummy-host')
@click.option('--scenario', default='unknown', help='OPNFV scenario')
@click.argument('name')
def create(pod, installer, master_host, scenario, name):
diff --git a/qtip/collector/calculator.py b/qtip/collector/calculator.py
deleted file mode 100644
index c3d961b3..00000000
--- a/qtip/collector/calculator.py
+++ /dev/null
@@ -1,38 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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 operator import add
-
-from qtip.util.logger import QtipLogger
-
-logger = QtipLogger('calculator').get
-
-
-def dpi_calculator(samples):
- try:
- float_pps = map(lambda x: float(x), samples['pps'])
- float_bps = map(lambda x: float(x), samples['bps'])
- sum_dpi_pps = reduce(add,
- map(lambda x: x / 1000 if x > 100 else x, float_pps))
- sum_dpi_bps = reduce(add,
- map(lambda x: x / 1000 if x > 100 else x, float_bps))
-
- return {'pps': round(sum_dpi_pps / 10, 3), 'bps': round(sum_dpi_bps / 10, 3)}
- except Exception as error:
- logger.error(error)
- return {'pps': None, 'bps': None}
-
-
-def calculate_cpu_usage(cpu_idle):
- try:
- cpu_usage = round((100.0 - float(cpu_idle)), 3)
- return '{0}%'.format(str(cpu_usage))
- except Exception, error:
- logger.error(error)
- return None
diff --git a/qtip/collector/parser/grep.py b/qtip/collector/parser/grep.py
index d3a8210a..66b51b1e 100644
--- a/qtip/collector/parser/grep.py
+++ b/qtip/collector/parser/grep.py
@@ -7,21 +7,15 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-from collections import defaultdict
-from os import path
import re
-import yaml
from qtip.base import BaseActor
from qtip.base.constant import BaseProp
-from qtip.collector import calculator
from qtip.util.logger import QtipLogger
logger = QtipLogger('grep').get
-REGEX_FILE = path.join(path.dirname(__file__), 'regex.yaml')
-
class GrepProp(BaseProp):
FILENAME = 'filename'
@@ -40,63 +34,3 @@ def grep_in_file(filename, regex):
with open(filename, 'r') as f:
return filter(lambda x: x is not None,
re.finditer(regex, f.read(), re.MULTILINE))
-
-
-def _parse_logfile(config, paths):
- captured = {}
- for regex_rules_by_file in config:
- filename = \
- '{0}/{1}'.format(paths, regex_rules_by_file[GrepProp.FILENAME])
- for regex in regex_rules_by_file['grep']:
- matches = grep_in_file(filename, regex)
- if len(matches) > 1:
- temp_dict = defaultdict(list)
- for item in [match.groupdict() for match in matches]:
- for key in item:
- temp_dict[key].append(item[key])
- captured.update(temp_dict)
- elif len(matches) == 1:
- captured.update(matches[0].groupdict())
- else:
- logger.error("Nothing is matched from {0}".format(filename))
- return captured
-
-
-# TODO: Hardcord in Danube, it will be removed in the future.
-def parse_sysinfo(config, result_dir):
- sysinfo = _parse_logfile(config, result_dir)
- if "cpu_idle" in sysinfo:
- sysinfo['cpu_usage'] = \
- calculator.calculate_cpu_usage(sysinfo['cpu_idle'])
- sysinfo.pop('cpu_idle')
- return sysinfo
-
-
-# TODO: Hardcord in Danube, it will be removed in the future.
-def parse_test_result(benchmark, config, result_dir):
- test_result = _parse_logfile(config, result_dir)
- if benchmark == 'dpi':
- return calculator.dpi_calculator(test_result)
- if benchmark == 'dhrystone' or benchmark == 'whetstone':
- return {'total_cpus': test_result['total_cpus'],
- 'single_cpu': {'num': test_result['single_cpu'],
- 'score': test_result['score'][0]},
- 'multi_cpus': {'num': test_result['multi_cpus'],
- 'score': test_result['score'][1]}}
- return test_result
-
-
-# TODO: Hardcord in Danube, it will be removed in the future.
-def parse_benchmark_result(result_dir):
- regex_config = yaml.safe_load(file(REGEX_FILE))
- benchmark = result_dir.split('/')[-1]
- result = {'name': benchmark}
-
- test_result = \
- parse_test_result(benchmark, regex_config[benchmark], result_dir)
- result['results'] = test_result.copy()
-
- sysinfo = parse_sysinfo(regex_config['sysinfo'], result_dir)
- result['sysinfo'] = sysinfo.copy()
-
- return result
diff --git a/qtip/collector/parser/regex.yaml b/qtip/collector/parser/regex.yaml
deleted file mode 100644
index e1512855..00000000
--- a/qtip/collector/parser/regex.yaml
+++ /dev/null
@@ -1,85 +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
-##############################################################################
-
-dhrystone:
- - filename: dhrystone
- grep:
- - '^(?P<total_cpus>\d+)\sCPUs in system; running 1 parallel copy of tests$'
- - '.+\srunning (?P<single_cpu>\d+) parallel copy of tests$'
- - '.+\srunning (?P<multi_cpus>\d+) parallel copies of tests$'
- - '^System Benchmarks Index Score \(Partial Only\)\s+(?P<score>\d+\.\d)$'
-whetstone:
- - filename: whetstone
- grep:
- - '^(?P<total_cpus>\d+)\sCPUs in system; running 1 parallel copy of tests$'
- - '.+\srunning (?P<single_cpu>\d+) parallel copy of tests$'
- - '.+\srunning (?P<multi_cpus>\d+) parallel copies of tests$'
- - '^System Benchmarks Index Score \(Partial Only\)\s+(?P<score>\d+\.\d)$'
-dpi:
- - filename: dpi_dump.txt
- grep:
- - |-
- ^\s+nDPI throughput:.+?(?P<pps>\d+.\d+)\s.+\spps.+
- ?(?P<bps>\d+.\d+)\s.+\/sec
-ramspeed:
- - filename: Intmem
- grep:
- - '^INTEGER\s+BatchRun\s+Copy:\s+?(?P<integer_copy>\d+\.\d+)\sMB/s$'
- - '^INTEGER\s+BatchRun\s+Scale:\s+?(?P<integer_scale>\d+\.\d+)\sMB/s$'
- - '^INTEGER\s+BatchRun\s+Add:\s+?(?P<integer_add>\d+\.\d+)\sMB/s$'
- - '^INTEGER\s+BatchRun\s+Triad:\s+?(?P<integer_triad>\d+\.\d+)\sMB/s$'
- - '^INTEGER\s+BatchRun\s+AVERAGE:\s+?(?P<integer_average>\d+\.\d+)\sMB/s$'
- - filename: Floatmem
- grep:
- - '^FL-POINT\s+BatchRun\s+Copy:\s+?(?P<float_copy>\d+\.\d+)\sMB/s$'
- - '^FL-POINT\s+BatchRun\s+Scale:\s+?(?P<float_scale>\d+\.\d+)\sMB/s$'
- - '^FL-POINT\s+BatchRun\s+Add:\s+?(?P<float_add>\d+\.\d+)\sMB/s$'
- - '^FL-POINT\s+BatchRun\s+Triad:\s+?(?P<float_triad>\d+\.\d+)\sMB/s$'
- - '^FL-POINT\s+BatchRun\s+AVERAGE:\s+?(?P<float_average>\d+\.\d+)\sMB/s$'
-ssl:
- - filename: RSA_dump
- grep:
- - |-
- ^rsa\s+512\sbits\s.+\s+
- ?(?P<rsa_sign_512>\d+\.\d)\s+
- ?(?P<rsa_verify_512>\d+\.\d)$
- - |-
- ^rsa\s+1024\sbits\s.+\s+
- ?(?P<rsa_sign_1024>\d+\.\d)\s+
- ?(?P<rsa_verify_1024>\d+\.\d)$
- - |-
- ^rsa\s+2048\sbits\s.+\s+
- ?(?P<rsa_sign_2048>\d+\.\d)\s+
- ?(?P<rsa_verify_2048>\d+\.\d)$
- - |-
- ^rsa\s+4096\sbits\s.+\s+
- ?(?P<rsa_sign_4096>\d+\.\d)\s+
- ?(?P<rsa_verify_4096>\d+\.\d)$
- - filename: AES-128-CBC_dump
- grep:
- - |-
- ^aes-128-cbc\s+
- ?(?P<aes_128_cbc_16_bytes>\d+\.\w+)\s+
- ?(?P<aes_128_cbc_64_bytes>\d+\.\w+)\s+
- ?(?P<aes_128_cbc_256_bytes>\d+\.\w+)\s+
- ?(?P<aes_128_cbc_1024_bytes>\d+\.\w+)\s+
- ?(?P<aes_128_cbc_8192_bytes>\d+\.\w+)$
-sysinfo:
- - filename: top.log
- grep:
- - 'Cpu\(s\):.+?(?P<cpu_idle>\d+\.\d)\sid'
- - filename: inxi.log
- grep:
- - '.+\s+Host:\s+(?P<hostname>.+)\sKernel'
- - '.+\sMemory:\s+(?P<memory>.+MB)\s'
- - '^CPU\(s\):\s+(?P<cpu>.+)'
- - '.+\sDistro:\s+(?P<os>.+)'
- - '.+\sKernel:\s+(?P<kernel>.+)\sConsole'
- - '.+\s+HDD Total Size:\s+(?P<disk>.+)\s'
- - '.+\sproduct:\s+(?P<product>.+)\sv' \ No newline at end of file
diff --git a/qtip/driver/__init__.py b/qtip/driver/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/qtip/driver/__init__.py
+++ /dev/null
diff --git a/qtip/driver/ansible_api.py b/qtip/driver/ansible_api.py
deleted file mode 100644
index 5c5baffc..00000000
--- a/qtip/driver/ansible_api.py
+++ /dev/null
@@ -1,58 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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 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
-
-
-class AnsibleApi(object):
-
- def __init__(self):
- self.variable_manager = VariableManager()
- self.loader = DataLoader()
- self.passwords = {}
- self.playbook_executor = None
-
- def execute_playbook(self, playbook_path, hosts_file=None,
- key_file=None, extra_vars=None):
- 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=key_file,
- ssh_common_args=None, ssh_extra_args=None, sftp_extra_args=None,
- scp_extra_args=None, become=None, become_method=None,
- become_user='root', verbosity=None, check=False)
- self.variable_manager.extra_vars = extra_vars
-
- self.playbook_executor = PlaybookExecutor(playbooks=[playbook_path],
- inventory=inventory,
- variable_manager=self.variable_manager,
- loader=self.loader,
- options=options,
- passwords=self.passwords)
- return self.playbook_executor.run()
-
- def get_detail_playbook_stats(self):
- if self.playbook_executor:
- stats = self.playbook_executor._tqm._stats
- return map(lambda x: (x, stats.summarize(x)), stats.processed.keys())
- else:
- return None
diff --git a/qtip/driver/ansible_driver.py b/qtip/driver/ansible_driver.py
deleted file mode 100644
index 34ef46ed..00000000
--- a/qtip/driver/ansible_driver.py
+++ /dev/null
@@ -1,102 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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 collections import defaultdict
-from os import path
-from operator import add
-
-from qtip.driver.ansible_api import AnsibleApi
-from qtip.util.env import AnsibleEnvSetup
-from qtip.util.logger import QtipLogger
-
-logger = QtipLogger('ansible_driver').get
-PLAYBOOK_DIR = path.join(path.dirname(__file__), 'playbook')
-
-
-class AnsibleDriver(object):
- """driver for running performance tests with Ansible"""
-
- def __init__(self, config={}):
- self.config = config
- self.env = AnsibleEnvSetup()
- self.env_setup_flag = False
-
- @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 pre_run(self):
- if self.env_setup_flag:
- logger.info("Already setup environment......")
- else:
- logger.info("Starting to setup test environment...")
- self.env.setup(self.config)
- self.env_setup_flag = True
- logger.info("Setup test enviroment, Done!")
-
- def cleanup(self):
- self.env.cleanup()
-
- def run(self, metric_list, **kwargs):
- if 'args' in self.config:
- extra_vars = self.merge_two_dicts(kwargs, self.config['args'])
- else:
- extra_vars = kwargs
- logger.info("extra_var: {0}".format(extra_vars))
-
- tool_to_metrics = defaultdict(list)
- for metric in metric_list:
- if metric == 'dhrystone' or metric == 'whetstone':
- tool_to_metrics['unixbench'].append(metric)
- extra_vars[metric] = True
- elif metric == 'ssl':
- tool_to_metrics['openssl'].append(metric)
- else:
- tool_to_metrics[metric].append(metric)
-
- result_list = map(lambda tool: self._run_metric(tool,
- tool_to_metrics[tool],
- extra_vars),
- tool_to_metrics)
- return False not in result_list
-
- def _run_metric(self, tool, metrics, extra_vars):
- logger.info('Using {0} to measure metrics {1}'.format(tool, metrics))
-
- setup_pbook = "{0}/{1}/setup.yaml".format(PLAYBOOK_DIR, tool)
- run_pbook = "{0}/{1}/run.yaml".format(PLAYBOOK_DIR, tool)
- clean_pbook = "{0}/{1}/clean.yaml".format(PLAYBOOK_DIR, tool)
-
- if self._run_ansible_playbook(setup_pbook, extra_vars):
- self._run_ansible_playbook(run_pbook, extra_vars)
- else:
- logger.error("{0} is failed.".format(setup_pbook))
-
- return self._run_ansible_playbook(clean_pbook, extra_vars)
-
- def _run_ansible_playbook(self, pbook, extra_vars):
- ansible_api = AnsibleApi()
- logger.debug("Run {0} with extra_vars: {1}".format(pbook, extra_vars))
- ansible_api.execute_playbook(pbook, self.env.hostfile,
- self.env.keypair['private'], extra_vars)
- playbook_stats = ansible_api.get_detail_playbook_stats()
- logger.debug("playbook_stat: {0}".format(playbook_stats))
- return self.is_pass(playbook_stats)
-
- @staticmethod
- def is_pass(stats):
- return 0 == reduce(add,
- map(lambda x: x[1]['failures'] + x[1]['unreachable'],
- stats))
diff --git a/qtip/driver/base.py b/qtip/driver/base.py
deleted file mode 100644
index 6f5cab3c..00000000
--- a/qtip/driver/base.py
+++ /dev/null
@@ -1,20 +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
-##############################################################################
-
-
-class BaseDriver(object):
- """performance testing tool driver"""
- def pre_run(self):
- pass
-
- def run(self):
- pass
-
- def post_run(self):
- pass
diff --git a/qtip/driver/playbook/dpi/clean.yaml b/qtip/driver/playbook/dpi/clean.yaml
deleted file mode 100644
index 0b9f9291..00000000
--- a/qtip/driver/playbook/dpi/clean.yaml
+++ /dev/null
@@ -1,23 +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: hosts
- become: yes
- remote_user: root
-
- tasks:
- - name: Cleaning tempD
- file:
- path: '{{ ansible_env.HOME }}/tempD'
- state: absent
-
- - name: Cleaning qtip_result
- file:
- path: '{{ ansible_env.HOME }}/qtip_result'
- state: absent
diff --git a/qtip/driver/playbook/dpi/dpi_average.sh b/qtip/driver/playbook/dpi/dpi_average.sh
deleted file mode 100644
index 6f038053..00000000
--- a/qtip/driver/playbook/dpi/dpi_average.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-COUNTER=0
-WDIR=$PWD
-while [ $COUNTER -lt 10 ]; do
- echo $WDIR
- $( ./ndpiReader -i test.pcap >> $WDIR/dpi_dump.txt )
- let COUNTER=COUNTER+1
- echo "Run number: $COUNTER"
-done \ No newline at end of file
diff --git a/qtip/driver/playbook/dpi/run.yaml b/qtip/driver/playbook/dpi/run.yaml
deleted file mode 100644
index f4c8c457..00000000
--- a/qtip/driver/playbook/dpi/run.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
-##############################################################################
-
-- hosts: hosts
- become: yes
- remote_user: root
-
- tasks:
- - name: Make some directories needed
- file:
- path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dpi/'
- state: directory
-
- - include: ../inxi.yaml
- vars:
- dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dpi/'
-
- - include: ../top.yaml
- vars:
- dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dpi/'
-
- - name: Run nDPI benchmark
- shell: ./dpi_average.sh
- args:
- chdir: '{{ ansible_env.HOME }}/tempD/nDPI/example/'
-
- - name: Copying result and system info to qtip result directory
- command: cp $HOME/tempD/nDPI/example/dpi_dump.txt ./
- args:
- chdir: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dpi/'
-
- - name: Fetch result files to local manchine
- synchronize:
- mode: pull
- src: '{{ ansible_env.HOME }}/qtip_result/'
- dest: '{{ result_dir }}/'
diff --git a/qtip/driver/playbook/dpi/setup.yaml b/qtip/driver/playbook/dpi/setup.yaml
deleted file mode 100644
index 76e62e6d..00000000
--- a/qtip/driver/playbook/dpi/setup.yaml
+++ /dev/null
@@ -1,93 +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: '{{ result_dir }}/'
- state: directory
-
-- hosts: hosts
- become: yes
- remote_user: root
-
- tasks:
- - name: Cleaning tempD directory
- file:
- path: '{{ ansible_env.HOME }}/tempD'
- state: absent
-
- - name: Cleaning qtip_result directory
- file:
- path: '{{ ansible_env.HOME }}/qtip_result'
- state: absent
-
- - include: ../prepare_env.yaml
-
- - name: Installing nDPI dependencies if CentOS
- yum:
- name: '{{ item }}'
- state: present
- when: ansible_os_family == "RedHat"
- with_items:
- - git
- - gcc
- - patch
- - perl-Time-HiRes
- - autofconf
- - automake
- - libpcap-devel libtool
-
- - name: Installing nDPI dependencies if Ubuntu
- apt:
- name: '{{ item }}'
- state: present
- when: ansible_os_family == "Debian"
- with_items:
- - git
- - gcc
- - patch
- - autoconf
- - automake
- - libpcap-dev
- - libtool
-
- - name: Making nDPI temporary directory
- file:
- path: '{{ ansible_env.HOME }}/tempD'
- state: directory
-
- - name: Clone nDPI
- git:
- repo: https://github.com/ntop/nDPI.git
- dest: '{{ ansible_env.HOME }}/tempD/nDPI'
-
- - name: Run autogen && configure Dpi && make Dpi
- command: '{{ item }}'
- with_items:
- - ./autogen.sh
- - ./configure
- - make
- args:
- chdir: '{{ ansible_env.HOME }}/tempD/nDPI/'
-
- - name: Fetching Test_pcap file
- get_url:
- url: http://build.opnfv.org/artifacts.opnfv.org/qtip/utilities/test.pcap
- dest: '{{ ansible_env.HOME }}/tempD/nDPI/example/test.pcap'
-
- - name: Fetch Averaging script
- copy:
- src: ./dpi_average.sh
- dest: '{{ ansible_env.HOME }}/tempD/nDPI/example'
- mode: 777 \ No newline at end of file
diff --git a/qtip/driver/playbook/inxi.yaml b/qtip/driver/playbook/inxi.yaml
deleted file mode 100644
index 2a4d9b3f..00000000
--- a/qtip/driver/playbook/inxi.yaml
+++ /dev/null
@@ -1,25 +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
-##############################################################################
-- name: Install Inxi when CentOS
- yum:
- name: inxi
- state: present
- when: ansible_os_family == "RedHat"
-
-- name: Install Inxi when Ubuntu
- apt:
- name: inxi
- state: present
- update_cache: yes
- when: ansible_os_family == "Debian"
-
-- name: Run inxi
- shell: inxi -b -c0 -n > inxi.log
- args:
- chdir: '{{ dest_path }}'
diff --git a/qtip/driver/playbook/openssl/clean.yaml b/qtip/driver/playbook/openssl/clean.yaml
deleted file mode 100644
index 0139ba54..00000000
--- a/qtip/driver/playbook/openssl/clean.yaml
+++ /dev/null
@@ -1,23 +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: hosts
- become: yes
- remote_user: root
-
- tasks:
- - name: Cleaning Open_SSL
- file:
- path: '{{ ansible_env.HOME }}/Open_SSL'
- state: absent
-
- - name: Cleaning qtip_result
- file:
- path: '{{ ansible_env.HOME }}/qtip_result'
- state: absent
diff --git a/qtip/driver/playbook/openssl/run.yaml b/qtip/driver/playbook/openssl/run.yaml
deleted file mode 100644
index db923fed..00000000
--- a/qtip/driver/playbook/openssl/run.yaml
+++ /dev/null
@@ -1,45 +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: hosts
- become: yes
- remote_user: root
-
- tasks:
- - name: Make some directories needed
- file:
- path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ssl/'
- state: directory
-
- - include: ../inxi.yaml
- vars:
- dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ssl/'
-
- - include: ../top.yaml
- vars:
- dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ssl/'
-
- - name: Benchmarking RSA signatures and AES-128-cbc cipher encryption throughput
- shell: '{{ item }}'
- with_items:
- - ./openssl speed rsa >> RSA_dump
- - ./openssl speed -evp aes-128-cbc >> AES-128-CBC_dump
- args:
- chdir: '{{ ansible_env.HOME }}/Open_SSL/openssl-1.0.2f/apps'
-
- - name: Copying result to qtip result directory
- shell: cp ~/Open_SSL/openssl-1.0.2f/apps/*_dump ./
- args:
- chdir: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ssl/'
-
- - name: Fetch result files to local manchine
- synchronize:
- mode: pull
- src: '{{ ansible_env.HOME }}/qtip_result/'
- dest: '{{ result_dir }}/'
diff --git a/qtip/driver/playbook/openssl/setup.yaml b/qtip/driver/playbook/openssl/setup.yaml
deleted file mode 100644
index 3a6f385a..00000000
--- a/qtip/driver/playbook/openssl/setup.yaml
+++ /dev/null
@@ -1,87 +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: '{{ result_dir }}/'
- state: directory
-
-- hosts: hosts
- become: yes
- remote_user: root
-
- tasks:
- - name: Cleaning Open_SSL directory
- file:
- path: '{{ ansible_env.HOME }}/Open_SSL'
- state: absent
-
- - name: Cleaning qtip_result directory
- file:
- path: '{{ ansible_env.HOME }}/qtip_result'
- state: absent
-
- - include: ../prepare_env.yaml
-
- - name: Installing UnixBench dependencies if CentOS
- yum:
- name: '{{ item }}'
- state: present
- when: ansible_os_family == "RedHat"
- with_items:
- - git
- - gcc
- - patch
- - perl-Time-HiRes
- - wget
- - autofconf
- - automake
- - libpcap-devel
- - libtool
-
- - name: Installing UnixBench dependencies if Ubuntu
- apt:
- name: '{{ item }}'
- state: present
- when: ansible_os_family == "Debian"
- with_items:
- - git
- - gcc
- - patch
- - perl
- - wget
- - autoconf
- - automake
- - libpcap-dev
- - libtool
-
- - name: Make Open_SSL directory
- file:
- path: '{{ ansible_env.HOME }}/Open_SSL'
- state: directory
-
- - name: Untar OpenSSL
- unarchive:
- src: http://artifacts.opnfv.org/qtip/utilities/openssl-1.0.2f.tar.gz
- dest: '{{ ansible_env.HOME }}/Open_SSL/'
- remote_src: True
-
- - name: Configure && Make && Install OpenSSL
- shell: "{{ item }}"
- with_items:
- - ./config
- - make
- - make install
- args:
- chdir: '{{ ansible_env.HOME }}/Open_SSL/openssl-1.0.2f' \ No newline at end of file
diff --git a/qtip/driver/playbook/prepare_env.yaml b/qtip/driver/playbook/prepare_env.yaml
deleted file mode 100644
index 1ec71520..00000000
--- a/qtip/driver/playbook/prepare_env.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
-##############################################################################
-- name: Epel Release install when CentOS
- yum:
- name: epel-release
- state: present
- when: ansible_os_family == "RedHat"
-
-- name: Software Properties Common
- apt:
- name: software-properties-common
- state: present
- when: ansible_os_family == "Debian"
-
-- name: Adding ubuntu backport main repo
- apt_repository:
- repo: deb http://archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}}-backports main restricted universe multiverse
- state: present
- when: ansible_os_family == "Debian"
-
-- name: Adding ubuntu main repo
- apt_repository:
- repo: deb http://archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}} main restricted universe multiverse
- when: ansible_os_family == "Debian"
-
-- name: Install ansible copy dependencies if remote host has selinux enabled
- yum:
- name: libselinux-python
- state: present
- when: ansible_os_family == "RedHat"
-
-- name: Install ansiblle copy dependencies if remote host has selinux enaled
- apt:
- name: python-selinux
- state: present
- when: ansible_os_family == "Debian"
-
-- name: Install rsync when CentOS
- yum:
- name: rsync
- state: present
- when: ansible_os_family == "RedHat"
-
-- name: Install rsync when Ubuntu
- apt:
- name: rsync
- state: present
- when: ansible_os_family == "Debian"
diff --git a/qtip/driver/playbook/ramspeed/clean.yaml b/qtip/driver/playbook/ramspeed/clean.yaml
deleted file mode 100644
index f0188159..00000000
--- a/qtip/driver/playbook/ramspeed/clean.yaml
+++ /dev/null
@@ -1,23 +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: hosts
- become: yes
- remote_user: root
-
- tasks:
- - name: Cleaning ramspeed
- file:
- path: '{{ ansible_env.HOME }}/ramspeed'
- state: absent
-
- - name: Cleaning qtip_result
- file:
- path: '{{ ansible_env.HOME }}/qtip_result'
- state: absent
diff --git a/qtip/driver/playbook/ramspeed/run.yaml b/qtip/driver/playbook/ramspeed/run.yaml
deleted file mode 100644
index 496cd5db..00000000
--- a/qtip/driver/playbook/ramspeed/run.yaml
+++ /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
-##############################################################################
-
-- hosts: hosts
- become: yes
- remote_user: root
-
- tasks:
- - name: Make some directories needed
- file:
- path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ramspeed/'
- state: directory
-
- - include: ../inxi.yaml
- vars:
- dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ramspeed/'
-
- - include: ../top.yaml
- vars:
- dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ramspeed/'
-
- - name: Benchmarking IntMem Bandwidth and FloatMem Bandwidth
- shell: '{{ item }}'
- with_items:
- - ~/ramspeed/ramsmp-3.5.0/ramsmp -b 3 -l 5 -p 1 >> Intmem
- - ~/ramspeed/ramsmp-3.5.0/ramsmp -b 6 -l 5 -p 1 >> Floatmem
- args:
- chdir: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ramspeed/'
-
- - name: Fetch result files to local manchine
- synchronize:
- mode: pull
- src: '{{ ansible_env.HOME }}/qtip_result/'
- dest: '{{ result_dir }}/'
diff --git a/qtip/driver/playbook/ramspeed/setup.yaml b/qtip/driver/playbook/ramspeed/setup.yaml
deleted file mode 100644
index 842bbda2..00000000
--- a/qtip/driver/playbook/ramspeed/setup.yaml
+++ /dev/null
@@ -1,70 +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: '{{ result_dir }}/'
- state: directory
-
-- hosts: hosts
- become: yes
- remote_user: root
-
- tasks:
- - name: Cleaning ramspeed directory
- file:
- path: '{{ ansible_env.HOME }}/ramspeed'
- state: absent
-
- - name: Cleaning qtip_result directory
- file:
- path: '{{ ansible_env.HOME }}/qtip_result'
- state: absent
-
- - include: ../prepare_env.yaml
-
- - name: Installing RAM_Speed dependencies if CentOS
- yum:
- name: '{{ item }}'
- state: present
- when: ansible_os_family == "RedHat"
- with_items:
- - gcc
- - wget
-
- - name: Installing RAM_Speed dependencies if Ubuntu
- apt:
- name: '{{ item }}'
- state: present
- when: ansible_os_family == "Debian"
- with_items:
- - gcc
- - wget
-
- - name: Making ramspeed temporary directory
- file:
- path: '{{ ansible_env.HOME }}/ramspeed'
- state: directory
-
- - name: Fetch and untar ramspeed.tar.gz
- unarchive:
- # TODO: Need to upload this file to http://artifacts.opnfv.org/qtip/utilities
- src: https://docs.google.com/uc?id=0B92Bp5LZTM7gRFctalZLMktTNDQ
- dest: '{{ ansible_env.HOME }}/ramspeed/'
- remote_src: True
-
- - name: Build ramsmp
- shell: ./build.sh
- args:
- chdir: '{{ ansible_env.HOME }}/ramspeed/ramsmp-3.5.0'
diff --git a/qtip/driver/playbook/unixbench/clean.yaml b/qtip/driver/playbook/unixbench/clean.yaml
deleted file mode 100644
index a7cb2540..00000000
--- a/qtip/driver/playbook/unixbench/clean.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation and others.
-# zhihui.wu1@zte.com.cn
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-- hosts: hosts
- become: yes
- remote_user: root
-
- tasks:
- - name: Cleaning tempT
- file:
- path: '{{ ansible_env.HOME }}/tempT'
- state: absent
-
- - name: Cleaning qtip_result
- file:
- path: '{{ ansible_env.HOME }}/qtip_result'
- state: absent
-
-
diff --git a/qtip/driver/playbook/unixbench/dhrystone.yaml b/qtip/driver/playbook/unixbench/dhrystone.yaml
deleted file mode 100644
index a0ee89a3..00000000
--- a/qtip/driver/playbook/unixbench/dhrystone.yaml
+++ /dev/null
@@ -1,41 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation and others.
-# zhihui.wu1@zte.com.cn
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-- name: Make dhrystone directories
- file:
- path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dhrystone/'
- state: directory
-
-- include: ../inxi.yaml
- vars:
- dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dhrystone/'
-
-- include: ../top.yaml
- vars:
- dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dhrystone/'
-
-- name: Run dhrystone
- shell: ./Run -v dhrystone
- args:
- chdir: '{{ ansible_env.HOME }}/tempT/UnixBench/'
-
-- name: Copying result to qtip result directory
- shell: '{{ item }}'
- with_items:
- - mv ~/tempT/UnixBench/results/*.log ./
- - mv ~/tempT/UnixBench/results/*.html ./
- - mv ~/tempT/UnixBench/results/* ./dhrystone
- args:
- chdir: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dhrystone/'
-
-- name: Fetch dhrystone result files to local manchine
- synchronize:
- mode: pull
- src: '{{ ansible_env.HOME }}/qtip_result/'
- dest: '{{ result_dir }}/'
diff --git a/qtip/driver/playbook/unixbench/run.yaml b/qtip/driver/playbook/unixbench/run.yaml
deleted file mode 100644
index fbe4d4ad..00000000
--- a/qtip/driver/playbook/unixbench/run.yaml
+++ /dev/null
@@ -1,23 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation and others.
-# zhihui.wu1@zte.com.cn
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-- hosts: hosts
- become: yes
- remote_user: root
-
- tasks:
- - set_fact:
- is_dhrystone: "{{ dhrystone | default(False) }}"
- is_whetstone: "{{ whetstone | default(False) }}"
-
- - include: ./dhrystone.yaml
- when: "{{ is_dhrystone }}"
-
- - include: ./whetstone.yaml
- when: "{{ is_whetstone }}" \ No newline at end of file
diff --git a/qtip/driver/playbook/unixbench/setup.yaml b/qtip/driver/playbook/unixbench/setup.yaml
deleted file mode 100644
index 4dcdd2c4..00000000
--- a/qtip/driver/playbook/unixbench/setup.yaml
+++ /dev/null
@@ -1,65 +0,0 @@
-#############################################################################
-# Copyright (c) 2017 ZTE Corporation and others.
-# zhihui.wu1@zte.com.cn
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-#############################################################################
-
-- hosts: localhost
- connection: local
- gather_facts: no
-
- tasks:
- - name: Making dhrystone directory
- file:
- path: '{{ result_dir }}/'
- state: directory
-
-- hosts: hosts
- become: yes
- remote_user: root
-
- tasks:
- - name: Cleaning tempT directory
- file:
- path: '{{ ansible_env.HOME }}/tempT'
- state: absent
-
- - name: Cleaning qtip_result directory
- file:
- path: '{{ ansible_env.HOME }}/qtip_result'
- state: absent
-
- - include: ../prepare_env.yaml
-
- - name: Installing UnixBench dependencies if CentOS
- yum:
- name: '{{ item }}'
- state: present
- when: ansible_os_family == "RedHat"
- with_items:
- - git
- - gcc
- - patch
- - perl-Time-HiRes
-
- - name: Installing UnixBench dependencies if Ubuntu
- apt:
- name: '{{ item }}'
- state: present
- when: ansible_os_family == "Debian"
- with_items:
- - git
- - gcc
- - patch
- - perl
-
- - name: Clone UnixBench
- git:
- repo: https://github.com/kdlucas/byte-unixbench.git
- dest: '{{ ansible_env.HOME }}/tempT/'
-
- - name: Make UnixBench1
- shell: make --directory $HOME/tempT/UnixBench/ \ No newline at end of file
diff --git a/qtip/driver/playbook/unixbench/whetstone.yaml b/qtip/driver/playbook/unixbench/whetstone.yaml
deleted file mode 100644
index c753779f..00000000
--- a/qtip/driver/playbook/unixbench/whetstone.yaml
+++ /dev/null
@@ -1,41 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation and others.
-# zhihui.wu1@zte.com.cn
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-- name: Make whetstone directories
- file:
- path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/whetstone/'
- state: directory
-
-- include: ../inxi.yaml
- vars:
- dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/whetstone/'
-
-- include: ../top.yaml
- vars:
- dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/whetstone/'
-
-- name: Run whetstone
- shell: ./Run -v whetstone
- args:
- chdir: '{{ ansible_env.HOME }}/tempT/UnixBench/'
-
-- name: Copying result to qtip result directory
- shell: '{{ item }}'
- with_items:
- - mv ~/tempT/UnixBench/results/*.log ./
- - mv ~/tempT/UnixBench/results/*.html ./
- - mv ~/tempT/UnixBench/results/* ./whetstone
- args:
- chdir: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/whetstone/'
-
-- name: Fetch whetstone result files to local manchine
- synchronize:
- mode: pull
- src: '{{ ansible_env.HOME }}/qtip_result/'
- dest: '{{ result_dir }}/'
diff --git a/qtip/runner/runner.py b/qtip/runner/runner.py
deleted file mode 100644
index 9b09f0f8..00000000
--- a/qtip/runner/runner.py
+++ /dev/null
@@ -1,107 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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 argparse
-import json
-import os
-from os import path
-import sys
-import time
-
-from qtip.collector.parser import grep
-from qtip.driver.ansible_driver import AnsibleDriver
-from qtip.util.logger import QtipLogger
-
-logger = QtipLogger('runner').get
-
-ALL_BENCHMARKS = ['dpi', 'ramspeed', 'ssl', 'dhrystone', 'whetstone']
-
-
-def parse_args(args):
- parser = argparse.ArgumentParser()
- parser.add_argument('-d', '--dest', required=True,
- help='the destination where results will be stored.')
- parser.add_argument('-b', '--benchmark', required=True, action='append',
- help='the benchmark you want to execute.')
- return parser.parse_args(args)
-
-
-def run_benchmark(result_dir, benchmarks):
- if not path.isdir(result_dir):
- os.makedirs(result_dir)
- driver = AnsibleDriver({'args': {'result_dir': result_dir}})
- driver.pre_run()
- result = driver.run(benchmarks)
- driver.cleanup()
- return result
-
-
-def generate_report(result_dir, start_time, stop_time):
- output = {
- "plan_name": "compute_qpi",
- "start_time": start_time,
- "stop_time": stop_time,
- "sut": []
- }
- output.update(parse_result(result_dir))
- output.update({'stop_time': stop_time})
- with open('{0}/result.json'.format(result_dir), 'w+') as f:
- json.dump(output, f, indent=4, sort_keys=True)
-
-
-def parse_result(result_dir):
- sut_template = {'sut': []}
- nodes_list = os.listdir(result_dir)
- for node in nodes_list:
- node_output_template = {
- 'name': node,
- 'type': 'baremetal',
- 'qpis': []
- }
- qpi_result = {'name': 'compute_qpi', 'benchmarks': []}
- for benchmark in os.listdir('{0}/{1}'.format(result_dir, node)):
- benchmark_result = \
- grep.parse_benchmark_result(
- '{0}/{1}/{2}'.format(result_dir, node, benchmark))
- qpi_result['benchmarks'].append(benchmark_result)
- node_output_template['qpis'].append(qpi_result)
- sut_template['sut'].append(node_output_template)
- return sut_template
-
-
-def main(args=sys.argv[1:]):
- args = parse_args(args)
-
- if not path.isdir(str(args.dest)):
- logger.error("The destination {0} you give doesn't exist. "
- "Please check!".format(args.dest))
- sys.exit(1)
-
- if args.benchmark == ['all']:
- args.benchmark = ALL_BENCHMARKS
- elif len(set(args.benchmark).difference(ALL_BENCHMARKS)) != 0:
- logger.error("Please check benchmarks name. The supported benchmarks are"
- "{0}".format(ALL_BENCHMARKS))
- logger.info("Start to run benchmark test: {0}.".format(args.benchmark))
-
- start_time = time.strftime("%Y-%m-%d-%H-%M")
- logger.info("start_time: {0}".format(start_time))
- if not args.dest.endswith('/'):
- args.dest += '/'
- result_dir = args.dest + 'qtip-' + start_time
- ansible_result = run_benchmark(result_dir, args.benchmark)
- stop_time = time.strftime("%Y-%m-%d-%H-%M")
- logger.info("stop_time: {0}".format(stop_time))
- if not ansible_result:
- logger.error("Bechmarks run failed. Cann't generate any report.")
- sys.exit(1)
- generate_report(result_dir, start_time, stop_time)
-
-
-if __name__ == "__main__":
- main()
diff --git a/qtip/scripts/cleanup_creds.sh b/qtip/scripts/cleanup_creds.sh
deleted file mode 100755
index ad66ba95..00000000
--- a/qtip/scripts/cleanup_creds.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#! /bin/bash
-##############################################################################
-# Copyright (c) 2017 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
-##############################################################################
-
-DEST_IP=$1
-PRIVATE_KEY=$2
-PUBLIC_KEY=$3
-sshoptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
-
-case "$INSTALLER_TYPE" in
- fuel)
- ssh $sshoptions -i $PRIVATE_KEY root@$DEST_IP "sed -i '/$PUBLIC_KEY/d' /root/.ssh/authorized_keys"
- ;;
-esac
diff --git a/qtip/scripts/generate_host_file.sh b/qtip/scripts/generate_host_file.sh
deleted file mode 100755
index ecc4d55f..00000000
--- a/qtip/scripts/generate_host_file.sh
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/bin/bash
-##############################################################################
-#Copyright (c) 2016 Ericsson AB, ZTE and others.
-#jose.lausuch@ericsson.com
-#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
-##############################################################################
-
-
-usage(){
- echo "usage: $0 -t <installer_type> -i <installer_ipaddr> -d <dest_hostfile>" >&2
-}
-
-info() {
- logger -s -t "generate_host_file.info" "$*"
-}
-
-error() {
- logger -s -t "generate_host_file.error" "$*"
- exit 1
-}
-
-verify_connectivity(){
- local ip=$1
- info "Verifying connectivity to $ip..."
- for i in $(seq 0 10); do
- if ping -c 1 -W 1 $ip > /dev/null; then
- info "$ip is reachable!"
- return 0
- fi
- sleep 1
- done
- error "Can not talk to $ip."
-}
-
-:${DEPLOY_TYPE:=''}
-
-#Getoptions
-while getopts ":t:i:d:" optchar; do
- case "${optchar}" in
- t) installer_type=${OPTARG} ;;
- i) installer_ipaddr=${OPTARG} ;;
- d) dest_hostfile=${OPTARG} ;;
- *) echo "Non-option argument: '-${OPTARG}'" >&2
- usage
- exit 2
- ;;
- esac
-done
-
-#set vars from env if not provided by user as options
-installer_type=${installer_type:-$INSTALLER_TYPE}
-installer_ipaddr=${installer_ipaddr:-$INSTALLER_IP}
-
-if [ -z $installer_type ] || [ -z $installer_ipaddr ]; then
- usage
- exit 2
-fi
-
-ssh_options="-oUserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
-
-#Start fetching compute ip
-if [ "$installer_type" == "fuel" ]; then
- verify_connectivity $installer_ipaddr
-
- env=$(sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ipaddr} \
- 'fuel env'|grep operational|head -1|awk '{print $1}') &> /dev/null
- if [ -z $env ]; then
- error "No operational environment detected in Fuel"
- fi
- env_id="${FUEL_ENV:-$env}"
-
- # Check if compute is alive (online='True')
- IPS=$(sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ipaddr} \
- "fuel node --env ${env_id} | grep compute | grep 'True\| 1' | awk -F\| '{print \$5}' " | \
- sed 's/ //g') &> /dev/null
-
-
-elif [ "$installer_type" == "apex" ]; then
- echo "not implement now"
- exit 1
-
-elif [ "$installer_type" == "compass" ]; then
- # need test
- verify_connectivity $installer_ipaddr
- IPS=$(sshpass -p'root' ssh 2>/dev/null $ssh_options root@${installer_ipaddr} \
- 'mysql -ucompass -pcompass -Dcompass -e"select * from cluster;"' \
- | awk -F"," '{for(i=1;i<NF;i++)if($i~/\"host[4-5]\"/) {print $(i+1);}}' \
- | grep -oP "\d+.\d+.\d+.\d+")
-
-elif [ "$installer_type" == "joid" ]; then
- echo "not implement now"
- exit 1
-
-elif [ "$installer_type" == "foreman" ]; then
- echo "not implement now"
- exit 1
-
-else
- error "Installer $installer is not supported by this script"
-fi
-
-if [ -z "$IPS" ]; then
- error "The compute node $IPS are not up. Please check that the POD is correctly deployed."
-else
- echo "-------- all compute node ips: --------"
- rm $dest_hostfile
- touch $dest_hostfile
- echo "[hosts]" >> $dest_hostfile
- echo "$IPS" >> $dest_hostfile
- cat $dest_hostfile
-fi
-
-exit 0
diff --git a/qtip/util/env.py b/qtip/util/env.py
deleted file mode 100644
index 9299f8c0..00000000
--- a/qtip/util/env.py
+++ /dev/null
@@ -1,213 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 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 collections import defaultdict
-import os
-from os import path
-import re
-import socket
-import sys
-import time
-
-import paramiko
-
-from qtip.util.logger import QtipLogger
-
-logger = QtipLogger('env').get
-
-SCRIPT_DIR = path.join(path.dirname(__file__), path.pardir, 'scripts')
-KEYNAME = 'QtipKey'
-PRIVATE_KEY = '{0}/qtip/{1}'.format(os.environ['HOME'], KEYNAME)
-PUBLIC_KEY = PRIVATE_KEY + '.pub'
-HOST_FILE = '{0}/qtip/hosts'.format(os.environ['HOME'])
-
-
-def all_files_exist(*files):
- if len(files) == 0:
- return False
- flag = True
- for f_item in files:
- flag &= path.isfile(f_item)
- logger.info("Is {0} existed: {1}".format(f_item, flag))
- return flag
-
-
-def clean_file(*files):
- if len(files) == 0:
- logger.info('Nothing to clean')
- return False
-
- def clean(f):
- try:
- if all_files_exist(f):
- os.remove(f)
- logger.info("Removed: {0}".format(f))
- else:
- logger.info("Not exists: {0}".format(f))
- return True
- except OSError as error:
- logger.error("Not able to Remove: {0}".format(f), error)
- return False
-
- results = map(clean, files)
- return len(results) == len(files) and False not in results
-
-
-class AnsibleEnvSetup(object):
- def __init__(self):
- self.keypair = defaultdict(str)
- self.hostfile = None
- self.host_ip_list = []
-
- def setup(self, config={}):
- try:
- if 'hostfile' in config:
- self.check_hostfile(config['hostfile'])
- else:
- self.generate_default_hostfile()
- self.fetch_host_ip_from_hostfile()
- if 'keypair' in config:
- self.check_keypair(config['keypair'])
- else:
- self.generate_default_keypair()
- self.pass_keypair_to_remote()
- self.check_hosts_ssh_connectivity()
- except Exception as error:
- logger.info(error)
- sys.exit(1)
-
- def check_keypair(self, keypair):
- self.keypair = defaultdict(str)
- if all_files_exist(keypair, '{0}.pub'.format(keypair)):
- self.keypair['private'] = keypair
- self.keypair['public'] = '{0}.pub'.format(keypair)
- else:
- raise RuntimeError("The keypairs you in the configuration file"
- " is invalid or not existed.")
-
- def generate_default_keypair(self):
- if not all_files_exist(PRIVATE_KEY, PUBLIC_KEY):
- logger.info("Generate default keypair {0} under "
- "{1}".format(KEYNAME, os.environ['HOME']))
- cmd = '''ssh-keygen -t rsa -N "" -f {0} -q -b 2048
- -C qtip@insecure'''.format(PRIVATE_KEY)
- os.system(cmd)
- self.keypair['private'] = PRIVATE_KEY
- self.keypair['public'] = PUBLIC_KEY
-
- def pass_keypair_to_remote(self):
- results = map(lambda ip: self._pass_keypair(ip, self.keypair['private']),
- self.host_ip_list)
-
- if not (len(results) == len(self.host_ip_list) and False not in results):
- raise RuntimeError("Failed on passing keypair to remote.")
-
- @staticmethod
- def _pass_keypair(ip, private_key):
- try:
- os.system('ssh-keyscan %s >> /root/.ssh/known_hosts' % ip)
- time.sleep(2)
- ssh_cmd = '%s/qtip_creds.sh %s %s' % (SCRIPT_DIR, ip, private_key)
- os.system(ssh_cmd)
- logger.info('Pass keypair to remote hosts {0} successfully'.format(ip))
- return True
- except Exception as error:
- logger.error(error)
- return False
-
- def check_hostfile(self, hostfile):
- if all_files_exist(hostfile):
- self.hostfile = hostfile
- else:
- raise RuntimeError(
- "The hostfile {0} is invalid or not existed.".format(hostfile))
-
- def generate_default_hostfile(self):
- try:
- # check whether the file is already existed
- self.check_hostfile(HOST_FILE)
- except Exception:
- logger.info("Generate default hostfile {0} under "
- "{1}".format(HOST_FILE, os.environ['HOME']))
- self._generate_hostfile_via_installer()
-
- def _generate_hostfile_via_installer(self):
- self.hostfile = None
-
- installer_type = str(os.environ['INSTALLER_TYPE'].lower())
- installer_ip = str(os.environ['INSTALLER_IP'])
-
- if installer_type not in ["fuel"]:
- raise ValueError("{0} is not supported".format(installer_type))
- if not installer_ip:
- raise ValueError(
- "The value of environment variable INSTALLER_IP is empty.")
-
- cmd = "bash %s/generate_host_file.sh -t %s -i %s -d %s" % \
- (SCRIPT_DIR, installer_type, installer_ip, HOST_FILE)
- os.system(cmd)
-
- self.hostfile = HOST_FILE
-
- def fetch_host_ip_from_hostfile(self):
- self.host_ip_list = []
- logger.info('Fetch host ips from hostfile...')
- with open(self.hostfile, 'r') as f:
- self.host_ip_list = re.findall('\d+.\d+.\d+.\d+', f.read())
- if self.host_ip_list:
- logger.info("The remote compute nodes: {0}".format(self.host_ip_list))
- else:
- raise ValueError("The hostfile doesn't include host ip addresses.")
-
- def check_hosts_ssh_connectivity(self):
- results = map(lambda ip: self._ssh_is_ok(ip, self.keypair['private']),
- self.host_ip_list)
- if not (len(results) == len(self.host_ip_list) and False not in results):
- raise RuntimeError("Failed on checking hosts ssh connectivity.")
-
- @staticmethod
- def _ssh_is_ok(ip, private_key, attempts=100):
- logger.info('Check hosts {0} ssh connectivity...'.format(ip))
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- ssh.connect(ip, key_filename=private_key)
-
- for attempt in range(attempts):
- try:
- stdin, stdout, stderr = ssh.exec_command('uname')
- if not stderr.readlines():
- logger.info("{0}: SSH test successful.".format(ip))
- return True
- except socket.error:
- logger.debug("%s times ssh test......failed." % str(attempt + 1))
- if attempt == (attempts - 1):
- return False
- time.sleep(2)
- return False
-
- def cleanup(self):
- CI_DEBUG = os.getenv('CI_DEBUG')
-
- if CI_DEBUG is not None and CI_DEBUG.lower() == 'true':
- logger.info("DEBUG Mode: please do cleanup by manual.")
- else:
- with open(self.keypair['public'], 'r') as f:
- key = f.read().strip('\n').replace('/', '\/')
- if key:
- for ip in self.host_ip_list:
- logger.info("Cleanup authorized_keys from {0}...".format(ip))
- cmd = '''bash {0}/cleanup_creds.sh {1} {2} "{3}"'''.format(
- SCRIPT_DIR, ip, self.keypair['private'], key)
- os.system(cmd)
- else:
- logger.error("Nothing in public key file.")
-
- logger.info("Cleanup hostfile and keypair.")
- clean_file(self.hostfile,
- self.keypair['private'],
- self.keypair['public'])
diff --git a/resources/QPI/compute.yaml b/resources/QPI/compute.yaml
index 775f5c96..d27d769b 100644
--- a/resources/QPI/compute.yaml
+++ b/resources/QPI/compute.yaml
@@ -78,3 +78,12 @@ sections: # split based on different application
baseline: 11913.03
- name: scale
baseline: 11945.36
+ - name: arithmetic
+ description: arithmetic computing speed
+ metrics:
+ - name: arithmetic
+ workloads:
+ - name: dhrystone_lps
+ baseline: 34657490.5
+ - name: whetstone_MWIPS
+ baseline: 2495.9
diff --git a/resources/ansible_roles/qtip-workspace/defaults/main.yml b/resources/ansible_roles/qtip-workspace/defaults/main.yml
index 68dafbc2..7f6407d3 100644
--- a/resources/ansible_roles/qtip-workspace/defaults/main.yml
+++ b/resources/ansible_roles/qtip-workspace/defaults/main.yml
@@ -12,6 +12,7 @@ installer: fuel
installer_master_host: fuel-master
installer_master_group:
+ manual: dummy-group
fuel: fuel-masters
apex: apex-underclouds
diff --git a/resources/ansible_roles/qtip-workspace/files/template/group_vars/all.yml b/resources/ansible_roles/qtip-workspace/files/template/group_vars/all.yml
index 2967f6eb..3d41e1b4 100644
--- a/resources/ansible_roles/qtip-workspace/files/template/group_vars/all.yml
+++ b/resources/ansible_roles/qtip-workspace/files/template/group_vars/all.yml
@@ -14,6 +14,7 @@ qtip_dump: dump
qtip_cache: "{{ qtip_cache }}"
qtip_workdir: "{% raw %}{{ ansible_env.HOME }}{% endraw %}/qtip-workdir-{{ lookup('pipe', 'date +%Y%m%d-%H%M') }}"
installer_master_group:
+ manual: dummy-group
fuel: fuel-masters
apex: apex-underclouds
diff --git a/resources/ansible_roles/qtip-workspace/files/template/hosts b/resources/ansible_roles/qtip-workspace/files/template/hosts
index b8b4bbe6..b8b256a9 100644
--- a/resources/ansible_roles/qtip-workspace/files/template/hosts
+++ b/resources/ansible_roles/qtip-workspace/files/template/hosts
@@ -1,4 +1,13 @@
localhost ansible_connection=local
+{% if installer != 'manual' %}
[{{ installer_master_group[installer] }}]
{{ installer_master_host }}
+{% else %}
+[SUT]
+# Add hosts in system under test, example::
+#
+# host-1 ansible_host=192.168.10.1 ansible_host=22 ansile_user=root
+#
+# See http://docs.ansible.com/ansible/intro_inventory.html for details
+{% endif %} \ No newline at end of file
diff --git a/resources/ansible_roles/qtip-workspace/files/template/run.yml b/resources/ansible_roles/qtip-workspace/files/template/run.yml
index 9bb865d6..f8e71f0c 100644
--- a/resources/ansible_roles/qtip-workspace/files/template/run.yml
+++ b/resources/ansible_roles/qtip-workspace/files/template/run.yml
@@ -16,14 +16,14 @@
- { role: qtip, tasks: setup-local, tags: [setup] }
-- hosts: compute
+- hosts: SUT
roles:
# prepare environment
- { role: qtip, tasks: setup-node, tags: [setup] }
-- hosts: compute
+- hosts: SUT
roles:
# run test and collect metrics
diff --git a/resources/ansible_roles/qtip-workspace/files/template/setup.yml b/resources/ansible_roles/qtip-workspace/files/template/setup.yml
index a522d67b..d165a9fe 100644
--- a/resources/ansible_roles/qtip-workspace/files/template/setup.yml
+++ b/resources/ansible_roles/qtip-workspace/files/template/setup.yml
@@ -10,8 +10,14 @@
# Prepare connection to SUT (System Under Test)
---
-
-- hosts: [fuel-masters, apex-underclouds]
+{% if installer == 'manual' %}
+- hosts: localhost
+ gather_facts: no
+ tasks:
+ - debug: "msg='please add hosts to SUT group in `hosts` file manually.'"
+{% else %}
+- hosts: [{{ installer_master_group[installer] }}]
gather_facts: no
roles:
- { role: qtip, tasks: generate-inventory }
+{% endif %}
diff --git a/resources/ansible_roles/qtip-workspace/files/template/teardown.yml b/resources/ansible_roles/qtip-workspace/files/template/teardown.yml
index 4d51b64f..dc659930 100644
--- a/resources/ansible_roles/qtip-workspace/files/template/teardown.yml
+++ b/resources/ansible_roles/qtip-workspace/files/template/teardown.yml
@@ -7,12 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-- hosts: compute
-
- vars_prompt:
- - name: remove_workdir
- prompt: "WARNING: remove work dir from system under test? (yes|no)"
- default: no
+- hosts: SUT
roles:
# teardown environment
diff --git a/resources/ansible_roles/qtip-workspace/files/template/templates/hosts b/resources/ansible_roles/qtip-workspace/files/template/templates/hosts
index cbbfcfef..492651b0 100644
--- a/resources/ansible_roles/qtip-workspace/files/template/templates/hosts
+++ b/resources/ansible_roles/qtip-workspace/files/template/templates/hosts
@@ -4,12 +4,15 @@ localhost ansible_connection=local
[{{ installer_master_group[installer] }}]
{{ installer_master_host }}
-[fuel-groups:children]
+[SUT] # system under test
+compute
+
+[node-groups:children]
{% for group in hosts|sort %}
{{ group }}
{% endfor %}
-[fuel-groups:vars]
+[node-groups:vars]
ansible_ssh_common_args=-F ./ssh.cfg
{% for group in hosts|sort %}
@@ -19,4 +22,4 @@ ansible_ssh_common_args=-F ./ssh.cfg
{% endfor %}
{% endfor %}
-{% endraw %} \ No newline at end of file
+{% endraw %}
diff --git a/resources/ansible_roles/qtip/tasks/calculate.yml b/resources/ansible_roles/qtip/tasks/calculate.yml
index 62779c73..63fec7fd 100644
--- a/resources/ansible_roles/qtip/tasks/calculate.yml
+++ b/resources/ansible_roles/qtip/tasks/calculate.yml
@@ -17,6 +17,7 @@
dpi_throughput: "{{ qtip_results }}/dpi/metrics.json"
intmem: "{{ qtip_results }}/memory/integer-metrics.json"
floatmem: "{{ qtip_results }}/memory/float-metrics.json"
+ arithmetic: "{{ qtip_results }}/arithmetic/metrics.json"
spec: "{{ qtip_resources }}/QPI/compute.yaml"
dest: "{{ qtip_results }}/compute.json"
delegate_to: localhost
diff --git a/resources/ansible_roles/qtip/tasks/teardown.yml b/resources/ansible_roles/qtip/tasks/teardown.yml
index 660b3a6a..0c7989a5 100644
--- a/resources/ansible_roles/qtip/tasks/teardown.yml
+++ b/resources/ansible_roles/qtip/tasks/teardown.yml
@@ -13,4 +13,3 @@
file:
path: "{{ qtip_workdir }}"
state: absent
- when: remove_workdir|bool
diff --git a/tests/ci/run_ci.sh b/tests/ci/run_ci.sh
index c26ff58c..8fd53b36 100644
--- a/tests/ci/run_ci.sh
+++ b/tests/ci/run_ci.sh
@@ -70,10 +70,10 @@ qtip workspace create --pod ${pod_name} --installer ${installer_type} \
cd /home/opnfv/workspace/
-ansible-playbook setup.yml
+qtip setup
eval `ssh-agent`
-ansible-playbook run.yml
-ansible-playbook teardown.yml
+qtip run
+qtip teardown
# Remove ssh public key from installer
case "$installer_type" in
diff --git a/tests/unit/runner/runner_test.py b/tests/unit/runner/runner_test.py
deleted file mode 100644
index b7da1611..00000000
--- a/tests/unit/runner/runner_test.py
+++ /dev/null
@@ -1,16 +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 qtip.runner.base import BaseRunner
-
-
-def test_constructor():
- runner = BaseRunner()
- assert isinstance(runner, BaseRunner)
diff --git a/tests/unit/util/env_test.py b/tests/unit/util/env_test.py
deleted file mode 100644
index 793d1e4e..00000000
--- a/tests/unit/util/env_test.py
+++ /dev/null
@@ -1,307 +0,0 @@
-###############################################################
-# Copyright (c) 2017 ZTE Corporation
-#
-# 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 time
-
-import pytest
-import mock
-from collections import defaultdict
-import socket
-
-from qtip.util import env
-from qtip.util.env import AnsibleEnvSetup
-
-
-@pytest.fixture(scope='session')
-def ansible_envsetup():
- return AnsibleEnvSetup()
-
-
-@pytest.fixture()
-def hostfile(tmpdir):
- fake_hostfile = tmpdir.join('hosts')
- fake_hostfile.write("[hosts]\n")
- fake_hostfile.write("10.20.0.3")
- return fake_hostfile
-
-
-@pytest.fixture()
-def private_key(tmpdir):
- fake_private_key = tmpdir.join('QtipKey')
- fake_private_key.write("fake keypair")
- return fake_private_key
-
-
-@pytest.fixture()
-def public_key(tmpdir):
- fake_public_key = tmpdir.join('QtipKey.pub')
- fake_public_key.write("fake public key")
- return fake_public_key
-
-
-def test_all_files_exist(tmpdir):
- exist_file = tmpdir.mkdir('qtip').join('hello.txt')
- exist_file.write("hello")
- non_exist_file = tmpdir.strpath + '/tmp.txt'
- assert env.all_files_exist() is False
- assert env.all_files_exist(str(exist_file))
- assert env.all_files_exist(non_exist_file) is False
- assert env.all_files_exist(str(exist_file), non_exist_file) is False
-
-
-def test_clean_file(tmpdir):
- exist_file = tmpdir.mkdir('qtip').join('hello.txt')
- exist_file.write("hello")
- non_exist_file = tmpdir.strpath + '/tmp.txt'
-
- assert env.clean_file() is False
- assert env.clean_file(str(exist_file))
- assert env.clean_file(non_exist_file)
-
-
-def test_init(ansible_envsetup):
- assert 'AnsibleEnvSetup' in str(type(ansible_envsetup))
- assert ansible_envsetup.keypair == defaultdict(str)
- assert ansible_envsetup.hostfile is None
- assert ansible_envsetup.host_ip_list == []
-
-
-def test_setup_exception(mocker, ansible_envsetup, hostfile):
- with mock.patch.object(AnsibleEnvSetup, 'check_hostfile', side_effect=RuntimeError()):
- mock_os = mocker.patch('sys.exit')
- ansible_envsetup.setup({'hostfile': str(hostfile)})
- assert mock_os.call_count == 1
-
-
-# TODO(zhihui_wu) Need find a smart way to write this pytest
-def test_setup(mocker, ansible_envsetup):
- mock_check_hostfile = \
- mocker.patch.object(AnsibleEnvSetup, 'check_hostfile')
- mock_generate_default_hostfile = \
- mocker.patch.object(AnsibleEnvSetup, 'generate_default_hostfile')
- mock_fetch_ip = \
- mocker.patch.object(AnsibleEnvSetup, 'fetch_host_ip_from_hostfile')
- mock_check_keypair = \
- mocker.patch.object(AnsibleEnvSetup, 'check_keypair')
- mock_generate_default_keypair = \
- mocker.patch.object(AnsibleEnvSetup, 'generate_default_keypair')
- mock_pass_keypair = \
- mocker.patch.object(AnsibleEnvSetup, 'pass_keypair_to_remote')
- mock_check_ssh = \
- mocker.patch.object(AnsibleEnvSetup, 'check_hosts_ssh_connectivity')
-
- ansible_envsetup.setup({'keypair': str(private_key),
- 'hostfile': str(hostfile)})
- mock_check_hostfile.assert_called_with(str(hostfile))
- mock_fetch_ip.assert_called_with()
- mock_check_keypair.assert_called_with(str(private_key))
- mock_pass_keypair.assert_called_with()
- mock_check_ssh.assert_called_with()
-
- ansible_envsetup.setup({'keypair': str(private_key)})
- mock_generate_default_hostfile.assert_called_with()
- mock_fetch_ip.assert_called_with()
- mock_check_keypair.assert_called_with(str(private_key))
- mock_pass_keypair.assert_called_with()
- mock_check_ssh.assert_called_with()
-
- ansible_envsetup.setup({'hostfile': str(hostfile)})
- mock_check_hostfile.assert_called_with(str(hostfile))
- mock_fetch_ip.assert_called_with()
- mock_generate_default_keypair.assert_called_with()
- mock_pass_keypair.assert_called_with()
- mock_check_ssh.assert_called_with()
-
- ansible_envsetup.setup()
- mock_generate_default_hostfile.assert_called_with()
- mock_fetch_ip.assert_called_with()
- mock_generate_default_keypair.assert_called_with()
- mock_pass_keypair.assert_called_with()
- mock_check_ssh.assert_called_with()
-
-
-def test_check_keypair(mocker, ansible_envsetup, private_key, public_key):
- with mocker.patch.object(env, 'all_files_exist', return_value=True):
- ansible_envsetup.check_keypair(str(private_key))
- assert ansible_envsetup.keypair['private'] == str(private_key)
- assert ansible_envsetup.keypair['public'] == str(public_key)
-
-
-def test_check_keypair_failed(mocker, ansible_envsetup):
- mocker.patch.object(env, 'all_files_exist', return_value=False)
- with pytest.raises(RuntimeError) as excinfo:
- ansible_envsetup.check_keypair(str(private_key))
- assert 'The keypairs you in the configuration file ' \
- 'is invalid or not existed.' == str(excinfo.value)
- assert ansible_envsetup.keypair['private'] == ''
- assert ansible_envsetup.keypair['public'] == ''
-
-
-@pytest.mark.parametrize("file_existence, expected", [
- (True, 0),
- (False, 1)
-])
-def test_generate_default_keypair(mocker, ansible_envsetup, file_existence, expected):
- mock_os = mocker.patch('os.system')
- mocker.patch.object(env, 'all_files_exist', return_value=file_existence)
- ansible_envsetup.generate_default_keypair()
- assert mock_os.call_count == expected
- assert ansible_envsetup.keypair['private'] == env.PRIVATE_KEY
- assert ansible_envsetup.keypair['public'] == env.PUBLIC_KEY
-
-
-@pytest.mark.parametrize("ips, expected", [
- (['10.20.0.3'], 1),
- (['10.20.0.3', '10.20.0.4'], 2)
-])
-def test_pass_keypair_to_remote_successful(mocker, ansible_envsetup, ips, expected):
- ansible_envsetup.host_ip_list = ips
- mock_pass_keypair = \
- mocker.patch.object(AnsibleEnvSetup, '_pass_keypair', return_value=True)
- ansible_envsetup.pass_keypair_to_remote()
- assert mock_pass_keypair.call_count == expected
-
-
-def test_pass_keypair_to_remote_failed(mocker, ansible_envsetup):
- ansible_envsetup.host_ip_list = ['10.20.0.3']
- mocker.patch.object(AnsibleEnvSetup, '_pass_keypair', return_value=False)
- with pytest.raises(RuntimeError) as excinfo:
- ansible_envsetup.pass_keypair_to_remote()
- assert "Failed on passing keypair to remote." in str(excinfo.value)
-
-
-def test_pass_keypair(monkeypatch, mocker, ansible_envsetup):
- monkeypatch.setattr(time, 'sleep', lambda s: None)
- mock_os = mocker.patch('os.system')
- ansible_envsetup._pass_keypair('10.20.0.3', str(private_key))
- assert mock_os.call_count == 2
-
-
-def test_pass_keypair_exception(ansible_envsetup):
- with mock.patch('os.system', side_effect=Exception()) as mock_os:
- result = ansible_envsetup._pass_keypair('10.20.0.3', str(private_key))
- assert result is False
- assert mock_os.call_count == 1
-
-
-def test_check_hostfile(mocker, ansible_envsetup, hostfile):
- ansible_envsetup.check_hostfile(str(hostfile))
- assert ansible_envsetup.hostfile == str(hostfile)
-
- with pytest.raises(RuntimeError) as excinfo:
- mocker.patch.object(env, 'all_files_exist', return_value=False)
- ansible_envsetup.check_hostfile(str(hostfile))
- assert str(excinfo.value) == 'The hostfile {0} is invalid or not ' \
- 'existed.'.format(str(hostfile))
-
-
-def test_default_hostfile_non_existed(mocker, ansible_envsetup):
- with mocker.patch.object(env, 'all_files_exist', return_value=False):
- mock_generate_hostfile_via_installer = \
- mocker.patch.object(AnsibleEnvSetup,
- '_generate_hostfile_via_installer')
- ansible_envsetup.generate_default_hostfile()
- mock_generate_hostfile_via_installer.assert_called_once_with()
-
-
-def test_default_hostfile_existed(mocker, ansible_envsetup):
- with mocker.patch.object(env, 'all_files_exist', return_value=True):
- mock_generate_hostfile_via_installer = \
- mocker.patch.object(AnsibleEnvSetup,
- '_generate_hostfile_via_installer')
- ansible_envsetup.generate_default_hostfile()
- mock_generate_hostfile_via_installer.assert_not_called()
-
-
-@pytest.mark.parametrize("test_input, expected", [
- (({}, KeyError), 'INSTALLER_TYPE'),
- (({'INSTALLER_TYPE': 'fuel'}, KeyError), 'INSTALLER_IP'),
- (({'INSTALLER_TYPE': 'fuel_1', 'INSTALLER_IP': '10.20.0.2'}, ValueError),
- 'fuel_1 is not supported'),
- (({'INSTALLER_TYPE': 'fuel', 'INSTALLER_IP': ''}, ValueError),
- 'The value of environment variable INSTALLER_IP is empty')
-])
-def test_generate_hostfile_via_installer_exception(monkeypatch, ansible_envsetup, test_input, expected):
- if test_input[0]:
- for key in test_input[0]:
- monkeypatch.setenv(key, test_input[0][key])
-
- with pytest.raises(test_input[1]) as excinfo:
- ansible_envsetup._generate_hostfile_via_installer()
- assert expected in str(excinfo.value)
-
-
-def test_generate_hostfile_via_installer(monkeypatch, mocker, ansible_envsetup):
- monkeypatch.setenv('INSTALLER_TYPE', 'fuel')
- monkeypatch.setenv('INSTALLER_IP', '10.20.0.2')
- mock_os = mocker.patch('os.system')
- ansible_envsetup._generate_hostfile_via_installer()
- assert mock_os.call_count == 1
- assert ansible_envsetup.hostfile == env.HOST_FILE
-
-
-def test_fetch_host_ip_from_hostfile(ansible_envsetup, hostfile):
- ansible_envsetup.hostfile = str(hostfile)
- ansible_envsetup.fetch_host_ip_from_hostfile()
- assert ansible_envsetup.host_ip_list == ['10.20.0.3']
-
-
-def test_fetch_host_ip_from_empty_hostfile(ansible_envsetup, tmpdir):
- empty_hostfile = tmpdir.join('empty_hostfile')
- empty_hostfile.write("")
- ansible_envsetup.hostfile = str(empty_hostfile)
- with pytest.raises(ValueError) as excinfo:
- ansible_envsetup.fetch_host_ip_from_hostfile()
- assert str(excinfo.value) == "The hostfile doesn't include host ip addresses."
-
-
-@pytest.mark.parametrize("ips, expected", [
- (['10.20.0.3'], 1),
- (['10.20.0.3', '10.20.0.4'], 2)
-])
-def test_check_hosts_ssh_connectivity(mocker, ansible_envsetup, ips, expected):
- ansible_envsetup.host_ip_list = ips
- mock_ssh_is_ok = \
- mocker.patch.object(AnsibleEnvSetup, '_ssh_is_ok', return_value=True)
- ansible_envsetup.check_hosts_ssh_connectivity()
- assert mock_ssh_is_ok.call_count == expected
-
-
-def test_check_hosts_ssh_connectivity_failed(mocker, ansible_envsetup):
- ansible_envsetup.host_ip_list = ['10.20.0.3']
- mocker.patch.object(AnsibleEnvSetup, '_ssh_is_ok', return_value=False)
- with pytest.raises(RuntimeError) as excinfo:
- ansible_envsetup.check_hosts_ssh_connectivity()
- assert "Failed on checking hosts ssh connectivity." == str(excinfo.value)
-
-
-@pytest.mark.parametrize("stderrinfo, expected", [
- ('', True),
- ('sorry', False)
-])
-def test_ssh_is_ok(mocker, ansible_envsetup, private_key, stderrinfo, expected):
- stderr = mock.MagicMock()
- stderr.readlines.return_value = stderrinfo
- mock_sshclient = mocker.patch('paramiko.SSHClient')
- test_ssh_client = mock_sshclient.return_value
- test_ssh_client.exec_command.return_value = ('', '', stderr)
- result = ansible_envsetup._ssh_is_ok('10.20.0.3', str(private_key))
- assert result == expected
- test_ssh_client.connect.assert_called_once_with(
- '10.20.0.3', key_filename=str(private_key))
- test_ssh_client.exec_command.assert_called_with('uname')
-
-
-def test_ssh_exception(monkeypatch, mocker, ansible_envsetup):
- monkeypatch.setattr(time, 'sleep', lambda s: None)
- mock_sshclient = mocker.patch('paramiko.SSHClient')
- test_ssh_client = mock_sshclient.return_value
- test_ssh_client.exec_command.side_effect = socket.error()
- result = ansible_envsetup._ssh_is_ok('10.20.0.3', str(private_key), attempts=1)
- assert result is False