Collect dpi metrics and report 59/33459/1
authorYujun Zhang <zhang.yujunz@zte.com.cn>
Tue, 18 Apr 2017 09:26:20 +0000 (17:26 +0800)
committerYujun Zhang <zhang.yujunz@zte.com.cn>
Tue, 18 Apr 2017 09:26:20 +0000 (17:26 +0800)
Change-Id: I0e02cff9a5bfc123b3227803289fc03abe27f112
Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
resources/metric/nDPI.yaml
resources/template/dpi-metrics.j2 [new file with mode: 0644]
tests/integration/run.yaml

index 7922544..0391302 100644 (file)
@@ -73,6 +73,8 @@
   collect:
     string: "{{ nDPI_out.stdout }}"
     patterns:
-      - '^\s+nDPI throughput:.+?(?P<pps>\d+.\d+)\s.+\spps.+?(?P<bps>\d+.\d+)\s.+\/sec'
+      #        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/template/dpi-metrics.j2 b/resources/template/dpi-metrics.j2
new file mode 100644 (file)
index 0000000..4de200b
--- /dev/null
@@ -0,0 +1,7 @@
+nDPI throughput
+===============
+
+{% for host in groups['compute'] %}
+{% set dpi_metrics=hostvars[host].dpi_metrics %}
+{{ (hostvars[host].ansible_hostname, "{} / {}".format(dpi_metrics.dpi_pps[0], dpi_metrics.dpi_bps[0]))|justify }}
+{% endfor %}
index 99bee5e..f02ebf8 100644 (file)
@@ -26,7 +26,7 @@
     vars:
       nDPI_cwd: "{{ ansible_env.HOME }}/qtip/nDPI"
       nDPI_file: "dpi.pcap"
-    tags: [nDPI]
+    tags: [dpi]
 
 - hosts: compute
   tasks:
       src: "{{ qtip_resources }}/template/qpi-report.j2"
       dest: "{{ qtip_reports }}/qpi-report"
     tags: [report]
+  - name: create dpi metrics report
+    template:
+      src: "{{ qtip_resources }}/template/dpi-metrics.j2"
+      dest: "{{ qtip_reports }}/dpi-metrics"
+    tags: [report, dpi]
   - name: push result to testapi
     uri:
       url: "{{ testapi_url }}/results"