summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincenzo Riccobene <vincenzox.m.riccobene@intel.com>2015-12-11 21:24:56 +0000
committerJörgen Karlsson <jorgen.w.karlsson@ericsson.com>2015-12-14 23:01:24 +0000
commitd5268471785c70b048b55eebfbea62c7e5cd9683 (patch)
treefd84b984c0cae4bed1eddd051eda6c9050e987f6
parentd2749a4348130ce6c8fbfbd26e59e8de08a527ae (diff)
Add support to the test case required by YARDSTICK-36
Add support to ApexLake for the calculation of the throughput of the vTC in case of noisy neighbors deployment, through the DPDK pktgen. JIRA: YARDSTICK-36 Change-Id: I00950f967cac1f12f733a05af8166c757dc02e0a Signed-off-by: Vincenzo Riccobene <vincenzox.m.riccobene@intel.com>
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py79
-rw-r--r--yardstick/vTC/apexlake/tests/multi_tenancy_throughput_benchmark_test.py111
2 files changed, 190 insertions, 0 deletions
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py
new file mode 100644
index 000000000..ba1e0cc81
--- /dev/null
+++ b/yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py
@@ -0,0 +1,79 @@
+# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+from experimental_framework.benchmarks import rfc2544_throughput_benchmark \
+ as base
+from experimental_framework import common
+
+
+class MultiTenancyThroughputBenchmark(base.RFC2544ThroughputBenchmark):
+
+ def __init__(self, name, params):
+ base.RFC2544ThroughputBenchmark.__init__(self, name, params)
+ self.template_file = "{}{}".format(common.get_template_dir(),
+ 'stress_workload.yaml')
+ self.stack_name = 'neighbour'
+ self.neighbor_stack_names = list()
+
+ def get_features(self):
+ features = super(MultiTenancyThroughputBenchmark, self).get_features()
+ features['description'] = \
+ 'RFC 2544 Throughput calculation with ' \
+ 'memory-bound noisy neighbors'
+ features['parameters'].append('num_of_neighbours')
+ features['parameters'].append('amount_of_ram')
+ features['parameters'].append('number_of_cores')
+ features['allowed_values']['num_of_neighbours'] = \
+ ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
+ features['allowed_values']['number_of_cores'] = \
+ ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
+ features['allowed_values']['amount_of_ram'] = \
+ ['250M', '1G', '2G', '3G', '4G', '5G', '6G', '7G', '8G', '9G',
+ '10G']
+ features['default_values']['num_of_neighbours'] = '1'
+ features['default_values']['number_of_cores'] = '1'
+ features['default_values']['amount_of_ram'] = '250M'
+ return features
+
+ def init(self):
+ """
+ Initialize the benchmark
+ return: None
+ """
+ common.replace_in_file(self.lua_file, 'local out_file = ""',
+ 'local out_file = "' +
+ self.results_file + '"')
+ heat_param = dict()
+ heat_param['cores'] = self.params['number_of_cores']
+ heat_param['memory'] = self.params['amount_of_ram']
+ for i in range(0, int(self.params['num_of_neighbours'])):
+ stack_name = self.stack_name + str(i)
+ common.DEPLOYMENT_UNIT.deploy_heat_template(self.template_file,
+ stack_name,
+ heat_param)
+ self.neighbor_stack_names.append(stack_name)
+
+ def finalize(self):
+ """
+ Finalizes the benchmark
+ return: None
+ """
+ common.replace_in_file(self.lua_file, 'local out_file = "' +
+ self.results_file + '"',
+ 'local out_file = ""')
+ # destroy neighbor stacks
+ for stack_name in self.neighbor_stack_names:
+ common.DEPLOYMENT_UNIT.destroy_heat_template(stack_name)
+ self.neighbor_stack_names = list()
diff --git a/yardstick/vTC/apexlake/tests/multi_tenancy_throughput_benchmark_test.py b/yardstick/vTC/apexlake/tests/multi_tenancy_throughput_benchmark_test.py
new file mode 100644
index 000000000..78aff35ba
--- /dev/null
+++ b/yardstick/vTC/apexlake/tests/multi_tenancy_throughput_benchmark_test.py
@@ -0,0 +1,111 @@
+# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+__author__ = 'gpetralx'
+
+
+import unittest
+import mock
+from experimental_framework.benchmarks \
+ import multi_tenancy_throughput_benchmark as bench
+
+
+class MockDeploymentUnit(object):
+ def deploy_heat_template(self, temp_file, stack_name, heat_param):
+ pass
+
+ def destroy_heat_template(self, stack_name):
+ pass
+
+
+def get_deployment_unit():
+ return MockDeploymentUnit()
+
+
+class TestMultiTenancyThroughputBenchmark(unittest.TestCase):
+ def setUp(self):
+ name = 'benchmark'
+ params = dict()
+ self.benchmark = bench.MultiTenancyThroughputBenchmark(name, params)
+
+ def tearDown(self):
+ pass
+
+ def test_get_features_for_sanity(self):
+ output = self.benchmark.get_features()
+ self.assertIsInstance(output, dict)
+ self.assertIn('parameters', output.keys())
+ self.assertIn('allowed_values', output.keys())
+ self.assertIn('default_values', output.keys())
+ self.assertIsInstance(output['parameters'], list)
+ self.assertIsInstance(output['allowed_values'], dict)
+ self.assertIsInstance(output['default_values'], dict)
+
+ @mock.patch('experimental_framework.common.DEPLOYMENT_UNIT',
+ side_effect=get_deployment_unit)
+ @mock.patch('experimental_framework.common.replace_in_file')
+ def test_init_for_success(self, replace_in_file, deployment_unit):
+ num_of_neighbours = 5
+ num_of_cores = '3'
+ amount_of_ram = '250M'
+
+ self.benchmark.lua_file = 'lua_file'
+ self.benchmark.results_file = 'result_file'
+ self.benchmark.params['num_of_neighbours'] = str(num_of_neighbours)
+ self.benchmark.params['number_of_cores'] = num_of_cores
+ self.benchmark.params['amount_of_ram'] = amount_of_ram
+ self.benchmark.init()
+
+ param_1 = 'lua_file'
+ param_2 = 'local out_file = ""'
+ param_3 = 'local out_file = "result_file"'
+ replace_in_file.assert_called_once_with(param_1, param_2, param_3)
+
+ heat_param = dict()
+ heat_param['cores'] = num_of_cores
+ heat_param['memory'] = amount_of_ram
+ neighbor_stack_names = list()
+
+ deployment_unit.\
+ deploy_heat_template.assert_called_with(
+ self.benchmark.template_file,
+ 'neighbour' + str(num_of_neighbours - 1), heat_param)
+
+ for i in range(0, num_of_neighbours):
+ neighbor_stack_names.append('neighbour' + str(i))
+
+ self.assertListEqual(neighbor_stack_names,
+ self.benchmark.neighbor_stack_names)
+
+ @mock.patch('experimental_framework.common.DEPLOYMENT_UNIT',
+ side_effect=get_deployment_unit)
+ @mock.patch('experimental_framework.common.replace_in_file')
+ def test_finalize_for_success(self, replace_in_file, deployment_unit):
+ num_of_neighbours = 5
+ self.benchmark.lua_file = 'lua_file'
+ self.benchmark.results_file = 'result_file'
+ self.benchmark.params['num_of_neighbours'] = str(num_of_neighbours)
+ self.benchmark.neighbor_stack_names = list()
+ self.benchmark.neighbor_stack_names.append(str(num_of_neighbours - 1))
+ self.benchmark.finalize()
+
+ param_1 = 'lua_file'
+ param_2 = 'local out_file = "result_file"'
+ param_3 = 'local out_file = ""'
+ replace_in_file.assert_called_once_with(param_1, param_2, param_3)
+
+ deployment_unit.\
+ destroy_heat_template.\
+ assert_called_with(str(num_of_neighbours - 1))
+ self.assertListEqual(list(), self.benchmark.neighbor_stack_names)