aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ansible/nsb_setup.yml1
-rw-r--r--docs/testing/user/userguide/04-installation.rst138
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc011.yaml12
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc063.yaml4
-rw-r--r--tests/opnfv/test_suites/opnfv_k8-ovn-lb-noha_daily.yaml18
-rw-r--r--tests/unit/benchmark/contexts/test_heat.py38
-rw-r--r--tests/unit/benchmark/core/test_task.py52
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py14
-rw-r--r--tests/unit/test_ssh.py2
-rw-r--r--yardstick/__init__.py4
-rw-r--r--yardstick/benchmark/contexts/heat.py33
-rw-r--r--yardstick/benchmark/contexts/model.py15
-rw-r--r--yardstick/benchmark/core/plugin.py10
-rw-r--r--yardstick/benchmark/core/task.py42
-rw-r--r--yardstick/benchmark/runners/duration.py5
-rw-r--r--yardstick/benchmark/scenarios/lib/create_keypair.py2
-rw-r--r--yardstick/benchmark/scenarios/networking/ping.py2
-rw-r--r--yardstick/benchmark/scenarios/networking/vnf_generic.py29
-rw-r--r--yardstick/cmd/commands/task.py6
-rw-r--r--yardstick/orchestrator/heat.py14
-rw-r--r--yardstick/ssh.py3
21 files changed, 304 insertions, 140 deletions
diff --git a/ansible/nsb_setup.yml b/ansible/nsb_setup.yml
index e79ccabea..78cf87ec7 100644
--- a/ansible/nsb_setup.yml
+++ b/ansible/nsb_setup.yml
@@ -48,7 +48,6 @@
recreate: yes
state: started
restart_policy: always
- network_mode: host
privileged: True
interactive: True
volumes:
diff --git a/docs/testing/user/userguide/04-installation.rst b/docs/testing/user/userguide/04-installation.rst
index 37e4ba599..cb4f31434 100644
--- a/docs/testing/user/userguide/04-installation.rst
+++ b/docs/testing/user/userguide/04-installation.rst
@@ -443,6 +443,141 @@ Deploy InfluxDB and Grafana directly in Ubuntu (**Todo**)
-----------------------------------------------------------
+Yardstick common CLI
+--------------------
+
+list test cases
+>>>>>>>>>>>>>>>
+**yardstick testcase list**
+
+This command line would list all test cases in yardstick.
+It would show like below::
+
+ +---------------------------------------------------------------------------------------
+ | Testcase Name | Description
+ +---------------------------------------------------------------------------------------
+ | opnfv_yardstick_tc001 | Measure network throughput using pktgen
+ | opnfv_yardstick_tc002 | measure network latency using ping
+ | opnfv_yardstick_tc005 | Measure Storage IOPS, throughput and latency using fio.
+ | opnfv_yardstick_tc006 | Measure volume storage IOPS, throughput and latency using fio.
+ | opnfv_yardstick_tc008 | Measure network throughput and packet loss using Pktgen
+ | opnfv_yardstick_tc009 | Measure network throughput and packet loss using pktgen
+ | opnfv_yardstick_tc010 | measure memory read latency using lmbench.
+ | opnfv_yardstick_tc011 | Measure packet delay variation (jitter) using iperf3.
+ | opnfv_yardstick_tc012 | Measure memory read and write bandwidth using lmbench.
+ | opnfv_yardstick_tc014 | Measure Processing speed using unixbench.
+ | opnfv_yardstick_tc019 | Sample test case for the HA of controller node service.
+ ...
+ +---------------------------------------------------------------------------------------
+show a test case config file
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+Take opnfv_yardstick_tc002 for an example. This test case measure network latency.
+You just need to type in **yardstick testcase show opnfv_yardstick_tc002**, and the console
+would show the config yaml of this test case::
+ ##############################################################################
+ # Copyright (c) 2017 kristian.hunt@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
+ ##############################################################################
+ ---
+
+ schema: "yardstick:task:0.1"
+ description: >
+ Yardstick TC002 config file;
+ measure network latency using ping;
+
+ {% set image = image or "cirros-0.3.5" %}
+
+ {% set provider = provider or none %}
+ {% set physical_network = physical_network or 'physnet1' %}
+ {% set segmentation_id = segmentation_id or none %}
+ {% set packetsize = packetsize or 100 %}
+
+ scenarios:
+ {% for i in range(2) %}
+ -
+ type: Ping
+ options:
+ packetsize: {{packetsize}}
+ host: athena.demo
+ target: ares.demo
+
+ runner:
+ type: Duration
+ duration: 60
+ interval: 10
+
+ sla:
+ max_rtt: 10
+ action: monitor
+ {% endfor %}
+
+ context:
+ name: demo
+ image: {{image}}
+ flavor: yardstick-flavor
+ user: cirros
+
+ placement_groups:
+ pgrp1:
+ policy: "availability"
+
+ servers:
+ athena:
+ floating_ip: true
+ placement: "pgrp1"
+ ares:
+ placement: "pgrp1"
+
+ networks:
+ test:
+ cidr: '10.0.1.0/24'
+ {% if provider == "vlan" %}
+ provider: {{provider}}
+ physical_network: {{physical_network}}å
+ {% if segmentation_id %}
+ segmentation_id: {{segmentation_id}}
+ {% endif %}
+ {% endif %}
+
+start a task to run yardstick test case
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+If you want run a test case, then you need to use **yardstick task start <test_case_path>**
+this command support some parameters as below:
+
++---------------------+--------------------------------------------------+
+| Parameters | Detail |
++=====================+==================================================+
+| -d | show debug log of yardstick running |
+| | |
++---------------------+--------------------------------------------------+
+| --task-args | If you want to customize test case parameters, |
+| | use "--task-args" to pass the value. The format |
+| | is a json string with parameter key-value pair. |
+| | |
++---------------------+--------------------------------------------------+
+| --task-args-file | If you want to use yardstick |
+| | env prepare command(or |
+| | related API) to load the |
++---------------------+--------------------------------------------------+
+| --parse-only | |
+| | |
+| | |
++---------------------+--------------------------------------------------+
+| --output-file \ | Specify where to output the log. if not pass, |
+| OUTPUT_FILE_PATH | the default value is |
+| | "/tmp/yardstick/yardstick.log" |
+| | |
++---------------------+--------------------------------------------------+
+| --suite \ | run a test suite, TEST_SUITE_PATH speciy where |
+| TEST_SUITE_PATH | the test suite locates |
+| | |
++---------------------+--------------------------------------------------+
+
+
Run Yardstick in a local environment
------------------------------------
@@ -512,5 +647,4 @@ yaml file and add test cases, constraint or task arguments if necessary.
Proxy Support (**Todo**)
----------------------------
-
+--------------------------- \ No newline at end of file
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc011.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc011.yaml
index eef1a7a62..b2077d59e 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc011.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc011.yaml
@@ -13,6 +13,10 @@ description: >
Yardstick TC011 config file;
Measure packet delay variation (jitter) using iperf3.
+{% set udp = udp or "udp" %}
+{% set bandwidth = bandwidth or "20m" %}
+{% set length = length or "8K" %}
+{% set window = window or 29200 %}
{% set provider = provider or none %}
{% set physical_network = physical_network or 'physnet1' %}
{% set segmentation_id = segmentation_id or none %}
@@ -21,10 +25,10 @@ scenarios:
-
type: Iperf3
options:
- udp: udp
- bandwidth: 20m
- length: 8K
- window: 29200
+ udp: {{udp}}
+ bandwidth: {{bandwidth}}
+ length: {{length}}
+ window: {{window}}
host: zeus.demo
target: hera.demo
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc063.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc063.yaml
index 48288ef62..254c214d2 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc063.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc063.yaml
@@ -13,8 +13,8 @@ description: >
Yardstick TC063 config file;
Measure disk size, block size and disk utilization using fdisk and iostat.
-{% set host = host or "node5.yardstick-TC063" %}
{% set file = file or '/etc/yardstick/pod.yaml' %}
+{% set node = node or "node5" %}
scenarios:
-
@@ -22,7 +22,7 @@ scenarios:
options:
test_type: "disk_size"
- host: {{host}}
+ host: {{node}}.yardstick-TC063
runner:
type: Iteration
diff --git a/tests/opnfv/test_suites/opnfv_k8-ovn-lb-noha_daily.yaml b/tests/opnfv/test_suites/opnfv_k8-ovn-lb-noha_daily.yaml
new file mode 100644
index 000000000..207030073
--- /dev/null
+++ b/tests/opnfv/test_suites/opnfv_k8-ovn-lb-noha_daily.yaml
@@ -0,0 +1,18 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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
+##############################################################################
+---
+# k8 ovn lb noha daily task suite
+
+schema: "yardstick:suite:0.1"
+
+name: "k8-ovn-lb-noha"
+test_cases_dir: "tests/opnfv/test_cases/"
+test_cases:
+-
+ file_name: opnfv_yardstick_tc080.yaml
diff --git a/tests/unit/benchmark/contexts/test_heat.py b/tests/unit/benchmark/contexts/test_heat.py
index cc0c7bc8e..582d9ab99 100644
--- a/tests/unit/benchmark/contexts/test_heat.py
+++ b/tests/unit/benchmark/contexts/test_heat.py
@@ -13,7 +13,6 @@
from __future__ import absolute_import
-import ipaddress
import logging
import os
import unittest
@@ -147,30 +146,6 @@ class HeatContextTestCase(unittest.TestCase):
self.test_context.user = 'foo'
@mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
- @mock.patch('yardstick.benchmark.contexts.heat.get_neutron_client')
- def test_attrs_get(self, mock_neutron, mock_template):
- image, flavor, user = expected_tuple = 'foo1', 'foo2', 'foo3'
- self.assertNotEqual(self.test_context.image, image)
- self.assertNotEqual(self.test_context.flavor, flavor)
- self.assertNotEqual(self.test_context.user, user)
- self.test_context._image = image
- self.test_context._flavor = flavor
- self.test_context._user = user
- attr_tuple = self.test_context.image, self.test_context.flavor, self.test_context.user
- self.assertEqual(attr_tuple, expected_tuple)
-
- @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
- def test_attrs_set_negative(self, mock_template):
- with self.assertRaises(AttributeError):
- self.test_context.image = 'foo'
-
- with self.assertRaises(AttributeError):
- self.test_context.flavor = 'foo'
-
- with self.assertRaises(AttributeError):
- self.test_context.user = 'foo'
-
- @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
def test_deploy(self, mock_template):
self.test_context.name = 'foo'
self.test_context.template_file = '/bar/baz/some-heat-file'
@@ -210,8 +185,8 @@ class HeatContextTestCase(unittest.TestCase):
}
server = mock.MagicMock()
server.ports = OrderedDict([
- ('a', {'stack_name': 'b'}),
- ('c', {'stack_name': 'd'}),
+ ('a', {'stack_name': 'b', 'port': 'port_a'}),
+ ('c', {'stack_name': 'd', 'port': 'port_c'}),
])
expected = {
@@ -231,7 +206,7 @@ class HeatContextTestCase(unittest.TestCase):
self.test_context.add_server_port(server)
self.assertEqual(server.private_ip, '10.20.30.45')
self.assertEqual(len(server.interfaces), 2)
- self.assertDictEqual(server.interfaces['a'], expected)
+ self.assertDictEqual(server.interfaces['port_a'], expected)
@mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
def test_undeploy(self, mock_template):
@@ -472,7 +447,6 @@ class HeatContextTestCase(unittest.TestCase):
network2 = mock.MagicMock()
network2.name = 'net_2'
- network2.vld_id = 'vld999'
network2.segmentation_id = 'seg45'
network2.network_type = 'type_b'
network2.physical_network = 'virt'
@@ -488,16 +462,15 @@ class HeatContextTestCase(unittest.TestCase):
attr_name = {}
self.assertIsNone(self.test_context._get_network(attr_name))
- attr_name = {'vld_id': 'vld777'}
+ attr_name = {'network_type': 'nosuch'}
self.assertIsNone(self.test_context._get_network(attr_name))
attr_name = 'vld777'
self.assertIsNone(self.test_context._get_network(attr_name))
- attr_name = {'vld_id': 'vld999'}
+ attr_name = {'segmentation_id': 'seg45'}
expected = {
"name": 'net_2',
- "vld_id": 'vld999',
"segmentation_id": 'seg45',
"network_type": 'type_b',
"physical_network": 'virt',
@@ -508,7 +481,6 @@ class HeatContextTestCase(unittest.TestCase):
attr_name = 'a'
expected = {
"name": 'net_1',
- "vld_id": 'vld111',
"segmentation_id": 'seg54',
"network_type": 'type_a',
"physical_network": 'phys',
diff --git a/tests/unit/benchmark/core/test_task.py b/tests/unit/benchmark/core/test_task.py
index 14027e43c..e3917b5b2 100644
--- a/tests/unit/benchmark/core/test_task.py
+++ b/tests/unit/benchmark/core/test_task.py
@@ -66,31 +66,27 @@ class TaskTestCase(unittest.TestCase):
nodes = {
'node1': {
'interfaces': {
- 'eth0': {
- 'name': 'mgmt',
+ 'mgmt': {
+ 'network_name': 'mgmt',
},
- 'eth1': {
- 'name': 'external',
- 'vld_id': '23',
+ 'xe0': {
+ 'network_name': 'private_0',
},
- 'eth10': {
- 'name': 'internal',
- 'vld_id': '55',
+ 'xe1': {
+ 'network_name': 'public_0',
},
},
},
'node2': {
'interfaces': {
- 'eth4': {
- 'name': 'mgmt',
+ 'mgmt': {
+ 'network_name': 'mgmt',
},
- 'eth2': {
- 'name': 'external',
- 'vld_id': '32',
+ 'private_0': {
+ 'network_name': 'private_0',
},
- 'eth11': {
- 'name': 'internal',
- 'vld_id': '55',
+ 'public_0': {
+ 'network_name': 'public_0',
},
},
},
@@ -99,30 +95,30 @@ class TaskTestCase(unittest.TestCase):
mock_context.get_network.side_effect = iter([
None,
{
- 'name': 'a',
- 'network_type': 'private',
+ 'name': 'mgmt',
+ 'network_type': 'flat',
},
{},
{
- 'name': 'b',
- 'vld_id': 'y',
+ 'name': 'private_0',
'subnet_cidr': '10.20.0.0/16',
},
{
- 'name': 'c',
- 'vld_id': 'x',
+ 'name': 'public_0',
+ 'segmentation_id': '1001',
},
{
- 'name': 'd',
- 'vld_id': 'w',
+ 'name': 'private_1',
},
])
- # once for each vld_id in the nodes dict
- expected_get_network_calls = 4
+ # one for each interface
+ expected_get_network_calls = 6
expected = {
- 'a': {'name': 'a', 'network_type': 'private'},
- 'b': {'name': 'b', 'vld_id': 'y', 'subnet_cidr': '10.20.0.0/16'},
+ 'mgmt': {'name': 'mgmt', 'network_type': 'flat'},
+ 'private_0': {'name': 'private_0', 'subnet_cidr': '10.20.0.0/16'},
+ 'private_1': {'name': 'private_1'},
+ 'public_0': {'name': 'public_0', 'segmentation_id': '1001'},
}
networks = task.get_networks_from_nodes(nodes)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
index 0264facf5..983c21e61 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
@@ -186,6 +186,7 @@ class TestVnfSshHelper(unittest.TestCase):
@mock.patch('yardstick.ssh.paramiko')
def test_upload_config_file(self, mock_paramiko):
ssh_helper = VnfSshHelper(self.VNFD_0['mgmt-interface'], 'my/bin/path')
+ ssh_helper._run = mock.MagicMock()
self.assertFalse(ssh_helper.is_connected)
cfg_file = ssh_helper.upload_config_file('my/prefix', 'my content')
@@ -227,6 +228,7 @@ class TestVnfSshHelper(unittest.TestCase):
@mock.patch('yardstick.ssh.provision_tool')
def test_provision_tool(self, mock_provision_tool, mock_paramiko):
ssh_helper = VnfSshHelper(self.VNFD_0['mgmt-interface'], 'my/bin/path')
+ ssh_helper._run = mock.MagicMock()
self.assertFalse(ssh_helper.is_connected)
ssh_helper.provision_tool()
@@ -412,6 +414,7 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase):
'virtual-interface': {
'dst_mac': '00:00:00:00:00:03',
'vpci': '0000:05:00.0',
+ 'dpdk_port_num': '0',
'driver': 'i40e',
'local_ip': '152.16.100.19',
'type': 'PCI-PASSTHROUGH',
@@ -419,7 +422,9 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase):
'dpdk_port_num': '0',
'bandwidth': '10 Gbps',
'dst_ip': '152.16.100.20',
- 'local_mac': '00:00:00:00:00:01'
+ 'local_mac': '00:00:00:00:00:01',
+ 'vld_id': 'private_0',
+ 'ifname': 'xe0',
},
'vnfd-connection-point-ref': 'xe0',
'name': 'xe0'
@@ -428,6 +433,7 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase):
'virtual-interface': {
'dst_mac': '00:00:00:00:00:04',
'vpci': '0000:05:00.1',
+ 'dpdk_port_num': '1',
'driver': 'ixgbe',
'local_ip': '152.16.40.19',
'type': 'PCI-PASSTHROUGH',
@@ -435,7 +441,9 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase):
'dpdk_port_num': '1',
'bandwidth': '10 Gbps',
'dst_ip': '152.16.40.20',
- 'local_mac': '00:00:00:00:00:02'
+ 'local_mac': '00:00:00:00:00:02',
+ 'vld_id': 'public_0',
+ 'ifname': 'xe1',
},
'vnfd-connection-point-ref': 'xe1',
'name': 'xe1'
@@ -600,8 +608,8 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase):
dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
dpdk_setup_helper.CFG_CONFIG = 'config'
dpdk_setup_helper.CFG_SCRIPT = 'script'
- dpdk_setup_helper.all_ports = [3, 4, 5]
dpdk_setup_helper.pipeline_kwargs = {}
+ dpdk_setup_helper.all_ports = [0, 1, 2]
expected = {
'cfg_file': 'config',
diff --git a/tests/unit/test_ssh.py b/tests/unit/test_ssh.py
index 27ed68c7b..b298c745b 100644
--- a/tests/unit/test_ssh.py
+++ b/tests/unit/test_ssh.py
@@ -527,7 +527,7 @@ class TestAutoConnectSSH(unittest.TestCase):
'key_filename': None,
'password': None,
'name': None,
- 'wait': False,
+ 'wait': True,
}
result = auto_connect_ssh._make_dict()
self.assertDictEqual(result, expected)
diff --git a/yardstick/__init__.py b/yardstick/__init__.py
index c1010d98c..b673e7c4a 100644
--- a/yardstick/__init__.py
+++ b/yardstick/__init__.py
@@ -16,9 +16,7 @@ from yardstick.common import utils as yardstick_utils
yardstick_utils.makedirs(constants.LOG_DIR)
LOG_FILE = os.path.join(constants.LOG_DIR, 'yardstick.log')
-LOG_FORMATTER = ('%(asctime)s '
- '%(name)s %(filename)s:%(lineno)d '
- '%(levelname)s %(message)s')
+LOG_FORMATTER = '%(asctime)s [%(levelname)s] %(name)s %(filename)s:%(lineno)d %(message)s'
_LOG_FORMATTER = logging.Formatter(LOG_FORMATTER)
_LOG_STREAM_HDLR = logging.StreamHandler()
diff --git a/yardstick/benchmark/contexts/heat.py b/yardstick/benchmark/contexts/heat.py
index 575467f8f..d2309cc10 100644
--- a/yardstick/benchmark/contexts/heat.py
+++ b/yardstick/benchmark/contexts/heat.py
@@ -295,7 +295,7 @@ class HeatContext(Context):
def deploy(self):
"""deploys template into a stack using cloud"""
- print("Deploying context '%s'" % self.name)
+ LOG.info("Deploying context '%s' START", self.name)
heat_template = HeatTemplate(self.name, self.template_file,
self.heat_parameters)
@@ -325,23 +325,28 @@ class HeatContext(Context):
server.public_ip = \
self.stack.outputs[server.floating_ip["stack_name"]]
- print("Context '%s' deployed" % self.name)
+ LOG.info("Deploying context '%s' DONE", self.name)
def add_server_port(self, server):
# TODO(hafe) can only handle one internal network for now
- port = next(iter(server.ports.values()))
- server.private_ip = self.stack.outputs[port["stack_name"]]
+ # use private ip from first port
+ private_port = next(iter(server.ports.values()))
+ server.private_ip = self.stack.outputs[private_port["stack_name"]]
server.interfaces = {}
for network_name, port in server.ports.items():
- server.interfaces[network_name] = self.make_interface_dict(
- network_name, port['stack_name'], self.stack.outputs)
+ # port['port'] is either port name from mapping or default network_name
+ server.interfaces[port['port']] = self.make_interface_dict(network_name, port['port'],
+ port['stack_name'],
+ self.stack.outputs)
- def make_interface_dict(self, network_name, stack_name, outputs):
+ def make_interface_dict(self, network_name, port, stack_name, outputs):
private_ip = outputs[stack_name]
mac_address = outputs[h_join(stack_name, "mac_address")]
+ # these are attributes of the network, not the port
output_subnet_cidr = outputs[h_join(self.name, network_name,
'subnet', 'cidr')]
+ # these are attributes of the network, not the port
output_subnet_gateway = outputs[h_join(self.name, network_name,
'subnet', 'gateway_ip')]
@@ -355,6 +360,7 @@ class HeatContext(Context):
"mac_address": mac_address,
"device_id": outputs[h_join(stack_name, "device_id")],
"network_id": outputs[h_join(stack_name, "network_id")],
+ # this should be == vld_id for NSB tests
"network_name": network_name,
# to match vnf_generic
"local_mac": mac_address,
@@ -364,10 +370,10 @@ class HeatContext(Context):
def undeploy(self):
"""undeploys stack from cloud"""
if self.stack:
- print("Undeploying context '%s'" % self.name)
+ LOG.info("Undeploying context '%s' START", self.name)
self.stack.delete()
self.stack = None
- print("Context '%s' undeployed" % self.name)
+ LOG.info("Undeploying context '%s' DONE", self.name)
if os.path.exists(self.key_filename):
try:
@@ -438,9 +444,11 @@ class HeatContext(Context):
network = self.networks.get(attr_name, None)
else:
- # Don't generalize too much Just support vld_id
- vld_id = attr_name.get('vld_id', {})
- network_iter = (n for n in self.networks.values() if n.vld_id == vld_id)
+ # Only take the first key, value
+ key, value = next(iter(attr_name.items()), (None, None))
+ if key is None:
+ return None
+ network_iter = (n for n in self.networks.values() if getattr(n, key) == value)
network = next(network_iter, None)
if network is None:
@@ -448,7 +456,6 @@ class HeatContext(Context):
result = {
"name": network.name,
- "vld_id": network.vld_id,
"segmentation_id": network.segmentation_id,
"network_type": network.network_type,
"physical_network": network.physical_network,
diff --git a/yardstick/benchmark/contexts/model.py b/yardstick/benchmark/contexts/model.py
index 0b8197ce9..da2b74e1c 100644
--- a/yardstick/benchmark/contexts/model.py
+++ b/yardstick/benchmark/contexts/model.py
@@ -208,6 +208,7 @@ class Server(Object): # pragma: no cover
self.instances = attrs["instances"]
# dict with key network name, each item is a dict with port name and ip
+ self.network_ports = attrs.get("network_ports", {})
self.ports = {}
self.floating_ip = None
@@ -253,8 +254,18 @@ class Server(Object): # pragma: no cover
"""adds to the template one server and corresponding resources"""
port_name_list = []
for network in networks:
- port_name = server_name + "-" + network.name + "-port"
- self.ports[network.name] = {"stack_name": port_name}
+ # if explicit mapping skip unused networks
+ if self.network_ports:
+ try:
+ port = self.network_ports[network.name]
+ except KeyError:
+ # no port for this network
+ continue
+ # otherwise add a port for every network with port name as network name
+ else:
+ port = network.name
+ port_name = "{0}-{1}-port".format(server_name, port)
+ self.ports[network.name] = {"stack_name": port_name, "port": port}
# we can't use secgroups if port_security_enabled is False
if network.port_security_enabled is False:
sec_group_id = None
diff --git a/yardstick/benchmark/core/plugin.py b/yardstick/benchmark/core/plugin.py
index 24f1b6b25..56ecd29d9 100644
--- a/yardstick/benchmark/core/plugin.py
+++ b/yardstick/benchmark/core/plugin.py
@@ -38,19 +38,19 @@ class Plugin(object):
plugins, deployment = parser.parse_plugin()
plugin_name = plugins.get("name")
- print("Installing plugin: %s" % plugin_name)
+ LOG.info("Installing plugin: %s", plugin_name)
- LOG.info("Executing _install_setup()")
+ LOG.debug("Executing _install_setup()")
self._install_setup(plugin_name, deployment)
- LOG.info("Executing _run()")
+ LOG.debug("Executing _run()")
self._run(plugin_name)
total_end_time = time.time()
- LOG.info("total finished in %d secs",
+ LOG.info("Total finished in %d secs",
total_end_time - total_start_time)
- print("Done, exiting")
+ LOG.info("Plugin %s Done, exiting", plugin_name)
def remove(self, args):
"""Remove a plugin."""
diff --git a/yardstick/benchmark/core/task.py b/yardstick/benchmark/core/task.py
index a49a2cb71..a8447e2cf 100644
--- a/yardstick/benchmark/core/task.py
+++ b/yardstick/benchmark/core/task.py
@@ -97,8 +97,8 @@ class Task(object): # pragma: no cover
task_args = [args.task_args]
task_args_fnames = [args.task_args_file]
- LOG.info("\ntask_files:%s, \ntask_args:%s, \ntask_args_fnames:%s",
- task_files, task_args, task_args_fnames)
+ LOG.debug("task_files:%s, task_args:%s, task_args_fnames:%s",
+ task_files, task_args, task_args_fnames)
if args.parse_only:
sys.exit(0)
@@ -139,7 +139,7 @@ class Task(object): # pragma: no cover
context.undeploy()
self.contexts = []
one_task_end_time = time.time()
- LOG.info("task %s finished in %d secs", task_files[i],
+ LOG.info("Task %s finished in %d secs", task_files[i],
one_task_end_time - one_task_start_time)
result = self._get_format_result(testcases)
@@ -148,14 +148,13 @@ class Task(object): # pragma: no cover
self._generate_reporting(result)
total_end_time = time.time()
- LOG.info("total finished in %d secs",
+ LOG.info("Total finished in %d secs",
total_end_time - total_start_time)
scenario = scenarios[0]
- print("To generate report execute => yardstick report generate ",
- scenario['task_id'], scenario['tc'])
-
- print("Done, exiting")
+ LOG.info("To generate report, execute command "
+ "'yardstick report generate %(task_id)s %(tc)s'", scenario)
+ LOG.info("Task ALL DONE, exiting")
return result
def _generate_reporting(self, result):
@@ -163,7 +162,7 @@ class Task(object): # pragma: no cover
with open(constants.REPORTING_FILE, 'w') as f:
f.write(env.from_string(report_template).render(result))
- LOG.info('yardstick reporting generate in %s', constants.REPORTING_FILE)
+ LOG.info("Report can be found in '%s'", constants.REPORTING_FILE)
def _set_log(self):
log_format = '%(asctime)s %(name)s %(filename)s:%(lineno)d %(levelname)s %(message)s'
@@ -265,7 +264,7 @@ class Task(object): # pragma: no cover
raise RuntimeError
self.outputs.update(runner.get_output())
result.extend(runner.get_result())
- print("Runner ended, output in", output_file)
+ LOG.info("Runner ended, output in %s", output_file)
else:
# run serially
for scenario in scenarios:
@@ -277,7 +276,7 @@ class Task(object): # pragma: no cover
raise RuntimeError
self.outputs.update(runner.get_output())
result.extend(runner.get_result())
- print("Runner ended, output in", output_file)
+ LOG.info("Runner ended, output in %s", output_file)
# Abort background runners
for runner in background_runners:
@@ -302,7 +301,7 @@ class Task(object): # pragma: no cover
base_runner.Runner.terminate_all()
if self.contexts:
- print("Undeploying all contexts")
+ LOG.info("Undeploying all contexts")
for context in self.contexts[::-1]:
context.undeploy()
@@ -365,7 +364,7 @@ class Task(object): # pragma: no cover
context_cfg["nodes"])
runner = base_runner.Runner.get(runner_cfg)
- print("Starting runner of type '%s'" % runner_cfg["type"])
+ LOG.info("Starting runner of type '%s'", runner_cfg["type"])
runner.run(scenario_cfg, context_cfg)
return runner
@@ -377,8 +376,6 @@ class Task(object): # pragma: no cover
target_attr: either a name for a server created by yardstick or a dict
with attribute name mapping when using external heat templates
"""
- host = None
- target = None
for context in self.contexts:
if context.__context_type__ != "Heat":
continue
@@ -477,7 +474,7 @@ class TaskParser(object): # pragma: no cover
def parse_task(self, task_id, task_args=None, task_args_file=None):
"""parses the task file and return an context and scenario instances"""
- print("Parsing task config:", self.path)
+ LOG.info("Parsing task config: %s", self.path)
try:
kw = {}
@@ -494,10 +491,9 @@ class TaskParser(object): # pragma: no cover
input_task = f.read()
rendered_task = TaskTemplate.render(input_task, **kw)
except Exception as e:
- print("Failed to render template:\n%(task)s\n%(err)s\n"
- % {"task": input_task, "err": e})
+ LOG.exception('Failed to render template:\n%s\n', input_task)
raise e
- print("Input task is:\n%s\n" % rendered_task)
+ LOG.debug("Input task is:\n%s\n", rendered_task)
cfg = yaml_load(rendered_task)
except IOError as ioerror:
@@ -628,11 +624,11 @@ def get_networks_from_nodes(nodes):
continue
interfaces = node.get('interfaces', {})
for interface in interfaces.values():
- vld_id = interface.get('vld_id')
- # mgmt network doesn't have vld_id
- if not vld_id:
+ # vld_id is network_name
+ network_name = interface.get('network_name')
+ if not network_name:
continue
- network = Context.get_network({"vld_id": vld_id})
+ network = Context.get_network(network_name)
if network:
networks[network['name']] = network
return networks
diff --git a/yardstick/benchmark/runners/duration.py b/yardstick/benchmark/runners/duration.py
index 69d744562..c2c6a8f19 100644
--- a/yardstick/benchmark/runners/duration.py
+++ b/yardstick/benchmark/runners/duration.py
@@ -40,7 +40,8 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
interval = runner_cfg.get("interval", 1)
duration = runner_cfg.get("duration", 60)
- LOG.info("worker START, duration %d sec, class %s", duration, cls)
+ LOG.info("Worker START, duration is %ds", duration)
+ LOG.debug("class is %s", cls)
runner_cfg['runner_id'] = os.getpid()
@@ -95,7 +96,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
if (errors and sla_action is None) or \
(time.time() - start > duration or aborted.is_set()):
- LOG.info("worker END")
+ LOG.info("Worker END")
break
benchmark.teardown()
diff --git a/yardstick/benchmark/scenarios/lib/create_keypair.py b/yardstick/benchmark/scenarios/lib/create_keypair.py
index 2185bfa5d..f5b1fff7a 100644
--- a/yardstick/benchmark/scenarios/lib/create_keypair.py
+++ b/yardstick/benchmark/scenarios/lib/create_keypair.py
@@ -47,7 +47,7 @@ class CreateKeypair(base.Scenario):
rsa_key = paramiko.RSAKey.generate(bits=2048, progress_func=None)
rsa_key.write_private_key_file(self.key_filename)
- print("Writing %s ..." % self.key_filename)
+ LOG.info("Writing key_file %s ...", self.key_filename)
with open(self.key_filename + ".pub", "w") as pubkey_file:
pubkey_file.write(
"%s %s\n" % (rsa_key.get_name(), rsa_key.get_base64()))
diff --git a/yardstick/benchmark/scenarios/networking/ping.py b/yardstick/benchmark/scenarios/networking/ping.py
index 6a7927de4..3bade73e2 100644
--- a/yardstick/benchmark/scenarios/networking/ping.py
+++ b/yardstick/benchmark/scenarios/networking/ping.py
@@ -67,7 +67,7 @@ class Ping(base.Scenario):
else:
target_vm = self.scenario_cfg['target']
- LOG.debug("ping '%s' '%s'", options, dest)
+ LOG.debug("ping %s %s", options, dest)
with open(self.target_script, "r") as stdin_file:
exit_status, stdout, stderr = self.connection.execute(
"/bin/sh -s {0} {1}".format(dest, options),
diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py
index f7b2915a2..0e6ceab6e 100644
--- a/yardstick/benchmark/scenarios/networking/vnf_generic.py
+++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py
@@ -216,7 +216,26 @@ class NetworkServiceTestCase(base.Scenario):
@staticmethod
def get_vld_networks(networks):
- return {n['vld_id']: n for n in networks.values()}
+ # network name is vld_id
+ vld_map = {}
+ for name, n in networks.items():
+ try:
+ vld_map[n['vld_id']] = n
+ except KeyError:
+ vld_map[name] = n
+ return vld_map
+
+ @staticmethod
+ def find_node_if(nodes, name, if_name, vld_id):
+ try:
+ # check for xe0, xe1
+ intf = nodes[name]["interfaces"][if_name]
+ except KeyError:
+ # if not xe0, then maybe vld_id, private_0, public_0
+ # pop it and re-insert with the correct name from topology
+ intf = nodes[name]["interfaces"].pop(vld_id)
+ nodes[name]["interfaces"][if_name] = intf
+ return intf
def _resolve_topology(self):
for vld in self.topology["vld"]:
@@ -234,8 +253,8 @@ class NetworkServiceTestCase(base.Scenario):
try:
nodes = self.context_cfg["nodes"]
- node0_if = nodes[node0_name]["interfaces"][node0_if_name]
- node1_if = nodes[node1_name]["interfaces"][node1_if_name]
+ node0_if = self.find_node_if(nodes, node0_name, node0_if_name, vld["id"])
+ node1_if = self.find_node_if(nodes, node1_name, node1_if_name, vld["id"])
# names so we can do reverse lookups
node0_if["ifname"] = node0_if_name
@@ -285,8 +304,8 @@ class NetworkServiceTestCase(base.Scenario):
node1_if_name = node1_data["vnfd-connection-point-ref"]
nodes = self.context_cfg["nodes"]
- node0_if = nodes[node0_name]["interfaces"][node0_if_name]
- node1_if = nodes[node1_name]["interfaces"][node1_if_name]
+ node0_if = self.find_node_if(nodes, node0_name, node0_if_name, vld["id"])
+ node1_if = self.find_node_if(nodes, node1_name, node1_if_name, vld["id"])
# add peer interface dict, but remove circular link
# TODO: don't waste memory
diff --git a/yardstick/cmd/commands/task.py b/yardstick/cmd/commands/task.py
index bd5447836..e2e8bf67d 100644
--- a/yardstick/cmd/commands/task.py
+++ b/yardstick/cmd/commands/task.py
@@ -51,7 +51,7 @@ class TaskCommands(object): # pragma: no cover
self.output_file = param.output_file
result = {}
-
+ LOG.info('Task START')
try:
result = Task().start(param, **kwargs)
except Exception as e:
@@ -59,9 +59,9 @@ class TaskCommands(object): # pragma: no cover
LOG.exception("")
if result.get('result', {}).get('criteria') == 'PASS':
- LOG.info('Task Success')
+ LOG.info('Task SUCCESS')
else:
- LOG.info('Task Failed')
+ LOG.info('Task FAILED')
raise RuntimeError('Task Failed')
def _write_error_data(self, error):
diff --git a/yardstick/orchestrator/heat.py b/yardstick/orchestrator/heat.py
index 8c7b1e429..455ddc34e 100644
--- a/yardstick/orchestrator/heat.py
+++ b/yardstick/orchestrator/heat.py
@@ -89,14 +89,14 @@ class HeatStack(HeatObject):
if self.uuid is None:
return
- log.info("Deleting stack '%s', uuid:%s", self.name, self.uuid)
+ log.info("Deleting stack '%s' START, uuid:%s", self.name, self.uuid)
heat = self.heat_client
template = heat.stacks.get(self.uuid)
start_time = time.time()
template.delete()
for status in iter(self.status, u'DELETE_COMPLETE'):
- log.debug("stack state %s", status)
+ log.debug("Deleting stack state: %s", status)
if status == u'DELETE_FAILED':
raise RuntimeError(
heat.stacks.get(self.uuid).stack_status_reason)
@@ -104,7 +104,7 @@ class HeatStack(HeatObject):
time.sleep(2)
end_time = time.time()
- log.info("Deleted stack '%s' in %d secs", self.name,
+ log.info("Deleting stack '%s' DONE in %d secs", self.name,
end_time - start_time)
self.uuid = None
@@ -599,7 +599,7 @@ name (i.e. %s).\
:param: timeout: timeout in seconds for Heat create, default 3600s
:type timeout: int
"""
- log.info("Creating stack '%s'", self.name)
+ log.info("Creating stack '%s' START", self.name)
# create stack early to support cleanup, e.g. ctrl-c while waiting
stack = HeatStack(self.name)
@@ -613,13 +613,13 @@ name (i.e. %s).\
if not block:
self.outputs = stack.outputs = {}
end_time = time.time()
- log.info("Created stack '%s' in %.3e secs",
+ log.info("Creating stack '%s' DONE in %d secs",
self.name, end_time - start_time)
return stack
time_limit = start_time + timeout
for status in iter(self.status, self.HEAT_CREATE_COMPLETE_STATUS):
- log.debug("stack state %s", status)
+ log.debug("Creating stack state: %s", status)
if status == u'CREATE_FAILED':
stack_status_reason = heat_client.stacks.get(self.uuid).stack_status_reason
heat_client.stacks.delete(self.uuid)
@@ -631,7 +631,7 @@ name (i.e. %s).\
end_time = time.time()
outputs = heat_client.stacks.get(self.uuid).outputs
- log.info("Created stack '%s' in %.3e secs",
+ log.info("Creating stack '%s' DONE in %d secs",
self.name, end_time - start_time)
# keep outputs as unicode
diff --git a/yardstick/ssh.py b/yardstick/ssh.py
index a024cf64a..bb715e4b4 100644
--- a/yardstick/ssh.py
+++ b/yardstick/ssh.py
@@ -432,8 +432,9 @@ class SSH(object):
class AutoConnectSSH(SSH):
+ # always wait or we will get OpenStack SSH errors
def __init__(self, user, host, port=None, pkey=None,
- key_filename=None, password=None, name=None, wait=False):
+ key_filename=None, password=None, name=None, wait=True):
super(AutoConnectSSH, self).__init__(user, host, port, pkey, key_filename, password, name)
self._wait = wait