############################################################################## # 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 nDPI temporary directory file: path: "{{ workdir }}" state: directory - 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 }}' with_items: - ./autogen.sh - ./configure - make args: chdir: "{{ workdir }}/nDPI-1.6" creates: example/ndpiReader - 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: measuring dpi performance command: "./ndpiReader -i {{ sample_pcap }}" args: chdir: "{{ workdir }}/nDPI-1.6/example/" register: ndpi_out - name: saving output to log copy: content: "{{ ndpi_out.stdout }}" dest: "{{ logfile }}" delegate_to: localhost - name: collecting DPI metrics collect: string: "{{ lookup('file', logfile) }}" 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\d+.\d+.*) pps \/ (?P\d+.\d+.*)b/sec$' dest: "{{ output }}/metrics.json" register: dpi_metrics delegate_to: localhost tags: collect - name: create dpi report template: src: dpi-metrics.j2 dest: "{{ output }}/dpi-metrics" delegate_to: localhost