aboutsummaryrefslogtreecommitdiffstats
path: root/qtip
diff options
context:
space:
mode:
Diffstat (limited to 'qtip')
-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.yaml (renamed from qtip/driver/ansible.py)17
-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
38 files changed, 1443 insertions, 133 deletions
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/ansible.py b/qtip/driver/playbook/openssl/clean.yaml
index cd17625d..0139ba54 100644
--- a/qtip/driver/ansible.py
+++ b/qtip/driver/playbook/openssl/clean.yaml
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 2016 ZTE Corp and others.
+# 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
@@ -7,8 +7,17 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-from qtip.driver.base import BaseDriver
+- hosts: hosts
+ become: yes
+ remote_user: root
+ tasks:
+ - name: Cleaning Open_SSL
+ file:
+ path: '{{ ansible_env.HOME }}/Open_SSL'
+ state: absent
-class AnsibleDriver(BaseDriver):
- """driver for running performance tests with Ansible"""
+ - 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'])