summaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/benchmark')
-rw-r--r--tests/unit/benchmark/contexts/test_heat.py71
-rw-r--r--tests/unit/benchmark/contexts/test_kubernetes.py7
-rw-r--r--tests/unit/benchmark/core/test_task.py52
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_basemonitor.py45
-rw-r--r--tests/unit/benchmark/scenarios/networking/ipv4_throughput_vpe.yaml28
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_vnf_generic.py38
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_vsperf_dpdk.py25
-rw-r--r--tests/unit/benchmark/scenarios/networking/vpe_vnf_topology.yaml4
8 files changed, 149 insertions, 121 deletions
diff --git a/tests/unit/benchmark/contexts/test_heat.py b/tests/unit/benchmark/contexts/test_heat.py
index cc0c7bc8e..2e546805d 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'
@@ -207,11 +182,17 @@ class HeatContextTestCase(unittest.TestCase):
u'd-mac_address': u'00:10',
u'd-device_id': u'dev43',
u'd-network_id': u'net987',
+ u'e': u'40.30.20.15',
+ u'e-subnet_id': 2,
+ u'e-mac_address': u'00:10',
+ u'e-device_id': u'dev43',
+ u'e-network_id': u'net987',
}
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'},
+ {'stack_name': 'e', 'port': 'port_f'}]),
])
expected = {
@@ -230,8 +211,8 @@ 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.assertEqual(len(server.interfaces), 3)
+ self.assertDictEqual(server.interfaces['port_a'], expected)
@mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
def test_undeploy(self, mock_template):
@@ -246,19 +227,20 @@ class HeatContextTestCase(unittest.TestCase):
mock_os.path.exists.return_value = True
self.assertIsNone(self.test_context.undeploy())
- def test__get_server_found_dict(self):
+ @mock.patch("yardstick.benchmark.contexts.heat.pkg_resources")
+ def test__get_server_found_dict(self, mock_pkg_resources):
"""
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.key_filename = None
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.key_filename = None
baz3_server.private_ip = '10.0.0.3'
baz3_server.public_ip = '127.0.0.3'
baz3_server.context.user = 'zab'
@@ -283,11 +265,11 @@ class HeatContextTestCase(unittest.TestCase):
}
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):
+ @mock.patch("yardstick.benchmark.contexts.heat.pkg_resources")
+ def test__get_server_found_dict_no_attrs(self, mock_pkg_resources):
"""
Use HeatContext._get_server to get a server that matches
based on a dictionary input.
@@ -320,13 +302,13 @@ class HeatContextTestCase(unittest.TestCase):
}
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):
+ @mock.patch("yardstick.benchmark.contexts.heat.pkg_resources")
+ def test__get_server_found_not_dict(self, mock_pkg_resources):
"""
Use HeatContext._get_server to get a server that matches
based on a non-dictionary input
@@ -358,12 +340,12 @@ class HeatContextTestCase(unittest.TestCase):
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):
+ @mock.patch("yardstick.benchmark.contexts.heat.pkg_resources")
+ def test__get_server_none_found_not_dict(self, mock_pkg_resources):
"""
Use HeatContext._get_server to not get a server due to
None value associated with the match to a non-dictionary
@@ -396,7 +378,8 @@ class HeatContextTestCase(unittest.TestCase):
result = self.test_context._get_server(attr_name)
self.assertIsNone(result)
- def test__get_server_not_found_dict(self):
+ @mock.patch("yardstick.benchmark.contexts.heat.pkg_resources")
+ def test__get_server_not_found_dict(self, mock_pkg_resources):
"""
Use HeatContext._get_server to not get a server for lack
of a match to a dictionary input
@@ -431,7 +414,8 @@ class HeatContextTestCase(unittest.TestCase):
result = self.test_context._get_server(attr_name)
self.assertIsNone(result)
- def test__get_server_not_found_not_dict(self):
+ @mock.patch("yardstick.benchmark.contexts.heat.pkg_resources")
+ def test__get_server_not_found_not_dict(self, mock_pkg_resources):
"""
Use HeatContext._get_server to not get a server for lack
of a match to a non-dictionary input
@@ -472,7 +456,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 +471,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 +490,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/contexts/test_kubernetes.py b/tests/unit/benchmark/contexts/test_kubernetes.py
index b0ee792db..4976a9fe0 100644
--- a/tests/unit/benchmark/contexts/test_kubernetes.py
+++ b/tests/unit/benchmark/contexts/test_kubernetes.py
@@ -81,9 +81,14 @@ class KubernetesTestCase(unittest.TestCase):
self.assertTrue(mock_get_rc_pods.called)
self.assertTrue(mock_wait_until_running.called)
+ @mock.patch('{}.paramiko'.format(prefix), **{"resource_filename.return_value": ""})
+ @mock.patch('{}.pkg_resources'.format(prefix), **{"resource_filename.return_value": ""})
+ @mock.patch('{}.utils'.format(prefix))
+ @mock.patch('{}.open'.format(prefix), create=True)
@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):
+ def test_ssh_key(self, mock_create, mock_delete, mock_open, mock_utils, mock_resources,
+ mock_paramiko):
k8s_context = KubernetesContext()
k8s_context.init(context_cfg)
diff --git a/tests/unit/benchmark/core/test_task.py b/tests/unit/benchmark/core/test_task.py
index 14027e43c..737e7058b 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': 'uplink_0',
},
- 'eth10': {
- 'name': 'internal',
- 'vld_id': '55',
+ 'xe1': {
+ 'network_name': 'downlink_0',
},
},
},
'node2': {
'interfaces': {
- 'eth4': {
- 'name': 'mgmt',
+ 'mgmt': {
+ 'network_name': 'mgmt',
},
- 'eth2': {
- 'name': 'external',
- 'vld_id': '32',
+ 'uplink_0': {
+ 'network_name': 'uplink_0',
},
- 'eth11': {
- 'name': 'internal',
- 'vld_id': '55',
+ 'downlink_0': {
+ 'network_name': 'downlink_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': 'uplink_0',
'subnet_cidr': '10.20.0.0/16',
},
{
- 'name': 'c',
- 'vld_id': 'x',
+ 'name': 'downlink_0',
+ 'segmentation_id': '1001',
},
{
- 'name': 'd',
- 'vld_id': 'w',
+ 'name': 'uplink_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'},
+ 'uplink_0': {'name': 'uplink_0', 'subnet_cidr': '10.20.0.0/16'},
+ 'uplink_1': {'name': 'uplink_1'},
+ 'downlink_0': {'name': 'downlink_0', 'segmentation_id': '1001'},
}
networks = task.get_networks_from_nodes(nodes)
diff --git a/tests/unit/benchmark/scenarios/availability/test_basemonitor.py b/tests/unit/benchmark/scenarios/availability/test_basemonitor.py
index 3b7e07376..92ae8aa88 100644
--- a/tests/unit/benchmark/scenarios/availability/test_basemonitor.py
+++ b/tests/unit/benchmark/scenarios/availability/test_basemonitor.py
@@ -25,13 +25,32 @@ from yardstick.benchmark.scenarios.availability.monitor import basemonitor
class MonitorMgrTestCase(unittest.TestCase):
def setUp(self):
- config = {
- 'monitor_type': 'openstack-api',
- 'key': 'service-status'
- }
-
- self.monitor_configs = []
- self.monitor_configs.append(config)
+ self.monitor_configs = [
+ {
+ "monitor_type": "openstack-cmd",
+ "command_name": "openstack router list",
+ "monitor_time": 10,
+ "monitor_number": 3,
+ "sla": {
+ "max_outage_time": 5
+ }
+ },
+ {
+ "monitor_type": "process",
+ "process_name": "neutron-server",
+ "host": "node1",
+ "monitor_time": 20,
+ "monitor_number": 3,
+ "sla": {
+ "max_recover_time": 20
+ }
+ }
+ ]
+ self.MonitorMgr = basemonitor.MonitorMgr([])
+ self.MonitorMgr.init_monitors(self.monitor_configs, None)
+ self.monitor_list = self.MonitorMgr._monitor_list
+ for mo in self.monitor_list:
+ mo._result = {"outage_time": 10}
def test__MonitorMgr_setup_successful(self, mock_monitor):
instance = basemonitor.MonitorMgr({"nova-api": 10})
@@ -44,7 +63,13 @@ class MonitorMgrTestCase(unittest.TestCase):
def test_MonitorMgr_getitem(self, mock_monitor):
monitorMgr = basemonitor.MonitorMgr({"nova-api": 10})
monitorMgr.init_monitors(self.monitor_configs, None)
- monitorIns = monitorMgr['service-status']
+
+ def test_store_result(self, mock_monitor):
+ expect = {'process_neutron-server_outage_time': 10,
+ 'openstack-router-list_outage_time': 10}
+ result = {}
+ self.MonitorMgr.store_result(result)
+ self.assertDictEqual(result, expect)
class BaseMonitorTestCase(unittest.TestCase):
@@ -94,3 +119,7 @@ class BaseMonitorTestCase(unittest.TestCase):
except Exception:
pass
self.assertIsNone(cls)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tests/unit/benchmark/scenarios/networking/ipv4_throughput_vpe.yaml b/tests/unit/benchmark/scenarios/networking/ipv4_throughput_vpe.yaml
index cfa166a74..2123e4705 100644
--- a/tests/unit/benchmark/scenarios/networking/ipv4_throughput_vpe.yaml
+++ b/tests/unit/benchmark/scenarios/networking/ipv4_throughput_vpe.yaml
@@ -49,13 +49,13 @@ private:
ipv4:
outer_l2:
framesize:
- 64B: "{{ get(imix, 'imix.private.imix_small', '0') }}"
- 128B: "{{ get(imix, 'imix.private.imix_128B', '0') }}"
- 256B: "{{ get(imix, 'imix.private.imix_256B', '0') }}"
- 373b: "{{ get(imix, 'imix.private.imix_373B', '0') }}"
- 570B: "{{get(imix, 'imix.private.imix_570B', '0') }}"
- 1400B: "{{get(imix, 'imix.private.imix_1400B', '0') }}"
- 1518B: "{{get(imix, 'imix.private.imix_1500B', '0') }}"
+ 64B: "{{ get(imix, 'imix.uplink.imix_small', '0') }}"
+ 128B: "{{ get(imix, 'imix.uplink.imix_128B', '0') }}"
+ 256B: "{{ get(imix, 'imix.uplink.imix_256B', '0') }}"
+ 373b: "{{ get(imix, 'imix.uplink.imix_373B', '0') }}"
+ 570B: "{{get(imix, 'imix.uplink.imix_570B', '0') }}"
+ 1400B: "{{get(imix, 'imix.uplink.imix_1400B', '0') }}"
+ 1518B: "{{get(imix, 'imix.uplink.imix_1500B', '0') }}"
QinQ:
S-VLAN:
@@ -81,13 +81,13 @@ public:
ipv4:
outer_l2:
framesize:
- 64B: "{{ get(imix, 'imix.private.imix_small', '0') }}"
- 128B: "{{ get(imix, 'imix.private.imix_128B', '0') }}"
- 256B: "{{ get(imix, 'imix.private.imix_256B', '0') }}"
- 373b: "{{ get(imix, 'imix.private.imix_373B', '0') }}"
- 570B: "{{get(imix, 'imix.private.imix_570B', '0') }}"
- 1400B: "{{get(imix, 'imix.private.imix_1400B', '0') }}"
- 1518B: "{{get(imix, 'imix.private.imix_1500B', '0') }}"
+ 64B: "{{ get(imix, 'imix.uplink.imix_small', '0') }}"
+ 128B: "{{ get(imix, 'imix.uplink.imix_128B', '0') }}"
+ 256B: "{{ get(imix, 'imix.uplink.imix_256B', '0') }}"
+ 373b: "{{ get(imix, 'imix.uplink.imix_373B', '0') }}"
+ 570B: "{{get(imix, 'imix.uplink.imix_570B', '0') }}"
+ 1400B: "{{get(imix, 'imix.uplink.imix_1400B', '0') }}"
+ 1518B: "{{get(imix, 'imix.uplink.imix_1500B', '0') }}"
outer_l3v4:
proto: "tcp"
diff --git a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
index 58244b8f5..fa9b8549d 100644
--- a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
+++ b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
@@ -24,6 +24,8 @@ import errno
import unittest
import mock
+from copy import deepcopy
+
from tests.unit import STL_MOCKS
from yardstick.benchmark.scenarios.networking.vnf_generic import \
SshManager, NetworkServiceTestCase, IncorrectConfig, \
@@ -240,11 +242,11 @@ class TestNetworkServiceTestCase(unittest.TestCase):
'vnf__1': self.vnf__1,
},
'networks': {
- 'private': {
- 'vld_id': 'private',
+ GenericVNF.UPLINK: {
+ 'vld_id': GenericVNF.UPLINK,
},
- 'public': {
- 'vld_id': 'public',
+ GenericVNF.DOWNLINK: {
+ 'vld_id': GenericVNF.DOWNLINK,
},
},
}
@@ -263,7 +265,7 @@ class TestNetworkServiceTestCase(unittest.TestCase):
}
],
'type': 'ELAN',
- 'id': 'private',
+ 'id': GenericVNF.UPLINK,
'name': 'tg__1 to vnf__1 link 1'
}
@@ -281,7 +283,7 @@ class TestNetworkServiceTestCase(unittest.TestCase):
}
],
'type': 'ELAN',
- 'id': 'public',
+ 'id': GenericVNF.DOWNLINK,
'name': 'vnf__1 to tg__1 link 2'
}
@@ -365,6 +367,24 @@ class TestNetworkServiceTestCase(unittest.TestCase):
result = '152.16.100.2-152.16.100.254'
self.assertEqual(result, self.s._get_ip_flow_range({"tg__1": 'xe0'}))
+ @mock.patch('yardstick.benchmark.scenarios.networking.vnf_generic.ipaddress')
+ def test__get_ip_flow_range_no_node_data(self, mock_ipaddress):
+ scenario_cfg = deepcopy(self.scenario_cfg)
+ scenario_cfg["traffic_options"]["flow"] = \
+ self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml")
+
+ mock_ipaddress.ip_network.return_value = ipaddr = mock.Mock()
+ ipaddr.hosts.return_value = []
+
+ expected = '0.0.0.0'
+ result = self.s._get_ip_flow_range({"tg__2": 'xe0'})
+ self.assertEqual(result, expected)
+
+ def test__get_ip_flow_range_no_nodes(self):
+ expected = '0.0.0.0'
+ result = self.s._get_ip_flow_range({})
+ self.assertEqual(result, expected)
+
def test___get_traffic_flow(self):
self.scenario_cfg["traffic_options"]["flow"] = \
self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml")
@@ -653,12 +673,6 @@ class TestNetworkServiceTestCase(unittest.TestCase):
res = NetworkServiceTestCase.parse_netdev_info(output)
assert res == self.SAMPLE_VM_NETDEVS
- def test_sort_dpdk_port_num(self):
- netdevs = self.SAMPLE_NETDEVS.copy()
- NetworkServiceTestCase._sort_dpdk_port_num(netdevs)
- 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()
network = {'local_mac': '0a:de:ad:be:ef:f5'}
diff --git a/tests/unit/benchmark/scenarios/networking/test_vsperf_dpdk.py b/tests/unit/benchmark/scenarios/networking/test_vsperf_dpdk.py
index de5bae2f3..5759f0a90 100644
--- a/tests/unit/benchmark/scenarios/networking/test_vsperf_dpdk.py
+++ b/tests/unit/benchmark/scenarios/networking/test_vsperf_dpdk.py
@@ -118,7 +118,8 @@ class VsperfDPDKTestCase(unittest.TestCase):
result = p._is_dpdk_setup()
self.assertEqual(result, True)
- def test_vsperf_dpdk_dpdk_setup_first(self, mock_ssh, mock_subprocess):
+ @mock.patch('yardstick.benchmark.scenarios.networking.vsperf_dpdk.time')
+ def test_vsperf_dpdk_dpdk_setup_first(self, mock_time, mock_ssh, mock_subprocess):
p = vsperf_dpdk.VsperfDPDK(self.args, self.ctx)
# setup() specific mocks
@@ -135,42 +136,43 @@ class VsperfDPDKTestCase(unittest.TestCase):
self.assertEqual(p._is_dpdk_setup(), False)
self.assertEqual(p.dpdk_setup_done, True)
- def test_vsperf_dpdk_dpdk_setup_next(self, mock_ssh, mock_subprocess):
+ @mock.patch('yardstick.benchmark.scenarios.networking.vsperf_dpdk.time')
+ def test_vsperf_dpdk_dpdk_setup_next(self, mock_time, mock_ssh, mock_subprocess):
p = vsperf_dpdk.VsperfDPDK(self.args, self.ctx)
# setup() specific mocks
+ mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
mock_subprocess.call().execute.return_value = None
p.setup()
self.assertIsNotNone(p.client)
self.assertEqual(p.setup_done, True)
- # dpdk_setup() specific mocks
- mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
-
p.dpdk_setup()
self.assertEqual(p._is_dpdk_setup(), True)
self.assertEqual(p.dpdk_setup_done, True)
- def test_vsperf_dpdk_dpdk_setup_fail(self, mock_ssh, mock_subprocess):
+ @mock.patch('yardstick.benchmark.scenarios.networking.vsperf_dpdk.time')
+ def test_vsperf_dpdk_dpdk_setup_fail(self, mock_time, mock_ssh, mock_subprocess):
p = vsperf_dpdk.VsperfDPDK(self.args, self.ctx)
# setup() specific mocks
+ mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
mock_subprocess.call().execute.return_value = None
p.setup()
self.assertIsNotNone(p.client)
- self.assertEqual(p.setup_done, True)
-
- # dpdk_setup() specific mocks
mock_ssh.SSH.from_node().execute.return_value = (1, '', '')
+ self.assertEqual(p.setup_done, True)
self.assertRaises(RuntimeError, p.dpdk_setup)
- def test_vsperf_dpdk_run_ok(self, mock_ssh, mock_subprocess):
+ @mock.patch('yardstick.benchmark.scenarios.networking.vsperf_dpdk.time')
+ def test_vsperf_dpdk_run_ok(self, mock_time, mock_ssh, mock_subprocess):
p = vsperf_dpdk.VsperfDPDK(self.args, self.ctx)
# setup() specific mocks
+ mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
mock_subprocess.call().execute.return_value = None
p.setup()
@@ -179,7 +181,6 @@ class VsperfDPDKTestCase(unittest.TestCase):
# run() specific mocks
mock_subprocess.call().execute.return_value = None
- mock_subprocess.call().execute.return_value = None
mock_ssh.SSH.from_node().execute.return_value = (
0, 'throughput_rx_fps\r\n14797660.000\r\n', '')
@@ -193,6 +194,7 @@ class VsperfDPDKTestCase(unittest.TestCase):
p = vsperf_dpdk.VsperfDPDK(self.args, self.ctx)
# setup() specific mocks
+ mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
mock_subprocess.call().execute.return_value = None
p.setup()
@@ -211,6 +213,7 @@ class VsperfDPDKTestCase(unittest.TestCase):
p = vsperf_dpdk.VsperfDPDK(self.args, self.ctx)
# setup() specific mocks
+ mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
mock_subprocess.call().execute.return_value = None
p.setup()
diff --git a/tests/unit/benchmark/scenarios/networking/vpe_vnf_topology.yaml b/tests/unit/benchmark/scenarios/networking/vpe_vnf_topology.yaml
index 0de4b6e79..1ac6c1f89 100644
--- a/tests/unit/benchmark/scenarios/networking/vpe_vnf_topology.yaml
+++ b/tests/unit/benchmark/scenarios/networking/vpe_vnf_topology.yaml
@@ -27,7 +27,7 @@ nsd:nsd-catalog:
VNF model: ../../vnf_descriptors/vpe_vnf.yaml #tg_l3fwd.yaml #tg_trex_tpl.yaml #TREX
vld:
- - id: private
+ - id: uplink
name: tg__1 to vnf__1 link 1
type: ELAN
vnfd-connection-point-ref:
@@ -38,7 +38,7 @@ nsd:nsd-catalog:
vnfd-connection-point-ref: xe0
vnfd-id-ref: vnf__1 #VNF
- - id: public
+ - id: downlink
name: vnf__1 to tg__1 link 2
type: ELAN
vnfd-connection-point-ref: