aboutsummaryrefslogtreecommitdiffstats
path: root/resources/roles
diff options
context:
space:
mode:
authorYujun Zhang <zhang.yujunz@zte.com.cn>2017-04-20 20:58:13 +0800
committerYujun Zhang <zhang.yujunz@zte.com.cn>2017-04-21 13:43:50 +0800
commit9222ecb462099f667d78494f4886d6c84f8a2310 (patch)
tree695f9c4448b9a6ba637f33c8feabce0efa46f5bd /resources/roles
parent441dea324dc2442b746528e0337a539c18b85b2f (diff)
Reorganize benchmarking tasks into ansible roles which helps to
- group task with related templates and variables - simplify the main playbook to improve readability See: http://docs.ansible.com/ansible/playbooks_roles.html Change-Id: I9d3180edaac83ee9dba85ce5ac14ff574af7a905 Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
Diffstat (limited to 'resources/roles')
-rw-r--r--resources/roles/inxi/tasks/main.yml44
-rw-r--r--resources/roles/nDPI/defaults/main.yml12
-rw-r--r--resources/roles/nDPI/meta/main.yml12
-rw-r--r--resources/roles/nDPI/tasks/main.yml60
-rw-r--r--resources/roles/openssl/tasks/main.yml54
-rw-r--r--resources/roles/qtip-workspace/defaults/main.yml (renamed from resources/roles/qtip-bootstrap/defaults/main.yml)0
-rw-r--r--resources/roles/qtip-workspace/files/copy/fixtures/case.json (renamed from resources/roles/qtip-bootstrap/files/copy/fixtures/case.json)0
-rw-r--r--resources/roles/qtip-workspace/files/copy/fixtures/pod.json (renamed from resources/roles/qtip-bootstrap/files/copy/fixtures/pod.json)0
-rw-r--r--resources/roles/qtip-workspace/files/copy/fixtures/project.json (renamed from resources/roles/qtip-bootstrap/files/copy/fixtures/project.json)0
-rw-r--r--resources/roles/qtip-workspace/files/copy/group_vars/.gitkeep (renamed from resources/roles/qtip-bootstrap/files/copy/group_vars/.gitkeep)0
-rw-r--r--resources/roles/qtip-workspace/files/copy/host_vars/.gitkeep (renamed from resources/roles/qtip-bootstrap/files/copy/host_vars/.gitkeep)0
-rw-r--r--resources/roles/qtip-workspace/files/copy/run.yml (renamed from resources/roles/qtip-bootstrap/files/copy/run.yml)29
-rw-r--r--resources/roles/qtip-workspace/files/copy/setup.yml (renamed from resources/roles/qtip-bootstrap/files/copy/setup.yml)0
-rw-r--r--resources/roles/qtip-workspace/files/copy/templates/hosts (renamed from resources/roles/qtip-bootstrap/files/copy/templates/hosts)0
-rw-r--r--resources/roles/qtip-workspace/files/copy/templates/ssh.cfg (renamed from resources/roles/qtip-bootstrap/files/copy/templates/ssh.cfg)0
-rw-r--r--resources/roles/qtip-workspace/files/render/ansible.cfg (renamed from resources/roles/qtip-bootstrap/files/render/ansible.cfg)0
-rw-r--r--resources/roles/qtip-workspace/files/render/group_vars/all.yml (renamed from resources/roles/qtip-bootstrap/files/render/group_vars/all.yml)0
-rw-r--r--resources/roles/qtip-workspace/files/render/host_vars/localhost.yml (renamed from resources/roles/qtip-bootstrap/files/render/host_vars/localhost.yml)0
-rw-r--r--resources/roles/qtip-workspace/files/render/hosts (renamed from resources/roles/qtip-bootstrap/files/render/hosts)0
-rw-r--r--resources/roles/qtip-workspace/tasks/main.yml (renamed from resources/roles/qtip-bootstrap/tasks/main.yml)0
-rw-r--r--resources/roles/ramspeed/defaults/main.yml11
-rw-r--r--resources/roles/ramspeed/meta/main.yml12
-rw-r--r--resources/roles/ramspeed/tasks/main.yml75
23 files changed, 286 insertions, 23 deletions
diff --git a/resources/roles/inxi/tasks/main.yml b/resources/roles/inxi/tasks/main.yml
new file mode 100644
index 00000000..47eb2e73
--- /dev/null
+++ b/resources/roles/inxi/tasks/main.yml
@@ -0,0 +1,44 @@
+##############################################################################
+# 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 - Command line system information script for console and IRC
+ package:
+ name: inxi
+ state: present
+
+- name: check hardware information with inxi
+ command: inxi -b -c0 -n
+ register: inxi_out
+
+# TODO(yujunz) normalize system information, test condition and performance metrics for future data mining
+# e.g. convert "2 Deca core Intel Xeon E5-2650 v3s (-HT-MCP-SMP-) speed/max: 1200/3000 MHz" to
+# ---
+# processor:
+# id:
+# vendor: Intel
+# product_family: Xeon
+# processor_number: E5-2650 v3s
+# number_of_cores: 2
+# number_of_threads: None # set `None` when data is not available
+# base_frequency_mhz: 1200
+# max_turbo_frequency_mhz: 3000
+# cache_mb: None
+- name: collect system information from inxi
+ collect:
+ string: "{{ inxi_out.stdout }}"
+ patterns:
+ - '.+\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'
+ dump: 'inix.log'
+ register: system_info
diff --git a/resources/roles/nDPI/defaults/main.yml b/resources/roles/nDPI/defaults/main.yml
new file mode 100644
index 00000000..d8aae81a
--- /dev/null
+++ b/resources/roles/nDPI/defaults/main.yml
@@ -0,0 +1,12 @@
+#############################################################################
+# 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
+#############################################################################
+
+---
+nDPI_cwd: "{{ ansible_env.HOME }}/qtip/nDPI"
+nDPI_file: "dpi.pcap"
diff --git a/resources/roles/nDPI/meta/main.yml b/resources/roles/nDPI/meta/main.yml
new file mode 100644
index 00000000..03c96c42
--- /dev/null
+++ b/resources/roles/nDPI/meta/main.yml
@@ -0,0 +1,12 @@
+#############################################################################
+# 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
+#############################################################################
+
+---
+dependencies:
+ - { role: development-tools }
diff --git a/resources/roles/nDPI/tasks/main.yml b/resources/roles/nDPI/tasks/main.yml
new file mode 100644
index 00000000..b3e7259f
--- /dev/null
+++ b/resources/roles/nDPI/tasks/main.yml
@@ -0,0 +1,60 @@
+##############################################################################
+# 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: prepare sample pcap file
+ get_url:
+ url: "http://artifacts.opnfv.org/qtip/utilities/test.pcap"
+ dest: "{{ qtip_cache }}/{{ nDPI_file }}"
+ # validate_certs: no # required when using proxy for https
+ run_once: yes
+ delegate_to: localhost
+
+- name: making nDPI temporary directory
+ file:
+ path: "{{ nDPI_cwd }}"
+ state: directory
+
+- name: clone nDPI
+ git:
+ repo: https://github.com/ntop/nDPI.git
+ dest: "{{ nDPI_cwd }}"
+ depth: 1
+ update: no
+
+- name: build nDPI library
+ command: '{{ item }}'
+ with_items:
+ - ./autogen.sh
+ - ./configure
+ - make
+ args:
+ chdir: "{{ nDPI_cwd }}"
+ creates: example/ndpiReader
+
+- name: copy sample packet file
+ copy:
+ src: "{{ qtip_cache}}/{{ nDPI_file }}"
+ dest: "{{ nDPI_cwd }}/example/{{ nDPI_file }}"
+
+- name:
+ command: "./ndpiReader -i {{ nDPI_file }}"
+ args:
+ chdir: "{{ nDPI_cwd }}/example/"
+ register: nDPI_out
+
+- name: collect DPI metrics from nDPI
+ collect:
+ string: "{{ nDPI_out.stdout }}"
+ patterns:
+ # nDPI throughput: 1.46 M pps / 13.69 Gb/sec
+ # TODO(yujunz) convert "M pps" and "K pps" to number
+ - 'nDPI throughput:\s+?(?P<dpi_pps>\d+.\d+.*) \/ (?P<dpi_bps>\d+.\d+.*)$'
+ dump: 'nDPI.log'
+ register: dpi_metrics
diff --git a/resources/roles/openssl/tasks/main.yml b/resources/roles/openssl/tasks/main.yml
new file mode 100644
index 00000000..2dda0e33
--- /dev/null
+++ b/resources/roles/openssl/tasks/main.yml
@@ -0,0 +1,54 @@
+##############################################################################
+# 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 openssl - Cryptography and SSL/TLS Toolkit
+ package:
+ name: openssl
+ state: present
+
+- name: RSA signatures speed measurement
+ command: openssl speed rsa
+ register: openssl_rsa_log
+
+#- name: AES speed measurement
+# command: openssl speed -evp aes-128-cbc
+# register: openssl_aes_log
+
+- name: collect ssl metrics from openssl
+ collect:
+ string: "{{ openssl_rsa_log.stdout }}"
+ patterns:
+ - |-
+ ^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)$
+ dump: openssl_rsa_log
+ register: openssl_rsa_metrics
+
+# - 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+)$
diff --git a/resources/roles/qtip-bootstrap/defaults/main.yml b/resources/roles/qtip-workspace/defaults/main.yml
index 55e2cbce..55e2cbce 100644
--- a/resources/roles/qtip-bootstrap/defaults/main.yml
+++ b/resources/roles/qtip-workspace/defaults/main.yml
diff --git a/resources/roles/qtip-bootstrap/files/copy/fixtures/case.json b/resources/roles/qtip-workspace/files/copy/fixtures/case.json
index 22abc40f..22abc40f 100644
--- a/resources/roles/qtip-bootstrap/files/copy/fixtures/case.json
+++ b/resources/roles/qtip-workspace/files/copy/fixtures/case.json
diff --git a/resources/roles/qtip-bootstrap/files/copy/fixtures/pod.json b/resources/roles/qtip-workspace/files/copy/fixtures/pod.json
index 654b5828..654b5828 100644
--- a/resources/roles/qtip-bootstrap/files/copy/fixtures/pod.json
+++ b/resources/roles/qtip-workspace/files/copy/fixtures/pod.json
diff --git a/resources/roles/qtip-bootstrap/files/copy/fixtures/project.json b/resources/roles/qtip-workspace/files/copy/fixtures/project.json
index ecd03e83..ecd03e83 100644
--- a/resources/roles/qtip-bootstrap/files/copy/fixtures/project.json
+++ b/resources/roles/qtip-workspace/files/copy/fixtures/project.json
diff --git a/resources/roles/qtip-bootstrap/files/copy/group_vars/.gitkeep b/resources/roles/qtip-workspace/files/copy/group_vars/.gitkeep
index e69de29b..e69de29b 100644
--- a/resources/roles/qtip-bootstrap/files/copy/group_vars/.gitkeep
+++ b/resources/roles/qtip-workspace/files/copy/group_vars/.gitkeep
diff --git a/resources/roles/qtip-bootstrap/files/copy/host_vars/.gitkeep b/resources/roles/qtip-workspace/files/copy/host_vars/.gitkeep
index e69de29b..e69de29b 100644
--- a/resources/roles/qtip-bootstrap/files/copy/host_vars/.gitkeep
+++ b/resources/roles/qtip-workspace/files/copy/host_vars/.gitkeep
diff --git a/resources/roles/qtip-bootstrap/files/copy/run.yml b/resources/roles/qtip-workspace/files/copy/run.yml
index 52a66990..ddac875c 100644
--- a/resources/roles/qtip-bootstrap/files/copy/run.yml
+++ b/resources/roles/qtip-workspace/files/copy/run.yml
@@ -36,30 +36,13 @@
roles:
- - { role: unixbench, tags: [unixbench] }
-
- tasks:
-
- - name: collect system information
- include: "{{ qtip_resources }}/metric/inxi.yaml"
-
- - name: ssl metrics
- include: "{{ qtip_resources }}/metric/openssl.yaml"
- tags: [ssl]
-
- - name: DPI metrics
- include: "{{ qtip_resources }}/metric/nDPI.yaml"
- vars:
- nDPI_cwd: "{{ ansible_env.HOME }}/qtip/nDPI"
- nDPI_file: "dpi.pcap"
- tags: [dpi]
-
- - name: memory metrics
- include: "{{ qtip_resources }}/metric/ramspeed.yaml"
- vars:
- cwd: "{{ ansible_env.HOME }}/qtip/ramspeed"
- tags: [mem]
+ - { role: inxi, tags: [inxi, sysinfo] }
+ - { role: unixbench, tags: [unixbench, float, int] }
+ - { role: openssl, tags: [openssl, ssl]}
+ - { role: nDPI, tags: [ndpi, dpi]}
+ - { role: ramspeed, tags: [ramspeed, mem]}
+ post_tasks:
- name: calculate QPI of compute
calculate:
metrics:
diff --git a/resources/roles/qtip-bootstrap/files/copy/setup.yml b/resources/roles/qtip-workspace/files/copy/setup.yml
index 88cdb1d2..88cdb1d2 100644
--- a/resources/roles/qtip-bootstrap/files/copy/setup.yml
+++ b/resources/roles/qtip-workspace/files/copy/setup.yml
diff --git a/resources/roles/qtip-bootstrap/files/copy/templates/hosts b/resources/roles/qtip-workspace/files/copy/templates/hosts
index 27c8d1d6..27c8d1d6 100644
--- a/resources/roles/qtip-bootstrap/files/copy/templates/hosts
+++ b/resources/roles/qtip-workspace/files/copy/templates/hosts
diff --git a/resources/roles/qtip-bootstrap/files/copy/templates/ssh.cfg b/resources/roles/qtip-workspace/files/copy/templates/ssh.cfg
index d6a266ba..d6a266ba 100644
--- a/resources/roles/qtip-bootstrap/files/copy/templates/ssh.cfg
+++ b/resources/roles/qtip-workspace/files/copy/templates/ssh.cfg
diff --git a/resources/roles/qtip-bootstrap/files/render/ansible.cfg b/resources/roles/qtip-workspace/files/render/ansible.cfg
index 2d4b0b1d..2d4b0b1d 100644
--- a/resources/roles/qtip-bootstrap/files/render/ansible.cfg
+++ b/resources/roles/qtip-workspace/files/render/ansible.cfg
diff --git a/resources/roles/qtip-bootstrap/files/render/group_vars/all.yml b/resources/roles/qtip-workspace/files/render/group_vars/all.yml
index c00e72a4..c00e72a4 100644
--- a/resources/roles/qtip-bootstrap/files/render/group_vars/all.yml
+++ b/resources/roles/qtip-workspace/files/render/group_vars/all.yml
diff --git a/resources/roles/qtip-bootstrap/files/render/host_vars/localhost.yml b/resources/roles/qtip-workspace/files/render/host_vars/localhost.yml
index 8135e809..8135e809 100644
--- a/resources/roles/qtip-bootstrap/files/render/host_vars/localhost.yml
+++ b/resources/roles/qtip-workspace/files/render/host_vars/localhost.yml
diff --git a/resources/roles/qtip-bootstrap/files/render/hosts b/resources/roles/qtip-workspace/files/render/hosts
index bf19efab..bf19efab 100644
--- a/resources/roles/qtip-bootstrap/files/render/hosts
+++ b/resources/roles/qtip-workspace/files/render/hosts
diff --git a/resources/roles/qtip-bootstrap/tasks/main.yml b/resources/roles/qtip-workspace/tasks/main.yml
index e198732b..e198732b 100644
--- a/resources/roles/qtip-bootstrap/tasks/main.yml
+++ b/resources/roles/qtip-workspace/tasks/main.yml
diff --git a/resources/roles/ramspeed/defaults/main.yml b/resources/roles/ramspeed/defaults/main.yml
new file mode 100644
index 00000000..0cc06cf6
--- /dev/null
+++ b/resources/roles/ramspeed/defaults/main.yml
@@ -0,0 +1,11 @@
+#############################################################################
+# 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
+#############################################################################
+
+---
+cwd: "{{ ansible_env.HOME }}/qtip/ramspeed"
diff --git a/resources/roles/ramspeed/meta/main.yml b/resources/roles/ramspeed/meta/main.yml
new file mode 100644
index 00000000..03c96c42
--- /dev/null
+++ b/resources/roles/ramspeed/meta/main.yml
@@ -0,0 +1,12 @@
+#############################################################################
+# 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
+#############################################################################
+
+---
+dependencies:
+ - { role: development-tools }
diff --git a/resources/roles/ramspeed/tasks/main.yml b/resources/roles/ramspeed/tasks/main.yml
new file mode 100644
index 00000000..6473d576
--- /dev/null
+++ b/resources/roles/ramspeed/tasks/main.yml
@@ -0,0 +1,75 @@
+##############################################################################
+# 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: making ramspeed working directory
+ file:
+ path: "{{ cwd }}"
+ state: directory
+ tags: [setup]
+
+- name: download ramspeed/ramsmp
+ unarchive:
+ src: http://www.alasir.com/software/ramspeed/ramsmp-3.5.0.tar.gz
+ dest: "{{ cwd }}"
+ remote_src: yes
+ tags: [setup]
+
+- name: build ramsmp
+ command: ./build.sh
+ args:
+ chdir: "{{ cwd }}/ramsmp-3.5.0"
+ creates: ramsmp
+ tags: [setup]
+
+- name: intmem benchmarking
+ command: ./ramsmp -b 3 -l 5 -p 1
+ args:
+ chdir: "{{ cwd }}/ramsmp-3.5.0"
+ register: ramsmp_intmem_out
+ tags: [run]
+
+- name: floatmem benchmarking
+ command: ./ramsmp -b 6 -l 5 -p 1
+ args:
+ chdir: "{{ cwd }}/ramsmp-3.5.0"
+ register: ramsmp_floatmem_out
+ tags: [run]
+
+- name: collect integer memory metrics from ramspeed
+ collect:
+ string: "{{ ramsmp_intmem_out.stdout }}"
+ patterns:
+ - '^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$'
+ dump: 'ramsmp-intmem.log'
+ register: intmem_metrics
+ tags: [collect]
+
+- name: collect float memory metrics from ramspeed
+ collect:
+ string: "{{ ramsmp_floatmem_out.stdout }}"
+ patterns:
+ - '^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$'
+ dump: 'ramsmp-floatmem.log'
+ register: floatmem_metrics
+ tags: [collect]
+
+- name: create memory metrics report
+ template:
+ src: "{{ qtip_resources }}/template/mem-metrics.j2"
+ dest: "{{ qtip_reports }}/mem-metrics"
+ delegate_to: localhost
+ tags: [report]