aboutsummaryrefslogtreecommitdiffstats
path: root/resources/ansible_roles/nDPI
diff options
context:
space:
mode:
authorYujun Zhang <zhang.yujunz@zte.com.cn>2017-04-22 22:19:27 +0800
committerYujun Zhang <zhang.yujunz@zte.com.cn>2017-04-24 08:51:49 +0800
commite579659699b4571a69990efc5861914e4701a4f6 (patch)
tree25a1e3cb196c457b39a6e22b57ce0754361f6a21 /resources/ansible_roles/nDPI
parentb9ac93be6587754b1e7ddc7c6bdafbf1f50fa50c (diff)
Unify workdir
- use role variable `workdir` - download dependencies to remote workdir with checksum Change-Id: I2a7991e014e365fec532520c2b57a3fe480914d8 Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
Diffstat (limited to 'resources/ansible_roles/nDPI')
-rw-r--r--resources/ansible_roles/nDPI/tasks/main.yml48
-rw-r--r--resources/ansible_roles/nDPI/vars/main.yml (renamed from resources/ansible_roles/nDPI/defaults/main.yml)4
2 files changed, 26 insertions, 26 deletions
diff --git a/resources/ansible_roles/nDPI/tasks/main.yml b/resources/ansible_roles/nDPI/tasks/main.yml
index d8bee591..e8d359e5 100644
--- a/resources/ansible_roles/nDPI/tasks/main.yml
+++ b/resources/ansible_roles/nDPI/tasks/main.yml
@@ -7,26 +7,24 @@
# 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 }}"
+ path: "{{ workdir }}"
state: directory
-- name: clone nDPI
- git:
- repo: https://github.com/ntop/nDPI.git
- dest: "{{ nDPI_cwd }}"
- depth: 1
- update: no
+- name: downloading nDPI
+ get_url:
+ url: https://github.com/ntop/nDPI/archive/1.6.tar.gz
+ dest: "{{ workdir }}"
+ checksum: "sha256:0863c7096f70c785e1b27a34f7b40939ac1a0e3a734ea3dcaa5cf161360a2561"
+
+- name: extracting nDPI
+ command: "tar zxf nDPI-1.6.tar.gz"
+ args:
+ chdir: "{{ workdir }}"
+ creates: nDPI-1.6
- name: build nDPI library
command: '{{ item }}'
@@ -35,23 +33,25 @@
- ./configure
- make
args:
- chdir: "{{ nDPI_cwd }}"
+ chdir: "{{ workdir }}/nDPI-1.6"
creates: example/ndpiReader
-- name: copy sample packet file
- copy:
- src: "{{ qtip_cache}}/{{ nDPI_file }}"
- dest: "{{ nDPI_cwd }}/example/{{ nDPI_file }}"
+- name: downloading sample pcap file
+ get_url:
+ url: "https://build.opnfv.org/artifacts.opnfv.org/qtip/utilities/test.pcap"
+ dest: "{{ workdir }}/nDPI-1.6/example/{{ sample_pcap }}"
+ checksum: "sha256:ac5d1501d91a6d8a8d3bfcef6f74a87bf660cd2c2ab11b9791535aa5193e4f71"
+ validate_certs: no # required when using proxy for https
- name:
- command: "./ndpiReader -i {{ nDPI_file }}"
+ command: "./ndpiReader -i {{ sample_pcap }}"
args:
- chdir: "{{ nDPI_cwd }}/example/"
- register: nDPI_out
+ chdir: "{{ workdir }}/nDPI-1.6/example/"
+ register: ndpi_out
- name: collect DPI metrics from nDPI
collect:
- string: "{{ nDPI_out.stdout }}"
+ 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
diff --git a/resources/ansible_roles/nDPI/defaults/main.yml b/resources/ansible_roles/nDPI/vars/main.yml
index d8aae81a..a39e9836 100644
--- a/resources/ansible_roles/nDPI/defaults/main.yml
+++ b/resources/ansible_roles/nDPI/vars/main.yml
@@ -8,5 +8,5 @@
#############################################################################
---
-nDPI_cwd: "{{ ansible_env.HOME }}/qtip/nDPI"
-nDPI_file: "dpi.pcap"
+workdir: "{{ qtip_workdir }}/ndpi"
+sample_pcap: "dpi.pcap"