summaryrefslogtreecommitdiffstats
path: root/tests/unit/network_services/vnf_generic
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-03-09 13:19:22 +0000
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-03-09 13:51:52 +0000
commitba811fc624003829bb972890d96aac4f5eaf97b5 (patch)
treea3dfdd08bd8a12efa95bf595f335ff9f6be2be98 /tests/unit/network_services/vnf_generic
parentf753fb86cc26e08dca168c0827d28a7b6f022d1f (diff)
Make Sample VNF hugepages size configurable
The amount of hugepages claimed for a Sample VNF is always 16GB. This value is excesive for most of the Sample VNF applications (except for vPE). Making this parameter configurable we allow to spawn smaller VMs by using less hugepages (in case of StandAlone and OpenStack deployments). Because this parameter depends on the Scenario and the type of VNF executed, the parameter is located in: scenarios: {options: hugepages_gb} # number of GB of hugepages claimed PENDING: document this new parameter. A new userguide section should be created to document all "scenario" sections and parameters. JIRA: YARDSTICK-1061 Change-Id: I6f082e105289bd01781be18f2fecbe0ba2fdfdee Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'tests/unit/network_services/vnf_generic')
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py22
1 files changed, 20 insertions, 2 deletions
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 c7d2abcd5..26bd1dadd 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
@@ -533,10 +533,12 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase):
@mock.patch.object(six, 'BytesIO', return_value=six.BytesIO(b'100\n'))
@mock.patch.object(utils, 'read_meminfo',
return_value={'Hugepagesize': '2048'})
- def test__setup_hugepages(self, mock_meminfo, *args):
+ def test__setup_hugepages_no_hugepages_defined(self, mock_meminfo, *args):
ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ scenario_helper.all_options = {}
dpdk_setup_helper = DpdkVnfSetupEnvHelper(
- mock.ANY, ssh_helper, mock.ANY)
+ mock.ANY, ssh_helper, scenario_helper)
with mock.patch.object(sample_vnf.LOG, 'info') as mock_info:
dpdk_setup_helper._setup_hugepages()
mock_info.assert_called_once_with(
@@ -544,6 +546,22 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase):
'%s', 2048, 8192, 100)
mock_meminfo.assert_called_once_with(ssh_helper)
+ @mock.patch.object(six, 'BytesIO', return_value=six.BytesIO(b'100\n'))
+ @mock.patch.object(utils, 'read_meminfo',
+ return_value={'Hugepagesize': '1048576'})
+ def test__setup_hugepages_8gb_hugepages_defined(self, mock_meminfo, *args):
+ ssh_helper = mock.Mock()
+ scenario_helper = mock.Mock()
+ scenario_helper.all_options = {'hugepages_gb': 8}
+ dpdk_setup_helper = DpdkVnfSetupEnvHelper(
+ mock.ANY, ssh_helper, scenario_helper)
+ with mock.patch.object(sample_vnf.LOG, 'info') as mock_info:
+ dpdk_setup_helper._setup_hugepages()
+ mock_info.assert_called_once_with(
+ 'Hugepages size (kB): %s, number claimed: %s, number set: '
+ '%s', 1048576, 8, 100)
+ mock_meminfo.assert_called_once_with(ssh_helper)
+
@mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.open')
@mock.patch.object(utils, 'find_relative_file')
@mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.MultiPortConfig')