aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--benchmarks/QPI/compute.yaml37
-rw-r--r--benchmarks/metric/dhrystone.yaml17
-rw-r--r--benchmarks/metric/dpi.yaml (renamed from qtip/driver/ansible.py)13
-rw-r--r--benchmarks/metric/ramspeed.yaml13
-rw-r--r--benchmarks/metric/ssl.yaml13
-rw-r--r--benchmarks/metric/whetstone.yaml18
-rw-r--r--benchmarks/plan/compute.yaml120
-rw-r--r--docker/Dockerfile2
-rw-r--r--docker/Dockerfile.aarch64.patch33
-rw-r--r--docs/release/release-notes/index.rst2
-rw-r--r--qtip/api/__main__.py8
-rw-r--r--qtip/api/controllers/common.py19
-rw-r--r--qtip/api/controllers/metric.py26
-rw-r--r--qtip/api/controllers/plan.py38
-rw-r--r--qtip/api/controllers/qpi.py32
-rw-r--r--qtip/api/swagger/swagger.yaml316
-rw-r--r--qtip/cli/commands/cmd_metric.py13
-rw-r--r--qtip/cli/commands/cmd_plan.py13
-rw-r--r--qtip/cli/commands/cmd_qpi.py13
-rw-r--r--qtip/cli/templates/metric.j26
-rw-r--r--qtip/cli/templates/plan.j22
-rw-r--r--qtip/cli/templates/qpi.j212
-rw-r--r--qtip/cli/utils.py31
-rw-r--r--qtip/collector/calculator.py38
-rw-r--r--qtip/collector/parser/grep.py72
-rw-r--r--qtip/collector/parser/regex.yaml85
-rw-r--r--qtip/driver/ansible_api.py58
-rw-r--r--qtip/driver/ansible_driver.py102
-rw-r--r--qtip/driver/playbook/bwn_ng.yaml2
-rw-r--r--qtip/driver/playbook/dhrystone/run.yaml63
-rw-r--r--qtip/driver/playbook/dpi/run.yaml14
-rw-r--r--qtip/driver/playbook/dpi/setup.yaml2
-rw-r--r--qtip/driver/playbook/inxi.yaml2
-rw-r--r--qtip/driver/playbook/openssl/clean.yaml23
-rw-r--r--qtip/driver/playbook/openssl/run.yaml45
-rw-r--r--qtip/driver/playbook/openssl/setup.yaml87
-rw-r--r--qtip/driver/playbook/ramspeed/clean.yaml23
-rw-r--r--qtip/driver/playbook/ramspeed/run.yaml40
-rw-r--r--qtip/driver/playbook/ramspeed/setup.yaml70
-rw-r--r--qtip/driver/playbook/top.yaml2
-rw-r--r--qtip/driver/playbook/unixbench/clean.yaml (renamed from qtip/driver/playbook/dhrystone/clean.yaml)12
-rw-r--r--qtip/driver/playbook/unixbench/dhrystone.yaml41
-rw-r--r--qtip/driver/playbook/unixbench/run.yaml23
-rw-r--r--qtip/driver/playbook/unixbench/setup.yaml (renamed from qtip/driver/playbook/dhrystone/setup.yaml)23
-rw-r--r--qtip/driver/playbook/unixbench/whetstone.yaml41
-rw-r--r--qtip/runner/runner.py107
-rwxr-xr-xqtip/scripts/cleanup_creds.sh20
-rw-r--r--qtip/util/env.py58
-rw-r--r--requirements.txt2
-rw-r--r--setup.cfg6
-rw-r--r--tests/data/benchmarks/plan/compute.yaml74
-rw-r--r--tests/data/external/dpi/dpi_dump.txt809
-rw-r--r--tests/data/external/ramspeed/Floatmem52
-rw-r--r--tests/data/external/ramspeed/Intmem52
-rw-r--r--tests/data/external/ssl/AES-128-CBC_dump7
-rw-r--r--tests/data/external/ssl/RSA_dump9
-rw-r--r--tests/unit/cli/cmd_metric_test.py14
-rw-r--r--tests/unit/cli/cmd_plan_test.py9
-rw-r--r--tests/unit/cli/cmd_qpi_test.py11
-rw-r--r--tests/unit/util/env_test.py26
60 files changed, 2749 insertions, 172 deletions
diff --git a/benchmarks/QPI/compute.yaml b/benchmarks/QPI/compute.yaml
new file mode 100644
index 00000000..78a2d324
--- /dev/null
+++ b/benchmarks/QPI/compute.yaml
@@ -0,0 +1,37 @@
+##############################################################################
+# Copyright (c) 2016 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
+##############################################################################
+title: compute
+description: sample performance index of computing
+formula: weighted arithmetic mean
+sections:
+- name: Integer
+ weight: 0.3
+ formula: geometric mean
+ metrics:
+ - dhrystone.yaml
+- name: Float
+ weight: 0.3
+ formula: geometric mean
+ metrics:
+ - whetstone.yaml
+- name: Memory
+ weight: 0.2
+ formula: geometric mean
+ metrics:
+ - ramspeed.yaml
+- name: DPI
+ weight: 0.1
+ formula: geometric mean
+ metrics:
+ - dpi.yaml
+- name: SSL
+ weight: 0.1
+ formula: geometric mean
+ metrics:
+ - ssl.yaml
diff --git a/benchmarks/metric/dhrystone.yaml b/benchmarks/metric/dhrystone.yaml
new file mode 100644
index 00000000..e4d26248
--- /dev/null
+++ b/benchmarks/metric/dhrystone.yaml
@@ -0,0 +1,17 @@
+##############################################################################
+# Copyright (c) 2016 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: dhrystone
+description: >
+ A synthetic computing benchmark program intended to be representative of
+ system (integer) programming.
+links:
+ - https://en.wikipedia.org/wiki/Dhrystone
+workloads:
+ - single_cpu
+ - multi_cpu
diff --git a/qtip/driver/ansible.py b/benchmarks/metric/dpi.yaml
index cd17625d..c90075d2 100644
--- a/qtip/driver/ansible.py
+++ b/benchmarks/metric/dpi.yaml
@@ -1,14 +1,13 @@
##############################################################################
-# Copyright (c) 2016 ZTE Corp and others.
+# Copyright (c) 2016 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
##############################################################################
-
-from qtip.driver.base import BaseDriver
-
-
-class AnsibleDriver(BaseDriver):
- """driver for running performance tests with Ansible"""
+name: dpi
+description: deep packet inspection
+workloads:
+ - bps
+ - pps
diff --git a/benchmarks/metric/ramspeed.yaml b/benchmarks/metric/ramspeed.yaml
new file mode 100644
index 00000000..e2e2b98f
--- /dev/null
+++ b/benchmarks/metric/ramspeed.yaml
@@ -0,0 +1,13 @@
+##############################################################################
+# Copyright (c) 2016 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: ramspeed
+description: a memory performance benchmarking
+workloads:
+ - int: [add, average, copy, scale, triad]
+ - float: [add, average, copy, scale, triad]
diff --git a/benchmarks/metric/ssl.yaml b/benchmarks/metric/ssl.yaml
new file mode 100644
index 00000000..2b01dccd
--- /dev/null
+++ b/benchmarks/metric/ssl.yaml
@@ -0,0 +1,13 @@
+##############################################################################
+# Copyright (c) 2016 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: ssl
+description: a Secure Sockets Layer performance benchmarking
+workloads:
+ - aes_128_cbc: [512, 1024, 2048, 4096]
+ - rsa_sig: [16, 64, 256, 1024, 8192]
diff --git a/benchmarks/metric/whetstone.yaml b/benchmarks/metric/whetstone.yaml
new file mode 100644
index 00000000..625ea87f
--- /dev/null
+++ b/benchmarks/metric/whetstone.yaml
@@ -0,0 +1,18 @@
+##############################################################################
+# Copyright (c) 2016 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: whetstone
+description: >
+ A synthetic benchmark for evaluating the performance of computers.
+ The Whetstone benchmark primarily measures the floating-point arithmetic
+ performance.
+links:
+ - https://en.wikipedia.org/wiki/Whetstone_(benchmark)
+workloads:
+ - single_cpu
+ - multi_cpu
diff --git a/benchmarks/plan/compute.yaml b/benchmarks/plan/compute.yaml
new file mode 100644
index 00000000..f4a7a2dc
--- /dev/null
+++ b/benchmarks/plan/compute.yaml
@@ -0,0 +1,120 @@
+##############################################################################
+# 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: compute QPI
+description: compute QPI profile
+info:
+ facility: local
+ engineer: local
+config:
+ driver: ansible
+ collectors:
+ - type: logfile
+ paths:
+ - '../../external/dpi/'
+ logs:
+ - filename: dpi_dump.txt
+ parsers:
+ - type: grep
+ regex: |-
+ ^\s+nDPI throughput:.+?(?P<pps>\d+.\d+)\sM\spps.+
+ ?(?P<bps>\d+.\d+)\sGb\/sec
+ - type: logfile
+ paths:
+ - '../../external/ramspeed/'
+ logs:
+ - filename: Intmem
+ parsers:
+ - type: grep
+ regex: '^INTEGER\s+BatchRun\s+Copy:\s+?(?P<integer_copy>\d+\.\d+)\sMB/s$'
+ - type: grep
+ regex: '^INTEGER\s+BatchRun\s+Scale:\s+?(?P<integer_scale>\d+\.\d+)\sMB/s$'
+ - type: grep
+ regex: '^INTEGER\s+BatchRun\s+Add:\s+?(?P<integer_add>\d+\.\d+)\sMB/s$'
+ - type: grep
+ regex: '^INTEGER\s+BatchRun\s+Triad:\s+?(?P<integer_triad>\d+\.\d+)\sMB/s$'
+ - type: grep
+ regex: '^INTEGER\s+BatchRun\s+AVERAGE:\s+?(?P<integer_average>\d+\.\d+)\sMB/s$'
+ - filename: Floatmem
+ parsers:
+ - type: grep
+ regex: '^FL-POINT\s+BatchRun\s+Copy:\s+?(?P<float_copy>\d+\.\d+)\sMB/s$'
+ - type: grep
+ regex: '^FL-POINT\s+BatchRun\s+Scale:\s+?(?P<float_scale>\d+\.\d+)\sMB/s$'
+ - type: grep
+ regex: '^FL-POINT\s+BatchRun\s+Add:\s+?(?P<float_add>\d+\.\d+)\sMB/s$'
+ - type: grep
+ regex: '^FL-POINT\s+BatchRun\s+Triad:\s+?(?P<float_triad>\d+\.\d+)\sMB/s$'
+ - type: grep
+ regex: '^FL-POINT\s+BatchRun\s+AVERAGE:\s+?(?P<float_average>\d+\.\d+)\sMB/s$'
+ - type: logfile
+ paths:
+ - '../../external/ssl/'
+ logs:
+ - filename: RSA_dump
+ parsers:
+ - type: grep
+ regex: |-
+ ^rsa\s+512\sbits\s.+
+ ?(?P<rsa_sign_512>\d+\.\d)\s+
+ ?(?P<rsa_verify_512>\d+\.\d)$
+ - type: grep
+ regex: |-
+ ^rsa\s+1024\sbits\s.+
+ ?(?P<rsa_sign_1024>\d+\.\d)\s+
+ ?(?P<rsa_verify_1024>\d+\.\d)$
+ - type: grep
+ regex: |-
+ ^rsa\s+2048\sbits\s.+
+ ?(?P<rsa_sign_2048>\d+\.\d)\s+
+ ?(?P<rsa_verify_2048>\d+\.\d)$
+ - type: grep
+ regex: |-
+ ^rsa\s+4096\sbits\s.+
+ ?(?P<rsa_sign_4096>\d+\.\d)\s+
+ ?(?P<rsa_verify_4096>\d+\.\d)$
+ - filename: AES-128-CBC_dump
+ parsers:
+ - type: grep
+ regex: |-
+ ^aes-128-cbc\s+
+ ?(?P<aes_128_cbc_16_bytes>\d+\.\w+)\s+
+ ?(?P<aes_128_cbc_64_bytes>\d+\.\w+)\s+
+ ?(?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+)$
+ - type: logfile
+ paths:
+ - '../../external/sysinfo'
+ logs:
+ - filename: top.log
+ parsers:
+ - type: grep
+ regex: 'Cpu\(s\):.+?(?P<cpu_idle>\d+\.\d)\sid'
+ - filename: inxi.log
+ parsers:
+ - type: grep
+ regex: '.+\s+Host:\s+(?P<hostname>.+)\sKernel'
+ - type: grep
+ regex: '.+\sMemory:\s+(?P<memory>.+MB)\s'
+ - type: grep
+ regex: '^CPU\(s\):\s+(?P<cpu>.+)'
+ - type: grep
+ regex: '.+\sDistro:\s+(?P<os>.+)'
+ - type: grep
+ regex: '.+\sKernel:\s+(?P<kernel>.+)\sConsole'
+ - type: grep
+ regex: '.+\s+HDD Total Size:\s+(?P<disk>.+)\s'
+ - type: grep
+ regex: '.+\sproduct:\s+(?P<product>.+)\sversion'
+ reporter:
+ name: console
+ # transform collected data into timeline
+ transformer: timeline
+QPIs:
+ - compute.yaml
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 13665131..a4a7e477 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -35,6 +35,8 @@ RUN apt-get update && apt-get install -y \
curl \
supervisor \
python-setuptools \
+ iputils-ping\
+ rsync \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
diff --git a/docker/Dockerfile.aarch64.patch b/docker/Dockerfile.aarch64.patch
new file mode 100644
index 00000000..80529476
--- /dev/null
+++ b/docker/Dockerfile.aarch64.patch
@@ -0,0 +1,33 @@
+From: Cristina Pauna <cristina.pauna@enea.com>
+Date: Mon, 13 Mar 2017 11:56:59 +0200
+Subject: [PATCH] Modify Dockerfile to build an aarch64 image
+
+This patch adapts the Dockerfile so that the qtip image
+can be build on an aarch64 machine
+
+Signed-off-by: Cristina Pauna <cristina.pauna@enea.com>
+---
+ docker/Dockerfile | 14 ++++++--------
+ 1 file changed, 6 insertions(+), 8 deletions(-)
+
+diff --git a/docker/Dockerfile b/docker/Dockerfile
+index a4a7e47..5d4467b 100644
+--- a/docker/Dockerfile
++++ b/docker/Dockerfile
+@@ -1,10 +1,10 @@
+-##########################################
+-#####Docker container for QTIP############
+-##########################################
++###################################################
++##### AArch64 Docker container for QTIP############
++###################################################
+
+-FROM ubuntu:16.04
+-MAINTAINER Yujun Zhang <zhang.yujunz@zte.com.cn>
+-LABEL version="0.1" description="OPNFV QTIP Docker container"
++FROM aarch64/ubuntu:16.04
++MAINTAINER Armband team <armband@enea.com>
++LABEL version="0.1" description="OPNFV QTIP AArch64 Docker container"
+
+ ARG BRANCH=master
+
diff --git a/docs/release/release-notes/index.rst b/docs/release/release-notes/index.rst
index 5d045388..3864c451 100644
--- a/docs/release/release-notes/index.rst
+++ b/docs/release/release-notes/index.rst
@@ -1,3 +1,5 @@
+.. _qtip-releasenotes:
+
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
.. (c) 2015 Dell Inc.
diff --git a/qtip/api/__main__.py b/qtip/api/__main__.py
index aa2941a7..05d92315 100644
--- a/qtip/api/__main__.py
+++ b/qtip/api/__main__.py
@@ -8,12 +8,16 @@
##############################################################################
import connexion
+import os
+
+
+swagger_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'swagger/'))
def main():
- app = connexion.App(__name__, specification_dir='swagger/')
+ app = connexion.App(__name__, specification_dir=swagger_dir)
app.add_api('swagger.yaml', base_path='/v1.0')
- app.run(host='0.0.0.0', port='5000')
+ app.run(host="0.0.0.0", port=5000)
if __name__ == '__main__':
diff --git a/qtip/api/controllers/common.py b/qtip/api/controllers/common.py
new file mode 100644
index 00000000..6cabbc7f
--- /dev/null
+++ b/qtip/api/controllers/common.py
@@ -0,0 +1,19 @@
+import httplib
+
+import connexion
+
+from qtip.base import error
+
+
+def get_one_exceptions(resource):
+ def _decorator(func):
+ def _execute(name):
+ try:
+ return func(name), httplib.OK
+ except error.NotFoundError:
+ return connexion.problem(
+ httplib.NOT_FOUND,
+ '{} Not Found'.format(resource),
+ 'Requested {} `{}` not found.'.format(resource, name))
+ return _execute
+ return _decorator
diff --git a/qtip/api/controllers/metric.py b/qtip/api/controllers/metric.py
new file mode 100644
index 00000000..dd4c8ac6
--- /dev/null
+++ b/qtip/api/controllers/metric.py
@@ -0,0 +1,26 @@
+##############################################################################
+# Copyright (c) 2017 akhil.batra@research.iiit.ac.in 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
+##############################################################################
+
+import httplib
+
+from qtip.api.controllers import common
+from qtip.loader import metric
+
+
+def list_metrics():
+ metric_list = list(metric.MetricSpec.list_all())
+ return metric_list, httplib.OK
+
+
+@common.get_one_exceptions(resource='metric')
+def get_metric(name):
+ metric_spec = metric.MetricSpec(name)
+ return {'name': metric_spec.name,
+ 'abspath': metric_spec.abspath,
+ 'content': metric_spec.content}
diff --git a/qtip/api/controllers/plan.py b/qtip/api/controllers/plan.py
new file mode 100644
index 00000000..93836a32
--- /dev/null
+++ b/qtip/api/controllers/plan.py
@@ -0,0 +1,38 @@
+##############################################################################
+# Copyright (c) 2017 akhil.batra@research.iiit.ac.in 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
+##############################################################################
+
+import httplib
+
+import connexion
+
+from qtip.base import error
+from qtip.loader import plan
+
+
+def list_plans():
+ plan_list = list(plan.Plan.list_all())
+ return plan_list, httplib.OK
+
+
+def get_plan(name):
+ try:
+ plan_spec = plan.Plan(name)
+ return {'name': plan_spec.name,
+ 'abspath': plan_spec.abspath,
+ 'content': plan_spec.content}, httplib.OK
+ except error.NotFoundError:
+ return connexion.problem(httplib.NOT_FOUND,
+ 'Plan Not Found',
+ 'requested plan `' + name + '` not found.')
+
+
+def run_plan(name, action="run"):
+ return connexion.problem(httplib.NOT_IMPLEMENTED,
+ 'Run a plan',
+ 'Plan runner not implemented')
diff --git a/qtip/api/controllers/qpi.py b/qtip/api/controllers/qpi.py
new file mode 100644
index 00000000..3c4dd718
--- /dev/null
+++ b/qtip/api/controllers/qpi.py
@@ -0,0 +1,32 @@
+##############################################################################
+# Copyright (c) 2017 akhil.batra@research.iiit.ac.in 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
+##############################################################################
+
+import httplib
+
+import connexion
+
+from qtip.base import error
+from qtip.loader import qpi
+
+
+def list_qpis():
+ qpi_spec_list = list(qpi.QPISpec.list_all())
+ return qpi_spec_list, httplib.OK
+
+
+def get_qpi(name):
+ try:
+ qpi_spec = qpi.QPISpec(name)
+ return {'name': qpi_spec.name,
+ 'abspath': qpi_spec.abspath,
+ 'content': qpi_spec.content}, httplib.OK
+ except error.NotFoundError:
+ return connexion.problem(httplib.NOT_FOUND,
+ 'QPI Not Found',
+ 'Requested QPI Spec `' + name + '` not found.')
diff --git a/qtip/api/swagger/swagger.yaml b/qtip/api/swagger/swagger.yaml
index a5a815f1..fb10317f 100644
--- a/qtip/api/swagger/swagger.yaml
+++ b/qtip/api/swagger/swagger.yaml
@@ -4,15 +4,327 @@
# 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
+# http://www.apache.org/licenses/LICENSE -2.0
##############################################################################
swagger: '2.0'
info:
title: QTIP-API
+ version: "1.0"
consumes:
- application/json
produces:
- application/json
paths:
- #TODO (akhil) add paths \ No newline at end of file
+ /plans:
+ get:
+ summary: List all plans
+ operationId: qtip.api.controllers.plan.list_plans
+ tags:
+ - Plan
+ - Standalone
+ responses:
+ 200:
+ description: A list of plans
+ schema:
+ type: array
+ items:
+ $ref: '#/definitions/Plans'
+ 501:
+ description: Resource not implemented
+ schema:
+ $ref: '#/definitions/Error'
+ default:
+ description: Unexpected error
+ schema:
+ $ref: '#/definitions/Error'
+ /plans/{name}:
+ get:
+ summary: Get a plan by plan name
+ operationId: qtip.api.controllers.plan.get_plan
+ tags:
+ - Plan
+ - Standalone
+ parameters:
+ - name: name
+ in: path
+ description: Plan name
+ required: true
+ type: string
+ responses:
+ 200:
+ description: Plan information
+ schema:
+ $ref: '#/definitions/Plan'
+ 404:
+ description: Plan not found
+ schema:
+ $ref: '#/definitions/Error'
+ 501:
+ description: Resource not implemented
+ schema:
+ $ref: '#/definitions/Error'
+ default:
+ description: Unexpected error
+ schema:
+ $ref: '#/definitions/Error'
+ post:
+ summary: Run a plan and return results
+ operationId: qtip.api.controllers.plan.run_plan
+ tags:
+ - Plan
+ - Standalone
+ parameters:
+ - name: name
+ in: path
+ description: Plan name
+ required: true
+ type: string
+ - name: action
+ in: query
+ description: action for a plan
+ required: true
+ type: string
+ responses:
+ 200:
+ description: Result of the run of the plan
+ #TODO (akhil) define schema
+ 404:
+ description: Plan not found
+ schema:
+ $ref: '#/definitions/Error'
+ 400:
+ description: Invalid parameters
+ schema:
+ $ref: '#/definitions/Error'
+ 501:
+ description: Resource not implemented
+ schema:
+ $ref: '#/definitions/Error'
+ default:
+ description: Unexpected error
+ schema:
+ $ref: '#/definitions/Error'
+ /qpis:
+ get:
+ summary: List all QPIs
+ operationId: qtip.api.controllers.qpi.list_qpis
+ tags:
+ - QPI
+ - Standalone
+ - Agent
+ responses:
+ 200:
+ description: A list of QPIs
+ schema:
+ items:
+ $ref: '#/definitions/QPIs'
+ 501:
+ description: Resource not implemented
+ schema:
+ $ref: '#/definitions/Error'
+ default:
+ description: Unexpected error
+ schema:
+ $ref: '#/definitions/Error'
+ /qpis/{name}:
+ get:
+ summary: Get a QPI
+ operationId: qtip.api.controllers.qpi.get_qpi
+ tags:
+ - QPI
+ - Standalone
+ - Agent
+ parameters:
+ - name: name
+ in: path
+ description: QPI name
+ required: true
+ type: string
+ responses:
+ 200:
+ description: QPI information
+ schema:
+ $ref: '#/definitions/QPI'
+ 404:
+ description: QPI not found
+ schema:
+ $ref: '#/definitions/Error'
+ 501:
+ description: Resource not implemented
+ schema:
+ $ref: '#/definitions/Error'
+ default:
+ description: Unexpected error
+ schema:
+ $ref: '#/definitions/Error'
+ /metrics:
+ get:
+ summary: List all metrics
+ operationId: qtip.api.controllers.metric.list_metrics
+ tags:
+ - Metric
+ - Standalone
+ - Agent
+ responses:
+ 200:
+ description: A list of metrics
+ schema:
+ items:
+ $ref: '#/definitions/Metrics'
+ 501:
+ description: Resource not implemented
+ schema:
+ $ref: '#/definitions/Error'
+ default:
+ description: Unexpected error
+ schema:
+ $ref: '#/definitions/Error'
+ /metrics/{name}:
+ get:
+ summary: Get a metric
+ operationId: qtip.api.controllers.metric.get_metric
+ tags:
+ - Metric
+ - Standalone
+ - Agent
+ parameters:
+ - name: name
+ in: path
+ description: Metric name
+ required: true
+ type: string
+ responses:
+ 200:
+ description: Metric information
+ schema:
+ $ref: '#/definitions/Metric'
+ 404:
+ description: Metric not found
+ schema:
+ $ref: '#/definitions/Error'
+ 501:
+ description: Resource not implemented
+ schema:
+ $ref: '#/definitions/Error'
+ default:
+ description: Unexpected error
+ schema:
+ $ref: '#/definitions/Error'
+definitions:
+ PlanContent:
+ type: object
+ required:
+ - name
+ properties:
+ name:
+ type: string
+ description:
+ type: string
+ info:
+ type: object
+ config:
+ type: object
+ QPIs:
+ type: array
+ items:
+ type: object
+ Plans:
+ type: object
+ required:
+ - name
+ - abspath
+ properties:
+ name:
+ type: string
+ abspath:
+ type: string
+ Plan:
+ allOf:
+ - $ref: '#/definitions/Plans'
+ - type: object
+ - required:
+ - content
+ properties:
+ content:
+ $ref: '#/definitions/PlanContent'
+ MetricContent:
+ type: object
+ required:
+ - name
+ properties:
+ name:
+ type: string
+ description:
+ type: string
+ links:
+ type: array
+ items:
+ type: string
+ workloads:
+ type: array
+ items:
+ type: string
+ Metrics:
+ type: object
+ required:
+ - name
+ - abspath
+ properties:
+ name:
+ type: string
+ abspath:
+ type: string
+ Metric:
+ allOf:
+ - $ref: '#/definitions/Metrics'
+ - required:
+ - content
+ properties:
+ content:
+ $ref: '#/definitions/MetricContent'
+ QPIContent:
+ type: object
+ required:
+ - name
+ properties:
+ name:
+ type: string
+ description:
+ type: string
+ formula:
+ type: string
+ sections:
+ type: array
+ items:
+ type: object
+ QPIs:
+ type: object
+ required:
+ - name
+ - abspath
+ properties:
+ name:
+ type: string
+ abspath:
+ type: string
+ QPI:
+ allOf:
+ - $ref: '#/definitions/QPIs'
+ - required:
+ - content
+ properties:
+ content:
+ $ref: '#/definitions/QPIContent'
+ Error:
+ type: object
+ properties:
+ status:
+ type: integer
+ format: int32
+ title:
+ type: string
+ detail:
+ type: string
+ type:
+ type: string \ No newline at end of file
diff --git a/qtip/cli/commands/cmd_metric.py b/qtip/cli/commands/cmd_metric.py
index b6035e2d..31b7b702 100644
--- a/qtip/cli/commands/cmd_metric.py
+++ b/qtip/cli/commands/cmd_metric.py
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 2016 ZTE Corp and others.
+# Copyright (c) 2017 taseer94@gmail.com and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -9,7 +9,9 @@
import click
+from qtip.cli import utils
from qtip.cli.entry import Context
+from qtip.loader.metric import MetricSpec
pass_context = click.make_pass_decorator(Context, ensure=False)
@@ -24,14 +26,19 @@ def cli(ctx):
@cli.command('list', help='List all the Metric Groups')
@pass_context
def cmd_list(ctx):
- pass
+ metrics = MetricSpec.list_all()
+ table = utils.table('Metrics', metrics)
+ click.echo(table)
@cli.command('show', help='View details of a Metric')
@click.argument('name')
@pass_context
def show(ctx, name):
- pass
+ metric = MetricSpec('{}.yaml'.format(name))
+ cnt = metric.content
+ output = utils.render('metric', cnt)
+ click.echo(output)
@cli.command('run', help='Run tests to run Performance Metrics')
diff --git a/qtip/cli/commands/cmd_plan.py b/qtip/cli/commands/cmd_plan.py
index 64c702d3..90773491 100644
--- a/qtip/cli/commands/cmd_plan.py
+++ b/qtip/cli/commands/cmd_plan.py
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 2016 ZTE Corp and others.
+# Copyright (c) 2016 taseer94@gmail.com and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -10,7 +10,9 @@
import click
+from qtip.cli import utils
from qtip.cli.entry import Context
+from qtip.loader.plan import Plan
pass_context = click.make_pass_decorator(Context, ensure=False)
@@ -32,14 +34,19 @@ def init(ctx):
@cli.command('list', help='List the Plans')
@pass_context
def list(ctx):
- pass
+ plans = Plan.list_all()
+ table = utils.table('Plans', plans)
+ click.echo(table)
@cli.command('show', help='View details of a Plan')
@click.argument('name')
@pass_context
def show(ctx, name):
- pass
+ plan = Plan('{}.yaml'.format(name))
+ cnt = plan.content
+ output = utils.render('plan', cnt)
+ click.echo(output)
@cli.command('run', help='Execute a Plan')
diff --git a/qtip/cli/commands/cmd_qpi.py b/qtip/cli/commands/cmd_qpi.py
index 5fc9bec8..1f23211e 100644
--- a/qtip/cli/commands/cmd_qpi.py
+++ b/qtip/cli/commands/cmd_qpi.py
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 2016 ZTE Corp and others.
+# Copyright (c) 2017 taseer94@gmail.com and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -10,7 +10,9 @@
import click
+from qtip.cli import utils
from qtip.cli.entry import Context
+from qtip.loader.qpi import QPISpec
pass_context = click.make_pass_decorator(Context, ensure=False)
@@ -25,14 +27,19 @@ def cli(ctx):
@cli.command('list', help='List all the QPI specs')
@pass_context
def cmd_list(ctx):
- pass
+ qpis = QPISpec.list_all()
+ table = utils.table('QPIs', qpis)
+ click.echo(table)
@cli.command('show', help='View details of a QPI')
@click.argument('name')
@pass_context
def show(ctx, name):
- pass
+ qpi = QPISpec('{}.yaml'.format(name))
+ cnt = qpi.content
+ output = utils.render('qpi', cnt)
+ click.echo(output)
@cli.command('run', help='Run performance tests for the specified QPI')
diff --git a/qtip/cli/templates/metric.j2 b/qtip/cli/templates/metric.j2
new file mode 100644
index 00000000..126587f9
--- /dev/null
+++ b/qtip/cli/templates/metric.j2
@@ -0,0 +1,6 @@
+Name: {{ name }}
+Description: {{ description }}
+Workloads:
+{% for wl in workloads %}
+ {{ wl }}
+{% endfor %}
diff --git a/qtip/cli/templates/plan.j2 b/qtip/cli/templates/plan.j2
new file mode 100644
index 00000000..c9adccc8
--- /dev/null
+++ b/qtip/cli/templates/plan.j2
@@ -0,0 +1,2 @@
+Name: {{ name }}
+Description: {{ description }}
diff --git a/qtip/cli/templates/qpi.j2 b/qtip/cli/templates/qpi.j2
new file mode 100644
index 00000000..cc85f10d
--- /dev/null
+++ b/qtip/cli/templates/qpi.j2
@@ -0,0 +1,12 @@
+Name: {{ title }}
+Description: {{ description }}
+{% for section in sections %}
+ Name: {{ section.name }}
+ Weight: {{ section.weight }}
+ Formula: {{ section.formula }}
+ Metrics:
+ {% for metric in section.metrics %}
+ {{ metric }}
+ {% endfor %}
+{% endfor %}
+
diff --git a/qtip/cli/utils.py b/qtip/cli/utils.py
new file mode 100644
index 00000000..a7473236
--- /dev/null
+++ b/qtip/cli/utils.py
@@ -0,0 +1,31 @@
+##############################################################################
+# Copyright (c) 2017 taseer94@gmail.com 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
+##############################################################################
+
+from jinja2 import Environment
+from jinja2 import FileSystemLoader
+from os import path
+from prettytable import PrettyTable
+
+
+def table(name, components):
+ """ Return a PrettyTable for component listing """
+ table = PrettyTable([name])
+ table.align[name] = 'l'
+ [table.add_row([component['name'][0:-5]]) for component in components]
+ return table
+
+
+def render(name, var_dict):
+ """ Get the templates to render for specific component """
+ tmpl_path = path.join(path.dirname(__file__), 'templates')
+ tmpl_loader = FileSystemLoader(tmpl_path)
+ env = Environment(loader=tmpl_loader)
+ template = env.get_template('{}.j2'.format(name))
+ result = template.render(var_dict)
+ return result
diff --git a/qtip/collector/calculator.py b/qtip/collector/calculator.py
new file mode 100644
index 00000000..c3d961b3
--- /dev/null
+++ b/qtip/collector/calculator.py
@@ -0,0 +1,38 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corp 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
+##############################################################################
+
+from operator import add
+
+from qtip.util.logger import QtipLogger
+
+logger = QtipLogger('calculator').get
+
+
+def dpi_calculator(samples):
+ try:
+ float_pps = map(lambda x: float(x), samples['pps'])
+ float_bps = map(lambda x: float(x), samples['bps'])
+ sum_dpi_pps = reduce(add,
+ map(lambda x: x / 1000 if x > 100 else x, float_pps))
+ sum_dpi_bps = reduce(add,
+ map(lambda x: x / 1000 if x > 100 else x, float_bps))
+
+ return {'pps': round(sum_dpi_pps / 10, 3), 'bps': round(sum_dpi_bps / 10, 3)}
+ except Exception as error:
+ logger.error(error)
+ return {'pps': None, 'bps': None}
+
+
+def calculate_cpu_usage(cpu_idle):
+ try:
+ cpu_usage = round((100.0 - float(cpu_idle)), 3)
+ return '{0}%'.format(str(cpu_usage))
+ except Exception, error:
+ logger.error(error)
+ return None
diff --git a/qtip/collector/parser/grep.py b/qtip/collector/parser/grep.py
index f74ce403..d3a8210a 100644
--- a/qtip/collector/parser/grep.py
+++ b/qtip/collector/parser/grep.py
@@ -7,12 +7,20 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-
+from collections import defaultdict
+from os import path
import re
+import yaml
-from qtip.base.constant import BaseProp
from qtip.base import BaseActor
+from qtip.base.constant import BaseProp
+from qtip.collector import calculator
+from qtip.util.logger import QtipLogger
+
+logger = QtipLogger('grep').get
+
+REGEX_FILE = path.join(path.dirname(__file__), 'regex.yaml')
class GrepProp(BaseProp):
@@ -32,3 +40,63 @@ def grep_in_file(filename, regex):
with open(filename, 'r') as f:
return filter(lambda x: x is not None,
re.finditer(regex, f.read(), re.MULTILINE))
+
+
+def _parse_logfile(config, paths):
+ captured = {}
+ for regex_rules_by_file in config:
+ filename = \
+ '{0}/{1}'.format(paths, regex_rules_by_file[GrepProp.FILENAME])
+ for regex in regex_rules_by_file['grep']:
+ matches = grep_in_file(filename, regex)
+ if len(matches) > 1:
+ temp_dict = defaultdict(list)
+ for item in [match.groupdict() for match in matches]:
+ for key in item:
+ temp_dict[key].append(item[key])
+ captured.update(temp_dict)
+ elif len(matches) == 1:
+ captured.update(matches[0].groupdict())
+ else:
+ logger.error("Nothing is matched from {0}".format(filename))
+ return captured
+
+
+# TODO: Hardcord in Danube, it will be removed in the future.
+def parse_sysinfo(config, result_dir):
+ sysinfo = _parse_logfile(config, result_dir)
+ if "cpu_idle" in sysinfo:
+ sysinfo['cpu_usage'] = \
+ calculator.calculate_cpu_usage(sysinfo['cpu_idle'])
+ sysinfo.pop('cpu_idle')
+ return sysinfo
+
+
+# TODO: Hardcord in Danube, it will be removed in the future.
+def parse_test_result(benchmark, config, result_dir):
+ test_result = _parse_logfile(config, result_dir)
+ if benchmark == 'dpi':
+ return calculator.dpi_calculator(test_result)
+ if benchmark == 'dhrystone' or benchmark == 'whetstone':
+ return {'total_cpus': test_result['total_cpus'],
+ 'single_cpu': {'num': test_result['single_cpu'],
+ 'score': test_result['score'][0]},
+ 'multi_cpus': {'num': test_result['multi_cpus'],
+ 'score': test_result['score'][1]}}
+ return test_result
+
+
+# TODO: Hardcord in Danube, it will be removed in the future.
+def parse_benchmark_result(result_dir):
+ regex_config = yaml.safe_load(file(REGEX_FILE))
+ benchmark = result_dir.split('/')[-1]
+ result = {'name': benchmark}
+
+ test_result = \
+ parse_test_result(benchmark, regex_config[benchmark], result_dir)
+ result['results'] = test_result.copy()
+
+ sysinfo = parse_sysinfo(regex_config['sysinfo'], result_dir)
+ result['sysinfo'] = sysinfo.copy()
+
+ return result
diff --git a/qtip/collector/parser/regex.yaml b/qtip/collector/parser/regex.yaml
new file mode 100644
index 00000000..397f8973
--- /dev/null
+++ b/qtip/collector/parser/regex.yaml
@@ -0,0 +1,85 @@
+##############################################################################
+# 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
+##############################################################################
+
+dhrystone:
+ - filename: dhrystone
+ grep:
+ - '^(?P<total_cpus>\d+)\sCPUs in system; running 1 parallel copy of tests$'
+ - '.+\srunning (?P<single_cpu>\d+) parallel copy of tests$'
+ - '.+\srunning (?P<multi_cpus>\d+) parallel copies of tests$'
+ - '^System Benchmarks Index Score \(Partial Only\)\s+(?P<score>\d+\.\d)$'
+whetstone:
+ - filename: whetstone
+ grep:
+ - '^(?P<total_cpus>\d+)\sCPUs in system; running 1 parallel copy of tests$'
+ - '.+\srunning (?P<single_cpu>\d+) parallel copy of tests$'
+ - '.+\srunning (?P<multi_cpus>\d+) parallel copies of tests$'
+ - '^System Benchmarks Index Score \(Partial Only\)\s+(?P<score>\d+\.\d)$'
+dpi:
+ - filename: dpi_dump.txt
+ grep:
+ - |-
+ ^\s+nDPI throughput:.+?(?P<pps>\d+.\d+)\sM\spps.+
+ ?(?P<bps>\d+.\d+)\sGb\/sec
+ramspeed:
+ - filename: Intmem
+ grep:
+ - '^INTEGER\s+BatchRun\s+Copy:\s+?(?P<integer_copy>\d+\.\d+)\sMB/s$'
+ - '^INTEGER\s+BatchRun\s+Scale:\s+?(?P<integer_scale>\d+\.\d+)\sMB/s$'
+ - '^INTEGER\s+BatchRun\s+Add:\s+?(?P<integer_add>\d+\.\d+)\sMB/s$'
+ - '^INTEGER\s+BatchRun\s+Triad:\s+?(?P<integer_triad>\d+\.\d+)\sMB/s$'
+ - '^INTEGER\s+BatchRun\s+AVERAGE:\s+?(?P<integer_average>\d+\.\d+)\sMB/s$'
+ - filename: Floatmem
+ grep:
+ - '^FL-POINT\s+BatchRun\s+Copy:\s+?(?P<float_copy>\d+\.\d+)\sMB/s$'
+ - '^FL-POINT\s+BatchRun\s+Scale:\s+?(?P<float_scale>\d+\.\d+)\sMB/s$'
+ - '^FL-POINT\s+BatchRun\s+Add:\s+?(?P<float_add>\d+\.\d+)\sMB/s$'
+ - '^FL-POINT\s+BatchRun\s+Triad:\s+?(?P<float_triad>\d+\.\d+)\sMB/s$'
+ - '^FL-POINT\s+BatchRun\s+AVERAGE:\s+?(?P<float_average>\d+\.\d+)\sMB/s$'
+ssl:
+ - filename: RSA_dump
+ grep:
+ - |-
+ ^rsa\s+512\sbits\s.+
+ ?(?P<rsa_sign_512>\d+\.\d)\s+
+ ?(?P<rsa_verify_512>\d+\.\d)$
+ - |-
+ ^rsa\s+1024\sbits\s.+
+ ?(?P<rsa_sign_1024>\d+\.\d)\s+
+ ?(?P<rsa_verify_1024>\d+\.\d)$
+ - |-
+ ^rsa\s+2048\sbits\s.+
+ ?(?P<rsa_sign_2048>\d+\.\d)\s+
+ ?(?P<rsa_verify_2048>\d+\.\d)$
+ - |-
+ ^rsa\s+4096\sbits\s.+
+ ?(?P<rsa_sign_4096>\d+\.\d)\s+
+ ?(?P<rsa_verify_4096>\d+\.\d)$
+ - filename: AES-128-CBC_dump
+ grep:
+ - |-
+ ^aes-128-cbc\s+
+ ?(?P<aes_128_cbc_16_bytes>\d+\.\w+)\s+
+ ?(?P<aes_128_cbc_64_bytes>\d+\.\w+)\s+
+ ?(?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+)$
+sysinfo:
+ - filename: top.log
+ grep:
+ - 'Cpu\(s\):.+?(?P<cpu_idle>\d+\.\d)\sid'
+ - filename: inxi.log
+ grep:
+ - '.+\s+Host:\s+(?P<hostname>.+)\sKernel'
+ - '.+\sMemory:\s+(?P<memory>.+MB)\s'
+ - '^CPU\(s\):\s+(?P<cpu>.+)'
+ - '.+\sDistro:\s+(?P<os>.+)'
+ - '.+\sKernel:\s+(?P<kernel>.+)\sConsole'
+ - '.+\s+HDD Total Size:\s+(?P<disk>.+)\s'
+ - '.+\sproduct:\s+(?P<product>.+)\sv' \ No newline at end of file
diff --git a/qtip/driver/ansible_api.py b/qtip/driver/ansible_api.py
new file mode 100644
index 00000000..5c5baffc
--- /dev/null
+++ b/qtip/driver/ansible_api.py
@@ -0,0 +1,58 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corp 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
+##############################################################################
+
+from collections import namedtuple
+
+from ansible.executor.playbook_executor import PlaybookExecutor
+from ansible.inventory import Inventory
+from ansible.parsing.dataloader import DataLoader
+from ansible.vars import VariableManager
+
+
+class AnsibleApi(object):
+
+ def __init__(self):
+ self.variable_manager = VariableManager()
+ self.loader = DataLoader()
+ self.passwords = {}
+ self.playbook_executor = None
+
+ def execute_playbook(self, playbook_path, hosts_file=None,
+ key_file=None, extra_vars=None):
+ inventory = Inventory(loader=self.loader,
+ variable_manager=self.variable_manager,
+ host_list=hosts_file)
+ Options = namedtuple('Options',
+ ['listtags', 'listtasks', 'listhosts', 'syntax',
+ 'connection', 'module_path', 'forks', 'remote_user',
+ 'private_key_file', 'ssh_common_args', 'ssh_extra_args',
+ 'sftp_extra_args', 'scp_extra_args', 'become',
+ 'become_method', 'become_user', 'verbosity', 'check'])
+ options = Options(listtags=False, listtasks=False, listhosts=False,
+ syntax=False, connection='ssh', module_path=None,
+ forks=100, remote_user='root', private_key_file=key_file,
+ ssh_common_args=None, ssh_extra_args=None, sftp_extra_args=None,
+ scp_extra_args=None, become=None, become_method=None,
+ become_user='root', verbosity=None, check=False)
+ self.variable_manager.extra_vars = extra_vars
+
+ self.playbook_executor = PlaybookExecutor(playbooks=[playbook_path],
+ inventory=inventory,
+ variable_manager=self.variable_manager,
+ loader=self.loader,
+ options=options,
+ passwords=self.passwords)
+ return self.playbook_executor.run()
+
+ def get_detail_playbook_stats(self):
+ if self.playbook_executor:
+ stats = self.playbook_executor._tqm._stats
+ return map(lambda x: (x, stats.summarize(x)), stats.processed.keys())
+ else:
+ return None
diff --git a/qtip/driver/ansible_driver.py b/qtip/driver/ansible_driver.py
new file mode 100644
index 00000000..34ef46ed
--- /dev/null
+++ b/qtip/driver/ansible_driver.py
@@ -0,0 +1,102 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corp 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
+##############################################################################
+
+from collections import defaultdict
+from os import path
+from operator import add
+
+from qtip.driver.ansible_api import AnsibleApi
+from qtip.util.env import AnsibleEnvSetup
+from qtip.util.logger import QtipLogger
+
+logger = QtipLogger('ansible_driver').get
+PLAYBOOK_DIR = path.join(path.dirname(__file__), 'playbook')
+
+
+class AnsibleDriver(object):
+ """driver for running performance tests with Ansible"""
+
+ def __init__(self, config={}):
+ self.config = config
+ self.env = AnsibleEnvSetup()
+ self.env_setup_flag = False
+
+ @staticmethod
+ def merge_two_dicts(x, y):
+ '''
+ It is from http://stackoverflow.com/questions/38987/
+ how-can-i-merge-two-python-dictionaries-in-a-single-expression
+ '''
+ z = x.copy()
+ z.update(y)
+ return z
+
+ def pre_run(self):
+ if self.env_setup_flag:
+ logger.info("Already setup environment......")
+ else:
+ logger.info("Starting to setup test environment...")
+ self.env.setup(self.config)
+ self.env_setup_flag = True
+ logger.info("Setup test enviroment, Done!")
+
+ def cleanup(self):
+ self.env.cleanup()
+
+ def run(self, metric_list, **kwargs):
+ if 'args' in self.config:
+ extra_vars = self.merge_two_dicts(kwargs, self.config['args'])
+ else:
+ extra_vars = kwargs
+ logger.info("extra_var: {0}".format(extra_vars))
+
+ tool_to_metrics = defaultdict(list)
+ for metric in metric_list:
+ if metric == 'dhrystone' or metric == 'whetstone':
+ tool_to_metrics['unixbench'].append(metric)
+ extra_vars[metric] = True
+ elif metric == 'ssl':
+ tool_to_metrics['openssl'].append(metric)
+ else:
+ tool_to_metrics[metric].append(metric)
+
+ result_list = map(lambda tool: self._run_metric(tool,
+ tool_to_metrics[tool],
+ extra_vars),
+ tool_to_metrics)
+ return False not in result_list
+
+ def _run_metric(self, tool, metrics, extra_vars):
+ logger.info('Using {0} to measure metrics {1}'.format(tool, metrics))
+
+ setup_pbook = "{0}/{1}/setup.yaml".format(PLAYBOOK_DIR, tool)
+ run_pbook = "{0}/{1}/run.yaml".format(PLAYBOOK_DIR, tool)
+ clean_pbook = "{0}/{1}/clean.yaml".format(PLAYBOOK_DIR, tool)
+
+ if self._run_ansible_playbook(setup_pbook, extra_vars):
+ self._run_ansible_playbook(run_pbook, extra_vars)
+ else:
+ logger.error("{0} is failed.".format(setup_pbook))
+
+ return self._run_ansible_playbook(clean_pbook, extra_vars)
+
+ def _run_ansible_playbook(self, pbook, extra_vars):
+ ansible_api = AnsibleApi()
+ logger.debug("Run {0} with extra_vars: {1}".format(pbook, extra_vars))
+ ansible_api.execute_playbook(pbook, self.env.hostfile,
+ self.env.keypair['private'], extra_vars)
+ playbook_stats = ansible_api.get_detail_playbook_stats()
+ logger.debug("playbook_stat: {0}".format(playbook_stats))
+ return self.is_pass(playbook_stats)
+
+ @staticmethod
+ def is_pass(stats):
+ return 0 == reduce(add,
+ map(lambda x: x[1]['failures'] + x[1]['unreachable'],
+ stats))
diff --git a/qtip/driver/playbook/bwn_ng.yaml b/qtip/driver/playbook/bwn_ng.yaml
index f79bb04e..c52cb14e 100644
--- a/qtip/driver/playbook/bwn_ng.yaml
+++ b/qtip/driver/playbook/bwn_ng.yaml
@@ -22,4 +22,4 @@
- name: Run bwm-ng
shell: bwm-ng -o plain -c 1 > bwm-dump.log
args:
- chdir: '{{ dest_path }}/' \ No newline at end of file
+ chdir: '{{ dest_path }}' \ No newline at end of file
diff --git a/qtip/driver/playbook/dhrystone/run.yaml b/qtip/driver/playbook/dhrystone/run.yaml
deleted file mode 100644
index 55de6597..00000000
--- a/qtip/driver/playbook/dhrystone/run.yaml
+++ /dev/null
@@ -1,63 +0,0 @@
-##############################################################################
-# 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
-##############################################################################
-
-- hosts: hosts
- become: yes
- remote_user: root
-
- tasks:
- - name: Get current timestamp
- set_fact:
- timestamp: "{{ lookup('pipe', 'date +%Y-%m-%d-%H-%M') }}"
-
- - name: Checking home directory
- shell: echo $HOME
- register: home_dir
-
- - name: Fetch hostname
- shell: hostname
- register: host_name
-
- - name: Make UnixBench
- shell: make --directory $HOME/tempT/UnixBench/
-
- - name: Make some directories needed
- file:
- path: '{{ home_dir.stdout }}/qtip_result/{{ timestamp }}/{{ host_name.stdout }}'
- state: directory
-
- - include: ../inxi.yaml
-
- - include: ../top.yaml
-
- - name: Run dhrystone
- shell: ./Run -v dhrystone
- args:
- chdir: '{{ home_dir.stdout }}/tempT/UnixBench/'
-
- - name: Copying result to qtip result directory
- shell: cp -r $HOME/tempT/UnixBench/results/* ./
- args:
- chdir: '{{ home_dir.stdout }}/qtip_result/{{ timestamp }}/{{ host_name.stdout }}'
-
- - name: Copy top log to qtip result directory
- shell: mv $HOME/qtip_result/top.log ./
- args:
- chdir: '{{ home_dir.stdout }}/qtip_result/{{ timestamp }}/{{ host_name.stdout }}'
-
- - name: Copy inxi log to qtip result directory
- shell: mv $HOME/qtip_result/inxi.log ./
- args:
- chdir: '{{ home_dir.stdout }}/qtip_result/{{ timestamp }}/{{ host_name.stdout }}'
-
- - name: Fetch result files to local manchine
- synchronize:
- mode: pull
- src: '{{ home_dir.stdout }}/qtip_result/'
- dest: '{{ result_dir }}/dhrystone/logs/'
diff --git a/qtip/driver/playbook/dpi/run.yaml b/qtip/driver/playbook/dpi/run.yaml
index 58f7eb2f..f4c8c457 100644
--- a/qtip/driver/playbook/dpi/run.yaml
+++ b/qtip/driver/playbook/dpi/run.yaml
@@ -12,22 +12,18 @@
remote_user: root
tasks:
- - name: Get current timestamp
- set_fact:
- timestamp: "{{ lookup('pipe', 'date +%Y-%m-%d-%H-%M') }}"
-
- name: Make some directories needed
file:
- path: '{{ ansible_env.HOME }}/qtip_result/{{ timestamp }}/{{ ansible_hostname }}'
+ path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dpi/'
state: directory
- include: ../inxi.yaml
vars:
- dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ timestamp }}/{{ ansible_hostname }}'
+ dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dpi/'
- include: ../top.yaml
vars:
- dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ timestamp }}/{{ ansible_hostname }}'
+ dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dpi/'
- name: Run nDPI benchmark
shell: ./dpi_average.sh
@@ -37,10 +33,10 @@
- name: Copying result and system info to qtip result directory
command: cp $HOME/tempD/nDPI/example/dpi_dump.txt ./
args:
- chdir: '{{ ansible_env.HOME }}/qtip_result/{{ timestamp }}/{{ ansible_hostname }}'
+ chdir: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dpi/'
- name: Fetch result files to local manchine
synchronize:
mode: pull
src: '{{ ansible_env.HOME }}/qtip_result/'
- dest: '{{ result_dir }}/dpi/logs/'
+ dest: '{{ result_dir }}/'
diff --git a/qtip/driver/playbook/dpi/setup.yaml b/qtip/driver/playbook/dpi/setup.yaml
index c1b45450..76e62e6d 100644
--- a/qtip/driver/playbook/dpi/setup.yaml
+++ b/qtip/driver/playbook/dpi/setup.yaml
@@ -14,7 +14,7 @@
tasks:
- name: Making Dpi directory
file:
- path: '{{ result_dir }}/dpi/logs/'
+ path: '{{ result_dir }}/'
state: directory
- hosts: hosts
diff --git a/qtip/driver/playbook/inxi.yaml b/qtip/driver/playbook/inxi.yaml
index a06da042..2a4d9b3f 100644
--- a/qtip/driver/playbook/inxi.yaml
+++ b/qtip/driver/playbook/inxi.yaml
@@ -22,4 +22,4 @@
- name: Run inxi
shell: inxi -b -c0 -n > inxi.log
args:
- chdir: '{{ dest_path }}/'
+ chdir: '{{ dest_path }}'
diff --git a/qtip/driver/playbook/openssl/clean.yaml b/qtip/driver/playbook/openssl/clean.yaml
new file mode 100644
index 00000000..0139ba54
--- /dev/null
+++ b/qtip/driver/playbook/openssl/clean.yaml
@@ -0,0 +1,23 @@
+##############################################################################
+# 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
+##############################################################################
+
+- hosts: hosts
+ become: yes
+ remote_user: root
+
+ tasks:
+ - name: Cleaning Open_SSL
+ file:
+ path: '{{ ansible_env.HOME }}/Open_SSL'
+ state: absent
+
+ - name: Cleaning qtip_result
+ file:
+ path: '{{ ansible_env.HOME }}/qtip_result'
+ state: absent
diff --git a/qtip/driver/playbook/openssl/run.yaml b/qtip/driver/playbook/openssl/run.yaml
new file mode 100644
index 00000000..db923fed
--- /dev/null
+++ b/qtip/driver/playbook/openssl/run.yaml
@@ -0,0 +1,45 @@
+##############################################################################
+# 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
+##############################################################################
+
+- hosts: hosts
+ become: yes
+ remote_user: root
+
+ tasks:
+ - name: Make some directories needed
+ file:
+ path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ssl/'
+ state: directory
+
+ - include: ../inxi.yaml
+ vars:
+ dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ssl/'
+
+ - include: ../top.yaml
+ vars:
+ dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ssl/'
+
+ - name: Benchmarking RSA signatures and AES-128-cbc cipher encryption throughput
+ shell: '{{ item }}'
+ with_items:
+ - ./openssl speed rsa >> RSA_dump
+ - ./openssl speed -evp aes-128-cbc >> AES-128-CBC_dump
+ args:
+ chdir: '{{ ansible_env.HOME }}/Open_SSL/openssl-1.0.2f/apps'
+
+ - name: Copying result to qtip result directory
+ shell: cp ~/Open_SSL/openssl-1.0.2f/apps/*_dump ./
+ args:
+ chdir: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ssl/'
+
+ - name: Fetch result files to local manchine
+ synchronize:
+ mode: pull
+ src: '{{ ansible_env.HOME }}/qtip_result/'
+ dest: '{{ result_dir }}/'
diff --git a/qtip/driver/playbook/openssl/setup.yaml b/qtip/driver/playbook/openssl/setup.yaml
new file mode 100644
index 00000000..3a6f385a
--- /dev/null
+++ b/qtip/driver/playbook/openssl/setup.yaml
@@ -0,0 +1,87 @@
+##############################################################################
+# 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
+##############################################################################
+
+- hosts: localhost
+ connection: local
+ gather_facts: no
+
+ tasks:
+ - name: Making ssl directory
+ file:
+ path: '{{ result_dir }}/'
+ state: directory
+
+- hosts: hosts
+ become: yes
+ remote_user: root
+
+ tasks:
+ - name: Cleaning Open_SSL directory
+ file:
+ path: '{{ ansible_env.HOME }}/Open_SSL'
+ state: absent
+
+ - name: Cleaning qtip_result directory
+ file:
+ path: '{{ ansible_env.HOME }}/qtip_result'
+ state: absent
+
+ - include: ../prepare_env.yaml
+
+ - name: Installing UnixBench dependencies if CentOS
+ yum:
+ name: '{{ item }}'
+ state: present
+ when: ansible_os_family == "RedHat"
+ with_items:
+ - git
+ - gcc
+ - patch
+ - perl-Time-HiRes
+ - wget
+ - autofconf
+ - automake
+ - libpcap-devel
+ - libtool
+
+ - name: Installing UnixBench dependencies if Ubuntu
+ apt:
+ name: '{{ item }}'
+ state: present
+ when: ansible_os_family == "Debian"
+ with_items:
+ - git
+ - gcc
+ - patch
+ - perl
+ - wget
+ - autoconf
+ - automake
+ - libpcap-dev
+ - libtool
+
+ - name: Make Open_SSL directory
+ file:
+ path: '{{ ansible_env.HOME }}/Open_SSL'
+ state: directory
+
+ - name: Untar OpenSSL
+ unarchive:
+ src: http://artifacts.opnfv.org/qtip/utilities/openssl-1.0.2f.tar.gz
+ dest: '{{ ansible_env.HOME }}/Open_SSL/'
+ remote_src: True
+
+ - name: Configure && Make && Install OpenSSL
+ shell: "{{ item }}"
+ with_items:
+ - ./config
+ - make
+ - make install
+ args:
+ chdir: '{{ ansible_env.HOME }}/Open_SSL/openssl-1.0.2f' \ No newline at end of file
diff --git a/qtip/driver/playbook/ramspeed/clean.yaml b/qtip/driver/playbook/ramspeed/clean.yaml
new file mode 100644
index 00000000..f0188159
--- /dev/null
+++ b/qtip/driver/playbook/ramspeed/clean.yaml
@@ -0,0 +1,23 @@
+##############################################################################
+# 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
+##############################################################################
+
+- hosts: hosts
+ become: yes
+ remote_user: root
+
+ tasks:
+ - name: Cleaning ramspeed
+ file:
+ path: '{{ ansible_env.HOME }}/ramspeed'
+ state: absent
+
+ - name: Cleaning qtip_result
+ file:
+ path: '{{ ansible_env.HOME }}/qtip_result'
+ state: absent
diff --git a/qtip/driver/playbook/ramspeed/run.yaml b/qtip/driver/playbook/ramspeed/run.yaml
new file mode 100644
index 00000000..496cd5db
--- /dev/null
+++ b/qtip/driver/playbook/ramspeed/run.yaml
@@ -0,0 +1,40 @@
+##############################################################################
+# 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
+##############################################################################
+
+- hosts: hosts
+ become: yes
+ remote_user: root
+
+ tasks:
+ - name: Make some directories needed
+ file:
+ path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ramspeed/'
+ state: directory
+
+ - include: ../inxi.yaml
+ vars:
+ dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ramspeed/'
+
+ - include: ../top.yaml
+ vars:
+ dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ramspeed/'
+
+ - name: Benchmarking IntMem Bandwidth and FloatMem Bandwidth
+ shell: '{{ item }}'
+ with_items:
+ - ~/ramspeed/ramsmp-3.5.0/ramsmp -b 3 -l 5 -p 1 >> Intmem
+ - ~/ramspeed/ramsmp-3.5.0/ramsmp -b 6 -l 5 -p 1 >> Floatmem
+ args:
+ chdir: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ramspeed/'
+
+ - name: Fetch result files to local manchine
+ synchronize:
+ mode: pull
+ src: '{{ ansible_env.HOME }}/qtip_result/'
+ dest: '{{ result_dir }}/'
diff --git a/qtip/driver/playbook/ramspeed/setup.yaml b/qtip/driver/playbook/ramspeed/setup.yaml
new file mode 100644
index 00000000..842bbda2
--- /dev/null
+++ b/qtip/driver/playbook/ramspeed/setup.yaml
@@ -0,0 +1,70 @@
+##############################################################################
+# 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
+##############################################################################
+
+- hosts: localhost
+ connection: local
+ gather_facts: no
+
+ tasks:
+ - name: Making ramspeed directory
+ file:
+ path: '{{ result_dir }}/'
+ state: directory
+
+- hosts: hosts
+ become: yes
+ remote_user: root
+
+ tasks:
+ - name: Cleaning ramspeed directory
+ file:
+ path: '{{ ansible_env.HOME }}/ramspeed'
+ state: absent
+
+ - name: Cleaning qtip_result directory
+ file:
+ path: '{{ ansible_env.HOME }}/qtip_result'
+ state: absent
+
+ - include: ../prepare_env.yaml
+
+ - name: Installing RAM_Speed dependencies if CentOS
+ yum:
+ name: '{{ item }}'
+ state: present
+ when: ansible_os_family == "RedHat"
+ with_items:
+ - gcc
+ - wget
+
+ - name: Installing RAM_Speed dependencies if Ubuntu
+ apt:
+ name: '{{ item }}'
+ state: present
+ when: ansible_os_family == "Debian"
+ with_items:
+ - gcc
+ - wget
+
+ - name: Making ramspeed temporary directory
+ file:
+ path: '{{ ansible_env.HOME }}/ramspeed'
+ state: directory
+
+ - name: Fetch and untar ramspeed.tar.gz
+ unarchive:
+ # TODO: Need to upload this file to http://artifacts.opnfv.org/qtip/utilities
+ src: https://docs.google.com/uc?id=0B92Bp5LZTM7gRFctalZLMktTNDQ
+ dest: '{{ ansible_env.HOME }}/ramspeed/'
+ remote_src: True
+
+ - name: Build ramsmp
+ shell: ./build.sh
+ args:
+ chdir: '{{ ansible_env.HOME }}/ramspeed/ramsmp-3.5.0'
diff --git a/qtip/driver/playbook/top.yaml b/qtip/driver/playbook/top.yaml
index 64584338..dfa0aff2 100644
--- a/qtip/driver/playbook/top.yaml
+++ b/qtip/driver/playbook/top.yaml
@@ -9,4 +9,4 @@
- name: Collect cpu usage
shell: top -bn1 > top.log
args:
- chdir: '{{ dest_path }}/'
+ chdir: '{{ dest_path }}'
diff --git a/qtip/driver/playbook/dhrystone/clean.yaml b/qtip/driver/playbook/unixbench/clean.yaml
index 72bfab7e..a7cb2540 100644
--- a/qtip/driver/playbook/dhrystone/clean.yaml
+++ b/qtip/driver/playbook/unixbench/clean.yaml
@@ -1,6 +1,6 @@
##############################################################################
# Copyright (c) 2017 ZTE Corporation and others.
-#
+# zhihui.wu1@zte.com.cn
# 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
@@ -12,16 +12,14 @@
remote_user: root
tasks:
- - name: Checking home directory
- shell: echo $HOME
- register: home_dir
-
- name: Cleaning tempT
file:
- path: '{{ home_dir.stdout }}/tempT'
+ path: '{{ ansible_env.HOME }}/tempT'
state: absent
- name: Cleaning qtip_result
file:
- path: '{{ home_dir.stdout }}/qtip_result'
+ path: '{{ ansible_env.HOME }}/qtip_result'
state: absent
+
+
diff --git a/qtip/driver/playbook/unixbench/dhrystone.yaml b/qtip/driver/playbook/unixbench/dhrystone.yaml
new file mode 100644
index 00000000..a0ee89a3
--- /dev/null
+++ b/qtip/driver/playbook/unixbench/dhrystone.yaml
@@ -0,0 +1,41 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corporation and others.
+# zhihui.wu1@zte.com.cn
+# 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: Make dhrystone directories
+ file:
+ path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dhrystone/'
+ state: directory
+
+- include: ../inxi.yaml
+ vars:
+ dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dhrystone/'
+
+- include: ../top.yaml
+ vars:
+ dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dhrystone/'
+
+- name: Run dhrystone
+ shell: ./Run -v dhrystone
+ args:
+ chdir: '{{ ansible_env.HOME }}/tempT/UnixBench/'
+
+- name: Copying result to qtip result directory
+ shell: '{{ item }}'
+ with_items:
+ - mv ~/tempT/UnixBench/results/*.log ./
+ - mv ~/tempT/UnixBench/results/*.html ./
+ - mv ~/tempT/UnixBench/results/* ./dhrystone
+ args:
+ chdir: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dhrystone/'
+
+- name: Fetch dhrystone result files to local manchine
+ synchronize:
+ mode: pull
+ src: '{{ ansible_env.HOME }}/qtip_result/'
+ dest: '{{ result_dir }}/'
diff --git a/qtip/driver/playbook/unixbench/run.yaml b/qtip/driver/playbook/unixbench/run.yaml
new file mode 100644
index 00000000..fbe4d4ad
--- /dev/null
+++ b/qtip/driver/playbook/unixbench/run.yaml
@@ -0,0 +1,23 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corporation and others.
+# zhihui.wu1@zte.com.cn
+# 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
+##############################################################################
+
+- hosts: hosts
+ become: yes
+ remote_user: root
+
+ tasks:
+ - set_fact:
+ is_dhrystone: "{{ dhrystone | default(False) }}"
+ is_whetstone: "{{ whetstone | default(False) }}"
+
+ - include: ./dhrystone.yaml
+ when: "{{ is_dhrystone }}"
+
+ - include: ./whetstone.yaml
+ when: "{{ is_whetstone }}" \ No newline at end of file
diff --git a/qtip/driver/playbook/dhrystone/setup.yaml b/qtip/driver/playbook/unixbench/setup.yaml
index 430670c1..4b9b5240 100644
--- a/qtip/driver/playbook/dhrystone/setup.yaml
+++ b/qtip/driver/playbook/unixbench/setup.yaml
@@ -1,11 +1,11 @@
-##############################################################################
+#############################################################################
# Copyright (c) 2017 ZTE Corporation and others.
-#
+# zhihui.wu1@zte.com.cn
# 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
-##############################################################################
+#############################################################################
- hosts: localhost
connection: local
@@ -14,7 +14,7 @@
tasks:
- name: Making dhrystone directory
file:
- path: '{{ result_dir }}/dhrystone/logs/'
+ path: '{{ result_dir }}/'
state: directory
- hosts: hosts
@@ -22,18 +22,14 @@
remote_user: root
tasks:
- - name: Checking home directory
- shell: echo $HOME
- register: home_dir
-
- name: Cleaning tempT directory
file:
- path: '{{ home_dir.stdout }}/tempT'
+ path: '{{ ansible_env.HOME }}/tempT'
state: absent
- name: Cleaning qtip_result directory
file:
- path: '{{ home_dir.stdout }}/qtip_result'
+ path: '{{ ansible_env.HOME }}/qtip_result'
state: absent
- include: ../prepare_env.yaml
@@ -60,7 +56,10 @@
- patch
- perl
- - name: Clone unixbench
+ - name: Clone UnixBench
git:
repo: https://github.com/kdlucas/byte-unixbench.git
- dest: '{{ home_dir.stdout }}/tempT'
+ dest: '{{ ansible_env.HOME }}/tempT/'
+
+ - name: Make UnixBench
+ shell: make --directory $HOME/tempT/UnixBench/ \ No newline at end of file
diff --git a/qtip/driver/playbook/unixbench/whetstone.yaml b/qtip/driver/playbook/unixbench/whetstone.yaml
new file mode 100644
index 00000000..c753779f
--- /dev/null
+++ b/qtip/driver/playbook/unixbench/whetstone.yaml
@@ -0,0 +1,41 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corporation and others.
+# zhihui.wu1@zte.com.cn
+# 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: Make whetstone directories
+ file:
+ path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/whetstone/'
+ state: directory
+
+- include: ../inxi.yaml
+ vars:
+ dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/whetstone/'
+
+- include: ../top.yaml
+ vars:
+ dest_path: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/whetstone/'
+
+- name: Run whetstone
+ shell: ./Run -v whetstone
+ args:
+ chdir: '{{ ansible_env.HOME }}/tempT/UnixBench/'
+
+- name: Copying result to qtip result directory
+ shell: '{{ item }}'
+ with_items:
+ - mv ~/tempT/UnixBench/results/*.log ./
+ - mv ~/tempT/UnixBench/results/*.html ./
+ - mv ~/tempT/UnixBench/results/* ./whetstone
+ args:
+ chdir: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/whetstone/'
+
+- name: Fetch whetstone result files to local manchine
+ synchronize:
+ mode: pull
+ src: '{{ ansible_env.HOME }}/qtip_result/'
+ dest: '{{ result_dir }}/'
diff --git a/qtip/runner/runner.py b/qtip/runner/runner.py
new file mode 100644
index 00000000..8bdbfb78
--- /dev/null
+++ b/qtip/runner/runner.py
@@ -0,0 +1,107 @@
+##############################################################################
+# Copyright (c) 2017 ZTE corp. 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
+##############################################################################
+import argparse
+import json
+import os
+from os import path
+import sys
+import time
+
+from qtip.collector.parser import grep
+from qtip.driver.ansible_driver import AnsibleDriver
+from qtip.util.logger import QtipLogger
+
+logger = QtipLogger('runner').get
+
+ALL_BENCHMARKS = ['dpi', 'ramspeed', 'ssl', 'dhrystone', 'whetstone']
+
+
+def parse_args(args):
+ parser = argparse.ArgumentParser()
+ parser.add_argument('-d', '--dest', required=True,
+ help='the destination where results will be stored.')
+ parser.add_argument('-b', '--benchmark', required=True, action='append',
+ help='the benchmark you want to execute.')
+ return parser.parse_args(args)
+
+
+def run_benchmark(result_dir, benchmarks):
+ if not path.isdir(result_dir):
+ os.makedirs(result_dir)
+ driver = AnsibleDriver({'args': {'result_dir': result_dir}})
+ driver.pre_run()
+ result = driver.run(benchmarks)
+ driver.cleanup()
+ return result
+
+
+def generate_report(result_dir, start_time, stop_time):
+ output = {
+ "plan_name": "compute_qpi",
+ "start_time": start_time,
+ "stop_time": stop_time,
+ "sut": []
+ }
+ output.update(parse_result(result_dir))
+ output.update({'stop_time': stop_time})
+ with open('{0}/result.json'.format(result_dir), 'w+') as f:
+ json.dump(output, f, indent=4, sort_keys=True)
+
+
+def parse_result(result_dir):
+ sut_template = {'sut': []}
+ nodes_list = os.listdir(result_dir)
+ for node in nodes_list:
+ node_output_template = {
+ 'name': node,
+ 'type': 'baremetal',
+ 'qpis': []
+ }
+ qpi_result = {'name': 'compute_qpi', 'benchmarks': []}
+ for benchmark in os.listdir('{0}/{1}'.format(result_dir, node)):
+ benchmark_result = \
+ grep.parse_benchmark_result(
+ '{0}/{1}/{2}'.format(result_dir, node, benchmark))
+ qpi_result['benchmarks'].append(benchmark_result)
+ node_output_template['qpis'].append(qpi_result)
+ sut_template['sut'].append(node_output_template)
+ return sut_template
+
+
+def main(args=sys.argv[1:]):
+ args = parse_args(args)
+
+ if not path.isdir(str(args.dest)):
+ logger.error("The destination {0} you give doesn't exist. "
+ "Please check!".format(args.dest))
+ sys.exit(1)
+
+ if args.benchmark == ['all']:
+ args.benchmark = ALL_BENCHMARKS
+ elif len(set(args.benchmark).difference(ALL_BENCHMARKS)) != 0:
+ logger.error("Please check benchmarks name. The supported benchmarks are"
+ "{0}".format(ALL_BENCHMARKS))
+ logger.info("Start to run benchmark test: {0}.".format(args.benchmark))
+
+ start_time = time.strftime("%Y-%m-%d-%H-%M")
+ logger.info("start_time: {0}".format(start_time))
+ if not args.dest.endswith('/'):
+ args.dest += '/'
+ result_dir = args.dest + start_time
+ ansible_result = run_benchmark(result_dir, args.benchmark)
+ stop_time = time.strftime("%Y-%m-%d-%H-%M")
+ logger.info("stop_time: {0}".format(stop_time))
+ if not ansible_result:
+ logger.error("Bechmarks run failed. Cann't generate any report.")
+ sys.exit(1)
+ generate_report(result_dir, start_time, stop_time)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/qtip/scripts/cleanup_creds.sh b/qtip/scripts/cleanup_creds.sh
new file mode 100755
index 00000000..1a7ddc1a
--- /dev/null
+++ b/qtip/scripts/cleanup_creds.sh
@@ -0,0 +1,20 @@
+#! /bin/bash
+##############################################################################
+# Copyright (c) 2017 ZTE corp. 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
+##############################################################################
+
+DEST_IP=$1
+PRIVATE_KEY=$2
+HOSTNAME=$(hostname)
+sshoptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
+
+case "$INSTALLER_TYPE" in
+ fuel)
+ ssh $sshoptions -i $PRIVATE_KEY root@$DEST_IP "sed -i '/root@$HOSTNAME/d' /root/.ssh/authorized_keys"
+ ;;
+esac
diff --git a/qtip/util/env.py b/qtip/util/env.py
index 24e08658..ab9ffa7a 100644
--- a/qtip/util/env.py
+++ b/qtip/util/env.py
@@ -16,6 +16,10 @@ import time
import paramiko
+from qtip.util.logger import QtipLogger
+
+logger = QtipLogger('env').get
+
SCRIPT_DIR = path.join(path.dirname(__file__), path.pardir, 'scripts')
KEYNAME = 'QtipKey'
PRIVATE_KEY = '{0}/qtip/{1}'.format(os.environ['HOME'], KEYNAME)
@@ -29,25 +33,25 @@ def all_files_exist(*files):
flag = True
for f_item in files:
flag &= path.isfile(f_item)
- print("Is {0} existed: {1}".format(f_item, flag))
+ logger.info("Is {0} existed: {1}".format(f_item, flag))
return flag
def clean_file(*files):
if len(files) == 0:
- print('Nothing to clean')
+ logger.info('Nothing to clean')
return False
def clean(f):
try:
if all_files_exist(f):
os.remove(f)
- print("Removed: {0}".format(f))
+ logger.info("Removed: {0}".format(f))
else:
- print("Not exists: {0}".format(f))
+ logger.info("Not exists: {0}".format(f))
return True
except OSError as error:
- print("Not able to Remove: {0}".format(f), error)
+ logger.error("Not able to Remove: {0}".format(f), error)
return False
results = map(clean, files)
@@ -74,7 +78,7 @@ class AnsibleEnvSetup(object):
self.pass_keypair_to_remote()
self.check_hosts_ssh_connectivity()
except Exception as error:
- print(error)
+ logger.info(error)
sys.exit(1)
def check_keypair(self, keypair):
@@ -88,10 +92,9 @@ class AnsibleEnvSetup(object):
def generate_default_keypair(self):
if not all_files_exist(PRIVATE_KEY, PUBLIC_KEY):
- print("Generate default keypair {0} under "
- "{1}".format(KEYNAME, os.environ['HOME']))
- cmd = '''ssh-keygen -t rsa -N "" -f {0} -q -b 2048'''.format(
- PRIVATE_KEY)
+ logger.info("Generate default keypair {0} under "
+ "{1}".format(KEYNAME, os.environ['HOME']))
+ cmd = '''ssh-keygen -t rsa -N "" -f {0} -q -b 2048'''.format(PRIVATE_KEY)
os.system(cmd)
self.keypair['private'] = PRIVATE_KEY
self.keypair['public'] = PUBLIC_KEY
@@ -110,10 +113,10 @@ class AnsibleEnvSetup(object):
time.sleep(2)
ssh_cmd = '%s/qtip_creds.sh %s %s' % (SCRIPT_DIR, ip, private_key)
os.system(ssh_cmd)
- print('Pass keypair to remote hosts {0} successfully'.format(ip))
+ logger.info('Pass keypair to remote hosts {0} successfully'.format(ip))
return True
except Exception as error:
- print(error)
+ logger.error(error)
return False
def check_hostfile(self, hostfile):
@@ -128,8 +131,8 @@ class AnsibleEnvSetup(object):
# check whether the file is already existed
self.check_hostfile(HOST_FILE)
except Exception:
- print("Generate default hostfile {0} under "
- "{1}".format(HOST_FILE, os.environ['HOME']))
+ logger.info("Generate default hostfile {0} under "
+ "{1}".format(HOST_FILE, os.environ['HOME']))
self._generate_hostfile_via_installer()
def _generate_hostfile_via_installer(self):
@@ -152,11 +155,11 @@ class AnsibleEnvSetup(object):
def fetch_host_ip_from_hostfile(self):
self.host_ip_list = []
- print('Fetch host ips from hostfile...')
+ logger.info('Fetch host ips from hostfile...')
with open(self.hostfile, 'r') as f:
self.host_ip_list = re.findall('\d+.\d+.\d+.\d+', f.read())
if self.host_ip_list:
- print("The remote compute nodes: {0}".format(self.host_ip_list))
+ logger.info("The remote compute nodes: {0}".format(self.host_ip_list))
else:
raise ValueError("The hostfile doesn't include host ip addresses.")
@@ -168,7 +171,7 @@ class AnsibleEnvSetup(object):
@staticmethod
def _ssh_is_ok(ip, private_key, attempts=100):
- print('Check hosts {0} ssh connectivity...'.format(ip))
+ logger.info('Check hosts {0} ssh connectivity...'.format(ip))
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(ip, key_filename=private_key)
@@ -177,11 +180,28 @@ class AnsibleEnvSetup(object):
try:
stdin, stdout, stderr = ssh.exec_command('uname')
if not stderr.readlines():
- print("{0}: SSH test successful.".format(ip))
+ logger.info("{0}: SSH test successful.".format(ip))
return True
except socket.error:
- print("%s times ssh test......failed." % str(attempt + 1))
+ logger.debug("%s times ssh test......failed." % str(attempt + 1))
if attempt == (attempts - 1):
return False
time.sleep(2)
return False
+
+ def cleanup(self):
+ CI_DEBUG = os.getenv('CI_DEBUG')
+
+ if CI_DEBUG is not None and CI_DEBUG.lower() == 'true':
+ logger.info("DEBUG Mode: please do cleanup by manual.")
+ else:
+ for ip in self.host_ip_list:
+ logger.info("Cleanup authorized_keys from {0}...".format(ip))
+ cmd = 'bash {0}/cleanup_creds.sh {1} {2}'.format(
+ SCRIPT_DIR, ip, self.keypair['private'])
+ os.system(cmd)
+
+ logger.info("Cleanup hostfile and keypair.")
+ clean_file(self.hostfile,
+ self.keypair['private'],
+ self.keypair['public'])
diff --git a/requirements.txt b/requirements.txt
index c51228f2..d00b3cf1 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,3 +4,5 @@ paramiko
connexion
numpy
pbr
+ConfigParser
+prettytable
diff --git a/setup.cfg b/setup.cfg
index 5b9b9567..23103fc5 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -14,11 +14,15 @@ setup-hooks =
[entry_points]
console_scripts =
qtip = qtip.cli.entry:cli
- # TODO(akhil) add qtip-api
+ qtip-api = qtip.api.__main__:main
[files]
packages =
qtip
+ benchmarks
+package_data =
+ benchmarks =
+ plan/*.*
data_files =
opt/qtip = opt/*
diff --git a/tests/data/benchmarks/plan/compute.yaml b/tests/data/benchmarks/plan/compute.yaml
index 8529d8dc..f4a7a2dc 100644
--- a/tests/data/benchmarks/plan/compute.yaml
+++ b/tests/data/benchmarks/plan/compute.yaml
@@ -16,6 +16,80 @@ config:
collectors:
- type: logfile
paths:
+ - '../../external/dpi/'
+ logs:
+ - filename: dpi_dump.txt
+ parsers:
+ - type: grep
+ regex: |-
+ ^\s+nDPI throughput:.+?(?P<pps>\d+.\d+)\sM\spps.+
+ ?(?P<bps>\d+.\d+)\sGb\/sec
+ - type: logfile
+ paths:
+ - '../../external/ramspeed/'
+ logs:
+ - filename: Intmem
+ parsers:
+ - type: grep
+ regex: '^INTEGER\s+BatchRun\s+Copy:\s+?(?P<integer_copy>\d+\.\d+)\sMB/s$'
+ - type: grep
+ regex: '^INTEGER\s+BatchRun\s+Scale:\s+?(?P<integer_scale>\d+\.\d+)\sMB/s$'
+ - type: grep
+ regex: '^INTEGER\s+BatchRun\s+Add:\s+?(?P<integer_add>\d+\.\d+)\sMB/s$'
+ - type: grep
+ regex: '^INTEGER\s+BatchRun\s+Triad:\s+?(?P<integer_triad>\d+\.\d+)\sMB/s$'
+ - type: grep
+ regex: '^INTEGER\s+BatchRun\s+AVERAGE:\s+?(?P<integer_average>\d+\.\d+)\sMB/s$'
+ - filename: Floatmem
+ parsers:
+ - type: grep
+ regex: '^FL-POINT\s+BatchRun\s+Copy:\s+?(?P<float_copy>\d+\.\d+)\sMB/s$'
+ - type: grep
+ regex: '^FL-POINT\s+BatchRun\s+Scale:\s+?(?P<float_scale>\d+\.\d+)\sMB/s$'
+ - type: grep
+ regex: '^FL-POINT\s+BatchRun\s+Add:\s+?(?P<float_add>\d+\.\d+)\sMB/s$'
+ - type: grep
+ regex: '^FL-POINT\s+BatchRun\s+Triad:\s+?(?P<float_triad>\d+\.\d+)\sMB/s$'
+ - type: grep
+ regex: '^FL-POINT\s+BatchRun\s+AVERAGE:\s+?(?P<float_average>\d+\.\d+)\sMB/s$'
+ - type: logfile
+ paths:
+ - '../../external/ssl/'
+ logs:
+ - filename: RSA_dump
+ parsers:
+ - type: grep
+ regex: |-
+ ^rsa\s+512\sbits\s.+
+ ?(?P<rsa_sign_512>\d+\.\d)\s+
+ ?(?P<rsa_verify_512>\d+\.\d)$
+ - type: grep
+ regex: |-
+ ^rsa\s+1024\sbits\s.+
+ ?(?P<rsa_sign_1024>\d+\.\d)\s+
+ ?(?P<rsa_verify_1024>\d+\.\d)$
+ - type: grep
+ regex: |-
+ ^rsa\s+2048\sbits\s.+
+ ?(?P<rsa_sign_2048>\d+\.\d)\s+
+ ?(?P<rsa_verify_2048>\d+\.\d)$
+ - type: grep
+ regex: |-
+ ^rsa\s+4096\sbits\s.+
+ ?(?P<rsa_sign_4096>\d+\.\d)\s+
+ ?(?P<rsa_verify_4096>\d+\.\d)$
+ - filename: AES-128-CBC_dump
+ parsers:
+ - type: grep
+ regex: |-
+ ^aes-128-cbc\s+
+ ?(?P<aes_128_cbc_16_bytes>\d+\.\w+)\s+
+ ?(?P<aes_128_cbc_64_bytes>\d+\.\w+)\s+
+ ?(?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+)$
+ - type: logfile
+ paths:
- '../../external/sysinfo'
logs:
- filename: top.log
diff --git a/tests/data/external/dpi/dpi_dump.txt b/tests/data/external/dpi/dpi_dump.txt
new file mode 100644
index 00000000..1f4e2839
--- /dev/null
+++ b/tests/data/external/dpi/dpi_dump.txt
@@ -0,0 +1,809 @@
+-----------------------------------------------------------
+* NOTE: This is demo app to show *some* nDPI features.
+* In this demo we have implemented only some basic features
+* just to show you what you can do with the library. Feel
+* free to extend it and send us the patches for inclusion
+------------------------------------------------------------
+
+Using nDPI (1.8.0-dev-707-6a27b62) [1 thread(s)]
+Reading packets from pcap file test.pcap...
+Running thread 0...
+
+nDPI Memory statistics:
+ nDPI Memory (once): 110.55 KB
+ Flow Memory (per flow): 1.95 KB
+ Actual Memory: 3.46 MB
+ Peak Memory: 3.46 MB
+
+Traffic statistics:
+ Ethernet bytes: 75948198 (includes ethernet CRC/IFC/trailer)
+ Discarded bytes: 55256
+ IP packets: 60265 of 61155 packets total
+ IP bytes: 74501838 (avg pkt size 1218 bytes)
+ Unique flows: 545
+ TCP Packets: 21188
+ UDP Packets: 39042
+ VLAN Packets: 0
+ MPLS Packets: 0
+ PPPoE Packets: 0
+ Fragmented Packets: 4
+ Max Packet size: 64260
+ Packet Len < 64: 30624
+ Packet Len 64-128: 1158
+ Packet Len 128-256: 674
+ Packet Len 256-1024: 817
+ Packet Len 1024-1500: 21924
+ Packet Len > 1500: 5068
+ nDPI throughput: 1.56 M pps / 14.62 Gb/sec
+ Traffic throughput: 228.03 pps / 2.19 Mb/sec
+ Traffic duration: 264.290 sec
+ Guessed flow protos: 9
+
+
+Detected protocols:
+ Unknown packets: 6126 bytes: 10913415 flows: 46
+ FTP_CONTROL packets: 42 bytes: 4384 flows: 1
+ DNS packets: 66 bytes: 6520 flows: 23
+ IPP packets: 46 bytes: 12059 flows: 1
+ HTTP packets: 377 bytes: 113616 flows: 24
+ MDNS packets: 43 bytes: 11742 flows: 9
+ NetBIOS packets: 48 bytes: 4754 flows: 12
+ SSDP packets: 101 bytes: 32533 flows: 21
+ DHCP packets: 21 bytes: 7346 flows: 2
+ BitTorrent packets: 37639 bytes: 29656716 flows: 65
+ ICMP packets: 15 bytes: 4956 flows: 5
+ IGMP packets: 10 bytes: 600 flows: 9
+ SSL packets: 1199 bytes: 622508 flows: 24
+ ICMPV6 packets: 2 bytes: 172 flows: 2
+ DHCPV6 packets: 1 bytes: 144 flows: 1
+ Facebook packets: 349 bytes: 206444 flows: 21
+ Twitter packets: 137 bytes: 45679 flows: 8
+ Dropbox packets: 155 bytes: 45358 flows: 12
+ GMail packets: 35 bytes: 10470 flows: 3
+ YouTube packets: 11721 bytes: 31050728 flows: 33
+ Skype packets: 237 bytes: 35082 flows: 30
+ Google packets: 558 bytes: 164639 flows: 52
+ WhatsApp packets: 969 bytes: 1477350 flows: 17
+ Viber packets: 60 bytes: 27602 flows: 1
+ LLMNR packets: 71 bytes: 5297 flows: 36
+ Amazon packets: 89 bytes: 23572 flows: 9
+ QUIC packets: 41 bytes: 3474 flows: 1
+ BJNP packets: 72 bytes: 4320 flows: 72
+ Microsoft packets: 35 bytes: 10358 flows: 5
+
+
+Protocol statistics:
+ Safe 632978 bytes
+ Acceptable 31693889 bytes
+ Fun 31257172 bytes
+ Unsafe 4384 bytes
+ Unrated 10913415 bytes
+
+-----------------------------------------------------------
+* NOTE: This is demo app to show *some* nDPI features.
+* In this demo we have implemented only some basic features
+* just to show you what you can do with the library. Feel
+* free to extend it and send us the patches for inclusion
+------------------------------------------------------------
+
+Using nDPI (1.8.0-dev-707-6a27b62) [1 thread(s)]
+Reading packets from pcap file test.pcap...
+Running thread 0...
+
+nDPI Memory statistics:
+ nDPI Memory (once): 110.55 KB
+ Flow Memory (per flow): 1.95 KB
+ Actual Memory: 3.46 MB
+ Peak Memory: 3.46 MB
+
+Traffic statistics:
+ Ethernet bytes: 75948198 (includes ethernet CRC/IFC/trailer)
+ Discarded bytes: 55256
+ IP packets: 60265 of 61155 packets total
+ IP bytes: 74501838 (avg pkt size 1218 bytes)
+ Unique flows: 545
+ TCP Packets: 21188
+ UDP Packets: 39042
+ VLAN Packets: 0
+ MPLS Packets: 0
+ PPPoE Packets: 0
+ Fragmented Packets: 4
+ Max Packet size: 64260
+ Packet Len < 64: 30624
+ Packet Len 64-128: 1158
+ Packet Len 128-256: 674
+ Packet Len 256-1024: 817
+ Packet Len 1024-1500: 21924
+ Packet Len > 1500: 5068
+ nDPI throughput: 1.31 M pps / 12.31 Gb/sec
+ Traffic throughput: 228.03 pps / 2.19 Mb/sec
+ Traffic duration: 264.290 sec
+ Guessed flow protos: 9
+
+
+Detected protocols:
+ Unknown packets: 6126 bytes: 10913415 flows: 46
+ FTP_CONTROL packets: 42 bytes: 4384 flows: 1
+ DNS packets: 66 bytes: 6520 flows: 23
+ IPP packets: 46 bytes: 12059 flows: 1
+ HTTP packets: 377 bytes: 113616 flows: 24
+ MDNS packets: 43 bytes: 11742 flows: 9
+ NetBIOS packets: 48 bytes: 4754 flows: 12
+ SSDP packets: 101 bytes: 32533 flows: 21
+ DHCP packets: 21 bytes: 7346 flows: 2
+ BitTorrent packets: 37639 bytes: 29656716 flows: 65
+ ICMP packets: 15 bytes: 4956 flows: 5
+ IGMP packets: 10 bytes: 600 flows: 9
+ SSL packets: 1199 bytes: 622508 flows: 24
+ ICMPV6 packets: 2 bytes: 172 flows: 2
+ DHCPV6 packets: 1 bytes: 144 flows: 1
+ Facebook packets: 349 bytes: 206444 flows: 21
+ Twitter packets: 137 bytes: 45679 flows: 8
+ Dropbox packets: 155 bytes: 45358 flows: 12
+ GMail packets: 35 bytes: 10470 flows: 3
+ YouTube packets: 11721 bytes: 31050728 flows: 33
+ Skype packets: 237 bytes: 35082 flows: 30
+ Google packets: 558 bytes: 164639 flows: 52
+ WhatsApp packets: 969 bytes: 1477350 flows: 17
+ Viber packets: 60 bytes: 27602 flows: 1
+ LLMNR packets: 71 bytes: 5297 flows: 36
+ Amazon packets: 89 bytes: 23572 flows: 9
+ QUIC packets: 41 bytes: 3474 flows: 1
+ BJNP packets: 72 bytes: 4320 flows: 72
+ Microsoft packets: 35 bytes: 10358 flows: 5
+
+
+Protocol statistics:
+ Safe 632978 bytes
+ Acceptable 31693889 bytes
+ Fun 31257172 bytes
+ Unsafe 4384 bytes
+ Unrated 10913415 bytes
+
+-----------------------------------------------------------
+* NOTE: This is demo app to show *some* nDPI features.
+* In this demo we have implemented only some basic features
+* just to show you what you can do with the library. Feel
+* free to extend it and send us the patches for inclusion
+------------------------------------------------------------
+
+Using nDPI (1.8.0-dev-707-6a27b62) [1 thread(s)]
+Reading packets from pcap file test.pcap...
+Running thread 0...
+
+nDPI Memory statistics:
+ nDPI Memory (once): 110.55 KB
+ Flow Memory (per flow): 1.95 KB
+ Actual Memory: 3.46 MB
+ Peak Memory: 3.46 MB
+
+Traffic statistics:
+ Ethernet bytes: 75948198 (includes ethernet CRC/IFC/trailer)
+ Discarded bytes: 55256
+ IP packets: 60265 of 61155 packets total
+ IP bytes: 74501838 (avg pkt size 1218 bytes)
+ Unique flows: 545
+ TCP Packets: 21188
+ UDP Packets: 39042
+ VLAN Packets: 0
+ MPLS Packets: 0
+ PPPoE Packets: 0
+ Fragmented Packets: 4
+ Max Packet size: 64260
+ Packet Len < 64: 30624
+ Packet Len 64-128: 1158
+ Packet Len 128-256: 674
+ Packet Len 256-1024: 817
+ Packet Len 1024-1500: 21924
+ Packet Len > 1500: 5068
+ nDPI throughput: 1.54 M pps / 14.45 Gb/sec
+ Traffic throughput: 228.03 pps / 2.19 Mb/sec
+ Traffic duration: 264.290 sec
+ Guessed flow protos: 9
+
+
+Detected protocols:
+ Unknown packets: 6126 bytes: 10913415 flows: 46
+ FTP_CONTROL packets: 42 bytes: 4384 flows: 1
+ DNS packets: 66 bytes: 6520 flows: 23
+ IPP packets: 46 bytes: 12059 flows: 1
+ HTTP packets: 377 bytes: 113616 flows: 24
+ MDNS packets: 43 bytes: 11742 flows: 9
+ NetBIOS packets: 48 bytes: 4754 flows: 12
+ SSDP packets: 101 bytes: 32533 flows: 21
+ DHCP packets: 21 bytes: 7346 flows: 2
+ BitTorrent packets: 37639 bytes: 29656716 flows: 65
+ ICMP packets: 15 bytes: 4956 flows: 5
+ IGMP packets: 10 bytes: 600 flows: 9
+ SSL packets: 1199 bytes: 622508 flows: 24
+ ICMPV6 packets: 2 bytes: 172 flows: 2
+ DHCPV6 packets: 1 bytes: 144 flows: 1
+ Facebook packets: 349 bytes: 206444 flows: 21
+ Twitter packets: 137 bytes: 45679 flows: 8
+ Dropbox packets: 155 bytes: 45358 flows: 12
+ GMail packets: 35 bytes: 10470 flows: 3
+ YouTube packets: 11721 bytes: 31050728 flows: 33
+ Skype packets: 237 bytes: 35082 flows: 30
+ Google packets: 558 bytes: 164639 flows: 52
+ WhatsApp packets: 969 bytes: 1477350 flows: 17
+ Viber packets: 60 bytes: 27602 flows: 1
+ LLMNR packets: 71 bytes: 5297 flows: 36
+ Amazon packets: 89 bytes: 23572 flows: 9
+ QUIC packets: 41 bytes: 3474 flows: 1
+ BJNP packets: 72 bytes: 4320 flows: 72
+ Microsoft packets: 35 bytes: 10358 flows: 5
+
+
+Protocol statistics:
+ Safe 632978 bytes
+ Acceptable 31693889 bytes
+ Fun 31257172 bytes
+ Unsafe 4384 bytes
+ Unrated 10913415 bytes
+
+-----------------------------------------------------------
+* NOTE: This is demo app to show *some* nDPI features.
+* In this demo we have implemented only some basic features
+* just to show you what you can do with the library. Feel
+* free to extend it and send us the patches for inclusion
+------------------------------------------------------------
+
+Using nDPI (1.8.0-dev-707-6a27b62) [1 thread(s)]
+Reading packets from pcap file test.pcap...
+Running thread 0...
+
+nDPI Memory statistics:
+ nDPI Memory (once): 110.55 KB
+ Flow Memory (per flow): 1.95 KB
+ Actual Memory: 3.46 MB
+ Peak Memory: 3.46 MB
+
+Traffic statistics:
+ Ethernet bytes: 75948198 (includes ethernet CRC/IFC/trailer)
+ Discarded bytes: 55256
+ IP packets: 60265 of 61155 packets total
+ IP bytes: 74501838 (avg pkt size 1218 bytes)
+ Unique flows: 545
+ TCP Packets: 21188
+ UDP Packets: 39042
+ VLAN Packets: 0
+ MPLS Packets: 0
+ PPPoE Packets: 0
+ Fragmented Packets: 4
+ Max Packet size: 64260
+ Packet Len < 64: 30624
+ Packet Len 64-128: 1158
+ Packet Len 128-256: 674
+ Packet Len 256-1024: 817
+ Packet Len 1024-1500: 21924
+ Packet Len > 1500: 5068
+ nDPI throughput: 1.35 M pps / 12.71 Gb/sec
+ Traffic throughput: 228.03 pps / 2.19 Mb/sec
+ Traffic duration: 264.290 sec
+ Guessed flow protos: 9
+
+
+Detected protocols:
+ Unknown packets: 6126 bytes: 10913415 flows: 46
+ FTP_CONTROL packets: 42 bytes: 4384 flows: 1
+ DNS packets: 66 bytes: 6520 flows: 23
+ IPP packets: 46 bytes: 12059 flows: 1
+ HTTP packets: 377 bytes: 113616 flows: 24
+ MDNS packets: 43 bytes: 11742 flows: 9
+ NetBIOS packets: 48 bytes: 4754 flows: 12
+ SSDP packets: 101 bytes: 32533 flows: 21
+ DHCP packets: 21 bytes: 7346 flows: 2
+ BitTorrent packets: 37639 bytes: 29656716 flows: 65
+ ICMP packets: 15 bytes: 4956 flows: 5
+ IGMP packets: 10 bytes: 600 flows: 9
+ SSL packets: 1199 bytes: 622508 flows: 24
+ ICMPV6 packets: 2 bytes: 172 flows: 2
+ DHCPV6 packets: 1 bytes: 144 flows: 1
+ Facebook packets: 349 bytes: 206444 flows: 21
+ Twitter packets: 137 bytes: 45679 flows: 8
+ Dropbox packets: 155 bytes: 45358 flows: 12
+ GMail packets: 35 bytes: 10470 flows: 3
+ YouTube packets: 11721 bytes: 31050728 flows: 33
+ Skype packets: 237 bytes: 35082 flows: 30
+ Google packets: 558 bytes: 164639 flows: 52
+ WhatsApp packets: 969 bytes: 1477350 flows: 17
+ Viber packets: 60 bytes: 27602 flows: 1
+ LLMNR packets: 71 bytes: 5297 flows: 36
+ Amazon packets: 89 bytes: 23572 flows: 9
+ QUIC packets: 41 bytes: 3474 flows: 1
+ BJNP packets: 72 bytes: 4320 flows: 72
+ Microsoft packets: 35 bytes: 10358 flows: 5
+
+
+Protocol statistics:
+ Safe 632978 bytes
+ Acceptable 31693889 bytes
+ Fun 31257172 bytes
+ Unsafe 4384 bytes
+ Unrated 10913415 bytes
+
+-----------------------------------------------------------
+* NOTE: This is demo app to show *some* nDPI features.
+* In this demo we have implemented only some basic features
+* just to show you what you can do with the library. Feel
+* free to extend it and send us the patches for inclusion
+------------------------------------------------------------
+
+Using nDPI (1.8.0-dev-707-6a27b62) [1 thread(s)]
+Reading packets from pcap file test.pcap...
+Running thread 0...
+
+nDPI Memory statistics:
+ nDPI Memory (once): 110.55 KB
+ Flow Memory (per flow): 1.95 KB
+ Actual Memory: 3.46 MB
+ Peak Memory: 3.46 MB
+
+Traffic statistics:
+ Ethernet bytes: 75948198 (includes ethernet CRC/IFC/trailer)
+ Discarded bytes: 55256
+ IP packets: 60265 of 61155 packets total
+ IP bytes: 74501838 (avg pkt size 1218 bytes)
+ Unique flows: 545
+ TCP Packets: 21188
+ UDP Packets: 39042
+ VLAN Packets: 0
+ MPLS Packets: 0
+ PPPoE Packets: 0
+ Fragmented Packets: 4
+ Max Packet size: 64260
+ Packet Len < 64: 30624
+ Packet Len 64-128: 1158
+ Packet Len 128-256: 674
+ Packet Len 256-1024: 817
+ Packet Len 1024-1500: 21924
+ Packet Len > 1500: 5068
+ nDPI throughput: 1.55 M pps / 14.53 Gb/sec
+ Traffic throughput: 228.03 pps / 2.19 Mb/sec
+ Traffic duration: 264.290 sec
+ Guessed flow protos: 9
+
+
+Detected protocols:
+ Unknown packets: 6126 bytes: 10913415 flows: 46
+ FTP_CONTROL packets: 42 bytes: 4384 flows: 1
+ DNS packets: 66 bytes: 6520 flows: 23
+ IPP packets: 46 bytes: 12059 flows: 1
+ HTTP packets: 377 bytes: 113616 flows: 24
+ MDNS packets: 43 bytes: 11742 flows: 9
+ NetBIOS packets: 48 bytes: 4754 flows: 12
+ SSDP packets: 101 bytes: 32533 flows: 21
+ DHCP packets: 21 bytes: 7346 flows: 2
+ BitTorrent packets: 37639 bytes: 29656716 flows: 65
+ ICMP packets: 15 bytes: 4956 flows: 5
+ IGMP packets: 10 bytes: 600 flows: 9
+ SSL packets: 1199 bytes: 622508 flows: 24
+ ICMPV6 packets: 2 bytes: 172 flows: 2
+ DHCPV6 packets: 1 bytes: 144 flows: 1
+ Facebook packets: 349 bytes: 206444 flows: 21
+ Twitter packets: 137 bytes: 45679 flows: 8
+ Dropbox packets: 155 bytes: 45358 flows: 12
+ GMail packets: 35 bytes: 10470 flows: 3
+ YouTube packets: 11721 bytes: 31050728 flows: 33
+ Skype packets: 237 bytes: 35082 flows: 30
+ Google packets: 558 bytes: 164639 flows: 52
+ WhatsApp packets: 969 bytes: 1477350 flows: 17
+ Viber packets: 60 bytes: 27602 flows: 1
+ LLMNR packets: 71 bytes: 5297 flows: 36
+ Amazon packets: 89 bytes: 23572 flows: 9
+ QUIC packets: 41 bytes: 3474 flows: 1
+ BJNP packets: 72 bytes: 4320 flows: 72
+ Microsoft packets: 35 bytes: 10358 flows: 5
+
+
+Protocol statistics:
+ Safe 632978 bytes
+ Acceptable 31693889 bytes
+ Fun 31257172 bytes
+ Unsafe 4384 bytes
+ Unrated 10913415 bytes
+
+-----------------------------------------------------------
+* NOTE: This is demo app to show *some* nDPI features.
+* In this demo we have implemented only some basic features
+* just to show you what you can do with the library. Feel
+* free to extend it and send us the patches for inclusion
+------------------------------------------------------------
+
+Using nDPI (1.8.0-dev-707-6a27b62) [1 thread(s)]
+Reading packets from pcap file test.pcap...
+Running thread 0...
+
+nDPI Memory statistics:
+ nDPI Memory (once): 110.55 KB
+ Flow Memory (per flow): 1.95 KB
+ Actual Memory: 3.46 MB
+ Peak Memory: 3.46 MB
+
+Traffic statistics:
+ Ethernet bytes: 75948198 (includes ethernet CRC/IFC/trailer)
+ Discarded bytes: 55256
+ IP packets: 60265 of 61155 packets total
+ IP bytes: 74501838 (avg pkt size 1218 bytes)
+ Unique flows: 545
+ TCP Packets: 21188
+ UDP Packets: 39042
+ VLAN Packets: 0
+ MPLS Packets: 0
+ PPPoE Packets: 0
+ Fragmented Packets: 4
+ Max Packet size: 64260
+ Packet Len < 64: 30624
+ Packet Len 64-128: 1158
+ Packet Len 128-256: 674
+ Packet Len 256-1024: 817
+ Packet Len 1024-1500: 21924
+ Packet Len > 1500: 5068
+ nDPI throughput: 1.32 M pps / 12.42 Gb/sec
+ Traffic throughput: 228.03 pps / 2.19 Mb/sec
+ Traffic duration: 264.290 sec
+ Guessed flow protos: 9
+
+
+Detected protocols:
+ Unknown packets: 6126 bytes: 10913415 flows: 46
+ FTP_CONTROL packets: 42 bytes: 4384 flows: 1
+ DNS packets: 66 bytes: 6520 flows: 23
+ IPP packets: 46 bytes: 12059 flows: 1
+ HTTP packets: 377 bytes: 113616 flows: 24
+ MDNS packets: 43 bytes: 11742 flows: 9
+ NetBIOS packets: 48 bytes: 4754 flows: 12
+ SSDP packets: 101 bytes: 32533 flows: 21
+ DHCP packets: 21 bytes: 7346 flows: 2
+ BitTorrent packets: 37639 bytes: 29656716 flows: 65
+ ICMP packets: 15 bytes: 4956 flows: 5
+ IGMP packets: 10 bytes: 600 flows: 9
+ SSL packets: 1199 bytes: 622508 flows: 24
+ ICMPV6 packets: 2 bytes: 172 flows: 2
+ DHCPV6 packets: 1 bytes: 144 flows: 1
+ Facebook packets: 349 bytes: 206444 flows: 21
+ Twitter packets: 137 bytes: 45679 flows: 8
+ Dropbox packets: 155 bytes: 45358 flows: 12
+ GMail packets: 35 bytes: 10470 flows: 3
+ YouTube packets: 11721 bytes: 31050728 flows: 33
+ Skype packets: 237 bytes: 35082 flows: 30
+ Google packets: 558 bytes: 164639 flows: 52
+ WhatsApp packets: 969 bytes: 1477350 flows: 17
+ Viber packets: 60 bytes: 27602 flows: 1
+ LLMNR packets: 71 bytes: 5297 flows: 36
+ Amazon packets: 89 bytes: 23572 flows: 9
+ QUIC packets: 41 bytes: 3474 flows: 1
+ BJNP packets: 72 bytes: 4320 flows: 72
+ Microsoft packets: 35 bytes: 10358 flows: 5
+
+
+Protocol statistics:
+ Safe 632978 bytes
+ Acceptable 31693889 bytes
+ Fun 31257172 bytes
+ Unsafe 4384 bytes
+ Unrated 10913415 bytes
+
+-----------------------------------------------------------
+* NOTE: This is demo app to show *some* nDPI features.
+* In this demo we have implemented only some basic features
+* just to show you what you can do with the library. Feel
+* free to extend it and send us the patches for inclusion
+------------------------------------------------------------
+
+Using nDPI (1.8.0-dev-707-6a27b62) [1 thread(s)]
+Reading packets from pcap file test.pcap...
+Running thread 0...
+
+nDPI Memory statistics:
+ nDPI Memory (once): 110.55 KB
+ Flow Memory (per flow): 1.95 KB
+ Actual Memory: 3.46 MB
+ Peak Memory: 3.46 MB
+
+Traffic statistics:
+ Ethernet bytes: 75948198 (includes ethernet CRC/IFC/trailer)
+ Discarded bytes: 55256
+ IP packets: 60265 of 61155 packets total
+ IP bytes: 74501838 (avg pkt size 1218 bytes)
+ Unique flows: 545
+ TCP Packets: 21188
+ UDP Packets: 39042
+ VLAN Packets: 0
+ MPLS Packets: 0
+ PPPoE Packets: 0
+ Fragmented Packets: 4
+ Max Packet size: 64260
+ Packet Len < 64: 30624
+ Packet Len 64-128: 1158
+ Packet Len 128-256: 674
+ Packet Len 256-1024: 817
+ Packet Len 1024-1500: 21924
+ Packet Len > 1500: 5068
+ nDPI throughput: 1.54 M pps / 14.46 Gb/sec
+ Traffic throughput: 228.03 pps / 2.19 Mb/sec
+ Traffic duration: 264.290 sec
+ Guessed flow protos: 9
+
+
+Detected protocols:
+ Unknown packets: 6126 bytes: 10913415 flows: 46
+ FTP_CONTROL packets: 42 bytes: 4384 flows: 1
+ DNS packets: 66 bytes: 6520 flows: 23
+ IPP packets: 46 bytes: 12059 flows: 1
+ HTTP packets: 377 bytes: 113616 flows: 24
+ MDNS packets: 43 bytes: 11742 flows: 9
+ NetBIOS packets: 48 bytes: 4754 flows: 12
+ SSDP packets: 101 bytes: 32533 flows: 21
+ DHCP packets: 21 bytes: 7346 flows: 2
+ BitTorrent packets: 37639 bytes: 29656716 flows: 65
+ ICMP packets: 15 bytes: 4956 flows: 5
+ IGMP packets: 10 bytes: 600 flows: 9
+ SSL packets: 1199 bytes: 622508 flows: 24
+ ICMPV6 packets: 2 bytes: 172 flows: 2
+ DHCPV6 packets: 1 bytes: 144 flows: 1
+ Facebook packets: 349 bytes: 206444 flows: 21
+ Twitter packets: 137 bytes: 45679 flows: 8
+ Dropbox packets: 155 bytes: 45358 flows: 12
+ GMail packets: 35 bytes: 10470 flows: 3
+ YouTube packets: 11721 bytes: 31050728 flows: 33
+ Skype packets: 237 bytes: 35082 flows: 30
+ Google packets: 558 bytes: 164639 flows: 52
+ WhatsApp packets: 969 bytes: 1477350 flows: 17
+ Viber packets: 60 bytes: 27602 flows: 1
+ LLMNR packets: 71 bytes: 5297 flows: 36
+ Amazon packets: 89 bytes: 23572 flows: 9
+ QUIC packets: 41 bytes: 3474 flows: 1
+ BJNP packets: 72 bytes: 4320 flows: 72
+ Microsoft packets: 35 bytes: 10358 flows: 5
+
+
+Protocol statistics:
+ Safe 632978 bytes
+ Acceptable 31693889 bytes
+ Fun 31257172 bytes
+ Unsafe 4384 bytes
+ Unrated 10913415 bytes
+
+-----------------------------------------------------------
+* NOTE: This is demo app to show *some* nDPI features.
+* In this demo we have implemented only some basic features
+* just to show you what you can do with the library. Feel
+* free to extend it and send us the patches for inclusion
+------------------------------------------------------------
+
+Using nDPI (1.8.0-dev-707-6a27b62) [1 thread(s)]
+Reading packets from pcap file test.pcap...
+Running thread 0...
+
+nDPI Memory statistics:
+ nDPI Memory (once): 110.55 KB
+ Flow Memory (per flow): 1.95 KB
+ Actual Memory: 3.46 MB
+ Peak Memory: 3.46 MB
+
+Traffic statistics:
+ Ethernet bytes: 75948198 (includes ethernet CRC/IFC/trailer)
+ Discarded bytes: 55256
+ IP packets: 60265 of 61155 packets total
+ IP bytes: 74501838 (avg pkt size 1218 bytes)
+ Unique flows: 545
+ TCP Packets: 21188
+ UDP Packets: 39042
+ VLAN Packets: 0
+ MPLS Packets: 0
+ PPPoE Packets: 0
+ Fragmented Packets: 4
+ Max Packet size: 64260
+ Packet Len < 64: 30624
+ Packet Len 64-128: 1158
+ Packet Len 128-256: 674
+ Packet Len 256-1024: 817
+ Packet Len 1024-1500: 21924
+ Packet Len > 1500: 5068
+ nDPI throughput: 1.54 M pps / 14.49 Gb/sec
+ Traffic throughput: 228.03 pps / 2.19 Mb/sec
+ Traffic duration: 264.290 sec
+ Guessed flow protos: 9
+
+
+Detected protocols:
+ Unknown packets: 6126 bytes: 10913415 flows: 46
+ FTP_CONTROL packets: 42 bytes: 4384 flows: 1
+ DNS packets: 66 bytes: 6520 flows: 23
+ IPP packets: 46 bytes: 12059 flows: 1
+ HTTP packets: 377 bytes: 113616 flows: 24
+ MDNS packets: 43 bytes: 11742 flows: 9
+ NetBIOS packets: 48 bytes: 4754 flows: 12
+ SSDP packets: 101 bytes: 32533 flows: 21
+ DHCP packets: 21 bytes: 7346 flows: 2
+ BitTorrent packets: 37639 bytes: 29656716 flows: 65
+ ICMP packets: 15 bytes: 4956 flows: 5
+ IGMP packets: 10 bytes: 600 flows: 9
+ SSL packets: 1199 bytes: 622508 flows: 24
+ ICMPV6 packets: 2 bytes: 172 flows: 2
+ DHCPV6 packets: 1 bytes: 144 flows: 1
+ Facebook packets: 349 bytes: 206444 flows: 21
+ Twitter packets: 137 bytes: 45679 flows: 8
+ Dropbox packets: 155 bytes: 45358 flows: 12
+ GMail packets: 35 bytes: 10470 flows: 3
+ YouTube packets: 11721 bytes: 31050728 flows: 33
+ Skype packets: 237 bytes: 35082 flows: 30
+ Google packets: 558 bytes: 164639 flows: 52
+ WhatsApp packets: 969 bytes: 1477350 flows: 17
+ Viber packets: 60 bytes: 27602 flows: 1
+ LLMNR packets: 71 bytes: 5297 flows: 36
+ Amazon packets: 89 bytes: 23572 flows: 9
+ QUIC packets: 41 bytes: 3474 flows: 1
+ BJNP packets: 72 bytes: 4320 flows: 72
+ Microsoft packets: 35 bytes: 10358 flows: 5
+
+
+Protocol statistics:
+ Safe 632978 bytes
+ Acceptable 31693889 bytes
+ Fun 31257172 bytes
+ Unsafe 4384 bytes
+ Unrated 10913415 bytes
+
+-----------------------------------------------------------
+* NOTE: This is demo app to show *some* nDPI features.
+* In this demo we have implemented only some basic features
+* just to show you what you can do with the library. Feel
+* free to extend it and send us the patches for inclusion
+------------------------------------------------------------
+
+Using nDPI (1.8.0-dev-707-6a27b62) [1 thread(s)]
+Reading packets from pcap file test.pcap...
+Running thread 0...
+
+nDPI Memory statistics:
+ nDPI Memory (once): 110.55 KB
+ Flow Memory (per flow): 1.95 KB
+ Actual Memory: 3.46 MB
+ Peak Memory: 3.46 MB
+
+Traffic statistics:
+ Ethernet bytes: 75948198 (includes ethernet CRC/IFC/trailer)
+ Discarded bytes: 55256
+ IP packets: 60265 of 61155 packets total
+ IP bytes: 74501838 (avg pkt size 1218 bytes)
+ Unique flows: 545
+ TCP Packets: 21188
+ UDP Packets: 39042
+ VLAN Packets: 0
+ MPLS Packets: 0
+ PPPoE Packets: 0
+ Fragmented Packets: 4
+ Max Packet size: 64260
+ Packet Len < 64: 30624
+ Packet Len 64-128: 1158
+ Packet Len 128-256: 674
+ Packet Len 256-1024: 817
+ Packet Len 1024-1500: 21924
+ Packet Len > 1500: 5068
+ nDPI throughput: 1.37 M pps / 12.89 Gb/sec
+ Traffic throughput: 228.03 pps / 2.19 Mb/sec
+ Traffic duration: 264.290 sec
+ Guessed flow protos: 9
+
+
+Detected protocols:
+ Unknown packets: 6126 bytes: 10913415 flows: 46
+ FTP_CONTROL packets: 42 bytes: 4384 flows: 1
+ DNS packets: 66 bytes: 6520 flows: 23
+ IPP packets: 46 bytes: 12059 flows: 1
+ HTTP packets: 377 bytes: 113616 flows: 24
+ MDNS packets: 43 bytes: 11742 flows: 9
+ NetBIOS packets: 48 bytes: 4754 flows: 12
+ SSDP packets: 101 bytes: 32533 flows: 21
+ DHCP packets: 21 bytes: 7346 flows: 2
+ BitTorrent packets: 37639 bytes: 29656716 flows: 65
+ ICMP packets: 15 bytes: 4956 flows: 5
+ IGMP packets: 10 bytes: 600 flows: 9
+ SSL packets: 1199 bytes: 622508 flows: 24
+ ICMPV6 packets: 2 bytes: 172 flows: 2
+ DHCPV6 packets: 1 bytes: 144 flows: 1
+ Facebook packets: 349 bytes: 206444 flows: 21
+ Twitter packets: 137 bytes: 45679 flows: 8
+ Dropbox packets: 155 bytes: 45358 flows: 12
+ GMail packets: 35 bytes: 10470 flows: 3
+ YouTube packets: 11721 bytes: 31050728 flows: 33
+ Skype packets: 237 bytes: 35082 flows: 30
+ Google packets: 558 bytes: 164639 flows: 52
+ WhatsApp packets: 969 bytes: 1477350 flows: 17
+ Viber packets: 60 bytes: 27602 flows: 1
+ LLMNR packets: 71 bytes: 5297 flows: 36
+ Amazon packets: 89 bytes: 23572 flows: 9
+ QUIC packets: 41 bytes: 3474 flows: 1
+ BJNP packets: 72 bytes: 4320 flows: 72
+ Microsoft packets: 35 bytes: 10358 flows: 5
+
+
+Protocol statistics:
+ Safe 632978 bytes
+ Acceptable 31693889 bytes
+ Fun 31257172 bytes
+ Unsafe 4384 bytes
+ Unrated 10913415 bytes
+
+-----------------------------------------------------------
+* NOTE: This is demo app to show *some* nDPI features.
+* In this demo we have implemented only some basic features
+* just to show you what you can do with the library. Feel
+* free to extend it and send us the patches for inclusion
+------------------------------------------------------------
+
+Using nDPI (1.8.0-dev-707-6a27b62) [1 thread(s)]
+Reading packets from pcap file test.pcap...
+Running thread 0...
+
+nDPI Memory statistics:
+ nDPI Memory (once): 110.55 KB
+ Flow Memory (per flow): 1.95 KB
+ Actual Memory: 3.46 MB
+ Peak Memory: 3.46 MB
+
+Traffic statistics:
+ Ethernet bytes: 75948198 (includes ethernet CRC/IFC/trailer)
+ Discarded bytes: 55256
+ IP packets: 60265 of 61155 packets total
+ IP bytes: 74501838 (avg pkt size 1218 bytes)
+ Unique flows: 545
+ TCP Packets: 21188
+ UDP Packets: 39042
+ VLAN Packets: 0
+ MPLS Packets: 0
+ PPPoE Packets: 0
+ Fragmented Packets: 4
+ Max Packet size: 64260
+ Packet Len < 64: 30624
+ Packet Len 64-128: 1158
+ Packet Len 128-256: 674
+ Packet Len 256-1024: 817
+ Packet Len 1024-1500: 21924
+ Packet Len > 1500: 5068
+ nDPI throughput: 1.55 M pps / 14.57 Gb/sec
+ Traffic throughput: 228.03 pps / 2.19 Mb/sec
+ Traffic duration: 264.290 sec
+ Guessed flow protos: 9
+
+
+Detected protocols:
+ Unknown packets: 6126 bytes: 10913415 flows: 46
+ FTP_CONTROL packets: 42 bytes: 4384 flows: 1
+ DNS packets: 66 bytes: 6520 flows: 23
+ IPP packets: 46 bytes: 12059 flows: 1
+ HTTP packets: 377 bytes: 113616 flows: 24
+ MDNS packets: 43 bytes: 11742 flows: 9
+ NetBIOS packets: 48 bytes: 4754 flows: 12
+ SSDP packets: 101 bytes: 32533 flows: 21
+ DHCP packets: 21 bytes: 7346 flows: 2
+ BitTorrent packets: 37639 bytes: 29656716 flows: 65
+ ICMP packets: 15 bytes: 4956 flows: 5
+ IGMP packets: 10 bytes: 600 flows: 9
+ SSL packets: 1199 bytes: 622508 flows: 24
+ ICMPV6 packets: 2 bytes: 172 flows: 2
+ DHCPV6 packets: 1 bytes: 144 flows: 1
+ Facebook packets: 349 bytes: 206444 flows: 21
+ Twitter packets: 137 bytes: 45679 flows: 8
+ Dropbox packets: 155 bytes: 45358 flows: 12
+ GMail packets: 35 bytes: 10470 flows: 3
+ YouTube packets: 11721 bytes: 31050728 flows: 33
+ Skype packets: 237 bytes: 35082 flows: 30
+ Google packets: 558 bytes: 164639 flows: 52
+ WhatsApp packets: 969 bytes: 1477350 flows: 17
+ Viber packets: 60 bytes: 27602 flows: 1
+ LLMNR packets: 71 bytes: 5297 flows: 36
+ Amazon packets: 89 bytes: 23572 flows: 9
+ QUIC packets: 41 bytes: 3474 flows: 1
+ BJNP packets: 72 bytes: 4320 flows: 72
+ Microsoft packets: 35 bytes: 10358 flows: 5
+
+
+Protocol statistics:
+ Safe 632978 bytes
+ Acceptable 31693889 bytes
+ Fun 31257172 bytes
+ Unsafe 4384 bytes
+ Unrated 10913415 bytes \ No newline at end of file
diff --git a/tests/data/external/ramspeed/Floatmem b/tests/data/external/ramspeed/Floatmem
new file mode 100644
index 00000000..f3cc1e6d
--- /dev/null
+++ b/tests/data/external/ramspeed/Floatmem
@@ -0,0 +1,52 @@
+RAMspeed/SMP (Linux) v3.5.0 by Rhett M. Hollander and Paul V. Bolotoff, 2002-09
+
+8Gb per pass mode, 1 processes
+
+5-benchmark FLOATmem BatchRun mode
+
+Benchmark #1:
+FL-POINT Copy: 8220.47 MB/s
+FL-POINT Scale: 8195.78 MB/s
+FL-POINT Add: 10319.18 MB/s
+FL-POINT Triad: 10403.87 MB/s
+---
+FL-POINT AVERAGE: 9284.83 MB/s
+
+Benchmark #2:
+FL-POINT Copy: 8086.66 MB/s
+FL-POINT Scale: 7842.82 MB/s
+FL-POINT Add: 9900.13 MB/s
+FL-POINT Triad: 10029.43 MB/s
+---
+FL-POINT AVERAGE: 8964.76 MB/s
+
+Benchmark #3:
+FL-POINT Copy: 7766.98 MB/s
+FL-POINT Scale: 7837.62 MB/s
+FL-POINT Add: 9827.57 MB/s
+FL-POINT Triad: 9918.89 MB/s
+---
+FL-POINT AVERAGE: 8837.77 MB/s
+
+Benchmark #4:
+FL-POINT Copy: 7647.89 MB/s
+FL-POINT Scale: 7594.00 MB/s
+FL-POINT Add: 9873.93 MB/s
+FL-POINT Triad: 9970.89 MB/s
+---
+FL-POINT AVERAGE: 8771.68 MB/s
+
+Benchmark #5:
+FL-POINT Copy: 7821.21 MB/s
+FL-POINT Scale: 7880.56 MB/s
+FL-POINT Add: 9914.84 MB/s
+FL-POINT Triad: 10044.05 MB/s
+---
+FL-POINT AVERAGE: 8915.17 MB/s
+
+FL-POINT BatchRun Copy: 7908.64 MB/s
+FL-POINT BatchRun Scale: 7870.16 MB/s
+FL-POINT BatchRun Add: 9967.13 MB/s
+FL-POINT BatchRun Triad: 10073.43 MB/s
+---
+FL-POINT BatchRun AVERAGE: 8954.84 MB/s \ No newline at end of file
diff --git a/tests/data/external/ramspeed/Intmem b/tests/data/external/ramspeed/Intmem
new file mode 100644
index 00000000..08fffe47
--- /dev/null
+++ b/tests/data/external/ramspeed/Intmem
@@ -0,0 +1,52 @@
+RAMspeed/SMP (Linux) v3.5.0 by Rhett M. Hollander and Paul V. Bolotoff, 2002-09
+
+8Gb per pass mode, 1 processes
+
+5-benchmark INTmem BatchRun mode
+
+Benchmark #1:
+INTEGER Copy: 11493.80 MB/s
+INTEGER Scale: 11527.61 MB/s
+INTEGER Add: 11567.60 MB/s
+INTEGER Triad: 11546.06 MB/s
+---
+INTEGER AVERAGE: 11533.77 MB/s
+
+Benchmark #2:
+INTEGER Copy: 11580.06 MB/s
+INTEGER Scale: 11617.25 MB/s
+INTEGER Add: 11748.95 MB/s
+INTEGER Triad: 11837.43 MB/s
+---
+INTEGER AVERAGE: 11695.92 MB/s
+
+Benchmark #3:
+INTEGER Copy: 11674.45 MB/s
+INTEGER Scale: 11566.59 MB/s
+INTEGER Add: 11643.59 MB/s
+INTEGER Triad: 11633.42 MB/s
+---
+INTEGER AVERAGE: 11629.51 MB/s
+
+Benchmark #4:
+INTEGER Copy: 11496.38 MB/s
+INTEGER Scale: 11528.06 MB/s
+INTEGER Add: 11641.10 MB/s
+INTEGER Triad: 11742.61 MB/s
+---
+INTEGER AVERAGE: 11602.04 MB/s
+
+Benchmark #5:
+INTEGER Copy: 11568.45 MB/s
+INTEGER Scale: 11579.32 MB/s
+INTEGER Add: 11646.55 MB/s
+INTEGER Triad: 11596.57 MB/s
+---
+INTEGER AVERAGE: 11597.72 MB/s
+
+INTEGER BatchRun Copy: 11562.63 MB/s
+INTEGER BatchRun Scale: 11563.77 MB/s
+INTEGER BatchRun Add: 11649.55 MB/s
+INTEGER BatchRun Triad: 11671.22 MB/s
+---
+INTEGER BatchRun AVERAGE: 11611.79 MB/s \ No newline at end of file
diff --git a/tests/data/external/ssl/AES-128-CBC_dump b/tests/data/external/ssl/AES-128-CBC_dump
new file mode 100644
index 00000000..32568e14
--- /dev/null
+++ b/tests/data/external/ssl/AES-128-CBC_dump
@@ -0,0 +1,7 @@
+OpenSSL 1.0.2f 28 Jan 2016
+built on: reproducible build, date unspecified
+options:bn(64,64) rc4(16x,int) des(idx,cisc,16,int) aes(partial) idea(int) blowfish(idx)
+compiler: gcc -I. -I.. -I../include -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
+The 'numbers' are in 1000s of bytes per second processed.
+type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
+aes-128-cbc 533103.05k 570042.22k 580021.25k 584568.83k 599470.83k \ No newline at end of file
diff --git a/tests/data/external/ssl/RSA_dump b/tests/data/external/ssl/RSA_dump
new file mode 100644
index 00000000..55e40792
--- /dev/null
+++ b/tests/data/external/ssl/RSA_dump
@@ -0,0 +1,9 @@
+OpenSSL 1.0.2f 28 Jan 2016
+built on: reproducible build, date unspecified
+options:bn(64,64) rc4(16x,int) des(idx,cisc,16,int) aes(partial) idea(int) blowfish(idx)
+compiler: gcc -I. -I.. -I../include -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
+ sign verify sign/s verify/s
+rsa 512 bits 0.000056s 0.000004s 17828.4 222903.5
+rsa 1024 bits 0.000169s 0.000011s 5923.9 88397.9
+rsa 2048 bits 0.000793s 0.000037s 1261.4 26951.3
+rsa 4096 bits 0.008280s 0.000131s 120.8 7633.7
diff --git a/tests/unit/cli/cmd_metric_test.py b/tests/unit/cli/cmd_metric_test.py
index 30f3448a..cd496ad9 100644
--- a/tests/unit/cli/cmd_metric_test.py
+++ b/tests/unit/cli/cmd_metric_test.py
@@ -1,5 +1,5 @@
###############################################################
-# Copyright (c) 2016 ZTE Corp and others.
+# Copyright (c) 2017 taseer94@gmail.com and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -8,8 +8,8 @@
##############################################################################
import pytest
-from click.testing import CliRunner
+from click.testing import CliRunner
from qtip.cli.entry import cli
@@ -20,7 +20,9 @@ def runner():
def test_list(runner):
result = runner.invoke(cli, ['metric', 'list'])
- assert result.output == ''
+ assert 'dhrystone' and 'whetstone' and 'dpi' and \
+ 'ramspeed' and 'fake-metric' and 'ssl' \
+ in result.output
def test_run(runner):
@@ -32,8 +34,10 @@ def test_run(runner):
def test_show(runner):
- result = runner.invoke(cli, ['metric', 'show', 'fake-metric'])
- assert result.output == ''
+ result = runner.invoke(cli, ['metric', 'show', 'dhrystone'])
+ assert 'Name: dhrystone' in result.output
+ assert 'Description: A synthetic computing benchmark program intended to be representative of' \
+ 'system (integer) programming.'
result = runner.invoke(cli, ['metric', 'show'])
assert 'Missing argument "name".' in result.output
diff --git a/tests/unit/cli/cmd_plan_test.py b/tests/unit/cli/cmd_plan_test.py
index 1708c340..30025ae0 100644
--- a/tests/unit/cli/cmd_plan_test.py
+++ b/tests/unit/cli/cmd_plan_test.py
@@ -1,5 +1,5 @@
###############################################################
-# Copyright (c) 2016 ZTE Corp and others.
+# Copyright (c) 2017 taseer94@gmail.com and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -20,7 +20,7 @@ def runner():
def test_list(runner):
result = runner.invoke(cli, ['plan', 'list'])
- assert result.output == ''
+ assert 'Plan' and 'compute' and 'sample' in result.output
def test_run(runner):
@@ -32,8 +32,9 @@ def test_run(runner):
def test_show(runner):
- result = runner.invoke(cli, ['plan', 'show', 'fake-plan'])
- assert result.output == ''
+ result = runner.invoke(cli, ['plan', 'show', 'compute'])
+ assert 'Name: compute QPI' in result.output
+ assert 'Description: compute QPI profile'
result = runner.invoke(cli, ['plan', 'show'])
assert 'Missing argument "name".' in result.output
diff --git a/tests/unit/cli/cmd_qpi_test.py b/tests/unit/cli/cmd_qpi_test.py
index 485d5462..3d2c2613 100644
--- a/tests/unit/cli/cmd_qpi_test.py
+++ b/tests/unit/cli/cmd_qpi_test.py
@@ -1,5 +1,5 @@
###############################################################
-# Copyright (c) 2016 ZTE Corp and others.
+# Copyright (c) 2017 taseer94@gmail.com and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -8,9 +8,9 @@
##############################################################################
import pytest
-from click.testing import CliRunner
from qtip.cli.entry import cli
+from click.testing import CliRunner
@pytest.fixture(scope="module")
@@ -20,7 +20,7 @@ def runner():
def test_list(runner):
result = runner.invoke(cli, ['qpi', 'list'])
- assert result.output == ''
+ assert 'QPIs' and 'compute' in result.output
def test_run(runner):
@@ -32,8 +32,9 @@ def test_run(runner):
def test_show(runner):
- result = runner.invoke(cli, ['qpi', 'show', 'fake-qpi'])
- assert result.output == ''
+ result = runner.invoke(cli, ['qpi', 'show', 'compute'])
+ assert 'Name: compute' in result.output
+ assert 'Description: sample performance index of computing' in result.output
result = runner.invoke(cli, ['qpi', 'show'])
assert 'Missing argument "name".' in result.output
diff --git a/tests/unit/util/env_test.py b/tests/unit/util/env_test.py
index 62d12a13..793d1e4e 100644
--- a/tests/unit/util/env_test.py
+++ b/tests/unit/util/env_test.py
@@ -72,12 +72,10 @@ def test_init(ansible_envsetup):
assert ansible_envsetup.host_ip_list == []
-def test_setup_exception(capsys, mocker, ansible_envsetup, hostfile):
+def test_setup_exception(mocker, ansible_envsetup, hostfile):
with mock.patch.object(AnsibleEnvSetup, 'check_hostfile', side_effect=RuntimeError()):
mock_os = mocker.patch('sys.exit')
ansible_envsetup.setup({'hostfile': str(hostfile)})
- out, error = capsys.readouterr()
- assert out == '\n'
assert mock_os.call_count == 1
@@ -178,21 +176,17 @@ def test_pass_keypair_to_remote_failed(mocker, ansible_envsetup):
assert "Failed on passing keypair to remote." in str(excinfo.value)
-def test_pass_keypair(monkeypatch, capsys, mocker, ansible_envsetup):
+def test_pass_keypair(monkeypatch, mocker, ansible_envsetup):
monkeypatch.setattr(time, 'sleep', lambda s: None)
mock_os = mocker.patch('os.system')
ansible_envsetup._pass_keypair('10.20.0.3', str(private_key))
assert mock_os.call_count == 2
- out, error = capsys.readouterr()
- assert "Pass keypair to remote hosts 10.20.0.3 successfully" in out
-def test_pass_keypair_exception(capsys, ansible_envsetup):
+def test_pass_keypair_exception(ansible_envsetup):
with mock.patch('os.system', side_effect=Exception()) as mock_os:
result = ansible_envsetup._pass_keypair('10.20.0.3', str(private_key))
assert result is False
- out, error = capsys.readouterr()
- assert out == '\n'
assert mock_os.call_count == 1
@@ -304,20 +298,10 @@ def test_ssh_is_ok(mocker, ansible_envsetup, private_key, stderrinfo, expected):
test_ssh_client.exec_command.assert_called_with('uname')
-@pytest.mark.parametrize("attempts, expected", [
- (1,
- 'Check hosts 10.20.0.3 ssh connectivity...\n1 times ssh test......failed.\n'),
- (2,
- 'Check hosts 10.20.0.3 ssh connectivity...\n'
- '1 times ssh test......failed.\n'
- '2 times ssh test......failed.\n')
-])
-def test_ssh_exception(capsys, monkeypatch, mocker, ansible_envsetup, attempts, expected):
+def test_ssh_exception(monkeypatch, mocker, ansible_envsetup):
monkeypatch.setattr(time, 'sleep', lambda s: None)
mock_sshclient = mocker.patch('paramiko.SSHClient')
test_ssh_client = mock_sshclient.return_value
test_ssh_client.exec_command.side_effect = socket.error()
- result = ansible_envsetup._ssh_is_ok('10.20.0.3', str(private_key), attempts=attempts)
- out, error = capsys.readouterr()
- assert expected == out
+ result = ansible_envsetup._ssh_is_ok('10.20.0.3', str(private_key), attempts=1)
assert result is False