aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests/unit/benchmark
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/tests/unit/benchmark')
-rw-r--r--yardstick/tests/unit/benchmark/contexts/standalone/test_model.py4
-rw-r--r--yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py2
-rw-r--r--yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py18
3 files changed, 21 insertions, 3 deletions
diff --git a/yardstick/tests/unit/benchmark/contexts/standalone/test_model.py b/yardstick/tests/unit/benchmark/contexts/standalone/test_model.py
index 98d2b1836..d880b4169 100644
--- a/yardstick/tests/unit/benchmark/contexts/standalone/test_model.py
+++ b/yardstick/tests/unit/benchmark/contexts/standalone/test_model.py
@@ -17,6 +17,7 @@ import os
import uuid
import mock
+import netaddr
import unittest
from xml.etree import ElementTree
@@ -123,7 +124,7 @@ class ModelLibvirtTestCase(unittest.TestCase):
def test_add_ovs_interfaces(self):
xml_input = copy.deepcopy(XML_SAMPLE)
xml_output = model.Libvirt.add_ovs_interface(
- '/usr/local', 0, self.pci_address_str, self.mac, xml_input)
+ '/usr/local', 0, self.pci_address_str, self.mac, xml_input, 4)
root = ElementTree.fromstring(xml_output)
et_out = ElementTree.ElementTree(element=root)
@@ -292,6 +293,7 @@ class ModelLibvirtTestCase(unittest.TestCase):
hostname = root.find('name').text
mac = "00:11:22:33:44:55"
ip = "{0}/{1}".format(node.get('ip'), node.get('netmask'))
+ ip = "{0}/{1}".format(node.get('ip'), netaddr.IPNetwork(ip).prefixlen)
model.StandaloneContextHelper.check_update_key(self.mock_ssh, node, hostname, id_name,
cdrom_img, mac)
mock_gen_cdrom_image.assert_called_once_with(self.mock_ssh, cdrom_img, hostname,
diff --git a/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py b/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py
index 707d45207..190e83d5f 100644
--- a/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py
+++ b/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py
@@ -385,7 +385,7 @@ class OvsDpdkContextTestCase(unittest.TestCase):
self.ovs_dpdk._enable_interfaces(0, ["private_0"], 'test')
mock_add_ovs_interface.assert_called_once_with(
'fake_path', 0, self.NETWORKS['private_0']['vpci'],
- self.NETWORKS['private_0']['mac'], 'test')
+ self.NETWORKS['private_0']['mac'], 'test', 1)
@mock.patch.object(ovs_dpdk.OvsDpdkContext, '_check_hugepages')
@mock.patch.object(common_utils, 'setup_hugepages')
diff --git a/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py b/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
index 6bf2f2c2f..90248d1bf 100644
--- a/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
+++ b/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
@@ -629,7 +629,7 @@ class TestNetworkServiceTestCase(unittest.TestCase):
@mock.patch.object(vnfdgen, 'generate_vnfd')
def test__fill_traffic_profile(self, mock_generate, mock_tprofile_get):
fake_tprofile = mock.Mock()
- fake_vnfd = mock.Mock()
+ fake_vnfd = mock.MagicMock()
with mock.patch.object(self.s, '_get_traffic_profile',
return_value=fake_tprofile) as mock_get_tp:
mock_generate.return_value = fake_vnfd
@@ -646,6 +646,22 @@ class TestNetworkServiceTestCase(unittest.TestCase):
)
mock_tprofile_get.assert_called_once_with(fake_vnfd)
+ @mock.patch.object(base.TrafficProfile, 'get')
+ @mock.patch.object(vnfdgen, 'generate_vnfd')
+ def test__fill_traffic_profile2(self, mock_generate, mock_tprofile_get):
+ fake_tprofile = mock.Mock()
+ fake_vnfd = {}
+ with mock.patch.object(self.s, '_get_traffic_profile',
+ return_value=fake_tprofile) as mock_get_tp:
+ mock_generate.return_value = fake_vnfd
+
+ self.s.scenario_cfg["options"] = {"traffic_config": {"duration": 99899}}
+ self.s._fill_traffic_profile()
+ mock_get_tp.assert_called_once()
+ self.assertIn("traffic_profile", fake_vnfd)
+ self.assertIn("duration", fake_vnfd["traffic_profile"])
+ self.assertEqual(99899, fake_vnfd["traffic_profile"]["duration"])
+
@mock.patch.object(utils, 'open_relative_file')
def test__get_topology(self, mock_open_path):
self.s.scenario_cfg['topology'] = 'fake_topology'