aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/vTC/apexlake/tests
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-07-31 20:10:20 -0700
committerRoss Brattain <ross.b.brattain@intel.com>2017-07-31 20:46:46 -0700
commitd455f3b56c866b0e61394a01f0a07e05831f3044 (patch)
treef1d3a289a70fb9265d6f891e4bde5fbf63d44612 /yardstick/vTC/apexlake/tests
parent5ad208bd8d0c1798179de226f28f1e1ec03033fa (diff)
DRAFT: remove apexlake
apexlake is unmaintained, so remove it From some reason orchestrator/heat.py started failing so fixup those unittests Change-Id: Ie06508b5ab7c9dcf9fdfca83e173a188a894d564 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'yardstick/vTC/apexlake/tests')
-rw-r--r--yardstick/vTC/apexlake/tests/api_test.py147
-rw-r--r--yardstick/vTC/apexlake/tests/base_packet_generator_test.py30
-rw-r--r--yardstick/vTC/apexlake/tests/benchmark_base_class_test.py86
-rw-r--r--yardstick/vTC/apexlake/tests/benchmarking_unit_test.py481
-rw-r--r--yardstick/vTC/apexlake/tests/common_test.py665
-rw-r--r--yardstick/vTC/apexlake/tests/conf_file_sections_test.py30
-rw-r--r--yardstick/vTC/apexlake/tests/data/common/conf.cfg43
-rw-r--r--yardstick/vTC/apexlake/tests/data/common/file_replacement.txt1
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait.tmp199
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_1.yaml212
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_1.yaml.json1
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_2.yaml212
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_2.yaml.json1
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml199
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml.json1
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml199
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml.json1
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/vTC.yaml207
-rw-r--r--yardstick/vTC/apexlake/tests/data/test_experiments/experiment_1/benchmark_1.csv3
-rw-r--r--yardstick/vTC/apexlake/tests/data/test_experiments/experiment_1/metadata.json1
-rw-r--r--yardstick/vTC/apexlake/tests/data/test_experiments/results_benchmark_1.csv5
-rw-r--r--yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait.tmp199
-rw-r--r--yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_1.yaml212
-rw-r--r--yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_1.yaml.json1
-rw-r--r--yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_2.yaml212
-rw-r--r--yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_2.yaml.json1
-rw-r--r--yardstick/vTC/apexlake/tests/deployment_unit_test.py279
-rw-r--r--yardstick/vTC/apexlake/tests/dpdk_packet_generator_test.py710
-rw-r--r--yardstick/vTC/apexlake/tests/generates_template_test.py102
-rw-r--r--yardstick/vTC/apexlake/tests/heat_manager_test.py235
-rw-r--r--yardstick/vTC/apexlake/tests/instantiation_validation_bench_test.py339
-rw-r--r--yardstick/vTC/apexlake/tests/instantiation_validation_noisy_bench_test.py150
-rw-r--r--yardstick/vTC/apexlake/tests/multi_tenancy_throughput_benchmark_test.py119
-rw-r--r--yardstick/vTC/apexlake/tests/rfc2544_throughput_benchmark_test.py162
-rw-r--r--yardstick/vTC/apexlake/tests/tree_node_test.py98
35 files changed, 0 insertions, 5543 deletions
diff --git a/yardstick/vTC/apexlake/tests/api_test.py b/yardstick/vTC/apexlake/tests/api_test.py
deleted file mode 100644
index b6191ed8f..000000000
--- a/yardstick/vTC/apexlake/tests/api_test.py
+++ /dev/null
@@ -1,147 +0,0 @@
-# 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 __future__ import absolute_import
-import unittest
-import mock
-import os
-import experimental_framework.common as common
-from experimental_framework import APEX_LAKE_ROOT
-from experimental_framework.api import FrameworkApi
-from experimental_framework.benchmarking_unit import BenchmarkingUnit
-import experimental_framework.benchmarks.\
- instantiation_validation_benchmark as iv
-from six.moves import map
-from six.moves import range
-
-
-class DummyBenchmarkingUnit(BenchmarkingUnit):
-
- def __init__(self):
- BenchmarkingUnit.__init__(self)
-
- @staticmethod
- def get_available_test_cases():
- return ['BenchA', 'BenchB']
-
- @staticmethod
- def get_required_benchmarks(required_benchmarks):
- common.BASE_DIR = "base_dir/"
- return [iv.InstantiationValidationBenchmark('benchmark', dict())]
-
-
-class DummyBenchmarkingUnit2(BenchmarkingUnit):
-
- counter_init = 0
- counter_finalize = 0
- counter_run = 0
-
- def __init__(self, base_heat_template, credentials,
- heat_template_parameters, iterations, test_cases):
- DummyBenchmarkingUnit.counter_init = 0
- DummyBenchmarkingUnit.counter_finalize = 0
- DummyBenchmarkingUnit.counter_run = 0
-
- def initialize(self):
- DummyBenchmarkingUnit2.counter_init += 1
-
- def run_benchmarks(self):
- DummyBenchmarkingUnit2.counter_run += 1
-
- def finalize(self):
- DummyBenchmarkingUnit2.counter_finalize += 1
-
-
-class TestGeneratesTemplate(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- @mock.patch('experimental_framework.common.init')
- def test_init_for_success(self, mock_init):
- FrameworkApi.init()
- mock_init.assert_called_once_with(api=True)
-
- # @mock.patch('experimental_framework.benchmarking_unit.BenchmarkingUnit.'
- # 'get_available_test_cases',
- # side_effect=DummyBenchmarkingUnit.get_available_test_cases)
- # def test_get_available_test_cases_for_success(self, mock_bench):
- # expected = ['BenchA', 'BenchB']
- # output = FrameworkApi.get_available_test_cases()
- # self.assertEqual(expected, output)
-
- @mock.patch('experimental_framework.benchmarking_unit.BenchmarkingUnit.'
- 'get_required_benchmarks',
- side_effect=DummyBenchmarkingUnit.get_required_benchmarks)
- def test_get_test_case_features_for_success(self, mock_get_req_bench):
- expected = dict()
- expected['description'] = 'Instantiation Validation Benchmark'
- expected['parameters'] = [
- iv.THROUGHPUT,
- iv.VLAN_SENDER,
- iv.VLAN_RECEIVER]
- expected['allowed_values'] = dict()
- expected['allowed_values'][iv.THROUGHPUT] = \
- list(map(str, list(range(0, 100))))
- expected['allowed_values'][iv.VLAN_SENDER] = \
- list(map(str, list(range(-1, 4096))))
- expected['allowed_values'][iv.VLAN_RECEIVER] = \
- list(map(str, list(range(-1, 4096))))
- expected['default_values'] = dict()
- expected['default_values'][iv.THROUGHPUT] = '1'
- expected['default_values'][iv.VLAN_SENDER] = '-1'
- expected['default_values'][iv.VLAN_RECEIVER] = '-1'
-
- test_case = 'instantiation_validation_benchmark.' \
- 'InstantiationValidationBenchmark'
- output = FrameworkApi.get_test_case_features(test_case)
- self.assertEqual(expected, output)
-
- def test__get_test_case_features__for_failure(self):
- self.assertRaises(
- ValueError, FrameworkApi.get_test_case_features, 111)
-
- @mock.patch('experimental_framework.common.init')
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.common.get_credentials')
- @mock.patch('experimental_framework.heat_template_generation.'
- 'generates_templates')
- @mock.patch('experimental_framework.benchmarking_unit.BenchmarkingUnit',
- side_effect=DummyBenchmarkingUnit2)
- def test_execute_framework_for_success(self, mock_b_unit, mock_heat,
- mock_credentials, mock_log,
- mock_common_init):
- common.TEMPLATE_DIR = os.path.join(APEX_LAKE_ROOT,
- 'tests/data/generated_templates/')
-
- test_cases = dict()
- iterations = 1
- heat_template = 'VTC_base_single_vm_wait.tmp'
- heat_template_parameters = dict()
- deployment_configuration = ''
- openstack_credentials = dict()
- openstack_credentials['ip_controller'] = ''
- openstack_credentials['heat_url'] = ''
- openstack_credentials['user'] = ''
- openstack_credentials['password'] = ''
- openstack_credentials['auth_uri'] = ''
- openstack_credentials['project'] = ''
- FrameworkApi.execute_framework(
- test_cases, iterations, heat_template,
- heat_template_parameters, deployment_configuration,
- openstack_credentials)
diff --git a/yardstick/vTC/apexlake/tests/base_packet_generator_test.py b/yardstick/vTC/apexlake/tests/base_packet_generator_test.py
deleted file mode 100644
index 153de171d..000000000
--- a/yardstick/vTC/apexlake/tests/base_packet_generator_test.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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 __future__ import absolute_import
-import unittest
-from experimental_framework.packet_generators import base_packet_generator
-
-
-class BasePacketGeneratorTest(unittest.TestCase):
-
- def setUp(self):
- self.mut = base_packet_generator.BasePacketGenerator()
- pass
-
- def tearDown(self):
- pass
-
- def test_send_traffic_for_failure(self):
- self.assertRaises(NotImplementedError, self.mut.send_traffic)
diff --git a/yardstick/vTC/apexlake/tests/benchmark_base_class_test.py b/yardstick/vTC/apexlake/tests/benchmark_base_class_test.py
deleted file mode 100644
index 4e5eb9fb0..000000000
--- a/yardstick/vTC/apexlake/tests/benchmark_base_class_test.py
+++ /dev/null
@@ -1,86 +0,0 @@
-# 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 __future__ import absolute_import
-import unittest
-from experimental_framework.benchmarks import benchmark_base_class as base
-
-
-class DummyBechmarkBaseClass(base.BenchmarkBaseClass):
-
- def get_features(self):
- features = dict()
- features['description'] = '***'
- features['parameters'] = ['A', 'B']
- features['allowed_values'] = dict()
- features['allowed_values']['A'] = ['a']
- features['allowed_values']['B'] = ['b']
- features['default_values'] = dict()
- features['default_values']['A'] = 'a'
- features['default_values']['B'] = 'b'
- return features
-
-
-class TestBenchmarkBaseClass(unittest.TestCase):
-
- def setUp(self):
- self.mut = base.BenchmarkBaseClass('name', dict())
-
- def test_constructor_for_success(self):
- name = 'name'
- params = dict()
- params['A'] = 'a'
- params['B'] = 'b'
- params['C'] = 'c'
- bench_base = DummyBechmarkBaseClass(name, params)
- self.assertEqual(name, bench_base.name)
- self.assertIn('A', list(bench_base.params.keys()))
- self.assertIn('B', list(bench_base.params.keys()))
- self.assertEqual('a', bench_base.params['A'])
- self.assertEqual('b', bench_base.params['B'])
-
- params = dict()
- params['A'] = 'a'
- # params['B'] = 'b'
- bench_base = DummyBechmarkBaseClass(name, params)
- # self.assertEqual(name, bench_base.name)
- # self.assertIn('A', bench_base.params.keys())
- # self.assertIn('B', bench_base.params.keys())
- # self.assertEqual('a', bench_base.params['A'])
- # self.assertEqual('b', bench_base.params['B'])
-
- def test_constructor_for_failure(self):
- name = 'name'
- params = 'params'
- self.assertRaises(ValueError, DummyBechmarkBaseClass, name, params)
-
- def test_constructor_for_failure_2(self):
- name = 'name'
- params = dict()
- params['A'] = 'a'
- params['B'] = '*'
- self.assertRaises(ValueError, DummyBechmarkBaseClass, name, params)
-
- def test_init_for_failure(self):
- self.assertRaises(NotImplementedError, self.mut.init)
-
- def test_finalize_for_failure(self):
- self.assertRaises(NotImplementedError, self.mut.finalize)
-
- def test_run_for_failure(self):
- self.assertRaises(NotImplementedError, self.mut.run)
-
- def test_get_name_for_success(self):
- self.assertEqual(self.mut.get_name(), 'name')
diff --git a/yardstick/vTC/apexlake/tests/benchmarking_unit_test.py b/yardstick/vTC/apexlake/tests/benchmarking_unit_test.py
deleted file mode 100644
index 7b33ba693..000000000
--- a/yardstick/vTC/apexlake/tests/benchmarking_unit_test.py
+++ /dev/null
@@ -1,481 +0,0 @@
-# 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 __future__ import absolute_import
-import os
-import unittest
-import mock
-
-from experimental_framework import APEX_LAKE_ROOT
-from experimental_framework.benchmarking_unit import BenchmarkingUnit
-# from experimental_framework.data_manager import DataManager
-from experimental_framework.deployment_unit import DeploymentUnit
-import experimental_framework.common as common
-from experimental_framework.benchmarks.rfc2544_throughput_benchmark import \
- RFC2544ThroughputBenchmark
-
-__author__ = 'vmriccox'
-
-
-# class DummyDataManager(DataManager):
-#
-# def __init__(self, experiment_directory):
-# self.experiment_directory = experiment_directory
-# self.experiments = dict()
-# self.new_exp_counter = 0
-# self.add_bench_counter = 0
-# self.close_experiment_1_counter = 0
-# self.close_experiment_2_counter = 0
-# self.generate_csv_counter = 0
-#
-# def create_new_experiment(self, experiment_name, get_counter=None):
-# if not get_counter:
-# self.new_exp_counter += 1
-# else:
-# return self.new_exp_counter
-#
-# def add_benchmark(self, experiment_name, benchmark_name, get_counter=None):
-# if not get_counter:
-# self.add_bench_counter += 1
-# else:
-# return self.add_bench_counter
-#
-# def close_experiment(self, experiment, get_counter=None):
-# if get_counter:
-# return [self.close_experiment_1_counter,
-# self.close_experiment_2_counter]
-# if experiment == 'VTC_base_single_vm_wait_1':
-# self.close_experiment_1_counter += 1
-# if experiment == 'VTC_base_single_vm_wait_2':
-# self.close_experiment_2_counter += 1
-#
-# def generate_result_csv_file(self, get_counter=None):
-# if get_counter:
-# return self.generate_csv_counter
-# else:
-# self.generate_csv_counter += 1
-#
-# def add_metadata(self, experiment_name, metadata):
-# pass
-#
-# def add_configuration(self, experiment_name, configuration):
-# pass
-#
-# def add_data_points(self, experiment_name, benchmark_name, result):
-# pass
-
-
-class Dummy_2544(RFC2544ThroughputBenchmark):
-
- def __init__(self, name, params):
- self.name = name
- self.init_counter = 0
- self.finalize_counter = 0
- self.run_counter = 0
- self.params = params
-
- def init(self, get_counter=None):
- if get_counter:
- return self.init_counter
- else:
- self.init_counter += 1
-
- def finalize(self, get_counter=None):
- if get_counter:
- return self.finalize_counter
- else:
- self.finalize_counter += 1
-
- def run(self, get_counter=None):
- if get_counter:
- return self.run_counter
- else:
- self.run_counter += 1
- return {'throughput': 10}
-
-
-class DummyDeploymentUnit(DeploymentUnit):
-
- def __init__(self, openstack_credentials):
- pass
-
- def deploy_heat_template(self, template_file, stack_name, parameters,
- attempt=0):
- return False
-
-
-class TestBenchmarkingUnit(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- @mock.patch('time.time')
- @mock.patch('experimental_framework.common.get_template_dir')
- # @mock.patch('experimental_framework.data_manager.DataManager',
- # side_effect=DummyDataManager)
- @mock.patch('experimental_framework.deployment_unit.DeploymentUnit')
- @mock.patch('experimental_framework.benchmarking_unit.heat.'
- 'get_all_heat_templates')
- def test___init__(self, mock_heat, mock_dep_unit,
- # mock_data_manager,
- mock_temp_dir, mock_time):
- mock_heat.return_value = list()
- mock_time.return_value = '12345'
- mock_temp_dir.return_value = 'tests/data/results/'
- common.TEMPLATE_FILE_EXTENSION = '.ext'
- common.RESULT_DIR = 'tests/data/results/'
- heat_template_name = 'name'
- openstack_credentials = {
- 'name': 'aaa',
- 'surname': 'bbb'
- }
- heat_template_parameters = {
- 'param_1': 'name_1',
- 'param_2': 'name_2'
- }
- iterations = 1
- benchmarks = ['bench_1', 'bench_2']
- bu = BenchmarkingUnit(heat_template_name,
- openstack_credentials,
- heat_template_parameters,
- iterations,
- benchmarks)
- self.assertEqual(bu.required_benchmarks, benchmarks)
- bu.heat_template_parameters = heat_template_parameters
- # mock_data_manager.assert_called_once_with('tests/data/results/12345')
- mock_dep_unit.assert_called_once_with(openstack_credentials)
- mock_heat.assert_called_once_with('tests/data/results/', '.ext')
-
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark', side_effect=Dummy_2544)
- @mock.patch('time.time')
- @mock.patch('experimental_framework.common.get_template_dir')
- # @mock.patch('experimental_framework.data_manager.DataManager',
- # side_effect=DummyDataManager)
- @mock.patch('experimental_framework.deployment_unit.DeploymentUnit')
- @mock.patch('experimental_framework.benchmarking_unit.'
- 'heat.get_all_heat_templates')
- def test_initialize_for_success(self, mock_heat, mock_dep_unit,
- # mock_data_manager,
- mock_temp_dir,
- mock_time, mock_rfc2544):
- mock_heat.return_value = list()
- mock_time.return_value = '12345'
- mock_temp_dir.return_value = 'tests/data/test_templates/'
- common.TEMPLATE_FILE_EXTENSION = '.yaml'
- common.RESULT_DIR = 'tests/data/results/'
-
- heat_template_name = 'VTC_base_single_vm_wait_'
- openstack_credentials = {
- 'name': 'aaa',
- 'surname': 'bbb'
- }
- heat_template_parameters = {
- 'param_1': 'name_1',
- 'param_2': 'name_2'
- }
- iterations = 1
- benchmarks = [
- {
- 'name':
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark',
- 'params': dict()
- }
- ]
- bu = BenchmarkingUnit(heat_template_name,
- openstack_credentials,
- heat_template_parameters,
- iterations,
- benchmarks)
- self.assertEqual(bu.required_benchmarks, benchmarks)
- bu.heat_template_parameters = heat_template_parameters
- bu.template_files = ['VTC_base_single_vm_wait_1.yaml',
- 'VTC_base_single_vm_wait_2.yaml']
- bu.initialize()
- self.assertTrue(len(bu.benchmarks) == 1)
- self.assertEqual(bu.benchmarks[0].__class__,
- Dummy_2544)
- # self.assertEqual(bu.data_manager.create_new_experiment('', True), 2)
- # self.assertEqual(bu.data_manager.add_benchmark('', '', True), 2)
-
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark', side_effect=Dummy_2544)
- @mock.patch('time.time')
- @mock.patch('experimental_framework.common.get_template_dir')
- # @mock.patch('experimental_framework.data_manager.DataManager',
- # side_effect=DummyDataManager)
- @mock.patch('experimental_framework.deployment_unit.DeploymentUnit')
- @mock.patch('experimental_framework.benchmarking_unit.'
- 'heat.get_all_heat_templates')
- def test_finalize_for_success(
- self, mock_heat, mock_dep_unit,
- # mock_data_manager,
- mock_temp_dir, mock_time, mock_rfc2544):
- mock_heat.return_value = list()
- mock_time.return_value = '12345'
- mock_temp_dir.return_value = 'tests/data/test_templates/'
- common.TEMPLATE_FILE_EXTENSION = '.yaml'
- common.RESULT_DIR = 'tests/data/results/'
-
- heat_template_name = 'VTC_base_single_vm_wait_'
- openstack_credentials = {
- 'name': 'aaa',
- 'surname': 'bbb'
- }
- heat_template_parameters = {
- 'param_1': 'name_1',
- 'param_2': 'name_2'
- }
- iterations = 1
- benchmarks = [
- {
- 'name':
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark',
- 'params': dict()
- }
- ]
- bu = BenchmarkingUnit(heat_template_name,
- openstack_credentials,
- heat_template_parameters,
- iterations,
- benchmarks)
- bu.heat_template_parameters = heat_template_parameters
- bu.template_files = ['VTC_base_single_vm_wait_1.yaml',
- 'VTC_base_single_vm_wait_2.yaml']
- bu.finalize()
- # self.assertEqual(bu.data_manager.close_experiment('', True), [1, 1])
- # self.assertEqual(bu.data_manager.generate_result_csv_file(True), 1)
-
- @mock.patch('experimental_framework.common.push_data_influxdb')
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark', side_effect=Dummy_2544)
- @mock.patch('time.time')
- @mock.patch('experimental_framework.common.get_template_dir')
- # @mock.patch('experimental_framework.data_manager.DataManager',
- # side_effect=DummyDataManager)
- @mock.patch('experimental_framework.common.DEPLOYMENT_UNIT')
- @mock.patch('experimental_framework.deployment_unit.DeploymentUnit')
- @mock.patch('experimental_framework.benchmarking_unit.'
- 'heat.get_all_heat_templates')
- def test_run_benchmarks_for_success(self, mock_heat, mock_common_dep_unit,
- mock_dep_unit,
- # mock_data_manager,
- mock_temp_dir, mock_time,
- mock_rfc2544, mock_log, mock_influx):
- mock_heat.return_value = list()
- mock_time.return_value = '12345'
- mock_temp_dir.return_value = os.path.join(APEX_LAKE_ROOT,
- 'tests/data/test_templates/')
- common.TEMPLATE_FILE_EXTENSION = '.yaml'
- common.RESULT_DIR = 'tests/data/results/'
- common.INFLUXDB_IP = 'InfluxIP'
- common.INFLUXDB_PORT = '8086'
- common.INFLUXDB_DB_NAME = 'test_db'
-
- heat_template_name = 'VTC_base_single_vm_wait_'
- openstack_credentials = {
- 'name': 'aaa',
- 'surname': 'bbb'
- }
- heat_template_parameters = {
- 'param_1': 'name_1',
- 'param_2': 'name_2'
- }
- iterations = 1
- benchmarks = [
- {
- 'name':
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark',
- 'params': dict()
- }
- ]
- bu = BenchmarkingUnit(heat_template_name,
- openstack_credentials,
- heat_template_parameters,
- iterations,
- benchmarks)
- # bu.data_manager = DummyDataManager('tests/data/results/12345')
- bu.template_files = ['VTC_base_single_vm_wait_1.yaml',
- 'VTC_base_single_vm_wait_2.yaml']
- bu.benchmarks = [Dummy_2544('dummy', {'param1': 'val1'})]
- bu.run_benchmarks()
- self.assertEqual(bu.benchmarks[0].init(True), 2)
- self.assertEqual(bu.benchmarks[0].finalize(True), 2)
- self.assertEqual(bu.benchmarks[0].run(True), 2)
- # expected_metric = \
- # 'throughput,vnic_type=direct,ram=1024,benchmark=dummy,' \
- # 'vcpus=2,experiment_name=VTC_base_single_vm_wait_2,' \
- # 'param1=val1 value=10 12345000000000'
- # mock_influx.assert_called_with(expected_metric)
-
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark', side_effect=Dummy_2544)
- @mock.patch('time.time')
- @mock.patch('experimental_framework.common.get_template_dir')
- # @mock.patch('experimental_framework.data_manager.DataManager',
- # side_effect=DummyDataManager)
- @mock.patch('experimental_framework.common.DEPLOYMENT_UNIT')
- @mock.patch('experimental_framework.deployment_unit.DeploymentUnit')
- @mock.patch('experimental_framework.benchmarking_unit.'
- 'heat.get_all_heat_templates')
- def test_run_benchmarks_2_for_success(
- self, mock_heat, mock_common_dep_unit, mock_dep_unit,
- # mock_data_manager,
- mock_temp_dir, mock_time, mock_rfc2544,
- mock_log):
- mock_heat.return_value = list()
- mock_time.return_value = '12345'
- mock_temp_dir.return_value = os.path.join(APEX_LAKE_ROOT,
- 'tests/data/test_templates/')
- common.TEMPLATE_FILE_EXTENSION = '.yaml'
- common.RESULT_DIR = 'tests/data/results/'
-
- heat_template_name = 'VTC_base_single_vm_wait_'
- openstack_credentials = {
- 'name': 'aaa',
- 'surname': 'bbb'
- }
- heat_template_parameters = {
- 'param_1': 'name_1',
- 'param_2': 'name_2'
- }
- iterations = 1
- benchmarks = [
- {
- 'name':
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark',
- 'params': dict()
- }
- ]
- bu = BenchmarkingUnit(heat_template_name,
- openstack_credentials,
- heat_template_parameters,
- iterations,
- benchmarks)
- # bu.data_manager = DummyDataManager('tests/data/results/12345')
- bu.template_files = ['VTC_base_single_vm_wait_1.yaml',
- 'VTC_base_single_vm_wait_2.yaml']
- bu.benchmarks = [Dummy_2544('dummy', dict())]
- common.DEPLOYMENT_UNIT = DummyDeploymentUnit(dict())
- bu.run_benchmarks()
- self.assertEqual(bu.benchmarks[0].init(True), 2)
- self.assertEqual(bu.benchmarks[0].finalize(True), 0)
- self.assertEqual(bu.benchmarks[0].run(True), 0)
-
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark', side_effect=Dummy_2544)
- @mock.patch('time.time')
- @mock.patch('experimental_framework.common.get_template_dir')
- # @mock.patch('experimental_framework.data_manager.DataManager',
- # side_effect=DummyDataManager)
- @mock.patch('experimental_framework.common.DEPLOYMENT_UNIT')
- @mock.patch('experimental_framework.deployment_unit.DeploymentUnit')
- @mock.patch('experimental_framework.benchmarking_unit.'
- 'heat.get_all_heat_templates')
- def test_get_benchmark_name_for_success(
- self, mock_heat, mock_common_dep_unit, mock_dep_unit,
- # mock_data_manager,
- mock_temp_dir, mock_time, mock_rfc2544,
- mock_log):
- mock_heat.return_value = list()
- mock_time.return_value = '12345'
- mock_temp_dir.return_value = 'tests/data/test_templates/'
- common.TEMPLATE_FILE_EXTENSION = '.yaml'
- common.RESULT_DIR = 'tests/data/results/'
-
- heat_template_name = 'VTC_base_single_vm_wait_'
- openstack_credentials = {
- 'name': 'aaa',
- 'surname': 'bbb'
- }
- heat_template_parameters = {
- 'param_1': 'name_1',
- 'param_2': 'name_2'
- }
- iterations = 1
- benchmarks = [
- {
- 'name':
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark',
- 'params': dict()
- }
- ]
- bu = BenchmarkingUnit(heat_template_name,
- openstack_credentials,
- heat_template_parameters,
- iterations,
- benchmarks)
-
- expected = 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark_0'
- output = bu.get_benchmark_name(
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark')
- self.assertEqual(expected, output)
-
- expected = 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark_1'
- output = bu.get_benchmark_name(
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark')
- self.assertEqual(expected, output)
-
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark', side_effect=Dummy_2544)
- @mock.patch('time.time')
- @mock.patch('experimental_framework.common.get_template_dir')
- # @mock.patch('experimental_framework.data_manager.DataManager',
- # side_effect=DummyDataManager)
- @mock.patch('experimental_framework.common.DEPLOYMENT_UNIT')
- @mock.patch('experimental_framework.deployment_unit.DeploymentUnit')
- @mock.patch('experimental_framework.benchmarking_unit.'
- 'heat.get_all_heat_templates')
- def test_get_required_benchmarks_for_success(
- self, mock_heat, mock_common_dep_unit, mock_dep_unit,
- # mock_data_manager,
- mock_temp_dir, mock_time, mock_rfc2544,
- mock_log):
- mock_heat.return_value = list()
- mock_time.return_value = '12345'
- mock_temp_dir.return_value = 'tests/data/test_templates/'
- common.TEMPLATE_FILE_EXTENSION = '.yaml'
- common.RESULT_DIR = 'tests/data/results/'
- openstack_credentials = {
- 'name': 'aaa',
- 'surname': 'bbb'
- }
- heat_template_parameters = {
- 'param_1': 'name_1',
- 'param_2': 'name_2'
- }
- iterations = 1
- benchmarks = [
- {
- 'name':
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark',
- 'params': dict()
- }
- ]
- bu = BenchmarkingUnit('',
- openstack_credentials,
- heat_template_parameters,
- iterations,
- benchmarks)
- req_benchs = \
- ['rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark']
- output = bu.get_required_benchmarks(req_benchs)
- self.assertEqual(len(req_benchs), 1)
- self.assertEqual(output[0].__class__, Dummy_2544)
diff --git a/yardstick/vTC/apexlake/tests/common_test.py b/yardstick/vTC/apexlake/tests/common_test.py
deleted file mode 100644
index b8dbfe6b8..000000000
--- a/yardstick/vTC/apexlake/tests/common_test.py
+++ /dev/null
@@ -1,665 +0,0 @@
-# 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 __future__ import absolute_import
-import unittest
-import mock
-import os
-import logging
-import six.moves.configparser
-import experimental_framework.common as common
-import experimental_framework.constants.conf_file_sections as cf
-from experimental_framework import APEX_LAKE_ROOT
-
-__author__ = 'vmricco'
-
-
-def reset_common():
- common.LOG = None
- common.CONF_FILE = None
- common.DEPLOYMENT_UNIT = None
- common.ITERATIONS = None
- common.BASE_DIR = None
- common.RESULT_DIR = None
- common.TEMPLATE_DIR = None
- common.TEMPLATE_NAME = None
- common.TEMPLATE_FILE_EXTENSION = None
- common.PKTGEN = None
- common.PKTGEN_DIR = None
- common.PKTGEN_DPDK_DIRECTORY = None
- common.PKTGEN_PROGRAM = None
- common.PKTGEN_COREMASK = None
- common.PKTGEN_MEMCHANNEL = None
- common.PKTGEN_BUS_SLOT_NIC_1 = None
- common.PKTGEN_BUS_SLOT_NIC_2 = None
- common.INFLUXDB_IP = None
- common.INFLUXDB_PORT = None
- common.INFLUXDB_DB_NAME = None
-
-
-class DummyConfigurationFile(common.ConfigurationFile):
-
- def __init__(self, sections, conf_file=''):
- pass
-
- def get_variable(self, section, variable_name):
- return 'vTC.yaml'
-
- def get_variable_list(self, section):
- return ['template_base_name']
-
-
-class DummyConfigurationFile2(common.ConfigurationFile):
-
- def __init__(self, sections):
- self.pktgen_counter = 0
-
- def get_variable(self, section, variable_name):
- if variable_name == cf.CFSG_TEMPLATE_NAME:
- return 'vTC.yaml'
- if variable_name == cf.CFSG_ITERATIONS:
- return '2'
- if variable_name == cf.CFSG_DEBUG:
- return 'True'
- if variable_name == cf.CFSP_PACKET_GENERATOR:
- if self.pktgen_counter == 1:
- return 'non_supported'
- self.pktgen_counter += 1
- return 'dpdk_pktgen'
- if variable_name == cf.CFSP_DPDK_PKTGEN_DIRECTORY:
- return APEX_LAKE_ROOT
- if variable_name == cf.CFSP_DPDK_PROGRAM_NAME:
- return 'program'
- if variable_name == cf.CFSP_DPDK_COREMASK:
- return 'coremask'
- if variable_name == cf.CFSP_DPDK_MEMORY_CHANNEL:
- return 'memchannel'
- if variable_name == cf.CFSP_DPDK_BUS_SLOT_NIC_1:
- return 'bus_slot_nic_1'
- if variable_name == cf.CFSP_DPDK_BUS_SLOT_NIC_2:
- return 'bus_slot_nic_2'
- if variable_name == cf.CFSP_DPDK_DPDK_DIRECTORY:
- return APEX_LAKE_ROOT
-
- def get_variable_list(self, section):
- if section == cf.CFS_PKTGEN:
- return [
- cf.CFSP_DPDK_NAME_IF_2,
- cf.CFSP_DPDK_NAME_IF_1,
- cf.CFSP_DPDK_BUS_SLOT_NIC_1,
- cf.CFSP_DPDK_BUS_SLOT_NIC_2,
- cf.CFSP_DPDK_COREMASK,
- cf.CFSP_DPDK_DPDK_DIRECTORY,
- cf.CFSP_DPDK_PKTGEN_DIRECTORY,
- cf.CFSP_DPDK_MEMORY_CHANNEL,
- cf.CFSP_DPDK_PROGRAM_NAME,
- cf.CFSP_PACKET_GENERATOR
- ]
- else:
- return [
- 'template_base_name',
- 'iterations',
- cf.CFSG_DEBUG
- ]
-
-
-class TestCommonInit(unittest.TestCase):
-
- def setUp(self):
- common.CONF_FILE = DummyConfigurationFile('')
- self.dir = os.path.join(APEX_LAKE_ROOT, 'experimental_framework/')
-
- def tearDown(self):
- reset_common()
- # common.CONF_FILE = None
-
- @mock.patch('os.getcwd')
- @mock.patch('experimental_framework.common.init_conf_file')
- @mock.patch('experimental_framework.common.init_general_vars')
- @mock.patch('experimental_framework.common.init_log')
- @mock.patch('experimental_framework.common.init_pktgen')
- @mock.patch('experimental_framework.common.CONF_FILE')
- def test_init_for_success(self, mock_conf_file, init_pkgen, init_log,
- init_general_vars, init_conf_file, mock_getcwd):
- mock_getcwd.return_value = self.dir
- common.init(True)
- if common.CONF_FILE.get_variable_list(cf.CFS_PKTGEN):
- init_pkgen.assert_called_once()
- init_conf_file.assert_called_once()
- init_general_vars.assert_called_once()
- init_log.assert_called_once()
- expected = self.dir.split('experimental_framework/')[0]
- self.assertEqual(common.BASE_DIR, expected)
-
- @mock.patch('experimental_framework.common.InputValidation')
- @mock.patch('os.path.exists')
- @mock.patch('os.makedirs')
- @mock.patch('experimental_framework.common.LOG')
- def test_init_general_vars_for_success(self, mock_log, mock_makedirs,
- mock_path_exists, mock_val_file):
- common.BASE_DIR = APEX_LAKE_ROOT
- mock_path_exists.return_value = False
- mock_val_file.return_value = True
- common.init_general_vars()
- self.assertEqual(common.TEMPLATE_FILE_EXTENSION, '.yaml')
- self.assertEqual(common.TEMPLATE_DIR, '/tmp/apexlake/heat_templates/')
- self.assertEqual(common.TEMPLATE_NAME, 'vTC.yaml')
- self.assertEqual(common.RESULT_DIR, '/tmp/apexlake/results/')
- self.assertEqual(common.ITERATIONS, 1)
- # mock_makedirs.assert_called_once_with('/tmp/apexlake/heat_templates/')
-
-
-class TestCommonInit2(unittest.TestCase):
-
- def setUp(self):
- common.CONF_FILE = DummyConfigurationFile2('')
- self.dir = os.path.join(APEX_LAKE_ROOT, 'experimental_framework')
-
- def tearDown(self):
- reset_common()
- common.CONF_FILE = None
-
- @mock.patch('experimental_framework.common.InputValidation')
- @mock.patch('os.path.exists')
- @mock.patch('os.makedirs')
- @mock.patch('experimental_framework.common.LOG')
- def test_init_general_vars_2_for_success(self, mock_log, mock_makedirs,
- mock_path_exists, mock_val_file):
- common.BASE_DIR = APEX_LAKE_ROOT
- common.init_general_vars()
- self.assertEqual(common.TEMPLATE_FILE_EXTENSION, '.yaml')
- self.assertEqual(common.TEMPLATE_DIR, '/tmp/apexlake/heat_templates/')
- self.assertEqual(common.TEMPLATE_NAME, 'vTC.yaml')
- self.assertEqual(common.RESULT_DIR, '/tmp/apexlake/results/')
- self.assertEqual(common.ITERATIONS, 2)
-
- def test_init_log_2_for_success(self):
- common.init_log()
- self.assertIsInstance(common.LOG, logging.RootLogger)
-
- def test_init_pktgen_for_success(self):
- common.init_pktgen()
- self.assertEqual(common.PKTGEN, 'dpdk_pktgen')
- directory = self.dir.split('experimental_framework')[0]
- self.assertEqual(common.PKTGEN_DIR, directory)
- self.assertEqual(common.PKTGEN_PROGRAM, 'program')
- self.assertEqual(common.PKTGEN_COREMASK, 'coremask')
- self.assertEqual(common.PKTGEN_MEMCHANNEL, 'memchannel')
- self.assertEqual(common.PKTGEN_BUS_SLOT_NIC_1, 'bus_slot_nic_1')
- self.assertEqual(common.PKTGEN_BUS_SLOT_NIC_2, 'bus_slot_nic_2')
- # we always add '/' to end of dirs for some reason
- # probably because we aren't using os.path.join everywhere
- expected_dir = APEX_LAKE_ROOT + '/'
- self.assertEqual(common.PKTGEN_DPDK_DIRECTORY, expected_dir)
-
- def test_init_pktgen_for_failure(self):
- common.CONF_FILE.get_variable('', cf.CFSP_PACKET_GENERATOR)
- self.assertRaises(ValueError, common.init_pktgen)
-
-
-class TestConfFileInitialization(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- reset_common()
-
- @mock.patch('experimental_framework.common.ConfigurationFile',
- side_effect=DummyConfigurationFile)
- def test_init_conf_file_for_success(self, conf_file):
- common.CONF_FILE = None
- common.init_conf_file(False)
- self.assertIsInstance(common.CONF_FILE,
- DummyConfigurationFile)
-
- common.CONF_FILE = None
- common.init_conf_file(True)
- self.assertIsInstance(common.CONF_FILE,
- DummyConfigurationFile)
-
- @mock.patch('experimental_framework.common.CONF_FILE')
- def test_init_log_for_success(self, mock_conf_file):
- mock_conf_file.get_variable_list.return_value = 'value'
- common.init_log()
- self.assertIsInstance(common.LOG, logging.RootLogger)
-
- @mock.patch('experimental_framework.common.CONF_FILE')
- def test_init_influxdb_for_success(self, mock_conf_file):
- mock_conf_file.get_variable.return_value = 'value'
- common.init_influxdb()
- self.assertEqual(common.INFLUXDB_IP, 'value')
- self.assertEqual(common.INFLUXDB_PORT, 'value')
- self.assertEqual(common.INFLUXDB_DB_NAME, 'value')
-
-
-class DummyConfigurationFile3(common.ConfigurationFile):
- counter = 0
-
- def __init__(self, sections, config_file='conf.cfg'):
- common.ConfigurationFile.__init__(self, sections, config_file)
-
- @staticmethod
- def _config_section_map(section, config_file, get_counter=None):
- if get_counter:
- return DummyConfigurationFile3.counter
- else:
- DummyConfigurationFile3.counter += 1
- return dict()
-
-
-class TestConfigFileClass(unittest.TestCase):
-
- def setUp(self):
- self.sections = [
- 'General',
- 'OpenStack',
- 'Experiment-VNF',
- 'PacketGen',
- 'Deployment-parameters',
- 'Testcase-parameters'
- ]
- c_file = os.path.join(APEX_LAKE_ROOT, 'tests/data/common/conf.cfg')
- common.BASE_DIR = APEX_LAKE_ROOT
- self.conf_file = common.ConfigurationFile(self.sections, c_file)
-
- def tearDown(self):
- reset_common()
- common.BASE_DIR = None
-
- @mock.patch('experimental_framework.common.ConfigurationFile.'
- '_config_section_map',
- side_effect=DummyConfigurationFile3._config_section_map)
- def test___init___for_success(self, mock_conf_map):
- sections = ['General', 'OpenStack', 'Experiment-VNF', 'PacketGen',
- 'Deployment-parameters', 'Testcase-parameters']
- c = DummyConfigurationFile3(
- sections, config_file=os.path.join(APEX_LAKE_ROOT,
- 'tests/data/common/conf.cfg'))
- self.assertEqual(
- DummyConfigurationFile3._config_section_map('', '', True),
- 6)
- for section in sections:
- self.assertEqual(getattr(c, section), dict())
-
- def test__config_section_map_for_success(self):
- general_section = 'General'
- # openstack_section = 'OpenStack'
- config_file = os.path.join(APEX_LAKE_ROOT,
- 'tests/data/common/conf.cfg')
- config = six.moves.configparser.ConfigParser()
- config.read(config_file)
-
- expected = {
- 'benchmarks': 'b_marks',
- 'iterations': '1',
- 'template_base_name': 't_name'
- }
- output = common.\
- ConfigurationFile._config_section_map(general_section, config)
- self.assertEqual(expected, output)
-
- @mock.patch('experimental_framework.common.'
- 'ConfigurationFile.get_variable_list')
- def test_get_variable_for_success(self, mock_get_var_list):
- section = self.sections[0]
- variable_name = 'template_base_name'
- expected = 't_name'
- mock_get_var_list.return_value = [variable_name]
- output = self.conf_file.get_variable(section, variable_name)
- self.assertEqual(expected, output)
-
- @mock.patch('experimental_framework.common.'
- 'ConfigurationFile.get_variable_list')
- def test_get_variable_for_failure(self, mock_get_var_list):
- section = self.sections[0]
- variable_name = 'something_else'
- self.assertRaises(
- ValueError,
- self.conf_file.get_variable,
- section, variable_name
- )
-
- def test_get_variable_list_for_success(self):
- section = self.sections[0]
- expected = {
- 'benchmarks': 'b_marks',
- 'iterations': '1',
- 'template_base_name': 't_name'
- }
- output = self.conf_file.get_variable_list(section)
- self.assertEqual(expected, output)
-
- def test_get_variable_list_for_failure(self):
- section = 'something_else'
- self.assertRaises(
- ValueError,
- self.conf_file.get_variable_list,
- section)
-
-
-class DummyConfigurationFile4(common.ConfigurationFile):
-
- def get_variable(self, section, variable_name):
- if variable_name == 'vnic2_type':
- return '"value"'
- elif variable_name == cf.CFSG_BENCHMARKS:
- return "BenchmarkClass1, BenchmarkClass2"
- return '@string "value"'
-
- # def get_variable_list(self, section):
- # return list()
-
-
-class TestCommonMethods(unittest.TestCase):
-
- def setUp(self):
- self.sections = [
- 'General',
- 'OpenStack',
- 'Experiment-VNF',
- 'PacketGen',
- 'Deployment-parameters',
- 'Testcase-parameters'
- ]
- config_file = os.path.join(APEX_LAKE_ROOT,
- 'tests/data/common/conf.cfg')
- common.BASE_DIR = APEX_LAKE_ROOT
- common.CONF_FILE = DummyConfigurationFile4(self.sections, config_file)
-
- def tearDown(self):
- reset_common()
- common.CONF_FILE = None
-
- def test_get_credentials_for_success(self):
- expected = {
- 'ip_controller': '@string "value"',
- 'project': '@string "value"',
- 'auth_uri': '@string "value"',
- 'user': '@string "value"',
- 'heat_url': '@string "value"',
- 'password': '@string "value"'
- }
- output = common.get_credentials()
- self.assertEqual(expected, output)
-
- def test_get_heat_template_params_for_success(self):
- expected = {
- 'param_1': '@string "value"',
- 'param_2': '@string "value"',
- 'param_3': '@string "value"',
- 'param_4': '@string "value"'
- }
- output = common.get_heat_template_params()
- self.assertEqual(expected, output)
-
- def test_get_testcase_params_for_success(self):
- expected = {'test_case_param': '@string "value"'}
- output = common.get_testcase_params()
- self.assertEqual(expected, output)
-
- def test_get_file_first_line_for_success(self):
- file = os.path.join(APEX_LAKE_ROOT, 'tests/data/common/conf.cfg')
- expected = '[General]\n'
- output = common.get_file_first_line(file)
- self.assertEqual(expected, output)
-
- def test_replace_in_file_for_success(self):
- filename = os.path.join(APEX_LAKE_ROOT,
- 'tests/data/common/file_replacement.txt')
- text_to_search = 'replacement of'
- text_to_replace = '***'
- common.replace_in_file(filename, text_to_search, text_to_replace)
- after = open(filename, 'r').readline()
- self.assertEqual(after, 'Test for the *** strings into a file\n')
- text_to_search = '***'
- text_to_replace = 'replacement of'
- common.replace_in_file(filename, text_to_search, text_to_replace)
-
- @mock.patch('os.system')
- @mock.patch('experimental_framework.common.LOG')
- def test_run_command_for_success(self, mock_log, mock_os_system):
- command = 'command to be run'
- common.run_command(command)
- mock_os_system.assert_called_once_with(command)
-
- @mock.patch('experimental_framework.common.run_command')
- def test_push_data_influxdb_for_success(self, mock_run_cmd):
- data = 'string that describes the data'
- expected = "curl -i -XPOST 'http://None:None/write?db=None' " \
- "--data-binary string that describes the data"
- common.push_data_influxdb(data)
- mock_run_cmd.assert_called_once_with(expected)
-
- def test_get_base_dir_for_success(self):
- base_dir = common.BASE_DIR
- common.BASE_DIR = 'base_dir'
- expected = 'base_dir'
- output = common.get_base_dir()
- self.assertEqual(expected, output)
- common.BASE_DIR = base_dir
-
- def test_get_template_dir_for_success(self):
- template_dir = common.TEMPLATE_DIR
- common.TEMPLATE_DIR = 'base_dir'
- expected = 'base_dir'
- output = common.get_template_dir()
- self.assertEqual(expected, output)
- common.TEMPLATE_DIR = template_dir
-
- def test_get_dpdk_pktgen_vars_test(self):
- # Test 1
- common.PKTGEN = 'dpdk_pktgen'
- common.PKTGEN_DIR = 'var'
- common.PKTGEN_PROGRAM = 'var'
- common.PKTGEN_COREMASK = 'var'
- common.PKTGEN_MEMCHANNEL = 'var'
- common.PKTGEN_BUS_SLOT_NIC_1 = 'var'
- common.PKTGEN_BUS_SLOT_NIC_2 = 'var'
- common.PKTGEN_NAME_NIC_1 = 'var'
- common.PKTGEN_NAME_NIC_2 = 'var'
- common.PKTGEN_DPDK_DIRECTORY = 'var'
- expected = {
- 'bus_slot_nic_1': 'var',
- 'bus_slot_nic_2': 'var',
- 'name_if_1': 'var',
- 'name_if_2': 'var',
- 'coremask': 'var',
- 'dpdk_directory': 'var',
- 'memory_channels': 'var',
- 'pktgen_directory': 'var',
- 'program_name': 'var'
- }
- output = common.get_dpdk_pktgen_vars()
- self.assertEqual(expected, output)
-
- # Test 2
- common.PKTGEN = 'something_else'
- common.PKTGEN_DIR = 'var'
- common.PKTGEN_PROGRAM = 'var'
- common.PKTGEN_COREMASK = 'var'
- common.PKTGEN_MEMCHANNEL = 'var'
- common.PKTGEN_BUS_SLOT_NIC_1 = 'var'
- common.PKTGEN_BUS_SLOT_NIC_2 = 'var'
- common.PKTGEN_DPDK_DIRECTORY = 'var'
- expected = {}
- output = common.get_dpdk_pktgen_vars()
- self.assertEqual(expected, output)
-
- @mock.patch('experimental_framework.common.LOG')
- def test_get_deployment_configuration_variables_for_success(self,
- mock_log):
- expected = {
- 'vcpu': ['value'],
- 'vnic1_type': ['value'],
- 'ram': ['value'],
- 'vnic2_type': ['value']
- }
- output = common.get_deployment_configuration_variables_from_conf_file()
- self.assertEqual(expected, output)
-
- def test_get_benchmarks_from_conf_file_for_success(self):
- expected = ['BenchmarkClass1', 'BenchmarkClass2']
- output = common.get_benchmarks_from_conf_file()
- self.assertEqual(expected, output)
-
-
-class TestinputValidation(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- reset_common()
-
- def test_validate_string_for_success(self):
- output = common.InputValidation.validate_string('string', '')
- self.assertTrue(output)
-
- def test_validate_string_for_failure(self):
- self.assertRaises(
- ValueError,
- common.InputValidation.validate_string,
- list(), ''
- )
-
- def test_validate_int_for_success(self):
- output = common.InputValidation.validate_integer(1111, '')
- self.assertTrue(output)
-
- def test_validate_int_for_failure(self):
- self.assertRaises(
- ValueError,
- common.InputValidation.validate_integer,
- list(), ''
- )
-
- def test_validate_dict_for_success(self):
- output = common.InputValidation.validate_dictionary(dict(), '')
- self.assertTrue(output)
-
- def test_validate_dict_for_failure(self):
- self.assertRaises(
- ValueError,
- common.InputValidation.validate_dictionary,
- list(), ''
- )
-
- def test_validate_directory_exist_and_format_for_success(self):
- directory = os.path.join(APEX_LAKE_ROOT, 'tests/data/common/')
- output = common.InputValidation.\
- validate_directory_exist_and_format(directory, '')
- self.assertTrue(output)
-
- def test_validate_directory_exist_and_format_for_failure(self):
- directory = os.path.join(APEX_LAKE_ROOT, 'tests/data/com/')
- self.assertRaises(
- ValueError,
- common.InputValidation.validate_directory_exist_and_format,
- directory, ''
- )
-
- @mock.patch('experimental_framework.common.CONF_FILE')
- def test_validate_configuration_file_parameter_for_success(self,
- mock_conf):
- mock_conf.get_variable_list.return_value = ['param']
- section = ''
- parameter = 'param'
- message = ''
- output = common.InputValidation.\
- validate_configuration_file_parameter(section, parameter, message)
- self.assertTrue(output)
-
- @mock.patch('experimental_framework.common.CONF_FILE')
- def test_validate_configuration_file_parameter_for_failure(
- self, mock_conf_file):
- section = ''
- parameter = 'something_else'
- message = ''
- mock_conf_file.get_variable_list.return_value(['parameter'])
- self.assertRaises(
- ValueError,
- common.InputValidation.
- validate_configuration_file_parameter,
- section, parameter, message
- )
-
- def test_validate_configuration_file_section_for_success(self):
- section = 'General'
- message = ''
- output = common.InputValidation.\
- validate_configuration_file_section(section, message)
- self.assertTrue(output)
-
- def test_validate_configuration_file_section_for_failure(self):
- section = 'Something-Else'
- message = ''
- self.assertRaises(
- ValueError,
- common.InputValidation.validate_configuration_file_section,
- section, message
- )
-
- def test_validate_boolean_for_success(self):
- message = ''
- boolean = True
- output = common.InputValidation.validate_boolean(boolean, message)
- self.assertTrue(output)
-
- boolean = 'True'
- output = common.InputValidation.validate_boolean(boolean, message)
- self.assertTrue(output)
-
- boolean = 'False'
- output = common.InputValidation.validate_boolean(boolean, message)
- self.assertFalse(output)
-
- def test_validate_boolean_for_failure(self):
- message = ''
- boolean = 'string'
- self.assertRaises(
- ValueError,
- common.InputValidation.validate_boolean,
- boolean, message
- )
-
- def test_validate_os_credentials_for_failure(self):
- # Test 1
- credentials = list()
- self.assertRaises(ValueError,
- common.InputValidation.validate_os_credentials,
- credentials)
-
- # Test 2
- credentials = dict()
- credentials['ip_controller'] = ''
- credentials['heat_url'] = ''
- credentials['user'] = ''
- credentials['password'] = ''
- credentials['auth_uri'] = ''
- # credentials['project'] = ''
- self.assertRaises(ValueError,
- common.InputValidation.validate_os_credentials,
- credentials)
-
- def test_validate_os_credentials_for_success(self):
- credentials = dict()
- credentials['ip_controller'] = ''
- credentials['heat_url'] = ''
- credentials['user'] = ''
- credentials['password'] = ''
- credentials['auth_uri'] = ''
- credentials['project'] = ''
- self.assertTrue(
- common.InputValidation.validate_os_credentials(credentials))
diff --git a/yardstick/vTC/apexlake/tests/conf_file_sections_test.py b/yardstick/vTC/apexlake/tests/conf_file_sections_test.py
deleted file mode 100644
index abf4134a5..000000000
--- a/yardstick/vTC/apexlake/tests/conf_file_sections_test.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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 __future__ import absolute_import
-import unittest
-from experimental_framework.constants import conf_file_sections as cfs
-
-__author__ = 'vmriccox'
-
-
-class TestConfFileSection(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def test_get_sections_api_for_success(self):
- expected = ['PacketGen', 'General', 'InfluxDB', 'OpenStack']
- output = cfs.get_sections_api()
- self.assertEqual(expected, output)
diff --git a/yardstick/vTC/apexlake/tests/data/common/conf.cfg b/yardstick/vTC/apexlake/tests/data/common/conf.cfg
deleted file mode 100644
index 9266647e8..000000000
--- a/yardstick/vTC/apexlake/tests/data/common/conf.cfg
+++ /dev/null
@@ -1,43 +0,0 @@
-[General]
-template_base_name = t_name
-benchmarks = b_marks
-iterations = 1
-
-[OpenStack]
-ip_controller =
-heat_url =
-user =
-password =
-auth_uri =
-project =
-
-
-[Experiment-VNF]
-VNIC1_TYPE = @string "normal" "direct" @costs '0', '1'
-VNIC2_TYPE = @string "normal", "direct" @costs '0', '1'
-VCPU = @numeric "4"
-RAM = @numeric "4096"
-
-
-[PacketGen]
-packet_generator = dpdk_pktgen
-pktgen_directory = pktgen_dir
-dpdk_directory = dpdk_dir
-program_name = app/app/x86_64-native-linuxapp-gcc/pktgen
-coremask = 1f
-memory_channels = 3
-bus_slot_nic_1 = 01:00.0
-name_if_1 = enp1s0f0
-bus_slot_nic_2 = 01:00.1
-name_if_2 = enp1s0f2
-
-
-[Deployment-parameters]
-param_1 = val_1
-param_2 = val_2
-param_3 = val_3
-param_4 = val_4
-
-
-[Testcase-parameters]
-test_case_param = 1280
diff --git a/yardstick/vTC/apexlake/tests/data/common/file_replacement.txt b/yardstick/vTC/apexlake/tests/data/common/file_replacement.txt
deleted file mode 100644
index 8122d9a91..000000000
--- a/yardstick/vTC/apexlake/tests/data/common/file_replacement.txt
+++ /dev/null
@@ -1 +0,0 @@
-Test for the replacement of strings into a file
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait.tmp b/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait.tmp
deleted file mode 100644
index aa3959fc1..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait.tmp
+++ /dev/null
@@ -1,199 +0,0 @@
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: #vnic_type
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: #vnic_type
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: #ram
- vcpus: #vcpus
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs: \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_1.yaml b/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_1.yaml
deleted file mode 100644
index 20fcb6718..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_1.yaml
+++ /dev/null
@@ -1,212 +0,0 @@
-# Copyright (c) 2016-2017 Intel Corporation
-#
-# 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.
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: 1024
- vcpus: 2
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs:
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_1.yaml.json b/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_1.yaml.json
deleted file mode 100644
index 3af9a1cc7..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_1.yaml.json
+++ /dev/null
@@ -1 +0,0 @@
-{"vnic_type": "normal", "ram": "1024", "vcpus": "2"} \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_2.yaml b/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_2.yaml
deleted file mode 100644
index 493d81b7a..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_2.yaml
+++ /dev/null
@@ -1,212 +0,0 @@
-# Copyright (c) 2016-2017 Intel Corporation
-#
-# 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.
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: direct
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: direct
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: 1024
- vcpus: 2
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs:
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_2.yaml.json b/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_2.yaml.json
deleted file mode 100644
index 9f246891d..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_2.yaml.json
+++ /dev/null
@@ -1 +0,0 @@
-{"vnic_type": "direct", "ram": "1024", "vcpus": "2"} \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml b/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml
deleted file mode 100644
index 5788980b0..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml
+++ /dev/null
@@ -1,199 +0,0 @@
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: 1024
- vcpus: 2
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs:
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml.json b/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml.json
deleted file mode 100644
index 44a8aeb2e..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml.json
+++ /dev/null
@@ -1 +0,0 @@
-{"ram": "1024", "vcpus": "2", "vnic_type": "normal"} \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml b/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml
deleted file mode 100644
index 44a81d081..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml
+++ /dev/null
@@ -1,199 +0,0 @@
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: direct
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: direct
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: 1024
- vcpus: 2
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs:
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml.json b/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml.json
deleted file mode 100644
index 0a66448b7..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml.json
+++ /dev/null
@@ -1 +0,0 @@
-{"ram": "1024", "vcpus": "2", "vnic_type": "direct"} \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/vTC.yaml b/yardstick/vTC/apexlake/tests/data/generated_templates/vTC.yaml
deleted file mode 100644
index 39dc095c1..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/vTC.yaml
+++ /dev/null
@@ -1,207 +0,0 @@
-##############################################################################
-# Copyright (c) 2016-2017 Intel Corporation
-#
-# 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
-##############################################################################
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: #vnic_type
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: #vnic_type
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: #ram
- vcpus: #vcpus
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs: \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/test_experiments/experiment_1/benchmark_1.csv b/yardstick/vTC/apexlake/tests/data/test_experiments/experiment_1/benchmark_1.csv
deleted file mode 100644
index f5f2932d0..000000000
--- a/yardstick/vTC/apexlake/tests/data/test_experiments/experiment_1/benchmark_1.csv
+++ /dev/null
@@ -1,3 +0,0 @@
-conf_1;conf_3;conf_2;point_4;point_5;point_6;point_1;point_2;point_3
-conf_value_1;conf_value_3;conf_value_2;?;?;?;value_1;value_2;value_3
-conf_value_1;conf_value_3;conf_value_2;value_4;value_5;value_6;?;?;?
diff --git a/yardstick/vTC/apexlake/tests/data/test_experiments/experiment_1/metadata.json b/yardstick/vTC/apexlake/tests/data/test_experiments/experiment_1/metadata.json
deleted file mode 100644
index ff4cebf41..000000000
--- a/yardstick/vTC/apexlake/tests/data/test_experiments/experiment_1/metadata.json
+++ /dev/null
@@ -1 +0,0 @@
-{"location": "tests/data/experiments/experiment_1/metadata.json", "item_2": "value_2", "item_3": "value_3", "item_1": "value_1"} \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/test_experiments/results_benchmark_1.csv b/yardstick/vTC/apexlake/tests/data/test_experiments/results_benchmark_1.csv
deleted file mode 100644
index 4662dd2be..000000000
--- a/yardstick/vTC/apexlake/tests/data/test_experiments/results_benchmark_1.csv
+++ /dev/null
@@ -1,5 +0,0 @@
-conf_5;conf_4;conf_6;conf_1;conf_3;conf_2;point_12;point_10;point_11;point_4;point_5;point_6;point_8;point_9;point_7;point_1;point_2;point_3
-?;?;?;conf_value_1;conf_value_3;conf_value_2;?;?;?;?;?;?;?;?;?;value_1;value_2;value_3
-?;?;?;conf_value_1;conf_value_3;conf_value_2;?;?;?;value_4;value_5;value_6;?;?;?;?;?;?
-conf_value_5;conf_value_4;conf_value_6;?;?;?;?;?;?;?;?;?;value_8;value_9;value_7;?;?;?
-conf_value_5;conf_value_4;conf_value_6;?;?;?;value_12;value_10;value_11;?;?;?;?;?;?;?;?;?
diff --git a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait.tmp b/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait.tmp
deleted file mode 100644
index aa3959fc1..000000000
--- a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait.tmp
+++ /dev/null
@@ -1,199 +0,0 @@
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: #vnic_type
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: #vnic_type
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: #ram
- vcpus: #vcpus
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs: \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_1.yaml b/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_1.yaml
deleted file mode 100644
index 20fcb6718..000000000
--- a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_1.yaml
+++ /dev/null
@@ -1,212 +0,0 @@
-# Copyright (c) 2016-2017 Intel Corporation
-#
-# 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.
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: 1024
- vcpus: 2
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs:
diff --git a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_1.yaml.json b/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_1.yaml.json
deleted file mode 100644
index 3af9a1cc7..000000000
--- a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_1.yaml.json
+++ /dev/null
@@ -1 +0,0 @@
-{"vnic_type": "normal", "ram": "1024", "vcpus": "2"} \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_2.yaml b/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_2.yaml
deleted file mode 100644
index 493d81b7a..000000000
--- a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_2.yaml
+++ /dev/null
@@ -1,212 +0,0 @@
-# Copyright (c) 2016-2017 Intel Corporation
-#
-# 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.
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: direct
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: direct
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: 1024
- vcpus: 2
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs:
diff --git a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_2.yaml.json b/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_2.yaml.json
deleted file mode 100644
index 9f246891d..000000000
--- a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_2.yaml.json
+++ /dev/null
@@ -1 +0,0 @@
-{"vnic_type": "direct", "ram": "1024", "vcpus": "2"} \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/deployment_unit_test.py b/yardstick/vTC/apexlake/tests/deployment_unit_test.py
deleted file mode 100644
index 1ff4225d6..000000000
--- a/yardstick/vTC/apexlake/tests/deployment_unit_test.py
+++ /dev/null
@@ -1,279 +0,0 @@
-# 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 __future__ import absolute_import
-import unittest
-import logging
-import mock
-import experimental_framework.deployment_unit as mut
-import experimental_framework.common as common
-
-__author__ = 'vmriccox'
-
-
-class DummyHeatManager:
-
- def __init__(self, param):
- self.counts = 0
- pass
-
- def validate_heat_template(self, template_file):
- return True
-
- def check_stack_status(self, stack_name):
- # return 'CREATE_COMPLETE'
- self.counts += 1
- if self.counts >= 3:
- return 'CREATE_COMPLETE'
- else:
- return 'CREATE_IN_PROGRESS'
-
- def delete_stack(self, stack_name):
- pass
-
-
-class DummyHeatManagerFailed(DummyHeatManager):
-
- def check_stack_status(self, stack_name):
- return 'CREATE_FAILED'
-
- def create_stack(self, template_file, stack_name, parameters):
- pass
-
-
-class DummyHeatManagerComplete(DummyHeatManager):
-
- def check_stack_status(self, stack_name):
- return 'CREATE_COMPLETE'
-
- def create_stack(self, template_file, stack_name, parameters):
- raise Exception()
-
-
-class DummyHeatManagerFailedException(DummyHeatManagerFailed):
-
- def create_stack(self, template_file, stack_name, parameters):
- raise Exception
-
- def check_stack_status(self, stack_name):
- return ''
-
-
-class DummyHeatManagerDestroy:
-
- def __init__(self, credentials):
- self.delete_stack_counter = 0
- self.check_stack_status_counter = 0
-
- def check_stack_status(self, stack_name):
- if self.check_stack_status_counter < 2:
- self.check_stack_status_counter += 1
- return 'DELETE_IN_PROGRESS'
- else:
- return 'DELETE_COMPLETE'
-
- def create_stack(self, template_file, stack_name, parameters):
- pass
-
- def delete_stack(self, stack_name=None):
- if stack_name == 'stack':
- self.delete_stack_counter += 1
- else:
- return self.delete_stack_counter
-
- def is_stack_deployed(self, stack_name):
- return True
-
-
-class DummyHeatManagerDestroyException(DummyHeatManagerDestroy):
-
- def delete_stack(self, stack_name=None):
- raise Exception
-
-
-class DummyHeatManagerReiteration:
-
- def __init__(self, param):
- self.counts = 0
-
- def validate_heat_template(self, template_file):
- return True
-
- def check_stack_status(self, stack_name):
- return 'CREATE_FAILED'
-
- def delete_stack(self, stack_name):
- pass
-
- def create_stack(self, template_file=None, stack_name=None,
- parameters=None):
- if template_file == 'template_reiteration' and \
- stack_name == 'stack_reiteration' and \
- parameters == 'parameters_reiteration':
- self.counts += 1
-
-
-class DummyDeploymentUnit(mut.DeploymentUnit):
-
- def destroy_heat_template(self, stack_name):
- raise Exception
-
-
-@mock.patch("experimental_framework.deployment_unit.time")
-class TestDeploymentUnit(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManager)
- def test_constructor_for_sanity(self, mock_heat_manager, mock_time):
- du = mut.DeploymentUnit(dict())
- self.assertTrue(isinstance(du.heat_manager, DummyHeatManager))
- mock_heat_manager.assert_called_once_with(dict())
- self.assertEqual(du.deployed_stacks, list())
-
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManager)
- @mock.patch('os.path.isfile')
- def test_deploy_heat_template_for_failure(self, mock_os_is_file,
- mock_heat_manager, mock_time):
- mock_os_is_file.return_value = False
- du = mut.DeploymentUnit(dict())
- template_file = ''
- stack_name = ''
- parameters = ''
- self.assertRaises(ValueError, du.deploy_heat_template, template_file,
- stack_name, parameters, 0)
-
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManager)
- @mock.patch('os.path.isfile')
- def test_deploy_heat_template_for_success(self, mock_os_is_file,
- mock_heat_manager, mock_time):
- mock_os_is_file.return_value = True
- du = mut.DeploymentUnit(dict())
- template_file = ''
- stack_name = ''
- parameters = ''
- common.LOG = logging.getLogger()
- output = du.deploy_heat_template(template_file, stack_name,
- parameters, 0)
- self.assertEqual(output, True)
-
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManagerComplete)
- @mock.patch('os.path.isfile')
- def test_deploy_heat_template_2_for_success(self, mock_os_is_file,
- mock_heat_manager, mock_time):
- mock_os_is_file.return_value = True
- du = mut.DeploymentUnit(dict())
- template_file = ''
- stack_name = ''
- parameters = ''
- common.LOG = logging.getLogger()
- output = du.deploy_heat_template(template_file, stack_name,
- parameters, 0)
- self.assertEqual(output, True)
-
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManagerComplete)
- @mock.patch('os.path.isfile')
- @mock.patch('experimental_framework.deployment_unit.DeploymentUnit',
- side_effect=DummyDeploymentUnit)
- def test_deploy_heat_template_3_for_success(self, mock_dep_unit,
- mock_os_is_file,
- mock_heat_manager, mock_time):
- mock_os_is_file.return_value = True
- du = mut.DeploymentUnit(dict())
- template_file = ''
- stack_name = ''
- parameters = ''
- common.LOG = logging.getLogger()
- output = du.deploy_heat_template(template_file, stack_name,
- parameters, 0)
- self.assertEqual(output, True)
-
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManagerFailed)
- @mock.patch('os.path.isfile')
- def test_deploy_heat_template_for_success_2(self, mock_os_is_file,
- mock_heat_manager, mock_log, mock_time):
- mock_os_is_file.return_value = True
- du = DummyDeploymentUnit(dict())
- template_file = ''
- stack_name = ''
- parameters = ''
- output = du.deploy_heat_template(template_file, stack_name,
- parameters, 0)
- self.assertEqual(output, False)
-
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManagerDestroy)
- @mock.patch('experimental_framework.common.LOG')
- def test_destroy_heat_template_for_success(self, mock_log,
- mock_heat_manager, mock_time):
- openstack_credentials = dict()
- du = mut.DeploymentUnit(openstack_credentials)
- du.deployed_stacks = ['stack']
- stack_name = 'stack'
- self.assertTrue(du.destroy_heat_template(stack_name))
- self.assertEqual(du.heat_manager.delete_stack(None), 1)
-
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManagerDestroyException)
- @mock.patch('experimental_framework.common.LOG')
- def test_destroy_heat_template_for_success_2(self, mock_log,
- mock_heat_manager, mock_time):
- openstack_credentials = dict()
- du = mut.DeploymentUnit(openstack_credentials)
- du.deployed_stacks = ['stack']
- stack_name = 'stack'
- self.assertFalse(du.destroy_heat_template(stack_name))
-
- def test_destroy_all_deployed_stacks_for_success(self, mock_time):
- du = DeploymentUnitDestroy()
- du.destroy_all_deployed_stacks()
- self.assertTrue(du.destroy_heat_template())
-
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManagerReiteration)
- @mock.patch('os.path.isfile')
- def test_deploy_heat_template_for_success_3(self, mock_os_is_file,
- mock_heat_manager, mock_time):
- mock_os_is_file.return_value = True
- du = mut.DeploymentUnit(dict())
- template = 'template_reiteration'
- stack = 'stack_reiteration'
- parameters = 'parameters_reiteration'
- output = du.deploy_heat_template(template, stack, parameters, 0)
- self.assertFalse(output)
- self.assertEqual(du.heat_manager.counts, 4)
-
-
-class DeploymentUnitDestroy(mut.DeploymentUnit):
-
- def __init__(self):
- self.deployed_stacks = ['stack']
- self.heat_manager = DummyHeatManagerDestroy(dict())
- self.destroy_all_deployed_stacks_called_correctly = False
-
- def destroy_heat_template(self, template_name=None):
- if template_name == 'stack':
- self.destroy_all_deployed_stacks_called_correctly = True
- return self.destroy_all_deployed_stacks_called_correctly
diff --git a/yardstick/vTC/apexlake/tests/dpdk_packet_generator_test.py b/yardstick/vTC/apexlake/tests/dpdk_packet_generator_test.py
deleted file mode 100644
index 9fa860ab4..000000000
--- a/yardstick/vTC/apexlake/tests/dpdk_packet_generator_test.py
+++ /dev/null
@@ -1,710 +0,0 @@
-# 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 __future__ import absolute_import
-import unittest
-import mock
-from experimental_framework.constants import conf_file_sections as conf_file
-
-
-from experimental_framework.packet_generators \
- import dpdk_packet_generator as mut
-
-
-def dummy_get_dpdk_pktgen_vars():
- vars = dict()
- vars[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'pktgen_dir/'
- vars[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program'
- vars[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- vars[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memchannel'
- return vars
-
-
-def dummy_get_base_dir():
- return 'base_dir/'
-
-
-def dummy_dirname(dir):
- if dir == 'pktgen_dir_test':
- return 'pktgen_dir'
- return 'test_directory'
-
-
-class MockChangeVlan():
-
- ret_val = [False, False]
-
- @staticmethod
- def mock_change_vlan(pcap_dir=None, pcap_file=None, vlan=None):
- if not pcap_file and not vlan:
- return MockChangeVlan.ret_val
-
- if pcap_dir == 'base_dir/experimental_framework/packet_generators/' \
- 'pcap_files/' and \
- pcap_file == 'pcap_file_1' and vlan == 'vlan0':
- MockChangeVlan.ret_val[0] = True
- if pcap_dir == 'base_dir/experimental_framework/packet_generators/' \
- 'pcap_files/' and \
- pcap_file == 'pcap_file_2' and vlan == 'vlan1':
- MockChangeVlan.ret_val[1] = True
- return False
-
-
-class TestDpdkPacketGenConstructor(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def test_constructor(self):
- obj = mut.DpdkPacketGenerator()
- self.assertEqual(obj.command, '')
- self.assertEqual(obj.directory, '')
- self.assertEqual(obj.dpdk_interfaces, -1)
-
-
-class TestDpdkPacketGenInitialization(unittest.TestCase):
-
- def setUp(self):
- self.mut = mut.DpdkPacketGenerator()
- pass
-
- def tearDown(self):
- pass
-
- @mock.patch('os.path')
- @mock.patch('experimental_framework.common.get_dpdk_pktgen_vars',
- side_effect=dummy_get_dpdk_pktgen_vars)
- @mock.patch('experimental_framework.common.get_base_dir',
- side_effect=dummy_get_base_dir)
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator._get_core_nics')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_init_input_validation')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator._change_vlan')
- def test_init_dpdk_pktgen_for_success(self, m_change_vlan,
- mock_init_input_validation,
- mock_get_core_nics,
- common_get_base_dir,
- common_get_dpdk_vars,
- mock_path):
- """
- Tests the initialization of the packet generator
- """
- mock_init_input_validation.return_value = None
- mock_get_core_nics.return_value = "{corenics}"
- mock_path.isfile.return_value = True
- expected = 'sudo pktgen_dir/program -c coremask -n memchannel ' \
- '--proc-type auto --file-prefix pg -- -T -P -m ' \
- '"{corenics}" -f base_dir/experimental_framework/' \
- 'packet_generators/dpdk_pktgen/lua_file ' \
- '-s 0:base_dir/experimental_framework/packet_generators' \
- '/pcap_files/pcap_file > /dev/null'
- self.mut.init_dpdk_pktgen(dpdk_interfaces=1, lua_script='lua_file',
- pcap_file_0='pcap_file', vlan_0='vlan0')
- self.assertEqual(expected, self.mut.command)
- m_change_vlan.assert_called_once_with('base_dir/'
- 'experimental_framework/'
- 'packet_generators/pcap_files/',
- 'pcap_file', 'vlan0')
-
- @mock.patch('os.path')
- @mock.patch('experimental_framework.common.get_dpdk_pktgen_vars',
- side_effect=dummy_get_dpdk_pktgen_vars)
- @mock.patch('experimental_framework.common.get_base_dir',
- side_effect=dummy_get_base_dir)
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator._get_core_nics')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_init_input_validation')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_change_vlan', side_effect=MockChangeVlan.mock_change_vlan)
- def test_init_dpdk_pktgen_2_for_success(self, m_change_vlan,
- mock_init_input_validation,
- mock_get_core_nics,
- common_get_base_dir,
- common_get_dpdk_vars, mock_path):
- """
- Tests the initialization of the packet generator
- :param common_get_base_dir: mock obj
- :param common_get_dpdk_vars: mock obj
- :param mock_path: mock obj
- :return: None
- """
- mock_init_input_validation.return_value = None
- mock_get_core_nics.return_value = "{corenics}"
- mock_path.isfile.return_value = True
- expected = 'sudo pktgen_dir/program -c coremask -n memchannel ' \
- '--proc-type auto --file-prefix pg -- -T -P -m ' \
- '"{corenics}" -f base_dir/experimental_framework/' \
- 'packet_generators/dpdk_pktgen/lua_file ' \
- '-s 0:base_dir/experimental_framework/packet_generators/' \
- 'pcap_files/pcap_file_1 ' \
- '-s 1:base_dir/experimental_framework/packet_generators/' \
- 'pcap_files/pcap_file_2 ' \
- '> /dev/null'
- self.mut.init_dpdk_pktgen(dpdk_interfaces=1, lua_script='lua_file',
- pcap_file_0='pcap_file_1',
- pcap_file_1='pcap_file_2', vlan_0='vlan0',
- vlan_1='vlan1')
- self.assertEqual(expected, self.mut.command)
- self.assertEqual(MockChangeVlan.mock_change_vlan(), [True, True])
-
- @mock.patch('os.path')
- @mock.patch('experimental_framework.common.get_dpdk_pktgen_vars',
- side_effect=dummy_get_dpdk_pktgen_vars)
- @mock.patch('experimental_framework.common.get_base_dir',
- side_effect=dummy_get_base_dir)
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator._get_core_nics')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_init_input_validation')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator._change_vlan')
- def test_init_dpdk_pktgen_for_failure(self, m_change_vlan,
- mock_init_input_validation,
- mock_get_core_nics,
- common_get_base_dir,
- common_get_dpdk_vars,
- mock_path):
- """
- Tests the initialization of the packet generator
- :param common_get_base_dir: mock obj
- :param common_get_dpdk_vars: mock obj
- :param mock_path: mock obj
- :return: None
- """
- mock_init_input_validation.return_value = None
- mock_get_core_nics.return_value = "{corenics}"
- self.assertRaises(ValueError, self.mut.init_dpdk_pktgen, 1,
- 'lua_file', 'pcap_file')
-
- @mock.patch('os.path')
- @mock.patch('experimental_framework.common.get_dpdk_pktgen_vars',
- side_effect=dummy_get_dpdk_pktgen_vars)
- @mock.patch('experimental_framework.common.get_base_dir',
- side_effect=dummy_get_base_dir)
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_get_core_nics')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_init_input_validation')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_change_vlan')
- def test_init_dpdk_pktgen_for_failure_2(self, m_change_vlan,
- mock_init_input_validation,
- mock_get_core_nics,
- common_get_base_dir,
- common_get_dpdk_vars,
- mock_path):
- """
- Tests the initialization of the packet generator
- :param common_get_base_dir: mock obj
- :param common_get_dpdk_vars: mock obj
- :param mock_path: mock obj
- :return: None
- """
- mock_init_input_validation.return_value = None
- mock_get_core_nics.return_value = "{corenics}"
- self.assertRaises(ValueError, self.mut.init_dpdk_pktgen, 2,
- 'lua_file_1', 'pcap_file_1', 'pcap_file_2',
- 'vlan_0')
-
-
-class DpdkPacketGeneratorDummy(mut.DpdkPacketGenerator):
-
- def __init__(self):
- self.directory = 'self_directory'
- self.dpdk_interfaces = 1
- self.command = 'command'
- self._count = 0
-
- chdir_test = [False, False]
-
- @staticmethod
- def _chdir(directory=None):
- if not directory:
- return DpdkPacketGeneratorDummy.chdir_test
- if directory == 'current_directory':
- DpdkPacketGeneratorDummy.chdir_test[0] = True
- # self._count += 1
- if directory == 'self_directory':
- DpdkPacketGeneratorDummy.chdir_test[1] = True
- # self._count += 1
- return DpdkPacketGeneratorDummy.chdir_test
-
-
-class TestDpdkPacketGenSendTraffic(unittest.TestCase):
-
- def setUp(self):
- self.mut = DpdkPacketGeneratorDummy()
-
- @mock.patch('os.system')
- @mock.patch('os.path')
- @mock.patch('os.path.dirname', side_effect=dummy_dirname)
- @mock.patch('experimental_framework.common.get_dpdk_pktgen_vars',
- side_effect=dummy_get_dpdk_pktgen_vars)
- @mock.patch('experimental_framework.common.get_base_dir',
- side_effect=dummy_get_base_dir)
- @mock.patch('experimental_framework.common.run_command')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator._get_core_nics')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_init_physical_nics')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_finalize_physical_nics')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator._chdir',
- side_effect=DpdkPacketGeneratorDummy._chdir)
- def test_send_traffic_for_success(self, mock_ch_dir,
- mock_finalize_physical_nics,
- mock_init_physical_nics,
- mock_get_core_nics,
- common_run_command,
- common_get_base_dir,
- common_get_dpdk_vars,
- mock_dir_name,
- mock_os_path,
- mock_os_system):
- """
- Calls the packet generator and starts to send traffic
- Blocking call
- """
- mock_get_core_nics.return_value = "{corenics}"
- mock_os_path.realpath.return_value = 'pktgen_dir_test'
- mock_os_path.dirname.return_value = 'current_directory'
- self.mut.send_traffic()
-
- self.assertEqual(DpdkPacketGeneratorDummy._chdir(), [True, True])
- mock_init_physical_nics.\
- assert_called_once_with(1, {'coremask': 'coremask',
- 'program_name': 'program',
- 'memory_channels': 'memchannel',
- 'pktgen_directory': 'pktgen_dir/'})
- mock_finalize_physical_nics.\
- assert_called_once_with(1, {'coremask': 'coremask',
- 'program_name': 'program',
- 'memory_channels': 'memchannel',
- 'pktgen_directory': 'pktgen_dir/'})
- common_run_command.assert_called_once_with('command')
-
-
-class MockRunCommand:
-
- ret_val = [False, False, False, False, False, False]
- ret_val_finalization = [False, False, False, False, False, False]
-
- @staticmethod
- def mock_run_command(command=None):
- if command == 'sudo ifconfig interface_1 down':
- MockRunCommand.ret_val[0] = True
- if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
- '--unbind 1:00.0':
- MockRunCommand.ret_val[1] = True
- if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
- '--bind=igb_uio 1:00.0':
- MockRunCommand.ret_val[2] = True
- if command == 'sudo ifconfig interface_2 down':
- MockRunCommand.ret_val[3] = True
- if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
- '--unbind 1:00.1':
- MockRunCommand.ret_val[4] = True
- if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
- '--bind=igb_uio 1:00.1':
- MockRunCommand.ret_val[5] = True
- else:
- return MockRunCommand.ret_val
-
- @staticmethod
- def mock_run_command_finalization(command=None):
- if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
- '--unbind 1:00.0':
- MockRunCommand.ret_val_finalization[0] = True
- if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
- '--bind=ixgbe 1:00.0':
- MockRunCommand.ret_val_finalization[1] = True
- if command == 'sudo ifconfig interface_1 up':
- MockRunCommand.ret_val_finalization[2] = True
- if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
- '--unbind 1:00.1':
- MockRunCommand.ret_val_finalization[3] = True
- if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
- '--bind=ixgbe 1:00.1':
- MockRunCommand.ret_val_finalization[4] = True
- if command == 'sudo ifconfig interface_2 up':
- MockRunCommand.ret_val_finalization[5] = True
- else:
- return MockRunCommand.ret_val_finalization
-
-
-@mock.patch('experimental_framework.packet_generators.dpdk_packet_generator.time')
-class TestDpdkPacketGenOthers(unittest.TestCase):
-
- def setUp(self):
- self.mut = mut.DpdkPacketGenerator()
-
- def tearDown(self):
- pass
-
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_cores_configuration')
- def test__get_core_nics_for_failure(self, mock_cores_configuration, mock_time):
- mock_cores_configuration.return_value = None
- self.assertRaises(ValueError, mut.DpdkPacketGenerator._get_core_nics,
- '', '')
-
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_cores_configuration')
- def test__get_core_nics_one_nic_for_success(self,
- mock_cores_configuration, mock_time):
- mock_cores_configuration.return_value = 'ret_val'
- expected = 'ret_val'
- output = mut.DpdkPacketGenerator._get_core_nics(1, 'coremask')
- self.assertEqual(expected, output)
- mock_cores_configuration.assert_called_once_with('coremask', 1, 2, 0)
-
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_cores_configuration')
- def test__get_core_nics_two_nics_for_success(self,
- mock_cores_configuration, mock_time):
- mock_cores_configuration.return_value = 'ret_val'
- expected = 'ret_val'
- output = mut.DpdkPacketGenerator._get_core_nics(2, 'coremask')
- self.assertEqual(expected, output)
- mock_cores_configuration.assert_called_once_with('coremask', 1, 2, 2)
-
- @mock.patch('os.path.isfile')
- def test__init_input_validation_for_success(self, mock_is_file, mock_time):
- mock_is_file.return_value = True
-
- pcap_file_0 = 'pcap_file_0'
- pcap_file_1 = 'pcap_file_1'
- lua_script = 'lua_script'
- pcap_directory = 'pcap_directory'
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- variables[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertEqual(mut.DpdkPacketGenerator._init_input_validation(
- pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory,
- variables), None)
-
- @mock.patch('os.path.isfile')
- def test__init_input_validation_for_failure(self, mock_is_file, mock_time):
- mock_is_file.return_value = True
-
- pcap_file_0 = 'pcap_file_0'
- pcap_file_1 = 'pcap_file_1'
- lua_script = 'lua_script'
- pcap_directory = 'pcap_directory'
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- # variables[common.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator.
- _init_input_validation, pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory, variables)
-
- @mock.patch('os.path.isfile')
- def test__init_input_validation_for_failure_2(self, mock_is_file, mock_time):
- mock_is_file.return_value = True
-
- pcap_directory = None
- pcap_file_0 = 'pcap_file_0'
- pcap_file_1 = 'pcap_file_1'
- lua_script = 'lua_script'
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- variables[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator.
- _init_input_validation, pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory, variables)
-
- @mock.patch('os.path.isfile')
- def test__init_input_validation_for_failure_3(self, mock_is_file, mock_time):
- mock_is_file.return_value = True
-
- pcap_directory = 'directory'
- pcap_file_0 = None
- pcap_file_1 = 'pcap_file_1'
- lua_script = 'lua_script'
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- variables[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator.
- _init_input_validation, pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory, variables)
-
- @mock.patch('os.path.isfile')
- def test__init_input_validation_for_failure_4(self, mock_is_file, mock_time):
- mock_is_file.return_value = True
-
- pcap_directory = 'directory'
- pcap_file_0 = 'pcap_file_0'
- pcap_file_1 = None
- lua_script = 'lua_script'
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- variables[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator.
- _init_input_validation, pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory, variables)
-
- @mock.patch('os.path.isfile')
- def test__init_input_validation_for_failure_5(self, mock_is_file, mock_time):
- mock_is_file.return_value = True
-
- pcap_directory = 'directory'
- pcap_file_0 = 'pcap_file_0'
- pcap_file_1 = 'pcap_file_1'
- lua_script = None
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- variables[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator.
- _init_input_validation, pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory, variables)
-
- @mock.patch('os.path.isfile', side_effect=[False])
- def test__init_input_validation_for_failure_6(self, mock_is_file, mock_time):
- # mock_is_file.return_value = False
-
- pcap_directory = 'directory'
- pcap_file_0 = 'pcap_file_0'
- pcap_file_1 = 'pcap_file_1'
- lua_script = 'lua_script'
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- variables[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator.
- _init_input_validation, pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory, variables)
-
- @mock.patch('os.path.isfile', side_effect=[True, False])
- def test__init_input_validation_for_failure_7(self, mock_is_file, mock_time):
- pcap_directory = 'directory'
- pcap_file_0 = 'pcap_file_0'
- pcap_file_1 = 'pcap_file_1'
- lua_script = 'lua_script'
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- variables[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator.
- _init_input_validation, pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory, variables)
-
- @mock.patch('os.path.isfile', side_effect=[True, True, False])
- def test__init_input_validation_for_failure_8(self, mock_is_file, mock_time):
- pcap_directory = 'directory'
- pcap_file_0 = 'pcap_file_0'
- pcap_file_1 = 'pcap_file_1'
- lua_script = 'lua_script'
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- variables[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator.
- _init_input_validation, pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory, variables)
-
- @mock.patch('os.chdir')
- def test__chdir_for_success(self, mock_os_chdir, mock_time):
- mut.DpdkPacketGenerator._chdir('directory')
- mock_os_chdir.assert_called_once_with('directory')
-
- @mock.patch('experimental_framework.common.run_command',
- side_effect=MockRunCommand.mock_run_command)
- def test__init_physical_nics_for_success(self, mock_run_command, mock_time):
- dpdk_interfaces = 1
- dpdk_vars = dict()
-
- dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] = 'dpdk_directory/'
- dpdk_vars[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'pktgen_directory/'
- dpdk_vars[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- dpdk_vars[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- dpdk_vars[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1] = '1:00.0'
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2] = '1:00.1'
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_1] = 'interface_1'
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_2] = 'interface_2'
- self.mut._init_physical_nics(dpdk_interfaces, dpdk_vars)
- self.assertEqual(MockRunCommand.mock_run_command(),
- [True, True, True, False, False, False])
-
- @mock.patch('experimental_framework.common.run_command',
- side_effect=MockRunCommand.mock_run_command)
- def test__init_physical_nics_for_success_2(self, mock_run_command, mock_time):
- dpdk_interfaces = 2
- dpdk_vars = dict()
-
- dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] = 'dpdk_directory/'
- dpdk_vars[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'pktgen_directory/'
- dpdk_vars[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- dpdk_vars[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- dpdk_vars[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1] = '1:00.0'
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2] = '1:00.1'
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_1] = 'interface_1'
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_2] = 'interface_2'
- self.mut._init_physical_nics(dpdk_interfaces, dpdk_vars)
- self.assertEqual(MockRunCommand.mock_run_command(),
- [True, True, True, True, True, True])
-
- @mock.patch('experimental_framework.common.run_command')
- def test__init_physical_nics_for_failure(self, mock_run_command, mock_time):
- dpdk_interfaces = 3
- dpdk_vars = dict()
- self.assertRaises(ValueError, self.mut._init_physical_nics,
- dpdk_interfaces, dpdk_vars)
-
- @mock.patch('experimental_framework.common.run_command',
- side_effect=MockRunCommand.mock_run_command_finalization)
- def test__finalize_physical_nics_for_success(self, mock_run_command, mock_time):
- dpdk_interfaces = 1
- dpdk_vars = dict()
- dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] = 'dpdk_directory/'
- dpdk_vars[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'pktgen_directory/'
- dpdk_vars[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- dpdk_vars[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- dpdk_vars[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1] = '1:00.0'
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2] = '1:00.1'
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_1] = 'interface_1'
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_2] = 'interface_2'
- self.mut._finalize_physical_nics(dpdk_interfaces, dpdk_vars)
- self.assertEqual(MockRunCommand.mock_run_command_finalization(),
- [True, True, True, False, False, False])
-
- @mock.patch('experimental_framework.common.run_command',
- side_effect=MockRunCommand.mock_run_command_finalization)
- def test__finalize_physical_nics_for_success_2(self, mock_run_command, mock_time):
- dpdk_interfaces = 2
- dpdk_vars = dict()
- dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] = 'dpdk_directory/'
- dpdk_vars[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'pktgen_directory/'
- dpdk_vars[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- dpdk_vars[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- dpdk_vars[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1] = '1:00.0'
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2] = '1:00.1'
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_1] = 'interface_1'
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_2] = 'interface_2'
- self.mut._finalize_physical_nics(dpdk_interfaces, dpdk_vars)
- self.assertEqual(MockRunCommand.mock_run_command_finalization(),
- [True, True, True, True, True, True])
-
- def test__finalize_physical_nics_for_failure(self, mock_time):
- dpdk_interfaces = 0
- dpdk_vars = dict()
- self.assertRaises(ValueError, self.mut._finalize_physical_nics,
- dpdk_interfaces, dpdk_vars)
-
- def test__cores_configuration_for_success(self, mock_time):
- coremask = '1f'
- expected = '[2:1].0,[4:3].1'
- output = mut.DpdkPacketGenerator._cores_configuration(coremask,
- 1, 2, 2)
- self.assertEqual(expected, output)
-
- def test__cores_configuration_for_success_2(self, mock_time):
- coremask = '1f'
- expected = '2.0,[4:3].1'
- output = mut.DpdkPacketGenerator._cores_configuration(coremask,
- 1, 1, 2)
- self.assertEqual(expected, output)
-
- def test__cores_configuration_for_success_3(self, mock_time):
- coremask = '1f'
- expected = '[3:2].0,4.1'
- output = mut.DpdkPacketGenerator._cores_configuration(coremask,
- 1, 2, 1)
- self.assertEqual(expected, output)
-
- def test__cores_configuration_for_failure(self, mock_time):
- coremask = '1'
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator._cores_configuration,
- coremask, 1, 2, 2)
-
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.common.run_command')
- def test__change_vlan_for_success(self, mock_run_command, mock_log, mock_time):
- mut.DpdkPacketGenerator._change_vlan('/directory/', 'pcap_file', '10')
- expected_param = '/directory/vlan_tag.sh /directory/pcap_file 10'
- mock_run_command.assert_called_with(expected_param)
diff --git a/yardstick/vTC/apexlake/tests/generates_template_test.py b/yardstick/vTC/apexlake/tests/generates_template_test.py
deleted file mode 100644
index cc3e1bf6e..000000000
--- a/yardstick/vTC/apexlake/tests/generates_template_test.py
+++ /dev/null
@@ -1,102 +0,0 @@
-# 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 __future__ import absolute_import
-import unittest
-import experimental_framework.heat_template_generation as heat_gen
-import mock
-import os
-import experimental_framework.common as common
-from experimental_framework import APEX_LAKE_ROOT
-
-__author__ = 'gpetralx'
-
-
-def reset_common():
- common.LOG = None
- common.CONF_FILE = None
- common.DEPLOYMENT_UNIT = None
- common.ITERATIONS = None
- common.BASE_DIR = None
- common.RESULT_DIR = None
- common.TEMPLATE_DIR = None
- common.TEMPLATE_NAME = None
- common.TEMPLATE_FILE_EXTENSION = None
- common.PKTGEN = None
- common.PKTGEN_DIR = None
- common.PKTGEN_DPDK_DIRECTORY = None
- common.PKTGEN_PROGRAM = None
- common.PKTGEN_COREMASK = None
- common.PKTGEN_MEMCHANNEL = None
- common.PKTGEN_BUS_SLOT_NIC_1 = None
- common.PKTGEN_BUS_SLOT_NIC_2 = None
- common.INFLUXDB_IP = None
- common.INFLUXDB_PORT = None
- common.INFLUXDB_DB_NAME = None
-
-
-class TestGeneratesTemplate(unittest.TestCase):
-
- def setUp(self):
- self.deployment_configuration = {
- 'vnic_type': ['normal', 'direct'],
- 'ram': ['1024'],
- 'vcpus': ['2']
- }
- self.template_name = 'VTC_base_single_vm_wait.tmp'
- # common.init()
-
- def tearDown(self):
- reset_common()
-
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.common.get_template_dir')
- def test_generates_template_for_success(self, mock_template_dir,
- mock_log):
- generated_templates_dir = os.path.join(
- APEX_LAKE_ROOT, 'tests/data/generated_templates/')
- mock_template_dir.return_value = generated_templates_dir
- test_templates = os.path.join(APEX_LAKE_ROOT,
- 'tests/data/test_templates/')
- heat_gen.generates_templates(self.template_name,
- self.deployment_configuration)
- for dirname, dirnames, filenames in os.walk(test_templates):
- for filename in filenames:
- with open(test_templates + filename) as test:
- with open(generated_templates_dir + filename) as generated:
- self.assertListEqual(test.readlines(),
- generated.readlines())
-
- self.template_name = os.path.join(
- APEX_LAKE_ROOT,
- 'tests/data/generated_templates/VTC_base_single_vm_wait.tmp')
- heat_gen.generates_templates(self.template_name,
- self.deployment_configuration)
- for dirname, dirnames, filenames in os.walk(test_templates):
- for filename in filenames:
- with open(test_templates + filename) as test:
- with open(generated_templates_dir + filename) as generated:
- self.assertListEqual(test.readlines(),
- generated.readlines())
-
- @mock.patch('experimental_framework.common.get_template_dir')
- def test_get_all_heat_templates_for_success(self, template_dir):
- generated_templates = os.path.join(APEX_LAKE_ROOT,
- 'tests/data/generated_templates/')
- template_dir.return_value = generated_templates
- extension = '.yaml'
- expected = ['experiment_1.yaml', 'experiment_2.yaml']
- result = heat_gen.get_all_heat_templates(generated_templates,
- extension)
- self.assertListEqual(expected, result)
diff --git a/yardstick/vTC/apexlake/tests/heat_manager_test.py b/yardstick/vTC/apexlake/tests/heat_manager_test.py
deleted file mode 100644
index 58bd75560..000000000
--- a/yardstick/vTC/apexlake/tests/heat_manager_test.py
+++ /dev/null
@@ -1,235 +0,0 @@
-# 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 __future__ import print_function
-
-from __future__ import absolute_import
-import os
-import unittest
-import logging
-import experimental_framework.common as common
-
-from experimental_framework import heat_manager, APEX_LAKE_ROOT
-import mock
-
-__author__ = 'gpetralx'
-
-
-def get_mock_heat(version, *args, **kwargs):
- return MockHeat()
-
-
-class MockStacks(object):
-
- def __init__(self, stacks):
- self.stacks = stacks
-
- def list(self):
- list_name = list()
- for stack in self.stacks:
- list_name.append(stack.stack_name)
- print(list_name)
- return self.stacks
-
- def validate(self, template=None):
- return False
-
- def delete(self, id):
- for stack in self.stacks:
- if stack.id == id:
- return self.stacks.remove(stack)
-
- def create(self, stack_name=None, files=None, template=None,
- parameters=None):
- print(stack_name)
- self.stacks.append(MockStack(stack_name))
-
-
-class MockStacks_2(object):
-
- def __init__(self, stacks):
- self.stacks = stacks
-
- def list(self):
- raise Exception
-
-
-class MockStack(object):
-
- def __init__(self, stack_name):
- self.name = stack_name
-
- @property
- def stack_status(self):
- return self.stack_name + '_status'
-
- @property
- def stack_name(self):
- return self.name
-
- @property
- def id(self):
- return self.name
-
- def __eq__(self, other):
- return self.name == other
-
-
-class MockHeat(object):
-
- def __init__(self):
- stacks = [MockStack('stack_1'), MockStack('stack_2')]
- self.stacks_list = MockStacks(stacks)
-
- @property
- def stacks(self):
- return self.stacks_list
-
-
-class MockHeat_2(MockHeat):
-
- def __init__(self):
- stacks = [MockStack('stack_1'), MockStack('stack_2')]
- self.stacks_list = MockStacks_2(stacks)
-
-
-class HeatManagerMock(heat_manager.HeatManager):
-
- def init_heat(self):
- if self.heat is None:
- self.heat = MockHeat()
-
-
-class HeatManagerMock_2(heat_manager.HeatManager):
-
- def init_heat(self):
- if self.heat is None:
- self.heat = MockHeat_2()
-
-
-class TestHeatManager(unittest.TestCase):
-
- def setUp(self):
- credentials = dict()
- credentials['ip_controller'] = '1.1.1.1'
- credentials['heat_url'] = 'http://heat_url'
- credentials['user'] = 'user'
- credentials['password'] = 'password'
- credentials['auth_uri'] = 'auth_uri'
- credentials['project'] = 'project'
- self.heat_manager = HeatManagerMock(credentials)
- self.heat_manager.init_heat()
-
- def tearDown(self):
- pass
-
- def test_is_stack_deployed_for_success(self):
- self.assertTrue(self.heat_manager.is_stack_deployed('stack_1'))
- self.assertFalse(self.heat_manager.is_stack_deployed('stack_n'))
-
- def test_check_status_for_success(self):
- self.assertEqual('stack_1_status',
- self.heat_manager.check_stack_status('stack_1'))
- self.assertEqual('NOT_FOUND',
- self.heat_manager.check_stack_status('stack_x'))
-
- def test_validate_template_for_success(self):
- template_file = os.path.join(
- APEX_LAKE_ROOT,
- 'tests/data/test_templates/VTC_base_single_vm_wait_1.yaml')
- with self.assertRaises(ValueError):
- self.heat_manager.validate_heat_template(template_file)
-
- def test_delete_stack_for_success(self):
- self.assertTrue(self.heat_manager.delete_stack('stack_1'))
- self.assertFalse(self.heat_manager.delete_stack('stack_x'))
-
- def test_delete_stack_for_success_2(self):
- self.assertTrue(self.heat_manager.delete_stack('stack_1'))
-
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('heatclient.common.template_utils.get_template_contents')
- @mock.patch('heatclient.client.Client')
- # @mock.patch('heatclient.client.Client', side_effect=DummyHeatClient)
- def test_create_stack_for_success(self, mock_stack_create,
- mock_get_template_contents,
- mock_log):
- return_value = ({'template': 'template'}, 'template')
- mock_get_template_contents.return_value = return_value
- self.heat_manager.create_stack('template', 'stack_n', 'parameters')
- self.assertTrue(self.heat_manager.is_stack_deployed('stack_n'))
-
-
-class TestHeatManager_2(unittest.TestCase):
-
- def setUp(self):
- credentials = dict()
- credentials['ip_controller'] = '1.1.1.1'
- credentials['heat_url'] = 'http://heat_url'
- credentials['user'] = 'user'
- credentials['password'] = 'password'
- credentials['auth_uri'] = 'auth_uri'
- credentials['project'] = 'project'
- self.heat_manager = HeatManagerMock_2(credentials)
-
- def tearDown(self):
- pass
-
- def test_delete_stack_for_success_2(self):
- common.LOG = logging.getLogger()
- self.assertFalse(self.heat_manager.delete_stack('stack_1'))
-
-
-class ServiceCatalog():
-
- def url_for(self, service_type):
- return 'http://heat_url'
-
-
-class KeystoneMock(object):
-
- @property
- def auth_token(self):
- return 'token'
-
- service_catalog = ServiceCatalog()
-
-
-class TestHeatInit(unittest.TestCase):
-
- def setUp(self):
- credentials = dict()
- credentials['ip_controller'] = '1.1.1.1'
- credentials['heat_url'] = 'http://heat_url'
- credentials['user'] = 'user'
- credentials['password'] = 'password'
- credentials['auth_uri'] = 'auth_uri'
- credentials['project'] = 'project'
- self.heat_manager = heat_manager.HeatManager(credentials)
-
- def tearDown(self):
- pass
-
- @mock.patch('heatclient.client.Client')
- @mock.patch('keystoneclient.v2_0.client.Client')
- def test_heat_init_for_sanity(self, keystone_client, heat_client):
- keystone_client.return_value = KeystoneMock()
- heat_client.return_value = MockHeat()
- self.heat_manager.init_heat()
- keystone_client.assert_called_once_with(username='user',
- tenant_name='project',
- password='password',
- auth_url='auth_uri')
- heat_client.assert_called_once_with('1', endpoint='http://heat_url',
- token='token')
diff --git a/yardstick/vTC/apexlake/tests/instantiation_validation_bench_test.py b/yardstick/vTC/apexlake/tests/instantiation_validation_bench_test.py
deleted file mode 100644
index 69c5d745e..000000000
--- a/yardstick/vTC/apexlake/tests/instantiation_validation_bench_test.py
+++ /dev/null
@@ -1,339 +0,0 @@
-# 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 __future__ import absolute_import
-import unittest
-import mock
-import os
-import experimental_framework.constants.conf_file_sections as cfs
-import experimental_framework.common as common
-import experimental_framework.benchmarks.\
- instantiation_validation_benchmark as iv_module
-from experimental_framework.benchmarks.\
- instantiation_validation_benchmark import InstantiationValidationBenchmark
-from six.moves import map
-from six.moves import range
-
-
-kill_counter = [0, 0]
-command_counter = [0, 0, 0, 0, 0]
-replace_counter = [0, 0, 0]
-
-
-def dummy_os_kill(pid, signal, get_counters=None):
- if get_counters:
- return kill_counter
- if pid == 1234:
- kill_counter[0] += 1
- return
- if pid == 4321:
- kill_counter[1] += 1
- return
- raise Exception(pid)
-
-
-def dummy_run_command(command, get_counters=None):
- if get_counters:
- return command_counter
- if command == 'sudo smcroute -k':
- command_counter[0] += 1
- return
- elif command == 'sudo ip link delete interface.100':
- command_counter[1] += 1
- return
- elif command == 'sudo kill 1234':
- kill_counter[0] += 1
- return
- elif command == 'sudo kill 4321':
- kill_counter[1] += 1
- return
- raise Exception(command)
-
-
-def dummy_run_command_2(command, get_counters=None):
- if get_counters:
- return command_counter
- if command == 'sudo ip link add link interface name interface.' \
- '100 type vlan id 100':
- command_counter[0] += 1
- return
- elif command == 'sudo ifconfig interface.100 10.254.254.254 up' \
- ' netmask 255.255.255.248':
- command_counter[1] += 1
- return
- elif command == "sudo echo 'mgroup from interface.100 group" \
- " 224.192.16.1' > /etc/smcroute.conf":
- command_counter[2] += 1
- return
- elif command == "sudo smcroute -d":
- command_counter[3] += 1
- return
- elif command == "sudo test_sniff interface.100 128 &":
- command_counter[4] += 1
- return
-
-
-def dummy_replace_in_file(file, str_from, str_to, get_couters=None):
- if get_couters:
- return replace_counter
- if file == 'file':
- if str_from == 'local out_file = "result_file"':
- if str_to == 'local out_file = ""':
- replace_counter[0] += 1
- return
- if str_from == 'local traffic_rate = 100':
- if str_to == 'local traffic_rate = 0':
- replace_counter[1] += 1
- return
- if str_from == 'local traffic_delay = 60':
- if str_to == 'local traffic_delay = 0':
- replace_counter[2] += 1
- return
- if str_from == 'local out_file = ""':
- if str_to == 'local out_file = "result_file"':
- replace_counter[3] += 1
- return
- if str_from == 'local traffic_rate = 0':
- if str_to == 'local traffic_rate = 100':
- replace_counter[4] += 1
- return
- if str_from == 'local traffic_delay = 0':
- if str_to == 'local traffic_delay = 60':
- replace_counter[5] += 1
- return
- raise Exception(file + ' ' + str_from + ' ' + str_to)
-
-
-class DummyDpdkPacketGenerator():
-
- counter = 0
-
- def __init__(self):
- DummyDpdkPacketGenerator.counter = [0, 0]
-
- def init_dpdk_pktgen(self, dpdk_interfaces, lua_script, pcap_file_0,
- pcap_file_1, vlan_0, vlan_1):
- if dpdk_interfaces == 1:
- if lua_script == 'constant_traffic.lua':
- if pcap_file_0 == 'packet_512.pcap':
- if pcap_file_1 == 'igmp.pcap':
- if vlan_0 == '-1':
- if vlan_1 == '-1':
- DummyDpdkPacketGenerator.counter[0] += 1
-
- def send_traffic(self):
- DummyDpdkPacketGenerator.counter[1] += 1
- return
-
-
-class DummyInstantiaionValidationBenchmark(InstantiationValidationBenchmark):
-
- counter = [0, 0, 0, 0, 0]
-
- def _configure_lua_file(self, traffic_rate_percentage, traffic_time):
- DummyInstantiaionValidationBenchmark.counter[0] += 1
-
- def _init_packet_checker(self):
- DummyInstantiaionValidationBenchmark.counter[1] += 1
-
- def _finalize_packet_checker(self):
- DummyInstantiaionValidationBenchmark.counter[2] += 1
-
- def _reset_lua_file(self, traffic_rate_percentage, traffic_time):
- if traffic_rate_percentage == '1' and traffic_time == '10':
- DummyInstantiaionValidationBenchmark.counter[3] += 1
-
- def _get_results(self):
- DummyInstantiaionValidationBenchmark.counter[4] += 1
- res = {'test': 'result'}
- return res
-
-
-class InstantiationValidationInitTest(unittest.TestCase):
-
- def setUp(self):
- common.BASE_DIR = os.getcwd()
- self.iv = InstantiationValidationBenchmark('InstantiationValidation',
- dict())
-
- def tearDown(self):
- common.BASE_DIR = None
-
- @mock.patch('experimental_framework.common.get_base_dir')
- def test___init___for_success(self, mock_base_dir):
- mock_base_dir.return_value = 'base_dir/'
- iv = InstantiationValidationBenchmark('InstantiationValidation',
- dict())
- self.assertEqual(iv.base_dir,
- 'base_dir/experimental_framework/'
- 'packet_generators/dpdk_pktgen/')
- self.assertEqual(iv.results_file,
- 'base_dir/experimental_framework/'
- 'packet_generators/dpdk_pktgen/packets.res')
- self.assertEqual(iv.lua_file,
- 'base_dir/experimental_framework/'
- 'packet_generators/dpdk_pktgen/constant_traffic.lua')
- self.assertEqual(iv.pkt_checker_command,
- 'base_dir/experimental_framework/'
- 'libraries/packet_checker/test_sniff ')
- self.assertEqual(iv.res_dir, '')
- self.assertEqual(iv.interface_name, '')
-
- def test_init_for_success(self):
- self.iv.init()
-
- def test_finalize_for_success(self):
- self.iv.finalize()
-
- def test_get_features_for_success(self):
-
- expected = dict()
- expected['description'] = 'Instantiation Validation Benchmark'
- expected['parameters'] = [
- iv_module.THROUGHPUT,
- iv_module.VLAN_SENDER,
- iv_module.VLAN_RECEIVER
- ]
- expected['allowed_values'] = dict()
- expected['allowed_values'][iv_module.THROUGHPUT] = \
- list(map(str, list(range(0, 100))))
- expected['allowed_values'][iv_module.VLAN_SENDER] = \
- list(map(str, list(range(-1, 4096))))
- expected['allowed_values'][iv_module.VLAN_RECEIVER] = \
- list(map(str, list(range(-1, 4096))))
- expected['default_values'] = dict()
- expected['default_values'][iv_module.THROUGHPUT] = '1'
- expected['default_values'][iv_module.VLAN_SENDER] = '-1'
- expected['default_values'][iv_module.VLAN_RECEIVER] = '-1'
- output = self.iv.get_features()
- self.assertEqual(expected, output)
-
- @mock.patch('subprocess.check_output')
- def test__get_pids_for_success(self, mock_getoutput):
- expected = [1234]
- mock_getoutput.return_value = '1234'
- output = self.iv._get_pids()
- self.assertEqual(expected, output)
-
- expected = [1234, 4321]
- mock_getoutput.return_value = '1234\n4321'
- output = self.iv._get_pids()
- self.assertEqual(expected, output)
-
- expected = []
- mock_getoutput.return_value = None
- output = self.iv._get_pids()
- self.assertEqual(expected, output)
-
- @mock.patch('experimental_framework.common.run_command',
- side_effect=dummy_run_command)
- @mock.patch('os.kill', side_effect=dummy_os_kill)
- @mock.patch('experimental_framework.benchmarks.'
- 'instantiation_validation_benchmark.'
- 'InstantiationValidationBenchmark._get_pids')
- def test__finalize_packet_checker_for_success(self,
- mock_pids,
- mock_os_kill,
- mock_run_command):
- global command_counter
- global kill_counter
- command_counter = [0, 0, 0, 0, 0]
- kill_counter = [0, 0]
- mock_pids.return_value = [1234, 4321]
- self.iv.interface_name = 'interface'
- self.iv.params[iv_module.VLAN_RECEIVER] = '100'
- self.iv._finalize_packet_checker()
- self.assertEqual(dummy_os_kill('', '', True), [1, 1])
- self.assertEqual(dummy_run_command('', True), [1, 1, 0, 0, 0])
-
- @mock.patch('experimental_framework.benchmarks.instantiation_validation_benchmark.time')
- @mock.patch('os.chdir')
- @mock.patch('experimental_framework.common.run_command',
- side_effect=dummy_run_command_2)
- @mock.patch('experimental_framework.benchmarks.'
- 'instantiation_validation_benchmark.'
- 'InstantiationValidationBenchmark._get_pids')
- @mock.patch('os.kill', side_effect=dummy_os_kill)
- def test__init_packet_checker_for_success(self, mock_kill, mock_pids,
- mock_run_command, mock_chdir, mock_time):
- global command_counter
- command_counter = [0, 0, 0, 0, 0]
- mock_pids.return_value = [1234, 4321]
- self.iv.pkt_checker_command = 'test_sniff '
- self.iv.interface_name = 'interface'
- self.iv.params[iv_module.VLAN_RECEIVER] = '100'
- self.iv._init_packet_checker()
- self.assertEqual(dummy_run_command('', True), [1, 1, 1, 1, 1])
-
- @mock.patch('experimental_framework.common.get_file_first_line')
- def test__get_results_for_success(self, mock_get_file):
- self.iv.res_dir = 'directory'
- mock_get_file.side_effect = ['100', '50']
- expected = {'failure': '0'}
- output = self.iv._get_results()
- self.assertEqual(expected, output)
-
- mock_get_file.side_effect = ['10', '50']
- expected = {'failure': '1'}
- output = self.iv._get_results()
- self.assertEqual(expected, output)
-
- @mock.patch('experimental_framework.common.replace_in_file',
- side_effect=dummy_replace_in_file)
- def test__reset_lua_file_for_success(self, mock_replace):
- global replace_counter
- replace_counter = [0, 0, 0, 0, 0, 0]
- traffic_rate_percentage = '100'
- traffic_time = '60'
- self.iv.lua_file = 'file'
- self.iv.results_file = 'result_file'
- self.iv._reset_lua_file(traffic_rate_percentage, traffic_time)
- self.assertEqual(dummy_replace_in_file('', '', '', True),
- [1, 1, 1, 0, 0, 0])
-
- @mock.patch('experimental_framework.common.replace_in_file',
- side_effect=dummy_replace_in_file)
- def test__configure_lua_file_for_success(self, mock_replace):
- global replace_counter
- replace_counter = [0, 0, 0, 0, 0, 0]
- traffic_rate_percentage = '100'
- traffic_time = '60'
- self.iv.lua_file = 'file'
- self.iv.results_file = 'result_file'
- self.iv._configure_lua_file(traffic_rate_percentage, traffic_time)
- self.assertEqual(dummy_replace_in_file('', '', '', True),
- [0, 0, 0, 1, 1, 1])
-
- @mock.patch('experimental_framework.benchmarks.instantiation_validation_benchmark.time')
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator',
- side_effect=DummyDpdkPacketGenerator)
- @mock.patch('experimental_framework.common.get_dpdk_pktgen_vars')
- def test_run_for_success(self, mock_common_get_vars, mock_pktgen,
- mock_log, mock_time):
- rval = dict()
- rval[cfs.CFSP_DPDK_BUS_SLOT_NIC_2] = 'bus_2'
- rval[cfs.CFSP_DPDK_NAME_IF_2] = 'if_2'
- mock_common_get_vars.return_value = rval
- expected = {'test': 'result'}
- iv = DummyInstantiaionValidationBenchmark('InstantiationValidation',
- dict())
- iv.params[iv_module.THROUGHPUT] = '1'
- output = iv.run()
- self.assertEqual(expected, output)
- self.assertEqual(DummyDpdkPacketGenerator.counter,
- [1, 1])
- self.assertEqual(DummyInstantiaionValidationBenchmark.counter,
- [1, 1, 1, 1, 1])
diff --git a/yardstick/vTC/apexlake/tests/instantiation_validation_noisy_bench_test.py b/yardstick/vTC/apexlake/tests/instantiation_validation_noisy_bench_test.py
deleted file mode 100644
index f9aa9473f..000000000
--- a/yardstick/vTC/apexlake/tests/instantiation_validation_noisy_bench_test.py
+++ /dev/null
@@ -1,150 +0,0 @@
-# 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 __future__ import absolute_import
-import unittest
-import mock
-
-from six.moves import range
-
-import experimental_framework.common as common
-import experimental_framework.deployment_unit as deploy
-import experimental_framework.benchmarks.\
- instantiation_validation_noisy_neighbors_benchmark as mut
-from experimental_framework import APEX_LAKE_ROOT
-
-
-class InstantiationValidationInitTest(unittest.TestCase):
-
- def setUp(self):
- name = 'instantiation_validation_noisy'
- params = {'param': 'value'}
- openstack_credentials = dict()
- openstack_credentials['ip_controller'] = ''
- openstack_credentials['project'] = ''
- openstack_credentials['auth_uri'] = ''
- openstack_credentials['user'] = ''
- openstack_credentials['heat_url'] = ''
- openstack_credentials['password'] = ''
- common.DEPLOYMENT_UNIT = deploy.DeploymentUnit(openstack_credentials)
- common.BASE_DIR = APEX_LAKE_ROOT
- common.TEMPLATE_DIR = 'tests/data/generated_templates'
- self.iv = mut.\
- InstantiationValidationNoisyNeighborsBenchmark(name, params)
-
- def tearDown(self):
- common.BASE_DIR = None
- common.TEMPLATE_DIR = None
-
- @mock.patch('experimental_framework.benchmarks.'
- 'instantiation_validation_benchmark.'
- 'InstantiationValidationBenchmark')
- @mock.patch('experimental_framework.common.get_template_dir')
- def test___init___for_success(self, mock_get_template_dir,
- mock_instant_validation):
- mock_get_template_dir.return_value = '/directory/'
- name = 'instantiation_validation_noisy'
- params = {'param': 'value'}
- obj = mut.InstantiationValidationNoisyNeighborsBenchmark(name, params)
- self.assertEqual(obj.template_file, '/directory/stress_workload.yaml')
- self.assertEqual(obj.stack_name, 'neighbour')
- self.assertEqual(obj.neighbor_stack_names, list())
-
- def test_get_features_for_success(self):
- expected = dict()
- expected['description'] = 'Instantiation Validation Benchmark with ' \
- 'noisy neghbors'
- expected['parameters'] = list()
- expected['allowed_values'] = dict()
- expected['default_values'] = dict()
- expected['parameters'].append('throughput')
- expected['parameters'].append('vlan_sender')
- expected['parameters'].append('vlan_receiver')
- expected['parameters'].append('network')
- expected['parameters'].append('subnet')
- expected['parameters'].append(mut.NUM_OF_NEIGHBORS)
- expected['parameters'].append(mut.AMOUNT_OF_RAM)
- expected['parameters'].append(mut.NUMBER_OF_CORES)
- expected['allowed_values']['throughput'] = [str(x) for x in range(100)]
- expected['allowed_values']['vlan_sender'] = [str(x) for x in
- range(-1, 4096)]
- expected['allowed_values']['vlan_receiver'] = [str(x) for x in
- range(-1, 4096)]
- expected['allowed_values'][mut.NUM_OF_NEIGHBORS] = \
- ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
- expected['allowed_values'][mut.NUMBER_OF_CORES] = \
- ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
- expected['allowed_values'][mut.AMOUNT_OF_RAM] = \
- ['256M', '1G', '2G', '3G', '4G', '5G', '6G', '7G', '8G', '9G',
- '10G']
- expected['default_values']['throughput'] = '1'
- expected['default_values']['vlan_sender'] = '-1'
- expected['default_values']['vlan_receiver'] = '-1'
- expected['default_values']['network'] = ''
- expected['default_values']['subnet'] = ''
- expected['default_values'][mut.NUM_OF_NEIGHBORS] = '1'
- expected['default_values'][mut.NUMBER_OF_CORES] = '1'
- expected['default_values'][mut.AMOUNT_OF_RAM] = '256M'
- output = self.iv.get_features()
- self.assertEqual(expected['description'], output['description'])
-
- for item in output['parameters']:
- self.assertIn(item, expected['parameters'])
- for key in output['allowed_values'].keys():
- self.assertEqual(expected['allowed_values'][key],
- output['allowed_values'][key])
- for key in output['default_values'].keys():
- self.assertEqual(expected['default_values'][key],
- output['default_values'][key])
-
- @mock.patch('experimental_framework.common.replace_in_file')
- @mock.patch('experimental_framework.common.'
- 'DEPLOYMENT_UNIT.deploy_heat_template')
- def test_init_for_success(self, mock_deploy_heat, mock_replace):
- self.iv.lua_file = 'file'
- self.iv.results_file = 'res_file'
- self.iv.params = {'number_of_cores': 1,
- 'amount_of_ram': 1,
- 'network': 1,
- 'subnet': 1,
- 'num_of_neighbours': 1}
- self.iv.template_file = 'template.yaml'
- self.iv.init()
- mock_replace.assert_called_once_with('file',
- 'local out_file = ""',
- 'local out_file = "' +
- 'res_file' + '"')
- mock_deploy_heat.assert_called_once_with('template.yaml',
- 'neighbour0',
- {'cores': 1,
- 'memory': 1,
- 'network': 1,
- 'subnet': 1})
- self.assertEqual(self.iv.neighbor_stack_names, ['neighbour0'])
-
- @mock.patch('experimental_framework.common.replace_in_file')
- @mock.patch('experimental_framework.common.'
- 'DEPLOYMENT_UNIT.destroy_heat_template')
- def test_finalize_for_success(self, mock_heat_destroy, mock_replace):
- self.iv.lua_file = 'file'
- self.iv.results_file = 'res_file'
- self.iv.neighbor_stack_names = ['neighbor0']
- stack_name = 'neighbor0'
- self.iv.finalize()
- mock_heat_destroy.assert_called_once_with(stack_name)
- mock_replace.assert_called_once_with('file',
- 'local out_file = "' +
- 'res_file' + '"',
- 'local out_file = ""')
- self.assertEqual(self.iv.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
deleted file mode 100644
index 39b38d7d3..000000000
--- a/yardstick/vTC/apexlake/tests/multi_tenancy_throughput_benchmark_test.py
+++ /dev/null
@@ -1,119 +0,0 @@
-# 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 __future__ import absolute_import
-import unittest
-import mock
-import os
-import experimental_framework.common as common
-from experimental_framework.benchmarks \
- import multi_tenancy_throughput_benchmark as bench
-from six.moves import range
-
-__author__ = 'gpetralx'
-
-
-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()
- common.BASE_DIR = os.getcwd()
- 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', list(output.keys()))
- self.assertIn('allowed_values', list(output.keys()))
- self.assertIn('default_values', list(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
- heat_param['network'] = ''
- heat_param['subnet'] = ''
- 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)
diff --git a/yardstick/vTC/apexlake/tests/rfc2544_throughput_benchmark_test.py b/yardstick/vTC/apexlake/tests/rfc2544_throughput_benchmark_test.py
deleted file mode 100644
index 487de7775..000000000
--- a/yardstick/vTC/apexlake/tests/rfc2544_throughput_benchmark_test.py
+++ /dev/null
@@ -1,162 +0,0 @@
-# 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 __future__ import absolute_import
-import unittest
-import mock
-import os
-from experimental_framework.benchmarks import rfc2544_throughput_benchmark \
- as mut
-import experimental_framework.common as common
-
-
-class RFC2544ThroughputBenchmarkRunTest(unittest.TestCase):
-
- def setUp(self):
- name = 'benchmark'
- params = dict()
- params[mut.VLAN_SENDER] = '1'
- params[mut.VLAN_RECEIVER] = '2'
- common.BASE_DIR = os.getcwd()
- self.benchmark = mut.RFC2544ThroughputBenchmark(name, params)
-
- def tearDown(self):
- common.BASE_DIR = None
-
- def test_get_features_for_sanity(self):
- output = self.benchmark.get_features()
- self.assertIsInstance(output, dict)
- self.assertIn('parameters', list(output.keys()))
- self.assertIn('allowed_values', list(output.keys()))
- self.assertIn('default_values', list(output.keys()))
- self.assertIsInstance(output['parameters'], list)
- self.assertIsInstance(output['allowed_values'], dict)
- self.assertIsInstance(output['default_values'], dict)
-
- def test_init(self):
- self.assertEqual(self.benchmark.init(), None)
-
- def test_finalize(self):
- self.assertEqual(self.benchmark.finalize(), None)
-
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark.'
- '_reset_lua_file')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark.'
- '_configure_lua_file')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark.'
- '_extract_packet_size_from_params')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark.'
- '_get_results')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark.dpdk.DpdkPacketGenerator')
- def test_run_for_success(self, mock_dpdk, mock_get_results,
- mock_extract_size, conf_lua_file_mock,
- reset_lua_file_mock, mock_common_log):
- expected = {'results': 0}
- mock_extract_size.return_value = '1'
- mock_get_results.return_value = {'results': 0}
- output = self.benchmark.run()
- self.assertEqual(expected, output)
- conf_lua_file_mock.assert_called_once()
- dpdk_instance = mock_dpdk()
- dpdk_instance.init_dpdk_pktgen.assert_called_once_with(
- dpdk_interfaces=2, pcap_file_0='packet_1.pcap',
- pcap_file_1='igmp.pcap', lua_script='rfc2544.lua',
- vlan_0='1', vlan_1='2')
- dpdk_instance.send_traffic.assert_called_once_with()
-
-
-class RFC2544ThroughputBenchmarkOthers(unittest.TestCase):
-
- def setUp(self):
- name = 'benchmark'
- params = {'packet_size': '128'}
- common.BASE_DIR = os.getcwd()
- self.benchmark = mut.RFC2544ThroughputBenchmark(name, params)
-
- def tearDown(self):
- common.BASE_DIR = None
-
- def test__extract_packet_size_from_params_for_success(self):
- expected = '128'
- output = self.benchmark._extract_packet_size_from_params()
- self.assertEqual(expected, output)
-
- @mock.patch('experimental_framework.common.replace_in_file')
- def test__configure_lua_file(self, mock_common_replace_in_file):
- self.benchmark.lua_file = 'lua_file'
- self.benchmark.results_file = 'result_file'
- self.benchmark._configure_lua_file()
- mock_common_replace_in_file.\
- assert_called_once_with('lua_file', 'local out_file = ""',
- 'local out_file = "result_file"')
-
- @mock.patch('experimental_framework.common.replace_in_file')
- def test__reset_lua_file(self, mock_common_replace_in_file):
- self.benchmark.lua_file = 'lua_file'
- self.benchmark.results_file = 'result_file'
- self.benchmark._reset_lua_file()
- mock_common_replace_in_file.\
- assert_called_once_with('lua_file',
- 'local out_file = "result_file"',
- 'local out_file = ""')
-
-
-class RFC2544ThroughputBenchmarkGetResultsTest(unittest.TestCase):
-
- def setUp(self):
- common.BASE_DIR = os.getcwd()
-
- def tearDown(self):
- common.BASE_DIR = None
-
- @mock.patch('experimental_framework.common.get_file_first_line')
- def test__get_results_for_success(self, mock_common_file_line):
- name = 'benchmark'
- params = {'packet_size': '128'}
- self.benchmark = mut.RFC2544ThroughputBenchmark(name, params)
- self.benchmark.results_file = 'base_dir/experimental_framework/' \
- 'packet_generators/dpdk_pktgen/' \
- 'experiment.res'
- mock_common_file_line.return_value = '10'
- expected = {'throughput': 10}
- output = self.benchmark._get_results()
- self.assertEqual(expected, output)
- mock_common_file_line.\
- assert_called_once_with('base_dir/experimental_framework/'
- 'packet_generators/dpdk_pktgen/'
- 'experiment.res')
-
- @mock.patch('experimental_framework.common.get_file_first_line')
- def test__get_results_for_success_2(self, mock_common_file_line):
- name = 'benchmark'
- params = {'packet_size': '128'}
- self.benchmark = mut.RFC2544ThroughputBenchmark(name, params)
- self.benchmark.results_file = 'base_dir/experimental_framework/' \
- 'packet_generators/dpdk_pktgen/' \
- 'experiment.res'
- mock_common_file_line.return_value = '1XXX0'
- expected = {'throughput': 0}
- output = self.benchmark._get_results()
- self.assertEqual(expected, output)
- mock_common_file_line.\
- assert_called_once_with('base_dir/experimental_framework/'
- 'packet_generators/dpdk_pktgen/'
- 'experiment.res')
diff --git a/yardstick/vTC/apexlake/tests/tree_node_test.py b/yardstick/vTC/apexlake/tests/tree_node_test.py
deleted file mode 100644
index fb38b69bd..000000000
--- a/yardstick/vTC/apexlake/tests/tree_node_test.py
+++ /dev/null
@@ -1,98 +0,0 @@
-# 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 __future__ import absolute_import
-import unittest
-import experimental_framework.heat_template_generation as heat_gen
-
-__author__ = 'gpetralx'
-
-
-class TestTreeNode(unittest.TestCase):
-
- def setUp(self):
- self.tree = heat_gen.TreeNode()
-
- def tearDown(self):
- pass
-
- def test_add_child_for_success(self):
- child = heat_gen.TreeNode()
- self.tree.add_child(child)
- self.assertIn(child, self.tree.down)
-
- def test_get_parent_for_success(self):
- self.assertIsNone(self.tree.get_parent())
- child = heat_gen.TreeNode()
- self.tree.add_child(child)
- self.assertEqual(self.tree, child.get_parent())
-
- def test_get_children_for_success(self):
- self.assertListEqual(list(), self.tree.get_children())
- child = heat_gen.TreeNode()
- self.tree.add_child(child)
- children = [child]
- self.assertListEqual(children, self.tree.get_children())
-
- def test_variable_name_for_success(self):
- self.assertEqual('', self.tree.get_variable_name())
- variable_name = 'test'
- self.tree.set_variable_name(variable_name)
- self.assertEqual(variable_name, self.tree.get_variable_name())
-
- def test_variable_value_for_success(self):
- self.assertEqual(0, self.tree.get_variable_value())
- variable_value = 1
- self.tree.set_variable_value(variable_value)
- self.assertEqual(variable_value, self.tree.get_variable_value())
-
- def test_get_path_for_success(self):
- child_1 = heat_gen.TreeNode()
- self.tree.add_child(child_1)
- child_2 = heat_gen.TreeNode()
- child_1.add_child(child_2)
- child_3 = heat_gen.TreeNode()
- child_2.add_child(child_3)
-
- path = [self.tree, child_1, child_2, child_3]
-
- self.assertListEqual(path, child_3.get_path())
-
- def test_str_for_success(self):
- name = 'name'
- value = 0
- self.tree.set_variable_name(name)
- self.tree.set_variable_value(value)
- self.assertEqual(name + " --> " + str(value), str(self.tree))
-
- def test_repr_for_success(self):
- name = 'name'
- value = 0
- self.tree.set_variable_name(name)
- self.tree.set_variable_value(value)
- self.assertEqual(name + " = " + str(value), repr(self.tree))
-
- def test_get_leaves_for_success(self):
- child_1 = heat_gen.TreeNode()
- self.tree.add_child(child_1)
- child_2 = heat_gen.TreeNode()
- child_1.add_child(child_2)
- child_3 = heat_gen.TreeNode()
- child_2.add_child(child_3)
- child_4 = heat_gen.TreeNode()
- child_2.add_child(child_4)
- child_5 = heat_gen.TreeNode()
- child_2.add_child(child_5)
- leaves = [child_3, child_4, child_5]
- self.assertListEqual(leaves, heat_gen.TreeNode.get_leaves(self.tree))