diff options
Diffstat (limited to 'tests/unit/benchmark')
10 files changed, 524 insertions, 355 deletions
diff --git a/tests/unit/benchmark/contexts/test_heat.py b/tests/unit/benchmark/contexts/test_heat.py index ae57402c0..658a8e580 100644 --- a/tests/unit/benchmark/contexts/test_heat.py +++ b/tests/unit/benchmark/contexts/test_heat.py @@ -22,21 +22,24 @@ from collections import OrderedDict import mock +from itertools import count from yardstick.benchmark.contexts import heat from yardstick.benchmark.contexts import model - LOG = logging.getLogger(__name__) class HeatContextTestCase(unittest.TestCase): + def __init__(self, *args, **kwargs): + super(HeatContextTestCase, self).__init__(*args, **kwargs) + self.name_iter = ('vnf{:03}'.format(x) for x in count(0, step=3)) + def setUp(self): self.test_context = heat.HeatContext() self.mock_context = mock.Mock(spec=heat.HeatContext()) - def test_construct(self): - + def test___init__(self): self.assertIsNone(self.test_context.name) self.assertIsNone(self.test_context.stack) self.assertEqual(self.test_context.networks, OrderedDict()) @@ -121,18 +124,63 @@ class HeatContextTestCase(unittest.TestCase): mock_template.add_router_interface.assert_called_with("bar-fool-network-router-if0", "bar-fool-network-router", "bar-fool-network-subnet") @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate') + def test_attrs_get(self, 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') @mock.patch('yardstick.benchmark.contexts.heat.get_neutron_client') - def test_deploy(self, mock_neutron, mock_template): + 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' self.test_context.heat_parameters = {'image': 'cirros'} - self.test_context.heat_timeout = 5 + self.test_context.get_neutron_info = mock.MagicMock() self.test_context.deploy() - mock_template.assert_called_with(self.test_context.name, - self.test_context.template_file, - self.test_context.heat_parameters) + mock_template.assert_called_with('foo', + '/bar/baz/some-heat-file', + {'image': 'cirros'}) self.assertIsNotNone(self.test_context.stack) def test_add_server_port(self): @@ -190,27 +238,233 @@ class HeatContextTestCase(unittest.TestCase): @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate') def test_undeploy(self, mock_template): - self.test_context.stack = mock_template self.test_context.undeploy() - self.assertTrue(mock_template.delete.called) - def test__get_server(self): - - self.mock_context.name = 'bar' - self.mock_context.stack.outputs = {'public_ip': '127.0.0.1', - 'private_ip': '10.0.0.1'} - self.mock_context.key_uuid = uuid.uuid4() - - attr_name = {'name': 'foo.bar', - 'public_ip_attr': 'public_ip', - 'private_ip_attr': 'private_ip'} - result = heat.HeatContext._get_server(self.mock_context, attr_name) + @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate') + @mock.patch('yardstick.benchmark.contexts.heat.os') + def test_undeploy_key_filename(self, mock_template, mock_os): + self.test_context.stack = mock_template + mock_os.path.exists.return_value = True + self.assertIsNone(self.test_context.undeploy()) + + def test__get_server_found_dict(self): + """ + Use HeatContext._get_server to get a server that matches + based on a dictionary input. + """ + foo2_server = mock.Mock() + foo2_server.key_filename = 'key_file' + foo2_server.private_ip = '10.0.0.2' + foo2_server.public_ip = '127.0.0.2' + foo2_server.context.user = 'oof' + + baz3_server = mock.Mock() + baz3_server.key_filename = 'key_filename' + baz3_server.private_ip = '10.0.0.3' + baz3_server.public_ip = '127.0.0.3' + baz3_server.context.user = 'zab' + + self.test_context.name = 'bar' + self.test_context._user = 'bot' + self.test_context.stack = mock.Mock() + self.test_context.stack.outputs = { + 'private_ip': '10.0.0.1', + 'public_ip': '127.0.0.1', + } + self.test_context.key_uuid = uuid.uuid4() + self.test_context._server_map = { + 'baz3': baz3_server, + 'foo2': foo2_server, + } + attr_name = { + 'name': 'foo.bar', + 'private_ip_attr': 'private_ip', + 'public_ip_attr': 'public_ip', + } + result = self.test_context._get_server(attr_name) + self.assertEqual(result['user'], 'bot') + self.assertIsNotNone(result['key_filename']) self.assertEqual(result['ip'], '127.0.0.1') self.assertEqual(result['private_ip'], '10.0.0.1') + def test__get_server_found_dict_no_attrs(self): + """ + Use HeatContext._get_server to get a server that matches + based on a dictionary input. + """ + foo2_server = mock.Mock() + foo2_server.private_ip = '10.0.0.2' + foo2_server.public_ip = '127.0.0.2' + foo2_server.context.user = 'oof' + + baz3_server = mock.Mock() + baz3_server.private_ip = '10.0.0.3' + baz3_server.public_ip = '127.0.0.3' + baz3_server.context.user = 'zab' + + self.test_context.name = 'bar' + self.test_context._user = 'bot' + self.test_context.stack = mock.Mock() + self.test_context.stack.outputs = { + 'private_ip': '10.0.0.1', + 'public_ip': '127.0.0.1', + } + self.test_context.key_uuid = uuid.uuid4() + self.test_context._server_map = { + 'baz3': baz3_server, + 'foo2': foo2_server, + } + + attr_name = { + 'name': 'foo.bar', + } + result = self.test_context._get_server(attr_name) + self.assertEqual(result['user'], 'bot') + self.assertIsNotNone(result['key_filename']) + # no private ip attr mapping in the map results in None value in the result + self.assertIsNone(result['private_ip']) + # no public ip attr mapping in the map results in no value in the result + self.assertNotIn('ip', result) + + def test__get_server_found_not_dict(self): + """ + Use HeatContext._get_server to get a server that matches + based on a non-dictionary input + """ + foo2_server = mock.Mock() + foo2_server.private_ip = '10.0.0.2' + foo2_server.public_ip = '127.0.0.2' + foo2_server.context.user = 'oof' + + baz3_server = mock.Mock() + baz3_server.private_ip = '10.0.0.3' + baz3_server.public_ip = None + baz3_server.context.user = 'zab' + + self.test_context.name = 'bar1' + self.test_context.stack = mock.Mock() + self.test_context.stack.outputs = { + 'private_ip': '10.0.0.1', + 'public_ip': '127.0.0.1', + } + self.test_context.key_uuid = uuid.uuid4() + self.test_context.generate_routing_table = mock.MagicMock(return_value=[]) + + self.test_context._server_map = { + 'baz3': baz3_server, + 'foo2': foo2_server, + } + + attr_name = 'baz3' + result = self.test_context._get_server(attr_name) + self.assertEqual(result['user'], 'zab') + self.assertIsNotNone(result['key_filename']) + self.assertEqual(result['private_ip'], '10.0.0.3') + # no public_ip on the server results in no value in the result + self.assertNotIn('public_ip', result) + + def test__get_server_none_found_not_dict(self): + """ + Use HeatContext._get_server to not get a server due to + None value associated with the match to a non-dictionary + input + """ + foo2_server = mock.Mock() + foo2_server.private_ip = '10.0.0.2' + foo2_server.public_ip = '127.0.0.2' + foo2_server.context.user = 'oof' + + baz3_server = mock.Mock() + baz3_server.private_ip = '10.0.0.3' + baz3_server.public_ip = None + baz3_server.context.user = 'zab' + + self.test_context.name = 'bar1' + self.test_context.stack = mock.Mock() + self.test_context.stack.outputs = { + 'private_ip': '10.0.0.1', + 'public_ip': '127.0.0.1', + } + self.test_context.key_uuid = uuid.uuid4() + self.test_context._server_map = { + 'baz3': baz3_server, + 'foo2': foo2_server, + 'wow4': None, + } + + attr_name = 'wow4' + result = self.test_context._get_server(attr_name) + self.assertIsNone(result) + + def test__get_server_not_found_dict(self): + """ + Use HeatContext._get_server to not get a server for lack + of a match to a dictionary input + """ + foo2_server = mock.Mock() + foo2_server.private_ip = '10.0.0.2' + foo2_server.public_ip = '127.0.0.2' + foo2_server.context.user = 'oof' + + baz3_server = mock.Mock() + baz3_server.private_ip = '10.0.0.3' + baz3_server.public_ip = None + baz3_server.context.user = 'zab' + + self.test_context.name = 'bar1' + self.test_context.stack = mock.Mock() + self.test_context.stack.outputs = { + 'private_ip': '10.0.0.1', + 'public_ip': '127.0.0.1', + } + self.test_context.key_uuid = uuid.uuid4() + self.test_context._server_map = { + 'baz3': baz3_server, + 'foo2': foo2_server, + } + + attr_name = { + 'name': 'foo.wow4', + 'private_ip_attr': 'private_ip', + 'public_ip_attr': 'public_ip', + } + result = self.test_context._get_server(attr_name) + self.assertIsNone(result) + + def test__get_server_not_found_not_dict(self): + """ + Use HeatContext._get_server to not get a server for lack + of a match to a non-dictionary input + """ + foo2_server = mock.Mock() + foo2_server.private_ip = '10.0.0.2' + foo2_server.public_ip = '127.0.0.2' + foo2_server.context.user = 'oof' + + baz3_server = mock.Mock() + baz3_server.private_ip = '10.0.0.3' + baz3_server.public_ip = None + baz3_server.context.user = 'zab' + + self.mock_context.name = 'bar1' + self.test_context.stack = mock.Mock() + self.mock_context.stack.outputs = { + 'private_ip': '10.0.0.1', + 'public_ip': '127.0.0.1', + } + self.mock_context.key_uuid = uuid.uuid4() + self.mock_context._server_map = { + 'baz3': baz3_server, + 'foo2': foo2_server, + } + + attr_name = 'foo.wow4' + result = self.test_context._get_server(attr_name) + self.assertIsNone(result) + def test__get_network(self): network1 = mock.MagicMock() network1.name = 'net_1' diff --git a/tests/unit/benchmark/contexts/test_kubernetes.py b/tests/unit/benchmark/contexts/test_kubernetes.py index f47c07a67..b0ee792db 100644 --- a/tests/unit/benchmark/contexts/test_kubernetes.py +++ b/tests/unit/benchmark/contexts/test_kubernetes.py @@ -15,6 +15,7 @@ from __future__ import absolute_import import unittest import mock +from yardstick.benchmark.contexts.base import Context from yardstick.benchmark.contexts.kubernetes import KubernetesContext @@ -40,7 +41,11 @@ service ssh restart;while true ; do sleep 10000; done'] prefix = 'yardstick.benchmark.contexts.kubernetes' -class UndeployTestCase(unittest.TestCase): +class KubernetesTestCase(unittest.TestCase): + + def tearDown(self): + # clear kubernetes contexts from global list so we don't break other tests + Context.list = [] @mock.patch('{}.KubernetesContext._delete_ssh_key'.format(prefix)) @mock.patch('{}.KubernetesContext._delete_rcs'.format(prefix)) @@ -57,9 +62,6 @@ class UndeployTestCase(unittest.TestCase): self.assertTrue(mock_delete_rcs.called) self.assertTrue(mock_delete_pods.called) - -class DeployTestCase(unittest.TestCase): - @mock.patch('{}.KubernetesContext._wait_until_running'.format(prefix)) @mock.patch('{}.KubernetesTemplate.get_rc_pods'.format(prefix)) @mock.patch('{}.KubernetesContext._create_rcs'.format(prefix)) @@ -72,15 +74,13 @@ class DeployTestCase(unittest.TestCase): k8s_context = KubernetesContext() k8s_context.init(context_cfg) - k8s_context.deploy() + with mock.patch("yardstick.benchmark.contexts.kubernetes.time"): + k8s_context.deploy() self.assertTrue(mock_set_ssh_key.called) self.assertTrue(mock_create_rcs.called) self.assertTrue(mock_get_rc_pods.called) self.assertTrue(mock_wait_until_running.called) - -class SSHKeyTestCase(unittest.TestCase): - @mock.patch('{}.k8s_utils.delete_config_map'.format(prefix)) @mock.patch('{}.k8s_utils.create_config_map'.format(prefix)) def test_ssh_key(self, mock_create, mock_delete): @@ -92,9 +92,6 @@ class SSHKeyTestCase(unittest.TestCase): self.assertTrue(mock_create.called) self.assertTrue(mock_delete.called) - -class WaitUntilRunningTestCase(unittest.TestCase): - @mock.patch('{}.k8s_utils.read_pod_status'.format(prefix)) def test_wait_until_running(self, mock_read_pod_status): @@ -104,9 +101,6 @@ class WaitUntilRunningTestCase(unittest.TestCase): mock_read_pod_status.return_value = 'Running' k8s_context._wait_until_running() - -class GetServerTestCase(unittest.TestCase): - @mock.patch('{}.k8s_utils.get_pod_list'.format(prefix)) def test_get_server(self, mock_get_pod_list): k8s_context = KubernetesContext() @@ -116,9 +110,6 @@ class GetServerTestCase(unittest.TestCase): server = k8s_context._get_server('server') self.assertIsNone(server) - -class CreateRcsTestCase(unittest.TestCase): - @mock.patch('{}.KubernetesContext._create_rc'.format(prefix)) def test_create_rcs(self, mock_create_rc): k8s_context = KubernetesContext() @@ -126,9 +117,6 @@ class CreateRcsTestCase(unittest.TestCase): k8s_context._create_rcs() self.assertTrue(mock_create_rc.called) - -class CreateRcTestCase(unittest.TestCase): - @mock.patch('{}.k8s_utils.create_replication_controller'.format(prefix)) def test_create_rc(self, mock_create_replication_controller): k8s_context = KubernetesContext() @@ -136,9 +124,6 @@ class CreateRcTestCase(unittest.TestCase): k8s_context._create_rc({}) self.assertTrue(mock_create_replication_controller.called) - -class DeleteRcsTestCases(unittest.TestCase): - @mock.patch('{}.KubernetesContext._delete_rc'.format(prefix)) def test_delete_rcs(self, mock_delete_rc): k8s_context = KubernetesContext() @@ -146,9 +131,6 @@ class DeleteRcsTestCases(unittest.TestCase): k8s_context._delete_rcs() self.assertTrue(mock_delete_rc.called) - -class DeleteRcTestCase(unittest.TestCase): - @mock.patch('{}.k8s_utils.delete_replication_controller'.format(prefix)) def test_delete_rc(self, mock_delete_replication_controller): k8s_context = KubernetesContext() diff --git a/tests/unit/benchmark/contexts/test_node.py b/tests/unit/benchmark/contexts/test_node.py index d5ce8c5cb..9b5761c8d 100644 --- a/tests/unit/benchmark/contexts/test_node.py +++ b/tests/unit/benchmark/contexts/test_node.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################## -# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. +# Copyright (c) 2015-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 @@ -14,36 +14,128 @@ from __future__ import absolute_import import os import unittest +import errno import mock +from yardstick.common import constants as consts from yardstick.benchmark.contexts import node class NodeContextTestCase(unittest.TestCase): + PREFIX = 'yardstick.benchmark.contexts.node' + NODES_SAMPLE = "nodes_sample.yaml" NODES_DUPLICATE_SAMPLE = "nodes_duplicate_sample.yaml" def setUp(self): self.test_context = node.NodeContext() + self.os_path_join = os.path.join - def test_construct(self): + def _get_file_abspath(self, filename): + curr_path = os.path.dirname(os.path.abspath(__file__)) + file_path = self.os_path_join(curr_path, filename) + return file_path + def test___init__(self): self.assertIsNone(self.test_context.name) self.assertIsNone(self.test_context.file_path) self.assertEqual(self.test_context.nodes, []) self.assertEqual(self.test_context.controllers, []) self.assertEqual(self.test_context.computes, []) self.assertEqual(self.test_context.baremetals, []) + self.assertEqual(self.test_context.env, {}) + self.assertEqual(self.test_context.attrs, {}) + + @mock.patch('{}.os.path.join'.format(PREFIX)) + def test_init_negative(self, mock_path_join): + special_path = '/foo/bar/error_file' + error_path = self._get_file_abspath("error_file") - def test_unsuccessful_init(self): + def path_join(*args): + if args == (consts.YARDSTICK_ROOT_PATH, error_path): + return special_path + return self.os_path_join(*args) + + # we can't count mock_path_join calls because + # it can catch join calls for .pyc files. + mock_path_join.side_effect = path_join + self.test_context.read_config_file = read_mock = mock.Mock() + read_calls = 0 + + with self.assertRaises(KeyError): + self.test_context.init({}) + + self.assertEqual(read_mock.call_count, read_calls) attrs = { 'name': 'foo', - 'file': self._get_file_abspath("error_file") + 'file': error_path, } + read_mock.side_effect = IOError(errno.EBUSY, 'busy') + with self.assertRaises(IOError) as raised: + self.test_context.init(attrs) + + read_calls += 1 + self.assertEqual(read_mock.called, read_calls) + self.assertIn(attrs['file'], self.test_context.file_path) + self.assertEqual(raised.exception.errno, errno.EBUSY) + self.assertEqual(str(raised.exception), str(read_mock.side_effect)) + + read_mock.side_effect = IOError(errno.ENOENT, 'not found') + with self.assertRaises(IOError) as raised: + self.test_context.init(attrs) + + read_calls += 2 + self.assertEqual(read_mock.call_count, read_calls) + self.assertEqual(self.test_context.file_path, special_path) + self.assertEqual(raised.exception.errno, errno.ENOENT) + self.assertEqual(str(raised.exception), str(read_mock.side_effect)) + + def test_read_config_file(self): + + attrs = { + 'name': 'foo', + 'file': self._get_file_abspath(self.NODES_SAMPLE) + } + + self.test_context.init(attrs) + + self.assertIsNotNone(self.test_context.read_config_file()) + + def test__dispatch_script(self): + + attrs = { + 'name': 'foo', + 'file': self._get_file_abspath(self.NODES_SAMPLE) + } + + self.test_context.init(attrs) + + self.test_context.env = {'bash': [{'script': 'dummy'}]} + self.test_context._execute_script = mock.Mock() + self.assertEqual(self.test_context._dispatch_script('bash'), None) + + def test__dispatch_ansible(self): + + attrs = { + 'name': 'foo', + 'file': self._get_file_abspath(self.NODES_SAMPLE) + } + + self.test_context.init(attrs) - self.assertRaises(IOError, self.test_context.init, attrs) + self.test_context.env = {'ansible': [{'script': 'dummy'}]} + self.test_context._do_ansible_job = mock.Mock() + self.assertEqual(self.test_context._dispatch_ansible('ansible'), None) + self.test_context.env = {} + self.assertEqual(self.test_context._dispatch_ansible('ansible'), None) + + @mock.patch("{}.subprocess".format(PREFIX)) + def test__do_ansible_job(self, mock_subprocess): + mock_subprocess.Popen = mock.MagicMock() + mock_subprocess.communicate = mock.Mock() + self.assertEqual(None, self.test_context._do_ansible_job('dummy')) def test_successful_init(self): @@ -90,6 +182,20 @@ class NodeContextTestCase(unittest.TestCase): self.assertEqual(result, None) + def test__get_server_mismatch(self): + + attrs = { + 'name': 'foo', + 'file': self._get_file_abspath(self.NODES_SAMPLE) + } + + self.test_context.init(attrs) + + attr_name = 'bar.foo1' + result = self.test_context._get_server(attr_name) + + self.assertEqual(result, None) + def test__get_server_duplicate(self): attrs = { @@ -100,8 +206,8 @@ class NodeContextTestCase(unittest.TestCase): self.test_context.init(attrs) attr_name = 'node1.foo' - - self.assertRaises(ValueError, self.test_context._get_server, attr_name) + with self.assertRaises(ValueError): + self.test_context._get_server(attr_name) def test__get_server_found(self): @@ -120,14 +226,7 @@ class NodeContextTestCase(unittest.TestCase): self.assertEqual(result['user'], 'root') self.assertEqual(result['key_filename'], '/root/.yardstick_key') - def _get_file_abspath(self, filename): - curr_path = os.path.dirname(os.path.abspath(__file__)) - file_path = os.path.join(curr_path, filename) - return file_path - - prefix = 'yardstick.benchmark.contexts.node' - - @mock.patch('{}.NodeContext._dispatch_script'.format(prefix)) + @mock.patch('{}.NodeContext._dispatch_script'.format(PREFIX)) def test_deploy(self, dispatch_script_mock): obj = node.NodeContext() obj.env = { @@ -136,7 +235,16 @@ class NodeContextTestCase(unittest.TestCase): obj.deploy() self.assertTrue(dispatch_script_mock.called) - @mock.patch('{}.NodeContext._dispatch_script'.format(prefix)) + @mock.patch('{}.NodeContext._dispatch_ansible'.format(PREFIX)) + def test_deploy_anisible(self, dispatch_ansible_mock): + obj = node.NodeContext() + obj.env = { + 'type': 'ansible' + } + obj.deploy() + self.assertTrue(dispatch_ansible_mock.called) + + @mock.patch('{}.NodeContext._dispatch_script'.format(PREFIX)) def test_undeploy(self, dispatch_script_mock): obj = node.NodeContext() obj.env = { @@ -145,8 +253,17 @@ class NodeContextTestCase(unittest.TestCase): obj.undeploy() self.assertTrue(dispatch_script_mock.called) - @mock.patch('{}.ssh.SSH._put_file_shell'.format(prefix)) - @mock.patch('{}.ssh.SSH.execute'.format(prefix)) + @mock.patch('{}.NodeContext._dispatch_ansible'.format(PREFIX)) + def test_undeploy_anisble(self, dispatch_ansible_mock): + obj = node.NodeContext() + obj.env = { + 'type': 'ansible' + } + obj.undeploy() + self.assertTrue(dispatch_ansible_mock.called) + + @mock.patch('{}.ssh.SSH._put_file_shell'.format(PREFIX)) + @mock.patch('{}.ssh.SSH.execute'.format(PREFIX)) def test_execute_remote_script(self, execute_mock, put_file_mock): obj = node.NodeContext() obj.env = {'prefix': 'yardstick.benchmark.scenarios.compute'} @@ -165,14 +282,14 @@ class NodeContextTestCase(unittest.TestCase): self.assertTrue(put_file_mock.called) self.assertTrue(execute_mock.called) - @mock.patch('{}.NodeContext._execute_local_script'.format(prefix)) + @mock.patch('{}.NodeContext._execute_local_script'.format(PREFIX)) def test_execute_script_local(self, local_execute_mock): node_name = 'local' info = {} node.NodeContext()._execute_script(node_name, info) self.assertTrue(local_execute_mock.called) - @mock.patch('{}.NodeContext._execute_remote_script'.format(prefix)) + @mock.patch('{}.NodeContext._execute_remote_script'.format(PREFIX)) def test_execute_script_remote(self, remote_execute_mock): node_name = 'node5' info = {} @@ -195,7 +312,7 @@ class NodeContextTestCase(unittest.TestCase): node_info = obj._get_node_info(node_name_args) self.assertEqual(node_info.get('check'), node_name_args) - @mock.patch('{}.ssh.SSH.wait'.format(prefix)) + @mock.patch('{}.ssh.SSH.wait'.format(PREFIX)) def test_get_client(self, wait_mock): node_name_args = 'node5' obj = node.NodeContext() @@ -208,6 +325,28 @@ class NodeContextTestCase(unittest.TestCase): obj._get_client(node_name_args) self.assertTrue(wait_mock.called) + def test_get_server(self): + self.test_context.name = 'vnf1' + self.test_context.nodes = [{'name': 'my', 'value': 100}] + + with self.assertRaises(ValueError): + self.test_context.get_server('my.vnf2') + + expected = {'name': 'my.vnf1', 'value': 100, 'interfaces': {}} + result = self.test_context.get_server('my.vnf1') + self.assertDictEqual(result, expected) + + def test_get_context_from_server(self): + self.test_context.name = 'vnf1' + self.test_context.nodes = [{'name': 'my', 'value': 100}] + self.test_context.attrs = {'attr1': 200} + + with self.assertRaises(ValueError): + self.test_context.get_context_from_server('my.vnf2') + + result = self.test_context.get_context_from_server('my.vnf1') + self.assertIs(result, self.test_context) + def test__get_network(self): network1 = { 'name': 'net_1', diff --git a/tests/unit/benchmark/contexts/test_standalone.py b/tests/unit/benchmark/contexts/test_standalone.py index 1fc740393..d13e28470 100644 --- a/tests/unit/benchmark/contexts/test_standalone.py +++ b/tests/unit/benchmark/contexts/test_standalone.py @@ -194,8 +194,6 @@ class StandaloneContextTestCase(unittest.TestCase): result = self.test_context._get_server(attr_name) self.assertEqual(result, None) - - def test__get_server_duplicate_sriov(self, mock_sriov_time, mock_standlalone_time, mock_ovsdpdk_time): attrs = { @@ -244,6 +242,7 @@ class StandaloneContextTestCase(unittest.TestCase): ValueError, self.test_context._get_server, attr_name) + def test__get_server_found_sriov(self, mock_sriov_time, mock_standlalone_time, mock_ovsdpdk_time): attrs = { @@ -453,11 +452,6 @@ class StandaloneContextTestCase(unittest.TestCase): self.test_context.nfvi_obj.setup_ovs_bridge = mock.Mock() self.test_context.nfvi_obj.add_oflows = mock.Mock() - # self.test_context.nfvi_obj.setup_ovs(PORTS) - # self.test_context.nfvi_obj.start_ovs_serverswitch() - # self.test_context.nfvi_obj.setup_ovs_bridge() - # self.test_context.nfvi_obj.add_oflows() - result = self.test_context.nfvi_obj.setup_ovs_context( PORTS, NIC_DETAILS, @@ -681,6 +675,7 @@ class StandaloneContextTestCase(unittest.TestCase): expected = network1 result = self.test_context._get_network(attr_name) self.assertDictEqual(result, expected) + if __name__ == '__main__': unittest.main() diff --git a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py index c9cd7fed5..84b42c832 100644 --- a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py +++ b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py @@ -209,8 +209,9 @@ TRAFFIC_PROFILE = { class TestNetworkServiceTestCase(unittest.TestCase): + def setUp(self): - self.trexgen__1 = { + self.tg__1 = { 'name': 'trafficgen_1.yardstick', 'ip': '10.10.10.11', 'role': 'TrafficGen', @@ -236,7 +237,7 @@ class TestNetworkServiceTestCase(unittest.TestCase): }, } - self.trexvnf__1 = { + self.vnf__1 = { 'name': 'vnf.yardstick', 'ip': '10.10.10.12', 'host': '10.223.197.164', @@ -293,8 +294,8 @@ class TestNetworkServiceTestCase(unittest.TestCase): self.context_cfg = { 'nodes': { - 'trexgen__1': self.trexgen__1, - 'trexvnf__1': self.trexvnf__1, + 'tg__1': self.tg__1, + 'vnf__1': self.vnf__1, }, 'networks': { 'private': { @@ -321,7 +322,7 @@ class TestNetworkServiceTestCase(unittest.TestCase): ], 'type': 'ELAN', 'id': 'private', - 'name': 'trexgen__1 to trexvnf__1 link 1' + 'name': 'tg__1 to vnf__1 link 1' } self.vld1 = { @@ -339,7 +340,7 @@ class TestNetworkServiceTestCase(unittest.TestCase): ], 'type': 'ELAN', 'id': 'public', - 'name': 'trexvnf__1 to trexgen__1 link 2' + 'name': 'vnf__1 to tg__1 link 2' } self.topology = { @@ -351,12 +352,12 @@ class TestNetworkServiceTestCase(unittest.TestCase): { 'member-vnf-index': '1', 'VNF model': 'tg_trex_tpl.yaml', - 'vnfd-id-ref': 'trexgen__1', + 'vnfd-id-ref': 'tg__1', }, { 'member-vnf-index': '2', 'VNF model': 'tg_trex_tpl.yaml', - 'vnfd-id-ref': 'trexvnf__1', + 'vnfd-id-ref': 'vnf__1', }, ], 'vld': [self.vld0, self.vld1], @@ -418,12 +419,12 @@ class TestNetworkServiceTestCase(unittest.TestCase): self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml") result = {'flow': {'dstip4_range': '152.40.0.20', 'srcip4_range': '152.16.0.20', 'count': 1}} - self.assertEqual(result, self.s._get_traffic_flow(self.scenario_cfg)) + self.assertEqual(result, self.s._get_traffic_flow()) def test___get_traffic_flow_error(self): self.scenario_cfg["traffic_options"]["flow"] = \ "ipv4_1flow_Packets_vpe.yaml1" - self.assertEqual({}, self.s._get_traffic_flow(self.scenario_cfg)) + self.assertEqual({}, self.s._get_traffic_flow()) def test_get_vnf_imp(self): vnfd = COMPLETE_TREX_VNFD['vnfd:vnfd-catalog']['vnfd'][0]['class-name'] @@ -439,9 +440,9 @@ class TestNetworkServiceTestCase(unittest.TestCase): self.assertIn('found in', exc_str) def test_load_vnf_models_invalid(self): - self.context_cfg["nodes"]['trexgen__1']['VNF model'] = \ + self.context_cfg["nodes"]['tg__1']['VNF model'] = \ self._get_file_abspath("tg_trex_tpl.yaml") - self.context_cfg["nodes"]['trexvnf__1']['VNF model'] = \ + self.context_cfg["nodes"]['vnf__1']['VNF model'] = \ self._get_file_abspath("tg_trex_tpl.yaml") vnf = mock.Mock(autospec=GenericVNF) @@ -456,15 +457,14 @@ class TestNetworkServiceTestCase(unittest.TestCase): ssh_mock.execute = \ mock.Mock(return_value=(0, SYS_CLASS_NET + IP_ADDR_SHOW, "")) ssh.from_node.return_value = ssh_mock - self.s.map_topology_to_infrastructure(self.context_cfg, - self.topology) + self.s.map_topology_to_infrastructure() nodes = self.context_cfg["nodes"] - self.assertEqual("tg_trex_tpl.yaml", nodes['trexgen__1']['VNF model']) - self.assertEqual("tg_trex_tpl.yaml", nodes['trexvnf__1']['VNF model']) + self.assertEqual("../../vnf_descriptors/tg_rfc2544_tpl.yaml", nodes['tg__1']['VNF model']) + self.assertEqual("../../vnf_descriptors/vpe_vnf.yaml", nodes['vnf__1']['VNF model']) def test_map_topology_to_infrastructure_insufficient_nodes(self): - del self.context_cfg['nodes']['trexvnf__1'] + del self.context_cfg['nodes']['vnf__1'] with mock.patch("yardstick.ssh.SSH") as ssh: ssh_mock = mock.Mock(autospec=ssh.SSH) ssh_mock.execute = \ @@ -472,11 +472,11 @@ class TestNetworkServiceTestCase(unittest.TestCase): ssh.from_node.return_value = ssh_mock with self.assertRaises(IncorrectSetup): - self.s.map_topology_to_infrastructure(self.context_cfg, self.topology) + self.s.map_topology_to_infrastructure() def test_map_topology_to_infrastructure_config_invalid(self): cfg = dict(self.context_cfg) - del cfg['nodes']['trexvnf__1']['interfaces']['xe0']['local_mac'] + del cfg['nodes']['vnf__1']['interfaces']['xe0']['local_mac'] with mock.patch("yardstick.ssh.SSH") as ssh: ssh_mock = mock.Mock(autospec=ssh.SSH) ssh_mock.execute = \ @@ -484,7 +484,7 @@ class TestNetworkServiceTestCase(unittest.TestCase): ssh.from_node.return_value = ssh_mock with self.assertRaises(IncorrectConfig): - self.s.map_topology_to_infrastructure(self.context_cfg, self.topology) + self.s.map_topology_to_infrastructure() def test__resolve_topology_invalid_config(self): with mock.patch("yardstick.ssh.SSH") as ssh: @@ -494,31 +494,41 @@ class TestNetworkServiceTestCase(unittest.TestCase): ssh.from_node.return_value = ssh_mock # purge an important key from the data structure - for interface in self.trexgen__1['interfaces'].values(): + for interface in self.tg__1['interfaces'].values(): del interface['local_mac'] - with self.assertRaises(IncorrectConfig) as raised: - self.s._resolve_topology(self.context_cfg, self.topology) + with mock.patch( + "yardstick.benchmark.scenarios.networking.vnf_generic.LOG") as mock_log: + with self.assertRaises(IncorrectConfig) as raised: + self.s._resolve_topology() self.assertIn('not found', str(raised.exception)) + # restore local_mac + for index, interface in enumerate(self.tg__1['interfaces'].values()): + interface['local_mac'] = '00:00:00:00:00:{:2x}'.format(index) + # make a connection point ref with 3 points - self.vld0['vnfd-connection-point-ref'].append( - self.vld0['vnfd-connection-point-ref'][0]) + self.s.topology["vld"][0]['vnfd-connection-point-ref'].append( + self.s.topology["vld"][0]['vnfd-connection-point-ref'][0]) - with self.assertRaises(IncorrectConfig) as raised: - self.s._resolve_topology(self.context_cfg, self.topology) + with mock.patch( + "yardstick.benchmark.scenarios.networking.vnf_generic.LOG") as mock_log: + with self.assertRaises(IncorrectConfig) as raised: + self.s._resolve_topology() - self.assertIn('wrong number of endpoints', str(raised.exception)) + self.assertIn('wrong endpoint count', str(raised.exception)) # make a connection point ref with 1 point - self.vld0['vnfd-connection-point-ref'] = \ - self.vld0['vnfd-connection-point-ref'][:1] + self.s.topology["vld"][0]['vnfd-connection-point-ref'] = \ + self.s.topology["vld"][0]['vnfd-connection-point-ref'][:1] - with self.assertRaises(IncorrectConfig) as raised: - self.s._resolve_topology(self.context_cfg, self.topology) + with mock.patch( + "yardstick.benchmark.scenarios.networking.vnf_generic.LOG") as mock_log: + with self.assertRaises(IncorrectConfig) as raised: + self.s._resolve_topology() - self.assertIn('wrong number of endpoints', str(raised.exception)) + self.assertIn('wrong endpoint count', str(raised.exception)) def test_run(self): tgen = mock.Mock(autospec=GenericTrafficGen) @@ -567,19 +577,16 @@ class TestNetworkServiceTestCase(unittest.TestCase): def test__get_traffic_profile(self): self.scenario_cfg["traffic_profile"] = \ self._get_file_abspath("ipv4_throughput_vpe.yaml") - self.assertIsNotNone(self.s._get_traffic_profile(self.scenario_cfg, - self.context_cfg)) + self.assertIsNotNone(self.s._get_traffic_profile()) def test__get_traffic_profile_exception(self): - cfg = dict(self.scenario_cfg) - cfg["traffic_profile"] = "" - with self.assertRaises(IOError): - self.s._get_traffic_profile(cfg, self.context_cfg) + with mock.patch.dict(self.scenario_cfg, {'traffic_profile': ''}): + with self.assertRaises(IOError): + self.s._get_traffic_profile() def test___get_traffic_imix_exception(self): - cfg = dict(self.scenario_cfg) - cfg["traffic_options"]["imix"] = "" - self.assertEqual({}, self.s._get_traffic_imix(cfg)) + with mock.patch.dict(self.scenario_cfg["traffic_options"], {'imix': ''}): + self.assertEqual({}, self.s._get_traffic_imix()) def test__fill_traffic_profile(self): with mock.patch.dict("sys.modules", STL_MOCKS): @@ -589,8 +596,7 @@ class TestNetworkServiceTestCase(unittest.TestCase): self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml") self.scenario_cfg["traffic_options"]["imix"] = \ self._get_file_abspath("imix_voice.yaml") - self.assertIsNotNone(self.s._fill_traffic_profile(self.scenario_cfg, - self.context_cfg)) + self.assertIsNotNone(self.s._fill_traffic_profile()) def test_teardown(self): vnf = mock.Mock(autospec=GenericVNF) @@ -604,31 +610,32 @@ class TestNetworkServiceTestCase(unittest.TestCase): self.assertIsNone(self.s.teardown()) SAMPLE_NETDEVS = { - 'enp11s0': { - 'address': '0a:de:ad:be:ef:f5', - 'device': '0x1533', - 'driver': 'igb', - 'ifindex': '2', - 'interface_name': 'enp11s0', - 'operstate': 'down', - 'pci_bus_id': '0000:0b:00.0', - 'subsystem_device': '0x1533', - 'subsystem_vendor': '0x15d9', - 'vendor': '0x8086' - }, - 'lan': { - 'address': '0a:de:ad:be:ef:f4', - 'device': '0x153a', - 'driver': 'e1000e', - 'ifindex': '3', - 'interface_name': 'lan', - 'operstate': 'up', - 'pci_bus_id': '0000:00:19.0', - 'subsystem_device': '0x153a', - 'subsystem_vendor': '0x15d9', - 'vendor': '0x8086' - } + 'enp11s0': { + 'address': '0a:de:ad:be:ef:f5', + 'device': '0x1533', + 'driver': 'igb', + 'ifindex': '2', + 'interface_name': 'enp11s0', + 'operstate': 'down', + 'pci_bus_id': '0000:0b:00.0', + 'subsystem_device': '0x1533', + 'subsystem_vendor': '0x15d9', + 'vendor': '0x8086' + }, + 'lan': { + 'address': '0a:de:ad:be:ef:f4', + 'device': '0x153a', + 'driver': 'e1000e', + 'ifindex': '3', + 'interface_name': 'lan', + 'operstate': 'up', + 'pci_bus_id': '0000:00:19.0', + 'subsystem_device': '0x153a', + 'subsystem_vendor': '0x15d9', + 'vendor': '0x8086' } + } + SAMPLE_VM_NETDEVS = { 'eth1': { 'address': 'fa:de:ad:be:ef:5b', @@ -681,19 +688,18 @@ class TestNetworkServiceTestCase(unittest.TestCase): def test_sort_dpdk_port_num(self): netdevs = self.SAMPLE_NETDEVS.copy() NetworkServiceTestCase._sort_dpdk_port_num(netdevs) - assert netdevs['lan']['dpdk_port_num'] == 1 - assert netdevs['enp11s0']['dpdk_port_num'] == 2 + assert netdevs['lan']['dpdk_port_num'] == 0 + assert netdevs['enp11s0']['dpdk_port_num'] == 1 def test_probe_missing_values(self): netdevs = self.SAMPLE_NETDEVS.copy() - NetworkServiceTestCase._sort_dpdk_port_num(netdevs) network = {'local_mac': '0a:de:ad:be:ef:f5'} NetworkServiceTestCase._probe_missing_values(netdevs, network, set()) - assert network['dpdk_port_num'] == 2 + assert network['vpci'] == '0000:0b:00.0' network = {'local_mac': '0a:de:ad:be:ef:f4'} NetworkServiceTestCase._probe_missing_values(netdevs, network, set()) - assert network['dpdk_port_num'] == 1 + assert network['vpci'] == '0000:00:19.0' def test_open_relative_path(self): mock_open = mock.mock_open() diff --git a/tests/unit/benchmark/scenarios/networking/test_vsperf.py b/tests/unit/benchmark/scenarios/networking/test_vsperf.py index 348aa4a63..cbbfc2b34 100644 --- a/tests/unit/benchmark/scenarios/networking/test_vsperf.py +++ b/tests/unit/benchmark/scenarios/networking/test_vsperf.py @@ -28,8 +28,6 @@ from yardstick.benchmark.scenarios.networking import vsperf @mock.patch('yardstick.benchmark.scenarios.networking.vsperf.subprocess') @mock.patch('yardstick.benchmark.scenarios.networking.vsperf.ssh') -@mock.patch("yardstick.benchmark.scenarios.networking.vsperf.open", - mock.mock_open()) class VsperfTestCase(unittest.TestCase): def setUp(self): diff --git a/tests/unit/benchmark/scenarios/networking/test_vtc_instantiation_validation.py b/tests/unit/benchmark/scenarios/networking/test_vtc_instantiation_validation.py deleted file mode 100644 index 07b3da992..000000000 --- a/tests/unit/benchmark/scenarios/networking/test_vtc_instantiation_validation.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python - -############################################################################## -# Copyright (c) 2015 Ericsson AB 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 -############################################################################## - -# Unittest for yardstick.benchmark.scenarios.networking.iperf3.Iperf - -from __future__ import absolute_import -import unittest - -from yardstick.benchmark.scenarios.networking import \ - vtc_instantiation_validation - - -class VtcInstantiationValidationTestCase(unittest.TestCase): - - def setUp(self): - scenario = dict() - scenario['options'] = dict() - scenario['options']['default_net_name'] = '' - scenario['options']['default_subnet_name'] = '' - scenario['options']['vlan_net_1_name'] = '' - scenario['options']['vlan_subnet_1_name'] = '' - scenario['options']['vlan_net_2_name'] = '' - scenario['options']['vlan_subnet_2_name'] = '' - scenario['options']['vnic_type'] = '' - scenario['options']['vtc_flavor'] = '' - scenario['options']['packet_size'] = '' - scenario['options']['vlan_sender'] = '' - scenario['options']['vlan_receiver'] = '' - - self.vt = vtc_instantiation_validation.VtcInstantiationValidation( - scenario, '') - - def test_run_for_success(self): - result = {} - self.vt.run(result) - - -def main(): - unittest.main() - -if __name__ == '__main__': - main() diff --git a/tests/unit/benchmark/scenarios/networking/test_vtc_instantiation_validation_noisy.py b/tests/unit/benchmark/scenarios/networking/test_vtc_instantiation_validation_noisy.py deleted file mode 100644 index 34f3610b1..000000000 --- a/tests/unit/benchmark/scenarios/networking/test_vtc_instantiation_validation_noisy.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python - -############################################################################## -# Copyright (c) 2015 Ericsson AB 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 -############################################################################## - -# Unittest for yardstick.benchmark.scenarios.networking.iperf3.Iperf - -from __future__ import absolute_import -import unittest - -from yardstick.benchmark.scenarios.networking import \ - vtc_instantiation_validation_noisy - - -class VtcInstantiationValidationiNoisyTestCase(unittest.TestCase): - - def setUp(self): - scenario = dict() - scenario['options'] = dict() - scenario['options']['default_net_name'] = '' - scenario['options']['default_subnet_name'] = '' - scenario['options']['vlan_net_1_name'] = '' - scenario['options']['vlan_subnet_1_name'] = '' - scenario['options']['vlan_net_2_name'] = '' - scenario['options']['vlan_subnet_2_name'] = '' - scenario['options']['vnic_type'] = '' - scenario['options']['vtc_flavor'] = '' - scenario['options']['packet_size'] = '' - scenario['options']['vlan_sender'] = '' - scenario['options']['vlan_receiver'] = '' - scenario['options']['num_of_neighbours'] = '1' - scenario['options']['amount_of_ram'] = '1G' - scenario['options']['number_of_cores'] = '1' - - self.vt = \ - vtc_instantiation_validation_noisy.VtcInstantiationValidationNoisy( - scenario, '') - - def test_run_for_success(self): - result = {} - self.vt.run(result) - - -def main(): - unittest.main() - -if __name__ == '__main__': - main() diff --git a/tests/unit/benchmark/scenarios/networking/test_vtc_throughput.py b/tests/unit/benchmark/scenarios/networking/test_vtc_throughput.py deleted file mode 100644 index a73fad5a8..000000000 --- a/tests/unit/benchmark/scenarios/networking/test_vtc_throughput.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python - -############################################################################## -# Copyright (c) 2015 Ericsson AB 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 -############################################################################## - -# Unittest for yardstick.benchmark.scenarios.networking.iperf3.Iperf - -from __future__ import absolute_import -import mock -import unittest - -from yardstick.benchmark.scenarios.networking import vtc_throughput - - -class VtcThroughputTestCase(unittest.TestCase): - - def setUp(self): - scenario = dict() - scenario['options'] = dict() - scenario['options']['default_net_name'] = '' - scenario['options']['default_subnet_name'] = '' - scenario['options']['vlan_net_1_name'] = '' - scenario['options']['vlan_subnet_1_name'] = '' - scenario['options']['vlan_net_2_name'] = '' - scenario['options']['vlan_subnet_2_name'] = '' - scenario['options']['vnic_type'] = '' - scenario['options']['vtc_flavor'] = '' - scenario['options']['packet_size'] = '' - scenario['options']['vlan_sender'] = '' - scenario['options']['vlan_receiver'] = '' - - self.vt = vtc_throughput.VtcThroughput(scenario, '') - - def test_run_for_success(self): - result = {} - self.vt.run(result) - - -def main(): - unittest.main() - -if __name__ == '__main__': - main() diff --git a/tests/unit/benchmark/scenarios/networking/test_vtc_throughput_noisy_test.py b/tests/unit/benchmark/scenarios/networking/test_vtc_throughput_noisy_test.py deleted file mode 100644 index e1b162c79..000000000 --- a/tests/unit/benchmark/scenarios/networking/test_vtc_throughput_noisy_test.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python - -############################################################################## -# Copyright (c) 2015 Ericsson AB 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 -############################################################################## - -# Unittest for yardstick.benchmark.scenarios.networking.iperf3.Iperf - -from __future__ import absolute_import -import mock -import unittest - -from yardstick.benchmark.scenarios.networking import vtc_throughput_noisy - - -class VtcThroughputNoisyTestCase(unittest.TestCase): - - def setUp(self): - scenario = dict() - scenario['options'] = dict() - scenario['options']['default_net_name'] = '' - scenario['options']['default_subnet_name'] = '' - scenario['options']['vlan_net_1_name'] = '' - scenario['options']['vlan_subnet_1_name'] = '' - scenario['options']['vlan_net_2_name'] = '' - scenario['options']['vlan_subnet_2_name'] = '' - scenario['options']['vnic_type'] = '' - scenario['options']['vtc_flavor'] = '' - scenario['options']['packet_size'] = '' - scenario['options']['vlan_sender'] = '' - scenario['options']['vlan_receiver'] = '' - scenario['options']['num_of_neighbours'] = '1' - scenario['options']['amount_of_ram'] = '1G' - scenario['options']['number_of_cores'] = '1' - - self.vt = vtc_throughput_noisy.VtcThroughputNoisy(scenario, '') - - def test_run_for_success(self): - result = {} - self.vt.run(result) - - -def main(): - unittest.main() - -if __name__ == '__main__': - main() |