Organize common tasks under qtip-common role 67/33767/1
authorYujun Zhang <zhang.yujunz@zte.com.cn>
Tue, 25 Apr 2017 08:46:51 +0000 (16:46 +0800)
committerYujun Zhang <zhang.yujunz@zte.com.cn>
Tue, 25 Apr 2017 08:58:31 +0000 (16:58 +0800)
Change-Id: I8592efdac7e6c2161eb7cb1b36d023697ebe7ad4
Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
13 files changed:
resources/ansible_roles/inxi/meta/main.yml [new file with mode: 0644]
resources/ansible_roles/inxi/tasks/main.yml
resources/ansible_roles/nDPI/meta/main.yml [new file with mode: 0644]
resources/ansible_roles/nDPI/tasks/main.yml
resources/ansible_roles/openssl/meta/main.yml [new file with mode: 0644]
resources/ansible_roles/openssl/tasks/main.yml
resources/ansible_roles/qtip-common/tasks/main.yml [new file with mode: 0644]
resources/ansible_roles/qtip-workspace/files/defaults/run.yml
resources/ansible_roles/qtip/tasks/calculate.yml
resources/ansible_roles/ramspeed/meta/main.yml [new file with mode: 0644]
resources/ansible_roles/ramspeed/tasks/main.yml
resources/ansible_roles/unixbench/meta/main.yml [new file with mode: 0644]
resources/ansible_roles/unixbench/tasks/main.yml

diff --git a/resources/ansible_roles/inxi/meta/main.yml b/resources/ansible_roles/inxi/meta/main.yml
new file mode 100644 (file)
index 0000000..76f78a3
--- /dev/null
@@ -0,0 +1,14 @@
+##############################################################################
+# 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
+##############################################################################
+
+---
+
+allow_duplicates: yes
+dependencies:
+- { role: qtip-common, basename: inxi }
index e7ffd18..d9dbf7a 100644 (file)
   command: inxi -b -c0 -n
   register: inxi_out
 
-- name: generating log filename
-  set_fact:
-    logfile: "{{ qtip_results }}/inxi.log"
-  tags:
-    - always
-
 - name: saving output to log
   copy:
     content: "{{ inxi_out.stdout }}"
@@ -52,7 +46,7 @@
       - '.+\sKernel:\s+(?P<kernel>.+)\sConsole'
       - '.+\s+HDD Total Size:\s+(?P<disk>.+)\s'
       - '.+\sproduct:\s+(?P<product>.+)\sv'
-    export_to: "{{ qtip_results }}/system_info.json"
+    dest: "{{ output }}/condition.json"
   register: system_info
   delegate_to: localhost
   tags:
@@ -61,7 +55,7 @@
 - name: create system information report
   template:
     src: system-info.j2
-    dest: "{{ qtip_results }}/system-info"
+    dest: "{{ output }}/report"
   delegate_to: localhost
   tags:
     - report
diff --git a/resources/ansible_roles/nDPI/meta/main.yml b/resources/ansible_roles/nDPI/meta/main.yml
new file mode 100644 (file)
index 0000000..b035a9a
--- /dev/null
@@ -0,0 +1,14 @@
+##############################################################################
+# 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
+##############################################################################
+
+---
+
+allow_duplicates: yes
+dependencies:
+- { role: qtip-common, basename: nDPI }
index c007a61..6dc7bf9 100644 (file)
     chdir: "{{ workdir }}/nDPI-1.6/example/"
   register: ndpi_out
 
-- name: generating log filename
-  set_fact:
-    logfile: "{{ qtip_results }}/nDPI.log"
-
 - name: saving output to log
   copy:
     content: "{{ ndpi_out.stdout }}"
       #        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+.*)$'
-    export_to: "{{ qtip_results }}/dpi_metrics.json"
+    dest: "{{ output }}/metrics.json"
   register: dpi_metrics
   delegate_to: localhost
 
 - name: create dpi report
   template:
     src: dpi-metrics.j2
-    dest: "{{ qtip_results }}/dpi-metrics"
+    dest: "{{ output }}/dpi-metrics"
   delegate_to: localhost
diff --git a/resources/ansible_roles/openssl/meta/main.yml b/resources/ansible_roles/openssl/meta/main.yml
new file mode 100644 (file)
index 0000000..d7c4381
--- /dev/null
@@ -0,0 +1,14 @@
+##############################################################################
+# 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
+##############################################################################
+
+---
+
+allow_duplicates: yes
+dependencies:
+- { role: qtip-common, basename: openssl }
index 91c5be9..0d57ef2 100644 (file)
@@ -23,8 +23,8 @@
 
 - name: generating log filename
   set_fact:
-    rsa_logfile: "{{ qtip_results }}/openssl_rsa.log"
-    aes_logfile: "{{ qtip_results }}/openssl_aes.log"
+    rsa_logfile: "{{ output }}/openssl-rsa.log"
+    aes_logfile: "{{ output }}/openssl-aes.log"
   tags: always
 
 # TODO(yujunz) `delegate_to` not working under `with_items`
@@ -60,7 +60,7 @@
           ^rsa\s+4096\sbits\s.+\s+
           ?(?P<rsa_sign_4096>\d+\.\d)\s+
           ?(?P<rsa_verify_4096>\d+\.\d)$
-    export_to: "{{ qtip_results }}/ssl_rsa_metrics.json"
+    dest: "{{ output }}/rsa-metrics.json"
   register: ssl_rsa_metrics
   tags: collect
 
           ?(?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+)$
-    export_to: "{{ qtip_results }}/ssl_aes_metrics.json"
+    dest: "{{ output }}/aes-metrics.json"
   register: ssl_aes_metrics
   tags: collect
 
 - name: create SSL report
   template:
     src: ssl-metrics.j2
-    dest: "{{ qtip_results }}/ssl-metrics"
+    dest: "{{ output }}/ssl-metrics"
   delegate_to: localhost
   tags: report
diff --git a/resources/ansible_roles/qtip-common/tasks/main.yml b/resources/ansible_roles/qtip-common/tasks/main.yml
new file mode 100644 (file)
index 0000000..72fae2b
--- /dev/null
@@ -0,0 +1,21 @@
+##############################################################################
+# 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: creating output directory
+  file:
+    state: directory
+    path: "{{ output }}"
+  delegate_to: localhost
+
+- name: generating log filename
+  set_fact:
+    logfile: "{{ output }}/{{ basename }}.log"
+  tags: always
index 15b1221..41df913 100644 (file)
 
   roles:
   # run test and collect metrics
-    - { role: inxi, tags: [run, inxi, sysinfo] }
-    - { role: unixbench, tags: [run, unixbench, arithmetic] }
-    - { role: openssl, tags: [run, openssl, ssl] }
-    - { role: nDPI, tags: [run, ndpi, dpi] }
-    - { role: ramspeed, tags: [run, ramspeed, memory] }
+    - { role: inxi, output: "{{ qtip_results }}/sysinfo", tags: [run, inxi, sysinfo] }
+    - { role: unixbench, output: "{{ qtip_results }}/arithmetic", tags: [run, unixbench, arithmetic] }
+    - { role: openssl, output: "{{ qtip_results }}/ssl", tags: [run, openssl, ssl] }
+    - { role: nDPI, output: "{{ qtip_results }}/dpi", tags: [run, ndpi, dpi] }
+    - { role: ramspeed, output: "{{ qtip_results }}/memory", tags: [run, ramspeed, memory] }
   # calculate scores
     - { role: qtip, tasks: calculate, tags: [calculate] }
 
index 3bcda9f..e067364 100644 (file)
@@ -15,6 +15,6 @@
       ssl_rsa: "{{ ssl_rsa_metrics }}"
       ssl_aes: "{{ ssl_aes_metrics }}"
     spec:   "{{ qtip_resources }}/QPI/compute.yaml"
-    export_to: "{{ qtip_results }}/qpi_result.json"
+    dest: "{{ qtip_results }}/qpi_result.json"
   register: qpi_result
   delegate_to: localhost
diff --git a/resources/ansible_roles/ramspeed/meta/main.yml b/resources/ansible_roles/ramspeed/meta/main.yml
new file mode 100644 (file)
index 0000000..9f6305c
--- /dev/null
@@ -0,0 +1,14 @@
+##############################################################################
+# 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
+##############################################################################
+
+---
+
+allow_duplicates: yes
+dependencies:
+- { role: qtip-common, basename: ramspeed }
index affa111..34b38fa 100644 (file)
@@ -45,8 +45,8 @@
 
 - name: generating log filename
   set_fact:
-    int_logfile: "{{ qtip_results }}/ramsmp-int.log"
-    float_logfile: "{{ qtip_results }}/ramsmp-float.log"
+    int_logfile: "{{ output }}/ramsmp-int.log"
+    float_logfile: "{{ output }}/ramsmp-float.log"
 
 - name: saving integer output to log
   copy:
@@ -69,7 +69,7 @@
       - '^INTEGER\s+BatchRun\s+Add:\s+?(?P<add>\d+\.\d+)\sMB/s$'
       - '^INTEGER\s+BatchRun\s+Triad:\s+?(?P<triad>\d+\.\d+)\sMB/s$'
       - '^INTEGER\s+BatchRun\s+AVERAGE:\s+?(?P<average>\d+\.\d+)\sMB/s$'
-    export_to: "{{ qtip_results }}/ram_int_metrics.json"
+    dest: "{{ output }}/integer-metrics.json"
   register: intmem_metrics
 
 - name: collect float memory metrics from ramspeed
       - '^FL-POINT\s+BatchRun\s+Add:\s+?(?P<add>\d+\.\d+)\sMB/s$'
       - '^FL-POINT\s+BatchRun\s+Triad:\s+?(?P<triad>\d+\.\d+)\sMB/s$'
       - '^FL-POINT\s+BatchRun\s+AVERAGE:\s+?(?P<average>\d+\.\d+)\sMB/s$'
-    export_to: "{{ qtip_results }}/ram_float_metrics.json"
+    dest: "{{ output }}/float-metrics.json"
   register: floatmem_metrics
 
 - name: create memory metrics report
   template:
     src: "memory-metrics.j2"
-    dest: "{{ qtip_results }}/memory-metrics"
+    dest: "{{ output }}/report"
   delegate_to: localhost
diff --git a/resources/ansible_roles/unixbench/meta/main.yml b/resources/ansible_roles/unixbench/meta/main.yml
new file mode 100644 (file)
index 0000000..333c512
--- /dev/null
@@ -0,0 +1,14 @@
+##############################################################################
+# 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
+##############################################################################
+
+---
+
+allow_duplicates: yes
+dependencies:
+- { role: qtip-common, basename: unixbench }
index e087bcb..64e1021 100644 (file)
     chdir: "{{ workdir }}/byte-unixbench-5.1.3/UnixBench"
   register: unixbench_out
 
-- name: generating log filename
-  set_fact:
-    logfile: "{{ qtip_results }}/unixbench.log"
-
-- name: saving output to log
-  copy:
-    content: "{{ unixbench_out.stdout }}"
-    dest: "{{ logfile }}"
-  delegate_to: localhost
-
 - name: saving unixbench output to log
   copy:
     content: "{{ unixbench_out.stdout }}"
       # Double-Precision Whetstone                       55.0       3720.5    676.5
       - '^Dhrystone 2 using register variables\s+(\d+\.\d+)\s+(?P<dhrystone_lps>\d+\.\d+)\s+(\d+\.\d+)'
       - '^Double-Precision Whetstone\s+(\d+\.\d+)\s+(?P<whetstone_MWIPS>\d+\.\d+)\s+(\d+\.\d+)'
-    export_to: "{{ qtip_results }}/arithmetic_metrics.json"
+    dest: "{{ output }}/metrics.json"
   register: arithmetic_metrics
   delegate_to: localhost
 
 - name: creating arithmetic metrics report
   template:
     src: arithmetic-metrics.j2
-    dest: "{{ qtip_results }}/arithmetic-metrics"
+    dest: "{{ output }}/report"
   delegate_to: localhost