diff options
author | 2017-04-20 20:58:13 +0800 | |
---|---|---|
committer | 2017-04-21 13:43:50 +0800 | |
commit | 9222ecb462099f667d78494f4886d6c84f8a2310 (patch) | |
tree | 695f9c4448b9a6ba637f33c8feabce0efa46f5bd /resources/roles/nDPI | |
parent | 441dea324dc2442b746528e0337a539c18b85b2f (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/nDPI')
-rw-r--r-- | resources/roles/nDPI/defaults/main.yml | 12 | ||||
-rw-r--r-- | resources/roles/nDPI/meta/main.yml | 12 | ||||
-rw-r--r-- | resources/roles/nDPI/tasks/main.yml | 60 |
3 files changed, 84 insertions, 0 deletions
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 |