aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker/Dockerfile37
-rw-r--r--qtip/ansible_library/modules/apex_generate_inventory.py3
-rw-r--r--qtip/ansible_library/modules/fuel.py3
-rw-r--r--qtip/cli/commands/cmd_qpi.py48
-rw-r--r--resources/QPI/compute.yaml7
-rw-r--r--resources/ansible_roles/qtip-generator/files/compute/templates/ssh.cfg2
-rw-r--r--tests/unit/ansible_library/modules/apex_generate_inventory_test.py10
-rw-r--r--tests/unit/ansible_library/modules/fuel_test.py12
-rw-r--r--tests/unit/cli/cmd_qpi_test.py24
9 files changed, 66 insertions, 80 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index bab503fc..8109fb69 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -8,11 +8,17 @@ LABEL version="0.1" description="OPNFV QTIP Docker container"
ARG BRANCH=master
-ENV REPOS_DIR /home/opnfv/repos
-ENV PYTHONPATH /home/opnfv/repos/qtip
-ENV USER root
+ENV REPOS_DIR=/home/opnfv/repos \
+ PYTHONPATH=/home/opnfv/repos/qtip \
+ USER=root
+
WORKDIR /home/opnfv
+RUN mkdir -p ${REPOS_DIR} \
+ && mkdir -p /root/qtip/logs \
+ && mkdir -p /root/.ssh \
+ && chmod 700 /root/.ssh
+
# Packaged Dependencies
RUN apt-get update && apt-get install -y \
software-properties-common \
@@ -28,26 +34,18 @@ RUN apt-get update && apt-get install -y \
python-setuptools \
rsync \
iputils-ping \
+ wget \
+ curl \
--no-install-recommends \
-&& rm -rf /var/lib/apt/lists/*
+ && rm -rf /var/lib/apt/lists/*
RUN pip install -U pip && pip install -U setuptools
-RUN apt-add-repository ppa:ansible/ansible -y
-RUN apt-key update -y
-RUN apt-get update && apt-get install ansible -y
-
-RUN mkdir -p ${REPOS_DIR}
-RUN mkdir -p /root/.ssh
-RUN mkdir -p /root/qtip/logs
-
-RUN chmod 700 /root/.ssh
-
#Cloning Repos
-RUN git config --global http.sslVerify false
-RUN git clone -b $BRANCH https://gerrit.opnfv.org/gerrit/qtip $REPOS_DIR/qtip
-
-RUN cd $REPOS_DIR/qtip && pip install -U -e .
+RUN git config --global http.sslVerify false \
+ && git clone -b $BRANCH https://gerrit.opnfv.org/gerrit/qtip $REPOS_DIR/qtip \
+ && cd $REPOS_DIR/qtip \
+ && pip install -U -e .
RUN echo 'eval $(ssh-agent)' >> /root/.bashrc
@@ -55,8 +53,7 @@ RUN echo 'eval $(ssh-agent)' >> /root/.bashrc
EXPOSE 5000
#Config supervisor
-RUN mkdir -p /var/log/supervisor
-RUN locale-gen en_US en_US.UTF-8
+RUN mkdir -p /var/log/supervisor && locale-gen en_US en_US.UTF-8
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
CMD ["/usr/bin/supervisord"] \ No newline at end of file
diff --git a/qtip/ansible_library/modules/apex_generate_inventory.py b/qtip/ansible_library/modules/apex_generate_inventory.py
index b1cc976d..0c9500f1 100644
--- a/qtip/ansible_library/modules/apex_generate_inventory.py
+++ b/qtip/ansible_library/modules/apex_generate_inventory.py
@@ -79,7 +79,8 @@ def generate_inventory(baremetal_info, server_info):
node_ip = re.findall('.+=(\d+.\d+.\d+.\d+)$', server['Networks'])[0]
hosts[role].append(node_ip)
# To match ssh.cfg.j2 template
- hosts_meta[node_ip] = {'ansible_ssh_host': node_ip}
+ hosts_meta[node_ip] = {'ansible_ssh_host': node_ip,
+ 'ansible_user': 'heat-admin'}
for host in hosts:
hosts[host].sort()
diff --git a/qtip/ansible_library/modules/fuel.py b/qtip/ansible_library/modules/fuel.py
index 5ec45dd1..04154e34 100644
--- a/qtip/ansible_library/modules/fuel.py
+++ b/qtip/ansible_library/modules/fuel.py
@@ -98,7 +98,8 @@ def generate_inventory(nodes):
'ip': node['ip'],
'mac': node['mac'],
'cluster': cluster_id,
- 'ansible_ssh_host': node['ip']
+ 'ansible_ssh_host': node['ip'],
+ 'ansible_user': 'root'
}
hosts_meta[hostname] = node_meta
diff --git a/qtip/cli/commands/cmd_qpi.py b/qtip/cli/commands/cmd_qpi.py
index d08842a4..4865b7ae 100644
--- a/qtip/cli/commands/cmd_qpi.py
+++ b/qtip/cli/commands/cmd_qpi.py
@@ -9,47 +9,41 @@
import click
-from colorama import Fore
import os
+from os import path
+from prettytable import PrettyTable
+import yaml
-from qtip.base.error import InvalidContentError
-from qtip.base.error import NotFoundError
-from qtip.cli import utils
-from qtip.loader.qpi import QPISpec
+QPI_PATH = path.join(path.dirname(__file__), '..', '..', '..',
+ 'resources', 'QPI')
@click.group()
def cli():
- ''' Collection of performance tests '''
+ """ Collection of performance tests """
pass
@cli.command('list', help='List all the QPI specs')
def cmd_list():
- qpis = QPISpec.list_all()
- table = utils.table('QPIs', qpis)
+ table = PrettyTable(['QPI', 'Description'])
+ table.align = 'l'
+ for qpi in os.listdir(QPI_PATH):
+ if qpi.endswith('yaml'):
+ with open('{}/{}'.format(QPI_PATH, qpi)) as conf:
+ details = yaml.safe_load(conf)
+ table.add_row([details['name'], details['description']])
click.echo(table)
@cli.command('show', help='View details of a QPI')
@click.argument('name')
def show(name):
- try:
- qpi = QPISpec('{}.yaml'.format(name))
- except NotFoundError as nf:
- click.echo(Fore.RED + "ERROR: qpi spec: " + nf.message)
- except InvalidContentError as ice:
- click.echo(Fore.RED + "ERROR: qpi spec: " + ice.message)
- else:
- cnt = qpi.content
- output = utils.render('qpi', cnt)
- click.echo(output)
-
-
-@cli.command('run', help='Run performance tests for the specified QPI')
-@click.argument('name')
-@click.option('-p', '--path', help='Path to store results')
-def run(name, path):
- runner_path = path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir,
- 'runner/runner.py')
- os.system('python {0} -b all -d {1}'.format(runner_path, path))
+ table = PrettyTable(['QPI', 'Description', 'Formula'])
+ table.align = 'l'
+ with open('{}/{}.yaml'.format(QPI_PATH, name)) as conf:
+ qpi = yaml.safe_load(conf)
+ for section in qpi['sections']:
+ table.add_row([section['name'], section['description'],
+ section['formula']])
+ click.echo(table)
diff --git a/resources/QPI/compute.yaml b/resources/QPI/compute.yaml
index 8169da4f..50c1cfbf 100644
--- a/resources/QPI/compute.yaml
+++ b/resources/QPI/compute.yaml
@@ -29,7 +29,7 @@ sections: # split based on different application
metrics:
- name: ssl_rsa
description: performance of cryptographic using RSA cipher algorithm
- formual: geometric mean
+ formula: geometric mean
workloads:
- name: rsa_sign_512
description: rsa 512 bits sign per second
@@ -50,7 +50,7 @@ sections: # split based on different application
- name: ssl_aes
description: >
performance of advanced encryption standard (AES) cipher algorithm in cipher block chaining (CBC) mode
- formual: geometric mean
+ formula: geometric mean
workloads:
- name: aes_128_cbc_16_bytes
description: aes 128 bits key cbc on 16 bytes blocks
@@ -64,6 +64,7 @@ sections: # split based on different application
description: aes 128 bits key cbc on 8192 bytes blocks
- name: DPI
description: deep packet inspection
+ formula: geometric mean
metrics:
- name: dpi_throughput
description: deep packet inspection throughput
@@ -74,6 +75,7 @@ sections: # split based on different application
description: DPI bits per second
- name: memory
description: cache and memory performance
+ formula: geometric mean
metrics:
- name: floatmem
description: >
@@ -123,6 +125,7 @@ sections: # split based on different application
(A = m*B + C).
- name: arithmetic
description: arithmetic computing speed
+ formula: geometric mean
metrics:
- name: integer
description: >
diff --git a/resources/ansible_roles/qtip-generator/files/compute/templates/ssh.cfg b/resources/ansible_roles/qtip-generator/files/compute/templates/ssh.cfg
index f0e33fd4..1b7c0183 100644
--- a/resources/ansible_roles/qtip-generator/files/compute/templates/ssh.cfg
+++ b/resources/ansible_roles/qtip-generator/files/compute/templates/ssh.cfg
@@ -9,7 +9,7 @@
{% for (name, host) in hosts_meta.items() %}
Host {{ name }}
HostName {{ host.ansible_ssh_host }}
- User root
+ User {{ host.ansible_user }}
ProxyCommand ssh -o 'ForwardAgent yes' {{ installer_host }} 'ssh-add && nc %h %p'
{% endfor %}
diff --git a/tests/unit/ansible_library/modules/apex_generate_inventory_test.py b/tests/unit/ansible_library/modules/apex_generate_inventory_test.py
index 7df9d35c..668a0155 100644
--- a/tests/unit/ansible_library/modules/apex_generate_inventory_test.py
+++ b/tests/unit/ansible_library/modules/apex_generate_inventory_test.py
@@ -23,8 +23,8 @@ def test_generate_inventory(data_root):
u'compute': [u'192.0.2.5', u'192.0.2.6'],
u'control': [u'192.0.2.7', u'192.0.2.8', u'192.0.2.9']}
assert dict(inventory['hosts_meta']) == {
- u'192.0.2.5': {'ansible_ssh_host': u'192.0.2.5'},
- u'192.0.2.6': {'ansible_ssh_host': u'192.0.2.6'},
- u'192.0.2.7': {'ansible_ssh_host': u'192.0.2.7'},
- u'192.0.2.8': {'ansible_ssh_host': u'192.0.2.8'},
- u'192.0.2.9': {'ansible_ssh_host': u'192.0.2.9'}}
+ u'192.0.2.5': {'ansible_ssh_host': u'192.0.2.5', 'ansible_user': 'heat-admin'},
+ u'192.0.2.6': {'ansible_ssh_host': u'192.0.2.6', 'ansible_user': 'heat-admin'},
+ u'192.0.2.7': {'ansible_ssh_host': u'192.0.2.7', 'ansible_user': 'heat-admin'},
+ u'192.0.2.8': {'ansible_ssh_host': u'192.0.2.8', 'ansible_user': 'heat-admin'},
+ u'192.0.2.9': {'ansible_ssh_host': u'192.0.2.9', 'ansible_user': 'heat-admin'}}
diff --git a/tests/unit/ansible_library/modules/fuel_test.py b/tests/unit/ansible_library/modules/fuel_test.py
index e004fc17..9ec1806f 100644
--- a/tests/unit/ansible_library/modules/fuel_test.py
+++ b/tests/unit/ansible_library/modules/fuel_test.py
@@ -34,21 +34,21 @@ def test_generate_inventory(data_root):
u'node-27'],
u'mongo': [u'node-24']}
assert dict(inventory['hosts_meta']) == {
- u'node-23': {'ansible_ssh_host': u'10.20.11.10', 'cluster': 4, 'ip': u'10.20.11.10',
+ u'node-23': {'ansible_ssh_host': u'10.20.11.10', 'ansible_user': 'root', 'cluster': 4, 'ip': u'10.20.11.10',
'mac': u'74:4a:a4:01:71:61', 'name': u'Untitled (71:61)', 'online': True, 'os_platform': u'ubuntu',
'status': u'ready'},
- u'node-24': {'ansible_ssh_host': u'10.20.11.11', 'cluster': 4, 'ip': u'10.20.11.11',
+ u'node-24': {'ansible_ssh_host': u'10.20.11.11', 'ansible_user': 'root', 'cluster': 4, 'ip': u'10.20.11.11',
'mac': u'74:4a:a4:01:73:50', 'name': u'Untitled (73:50)', 'online': True, 'os_platform': u'ubuntu',
'status': u'ready'},
- u'node-25': {'ansible_ssh_host': u'10.20.11.12', 'cluster': 4, 'ip': u'10.20.11.12',
+ u'node-25': {'ansible_ssh_host': u'10.20.11.12', 'ansible_user': 'root', 'cluster': 4, 'ip': u'10.20.11.12',
'mac': u'74:4a:a4:00:d8:76', 'name': u'Untitled (d8:76)', 'online': True, 'os_platform': u'ubuntu',
'status': u'ready'},
- u'node-26': {'ansible_ssh_host': u'10.20.11.15', 'cluster': 4, 'ip': u'10.20.11.15',
+ u'node-26': {'ansible_ssh_host': u'10.20.11.15', 'ansible_user': 'root', 'cluster': 4, 'ip': u'10.20.11.15',
'mac': u'74:4a:a4:01:61:ae', 'name': u'Untitled (61:ae)', 'online': True, 'os_platform': u'ubuntu',
'status': u'ready'},
- u'node-27': {'ansible_ssh_host': u'10.20.11.13', 'cluster': 4, 'ip': u'10.20.11.13',
+ u'node-27': {'ansible_ssh_host': u'10.20.11.13', 'ansible_user': 'root', 'cluster': 4, 'ip': u'10.20.11.13',
'mac': u'74:4a:a4:01:82:c0', 'name': u'Untitled (82:c0)', 'online': True, 'os_platform': u'ubuntu',
'status': u'ready'},
- u'node-28': {'ansible_ssh_host': u'10.20.11.14', 'cluster': 4, 'ip': u'10.20.11.14',
+ u'node-28': {'ansible_ssh_host': u'10.20.11.14', 'ansible_user': 'root', 'cluster': 4, 'ip': u'10.20.11.14',
'mac': u'74:4a:a4:01:74:63', 'name': u'Untitled (74:63)', 'online': True, 'os_platform': u'ubuntu',
'status': u'ready'}}
diff --git a/tests/unit/cli/cmd_qpi_test.py b/tests/unit/cli/cmd_qpi_test.py
index e7823c9b..ba5f814e 100644
--- a/tests/unit/cli/cmd_qpi_test.py
+++ b/tests/unit/cli/cmd_qpi_test.py
@@ -20,24 +20,14 @@ def runner():
def test_list(runner):
result = runner.invoke(cli, ['qpi', 'list'])
- assert 'QPIs' and 'compute' in result.output
-
-
-def test_run(runner):
- result = runner.invoke(cli, ['qpi', 'run', 'fake-qpi'])
- assert result.output == ''
-
- result = runner.invoke(cli, ['qpi', 'run'])
- assert 'Missing argument "name".' in result.output
+ assert 'QPI' in result.output
+ assert 'compute' in result.output
+ assert 'Description' in result.output
+ assert 'QTIP Performance Index of compute' in result.output
def test_show(runner):
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
-
- result = runner.invoke(cli, ['qpi', 'show', 'xyz'])
- assert "ERROR: qpi spec: xyz not found" in result.output
+ assert 'QPI' in result.output
+ assert 'Description' in result.output
+ assert 'Formula' in result.output