aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/vTC/apexlake/experimental_framework
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/experimental_framework
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/experimental_framework')
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/__init__.py22
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/api.py153
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarking_unit.py283
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/__init__.py17
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/benchmark_base_class.py85
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py260
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_noisy_neighbors_benchmark.py94
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py97
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/rfc2544_throughput_benchmark.py140
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/test_benchmark.py39
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/common.py622
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/constants/__init__.py17
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/constants/conf_file_sections.py102
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/constants/framework_parameters.py34
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/deployment_unit.py120
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/heat_manager.py103
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/heat_template_generation.py236
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/libraries/__init__.py19
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/Makefile19
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/test_sniff.c146
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/__init__.py19
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/base_packet_generator.py32
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_packet_generator.py351
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_pktgen/constant_traffic.lua74
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_pktgen/rfc2544.lua132
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/LICENSE.rst26
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/igmp.pcapbin172 -> 0 bytes
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1024.pcapbin1064 -> 0 bytes
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_128.pcapbin168 -> 0 bytes
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1280.pcapbin1320 -> 0 bytes
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1514.pcapbin1632 -> 0 bytes
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1518.pcapbin1558 -> 0 bytes
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_256.pcapbin295 -> 0 bytes
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_512.pcapbin553 -> 0 bytes
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_64.pcapbin104 -> 0 bytes
-rwxr-xr-xyardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/vlan_tag.sh21
36 files changed, 0 insertions, 3263 deletions
diff --git a/yardstick/vTC/apexlake/experimental_framework/__init__.py b/yardstick/vTC/apexlake/experimental_framework/__init__.py
deleted file mode 100644
index 9c4eef12d..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/__init__.py
+++ /dev/null
@@ -1,22 +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.
-
-"""
-Experimental Framework
-"""
-from __future__ import absolute_import
-import os
-
-APEX_LAKE_ROOT = os.path.realpath(
- os.path.join(os.path.dirname(os.path.dirname(__file__))))
diff --git a/yardstick/vTC/apexlake/experimental_framework/api.py b/yardstick/vTC/apexlake/experimental_framework/api.py
deleted file mode 100644
index 24dd1f89a..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/api.py
+++ /dev/null
@@ -1,153 +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 experimental_framework.benchmarking_unit as b_unit
-from experimental_framework import heat_template_generation, common
-
-
-class FrameworkApi(object):
-
- @staticmethod
- def init():
- """
- Initializes the Framework
-
- :return: None
- """
- common.init(api=True)
-
- # @staticmethod
- # def get_available_test_cases():
- # """
- # Returns a list of available test cases.
- # This list include eventual modules developed by the user, if any.
- # Each test case is returned as a string that represents the full name
- # of the test case and that can be used to get more information
- # calling get_test_case_features(test_case_name)
- #
- # :return: list of strings
- # """
- # return b_unit.BenchmarkingUnit.get_available_test_cases()
-
- @staticmethod
- def get_test_case_features(test_case):
- """
- Returns a list of features (description, requested parameters,
- allowed values, etc.) for a specified test case.
-
- :param test_case: name of the test case (string)
- The string represents the test case and can be
- obtained calling "get_available_test_cases()"
- method.
-
- :return: dict() containing the features of the test case
- """
- if not isinstance(test_case, str):
- raise ValueError('The provided test_case parameter has to be '
- 'a string')
- benchmark = b_unit.BenchmarkingUnit.get_required_benchmarks(
- [test_case])[0]
- return benchmark.get_features()
-
- @staticmethod
- def execute_framework(
- test_cases,
- iterations,
- heat_template,
- heat_template_parameters,
- deployment_configuration,
- openstack_credentials
- ):
- """
- Executes the framework according the inputs
-
- :param test_cases: Test cases to be ran on the workload
- (dict() of dict())
-
- Example:
- test_case = dict()
- test_case['name'] = 'module.Class'
- test_case['params'] = dict()
- test_case['params']['throughput'] = '1'
- test_case['params']['vlan_sender'] = '1007'
- test_case['params']['vlan_receiver'] = '1006'
- test_cases = [test_case]
-
- :param iterations: Number of cycles to be executed (int)
-
- :param heat_template: (string) File name of the heat template of the
- workload to be deployed. It contains the
- parameters to be evaluated in the form of
- #parameter_name. (See heat_templates/vTC.yaml as
- example).
-
- :param heat_template_parameters: (dict) Parameters to be provided
- as input to the heat template.
- See http://docs.openstack.org/developer/heat/
- template_guide/hot_guide.html - section
- "Template input parameters" for further info.
-
- :param deployment_configuration: ( dict[string] = list(strings) ) )
- Dictionary of parameters representing the
- deployment configuration of the workload
- The key is a string corresponding to the name of
- the parameter, the value is a list of strings
- representing the value to be assumed by a specific
- param.
- The parameters are user defined: they have to
- correspond to the place holders (#parameter_name)
- specified in the heat template.
-
- :return: dict() Containing results
- """
- common.init(api=True)
-
- # Input Validation
- common.InputValidation.validate_os_credentials(openstack_credentials)
- credentials = openstack_credentials
-
- msg = 'The provided heat_template does not exist'
- if common.RELEASE == 'liberty':
- heat_template = 'vTC_liberty.yaml'
- else:
- heat_template = 'vTC.yaml'
- template = "{}{}".format(common.get_template_dir(), heat_template)
- common.InputValidation.validate_file_exist(template, msg)
-
- msg = 'The provided iterations variable must be an integer value'
- common.InputValidation.validate_integer(iterations, msg)
-
- msg = 'The provided heat_template_parameters variable must be a ' \
- 'dictionary'
- common.InputValidation.validate_dictionary(heat_template_parameters,
- msg)
- log_msg = "Generation of all the heat templates " \
- "required by the experiment"
- common.LOG.info(log_msg)
- heat_template_generation.generates_templates(heat_template,
- deployment_configuration)
- benchmarking_unit = \
- b_unit.BenchmarkingUnit(
- heat_template, credentials, heat_template_parameters,
- iterations, test_cases)
- try:
- common.LOG.info("Benchmarking Unit initialization")
- benchmarking_unit.initialize()
- common.LOG.info("Benchmarking Unit Running")
- results = benchmarking_unit.run_benchmarks()
- finally:
- common.LOG.info("Benchmarking Unit Finalization")
- benchmarking_unit.finalize()
- return results
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarking_unit.py b/yardstick/vTC/apexlake/experimental_framework/benchmarking_unit.py
deleted file mode 100644
index 56ea6d2f0..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarking_unit.py
+++ /dev/null
@@ -1,283 +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.
-
-"""
-The Benchmarking Unit manages the Benchmarking of VNFs orchestrating the
-initialization, execution and finalization
-"""
-
-
-from __future__ import absolute_import
-import json
-import time
-import inspect
-
-from experimental_framework.benchmarks import benchmark_base_class as base
-from experimental_framework import common
-# from experimental_framework import data_manager as data
-from experimental_framework import heat_template_generation as heat
-from experimental_framework import deployment_unit as deploy
-from six.moves import range
-
-
-class BenchmarkingUnit:
- """
- Management of the overall Benchmarking process
- """
-
- def __init__(self, heat_template_name, openstack_credentials,
- heat_template_parameters, iterations, benchmarks):
- """
- :param heat_template_name: (str) Name of the heat template.
-
- :param openstack_credentials: (dict) Credentials for openstack.
- Required fields are: 'ip_controller', 'heat_url',
- 'user', 'password', 'auth_uri', 'project'.
-
- :param heat_template_parameters: (dict) parameters to be given as
- input to the heat template. Required keys depend on
- the specific heat template.
-
- :param iterations: (int) number of cycles to be executed.
-
- :param benchmarks: (list[str]) List of the names of the
- benchmarks/test_cases to be executed in the cycle.
-
- :return: None
- """
- # Loads vars from configuration file
- self.template_file_extension = common.TEMPLATE_FILE_EXTENSION
- self.template_dir = common.get_template_dir()
- self.results_directory = str(common.RESULT_DIR) + str(time.time())
-
- # Initializes other internal variable from parameters
- self.template_name = heat_template_name
- self.iterations = iterations
- self.required_benchmarks = benchmarks
- self.template_files = []
- self.benchmarks = list()
- self.benchmark_names = list()
- # self.data_manager = data.DataManager(self.results_directory)
- self.heat_template_parameters = heat_template_parameters
- self.template_files = \
- heat.get_all_heat_templates(self.template_dir,
- self.template_file_extension)
- common.DEPLOYMENT_UNIT = deploy.DeploymentUnit(openstack_credentials)
-
- def initialize(self):
- """
- Initialize the environment in order to run the benchmarking
-
- :return: None
- """
- for benchmark in self.required_benchmarks:
- benchmark_class = BenchmarkingUnit.get_benchmark_class(
- benchmark['name'])
- # Need to generate a unique name for the benchmark
- # (since there is the possibility to have different
- # instances of the same benchmark)
- self.benchmarks.append(benchmark_class(
- self.get_benchmark_name(benchmark['name']),
- benchmark['params']))
-
- # for template_file_name in self.template_files:
- # experiment_name = BenchmarkingUnit.extract_experiment_name(
- # template_file_name)
- # self.data_manager.create_new_experiment(experiment_name)
- # for benchmark in self.benchmarks:
- # self.data_manager.add_benchmark(experiment_name,
- # benchmark.get_name())
-
- def finalize(self):
- """
- Finalizes the Benchmarking Unit
- Destroys all the stacks deployed by the framework and save results on
- csv file.
-
- :return: None
- """
- # self.data_manager.generate_result_csv_file()
- common.DEPLOYMENT_UNIT.destroy_all_deployed_stacks()
-
- def run_benchmarks(self):
- """
- Runs all the requested benchmarks and collect the results.
-
- :return: None
- """
- common.LOG.info('Run Benchmarking Unit')
-
- experiment = {}
- result = {}
- for iteration in range(self.iterations):
- common.LOG.info('Iteration %s', iteration)
- for template_file_name in self.template_files:
- experiment_name = BenchmarkingUnit.\
- extract_experiment_name(template_file_name)
- experiment['experiment_name'] = experiment_name
- configuration = self.\
- get_experiment_configuration(template_file_name)
- # self.data_manager.add_configuration(experiment_name,
- # configuration)
- for key in configuration.keys():
- experiment[key] = configuration[key]
- # metadata = dict()
- # metadata['experiment_name'] = experiment_name
- # self.data_manager.add_metadata(experiment_name, metadata)
-
- # For each benchmark in the cycle the workload is deployed
- for benchmark in self.benchmarks:
- log_msg = 'Benchmark {} started on {}'.format(
- benchmark.get_name(), template_file_name
- )
- common.LOG.info(log_msg)
-
- # Initialization of Benchmark
- benchmark.init()
- log_msg = 'Template {} deployment START'.\
- format(experiment_name)
- common.LOG.info(log_msg)
-
- # Deployment of the workload
- deployment_success = \
- common.DEPLOYMENT_UNIT.deploy_heat_template(
- self.template_dir + template_file_name,
- experiment_name,
- self.heat_template_parameters)
-
- if deployment_success:
- log_msg = 'Template {} deployment COMPLETED'.format(
- experiment_name)
- common.LOG.info(log_msg)
- else:
- log_msg = 'Template {} deployment FAILED'.format(
- experiment_name)
- common.LOG.info(log_msg)
- continue
-
- # Running the Benchmark/test case
- result = benchmark.run()
- # self.data_manager.add_data_points(experiment_name,
- # benchmark.get_name(),
- # result)
-
- # Terminate the workload
- log_msg = 'Destroying deployment for experiment {}'.\
- format(experiment_name)
- common.LOG.info(log_msg)
- common.DEPLOYMENT_UNIT.destroy_heat_template(
- experiment_name)
-
- # Finalize the benchmark
- benchmark.finalize()
- log_msg = 'Benchmark {} terminated'.format(
- benchmark.__class__.__name__)
- common.LOG.info(log_msg)
- # self.data_manager.generate_result_csv_file()
-
- experiment['benchmark'] = benchmark.get_name()
- for key in benchmark.get_params():
- experiment[key] = benchmark.get_params()[key]
- common.LOG.info('Benchmark Finished')
- # self.data_manager.generate_result_csv_file()
- common.LOG.info('Benchmarking Unit: Experiments completed!')
- return result
-
- def get_experiment_configuration(self, template_file_name):
- """
- Reads and returns the configuration for the specific experiment
- (heat template)
-
- :param template_file_name: (str) Name of the file for the heat
- template for which it is requested the configuration
-
- :return: dict() Configuration parameters and values
- """
- file_name = "{}{}.json".format(self.template_dir, template_file_name)
- with open(file_name) as json_file:
- configuration = json.load(json_file)
- return configuration
-
- def get_benchmark_name(self, name, instance=0):
- """
- Returns the name to be used for the benchmark/test case (TC).
- This is required since each benchmark/TC could be run more than once
- within the same cycle, with different initialization parameters.
- In order to distinguish between them, a unique name is generated.
-
- :param name: (str) original name of the benchmark/TC
-
- :param instance: (int) number of instance already in the queue for
- this type of benchmark/TC.
-
- :return: (str) name to be assigned to the benchmark/TC
- """
- if name + "_" + str(instance) in self.benchmark_names:
- instance += 1
- return self.get_benchmark_name(name, instance)
- self.benchmark_names.append(name + "_" + str(instance))
- return name + "_" + str(instance)
-
- @staticmethod
- def extract_experiment_name(template_file_name):
- """
- Generates a unique experiment name for a given template.
-
- :param template_file_name: (str) File name of the template used
- during the experiment string
-
- :return: (str) Experiment Name
- """
- strings = template_file_name.split('.')
- return ".".join(strings[:(len(strings) - 1)])
-
- @staticmethod
- def get_benchmark_class(complete_module_name):
- """
- Returns the classes included in a given module.
-
- :param complete_module_name: (str) Complete name of the module as
- returned by get_available_test_cases.
-
- :return: Class related to the benchmark/TC present in the requested
- module.
- """
- strings = complete_module_name.split('.')
- class_name = 'experimental_framework.benchmarks.{}'.format(strings[0])
- pkg = __import__(class_name, globals(), locals(), [], 0)
- module = getattr(getattr(pkg, 'benchmarks'), strings[0])
- members = inspect.getmembers(module)
- for m in members:
- if inspect.isclass(m[1]):
- class_name = m[1]("", dict()).__class__.__name__
- if isinstance(m[1]("", dict()), base.BenchmarkBaseClass) and \
- not class_name == 'BenchmarkBaseClass':
- return m[1]
-
- @staticmethod
- def get_required_benchmarks(required_benchmarks):
- """
- Returns instances of required test cases.
-
- :param required_benchmarks: (list() of strings) Benchmarks to be
- executed by the experimental framework.
-
- :return: list() of BenchmarkBaseClass
- """
- benchmarks = list()
- for b in required_benchmarks:
- class_ = BenchmarkingUnit.get_benchmark_class(b)
- instance = class_("", dict())
- benchmarks.append(instance)
- return benchmarks
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/__init__.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/__init__.py
deleted file mode 100644
index 99635a45a..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/__init__.py
+++ /dev/null
@@ -1,17 +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.
-
-"""
-Benchmarks to be executed within the framework
-"""
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/benchmark_base_class.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/benchmark_base_class.py
deleted file mode 100644
index 38c91ee3a..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/benchmark_base_class.py
+++ /dev/null
@@ -1,85 +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 abc
-
-
-class BenchmarkBaseClass(object):
- """
- This class represents a Benchmark that we want to run on the platform.
- One of them will be the calculation of the throughput changing the
- configuration parameters
- """
-
- def __init__(self, name, params):
- if not params:
- params = dict()
- if not isinstance(params, dict):
- raise ValueError("Parameters need to be provided in a dict")
-
- for param in self.get_features()['parameters']:
- if param not in list(params.keys()):
- params[param] = self.get_features()['default_values'][param]
-
- for param in self.get_features()['parameters']:
- if param in self.get_features()['allowed_values'] and \
- params[param] not in \
- (self.get_features())['allowed_values'][param]:
- raise ValueError('Value of parameter "' + param +
- '" is not allowed')
- self.name = name
- self.params = params
-
- def get_name(self):
- return self.name
-
- def get_params(self):
- return self.params
-
- def get_features(self):
- features = dict()
- features['description'] = 'Please implement the method ' \
- '"get_features" for your benchmark'
- features['parameters'] = list()
- features['allowed_values'] = dict()
- features['default_values'] = dict()
- return features
-
- @abc.abstractmethod
- def init(self):
- """
- Initializes the benchmark
- :return:
- """
- raise NotImplementedError("Subclass must implement abstract method")
-
- @abc.abstractmethod
- def finalize(self):
- """
- Finalizes the benchmark
- :return:
- """
- raise NotImplementedError("Subclass must implement abstract method")
-
- @abc.abstractmethod
- def run(self):
- """
- This method executes the specific benchmark on the VNF already
- instantiated
- :return: list of dictionaries (every dictionary contains the results
- of a data point
- """
- raise NotImplementedError("Subclass must implement abstract method")
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py
deleted file mode 100644
index db9d449ef..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py
+++ /dev/null
@@ -1,260 +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 signal
-import time
-
-import subprocess
-from experimental_framework.benchmarks import benchmark_base_class as base
-from experimental_framework.constants import framework_parameters as fp
-from experimental_framework.constants import conf_file_sections as cfs
-from experimental_framework.packet_generators import dpdk_packet_generator \
- as dpdk
-import experimental_framework.common as common
-from six.moves import range
-
-
-THROUGHPUT = 'throughput'
-VLAN_SENDER = 'vlan_sender'
-VLAN_RECEIVER = 'vlan_receiver'
-PACKETS_FILE_NAME = 'packets.res'
-PACKET_CHECKER_PROGRAM_NAME = 'test_sniff'
-MULTICAST_GROUP = '224.192.16.1'
-
-
-class InstantiationValidationBenchmark(base.BenchmarkBaseClass):
-
- def __init__(self, name, params):
- base.BenchmarkBaseClass.__init__(self, name, params)
- self.base_dir = os.path.join(
- common.get_base_dir(), fp.EXPERIMENTAL_FRAMEWORK_DIR,
- fp.DPDK_PKTGEN_DIR)
- self.results_file = self.base_dir + PACKETS_FILE_NAME
- self.lua_file = self.base_dir + 'constant_traffic.lua'
- self.res_dir = ''
- self.interface_name = ''
-
- # Set the packet checker command
- self.pkt_checker_command = os.path.join(
- common.get_base_dir(),
- 'experimental_framework/libraries/',
- 'packet_checker/',
- PACKET_CHECKER_PROGRAM_NAME + ' ')
-
- def init(self):
- """
- Initialize the benchmark
- :return: None
- """
- pass
-
- def finalize(self):
- """
- Finalizes the benchmark
- :return: None
- """
- pass
-
- def get_features(self):
- features = dict()
- features['description'] = 'Instantiation Validation Benchmark'
- features['parameters'] = [THROUGHPUT, VLAN_SENDER, VLAN_RECEIVER]
- features['allowed_values'] = dict()
- features['allowed_values'][THROUGHPUT] = [str(x) for x in range(100)]
- features['allowed_values'][VLAN_SENDER] = [str(x) for x in
- range(-1, 4096)]
- features['allowed_values'][VLAN_RECEIVER] = [str(x)
- for x in range(-1, 4096)]
- features['default_values'] = dict()
- features['default_values'][THROUGHPUT] = '1'
- features['default_values'][VLAN_SENDER] = '-1'
- features['default_values'][VLAN_RECEIVER] = '-1'
- return features
-
- def run(self):
- # Setup packet generator
- traffic_time = '10'
- packet_size = '512'
- traffic_rate_percentage = self.params[THROUGHPUT]
-
- dpdk_pktgen_vars = common.get_dpdk_pktgen_vars()
- # bus_address = dpdk_pktgen_vars[cfs.CFSP_DPDK_BUS_SLOT_NIC_2]
- self.interface_name = dpdk_pktgen_vars[cfs.CFSP_DPDK_NAME_IF_2]
- packetgen = dpdk.DpdkPacketGenerator()
- self._configure_lua_file(traffic_rate_percentage, traffic_time)
- packetgen.init_dpdk_pktgen(dpdk_interfaces=1,
- pcap_file_0='packet_' + packet_size +
- '.pcap',
- pcap_file_1='igmp.pcap',
- lua_script='constant_traffic.lua',
- vlan_0=self.params[VLAN_SENDER],
- vlan_1=self.params[VLAN_RECEIVER])
-
- self._init_packet_checker()
- # Send constant traffic at a specified rate
- common.LOG.debug('Start the packet generator')
- packetgen.send_traffic()
- common.LOG.debug('Stop the packet generator')
- time.sleep(5)
- self._finalize_packet_checker()
- self._reset_lua_file(traffic_rate_percentage, traffic_time)
- return self._get_results()
-
- def _configure_lua_file(self, traffic_rate_percentage, traffic_time):
- """
- Configure the packet gen to write the results into the right file
- :return: None
- """
- common.replace_in_file(self.lua_file, 'local out_file = ""',
- 'local out_file = "' +
- self.results_file + '"')
- common.replace_in_file(self.lua_file, 'local traffic_rate = 0',
- 'local traffic_rate = ' +
- traffic_rate_percentage)
- common.replace_in_file(self.lua_file, 'local traffic_delay = 0',
- 'local traffic_delay = ' + traffic_time)
-
- def _reset_lua_file(self, traffic_rate_percentage, traffic_time):
- """
- Configure the packet gen to write the results into the right file
- :param traffic_rate_percentage:
- :param traffic_time:
- :return: None
- """
-
- common.replace_in_file(self.lua_file, 'local out_file = "' +
- self.results_file + '"',
- 'local out_file = ""')
- common.replace_in_file(self.lua_file, 'local traffic_rate = ' +
- traffic_rate_percentage,
- 'local traffic_rate = 0')
- common.replace_in_file(self.lua_file, 'local traffic_delay = ' +
- traffic_time, 'local traffic_delay = 0')
-
- def _get_results(self):
- ret_val = dict()
- packet_checker_res = 0
- if self.res_dir:
- packet_checker_res = \
- int(common.get_file_first_line(self.res_dir +
- 'packet_checker.res'))
- pkt_gen_res = int(common.get_file_first_line(self.results_file))
- if pkt_gen_res <= packet_checker_res or \
- (float(pkt_gen_res - packet_checker_res) / pkt_gen_res) <= 0.1:
- ret_val['failure'] = '0'
- else:
- ret_val['failure'] = '1'
- return ret_val
-
- def _init_packet_checker(self):
- """
- Sets up the multicast and starts the packet checker
- :return:
- """
- # Kill any other process running from previous failed execution
- self.res_dir = common.get_result_dir()
- pids = self._get_pids()
- for pid in pids:
- # os.kill(pid, signal.SIGTERM)
- command = 'sudo kill ' + str(pid)
- common.run_command(command)
-
- # initialization of the VLAN interface
- command = "sudo ip link add link "
- command += self.interface_name
- command += " name "
- command += self.interface_name + '.' + self.params[VLAN_RECEIVER]
- command += " type vlan id " + self.params[VLAN_RECEIVER]
- common.run_command(command)
-
- # set up the new
- command = 'sudo ifconfig ' + self.interface_name + '.' + \
- self.params[VLAN_RECEIVER]
- # An IP address is required for the interface to receive a multicast
- # flow. The specific address is not important
- command += ' 10.254.254.254 up netmask 255.255.255.248'
- common.run_command(command)
-
- command = "sudo ifconfig "
- command += self.interface_name + "." + self.params[VLAN_RECEIVER]
- command += " promisc"
- common.run_command(command)
-
- # configure smcroute
- command = "sudo echo 'mgroup from "
- command += self.interface_name + '.' + self.params[VLAN_RECEIVER]
- command += " group "
- command += MULTICAST_GROUP
- command += "' > /etc/smcroute.conf"
- common.run_command(command)
-
- # run smcroute on the interface
- command = 'sudo smcroute -d'
- common.run_command(command)
- time.sleep(3)
-
- # Start the packet checker
- current_dir = os.path.dirname(os.path.realpath(__file__))
- dir_list = self.pkt_checker_command.split('/')
- directory = os.pathsep.join(dir_list[0:len(dir_list) - 1])
- os.chdir(directory)
- command = "make"
- common.run_command(command)
- os.chdir(current_dir)
-
- command = "sudo chmod +x {}".format(self.pkt_checker_command)
- common.run_command(command)
-
- command = 'sudo ' + self.pkt_checker_command
- command += self.interface_name + '.' + self.params[VLAN_RECEIVER]
- command += ' 128'
- command += ' &'
- common.run_command(command)
-
- def _finalize_packet_checker(self):
- """
- Obtains the PID of the packet checker and sends an alarm to
- terminate it
- :return: None
- """
- pids = self._get_pids()
- for pid in pids:
- # os.kill(pid, signal.SIGTERM)
- command = 'sudo kill ' + str(pid)
- common.run_command(command)
-
- # stop smcroute on the interface
- command = 'sudo smcroute -k'
- common.run_command(command)
-
- # finalization of the VLAN interface
- command = "sudo ip link delete "
- command += self.interface_name + '.' + self.params[VLAN_RECEIVER]
- common.run_command(command)
-
- def _get_pids(self):
- """
- Returns a list of integers containing the pid or the pids of the
- processes currently running on the host
- :return: type: list of int
- """
- output = subprocess.check_output(
- 'pgrep "{}"'.format(PACKET_CHECKER_PROGRAM_NAME))
- if not output:
- pids = []
- else:
- pids = [int(x) for x in output.splitlines()]
- return pids
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_noisy_neighbors_benchmark.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_noisy_neighbors_benchmark.py
deleted file mode 100644
index 5569b6c12..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_noisy_neighbors_benchmark.py
+++ /dev/null
@@ -1,94 +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
-from experimental_framework import common
-from experimental_framework.benchmarks import \
- instantiation_validation_benchmark as base
-from six.moves import range
-
-
-NUM_OF_NEIGHBORS = 'num_of_neighbours'
-AMOUNT_OF_RAM = 'amount_of_ram'
-NUMBER_OF_CORES = 'number_of_cores'
-NETWORK_NAME = 'network'
-SUBNET_NAME = 'subnet'
-
-
-class InstantiationValidationNoisyNeighborsBenchmark(
- base.InstantiationValidationBenchmark):
-
- def __init__(self, name, params):
- base.InstantiationValidationBenchmark.__init__(self, name, params)
-
- if common.RELEASE == 'liberty':
- temp_name = 'stress_workload_liberty.yaml'
- else:
- temp_name = 'stress_workload.yaml'
-
- self.template_file = common.get_template_dir() + \
- temp_name
- self.stack_name = 'neighbour'
- self.neighbor_stack_names = []
-
- def get_features(self):
- features = super(InstantiationValidationNoisyNeighborsBenchmark,
- self).get_features()
- features['description'] = 'Instantiation Validation Benchmark ' \
- 'with noisy neghbors'
- features['parameters'].append(NUM_OF_NEIGHBORS)
- features['parameters'].append(AMOUNT_OF_RAM)
- features['parameters'].append(NUMBER_OF_CORES)
- features['parameters'].append(NETWORK_NAME)
- features['parameters'].append(SUBNET_NAME)
- features['allowed_values'][NUM_OF_NEIGHBORS] = \
- ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
- features['allowed_values'][NUMBER_OF_CORES] = \
- ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
- features['allowed_values'][AMOUNT_OF_RAM] = \
- ['256M', '1G', '2G', '3G', '4G', '5G', '6G', '7G', '8G', '9G',
- '10G']
- features['default_values'][NUM_OF_NEIGHBORS] = '1'
- features['default_values'][NUMBER_OF_CORES] = '1'
- features['default_values'][AMOUNT_OF_RAM] = '256M'
- features['default_values'][NETWORK_NAME] = ''
- features['default_values'][SUBNET_NAME] = ''
- return features
-
- def init(self):
- super(InstantiationValidationNoisyNeighborsBenchmark, self).init()
- common.replace_in_file(self.lua_file, 'local out_file = ""',
- 'local out_file = "' +
- self.results_file + '"')
- heat_param = dict()
- heat_param['network'] = self.params[NETWORK_NAME]
- heat_param['subnet'] = self.params[SUBNET_NAME]
- heat_param['cores'] = self.params['number_of_cores']
- heat_param['memory'] = self.params['amount_of_ram']
- for i in range(0, int(self.params['num_of_neighbours'])):
- stack_name = self.stack_name + str(i)
- common.DEPLOYMENT_UNIT.deploy_heat_template(self.template_file,
- stack_name,
- heat_param)
- self.neighbor_stack_names.append(stack_name)
-
- def finalize(self):
- common.replace_in_file(self.lua_file, 'local out_file = "' +
- self.results_file + '"',
- 'local out_file = ""')
- # destroy neighbor stacks
- for stack_name in self.neighbor_stack_names:
- common.DEPLOYMENT_UNIT.destroy_heat_template(stack_name)
- self.neighbor_stack_names = list()
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py
deleted file mode 100644
index 44c9f327a..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py
+++ /dev/null
@@ -1,97 +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
-from experimental_framework.benchmarks import rfc2544_throughput_benchmark \
- as base
-from experimental_framework import common
-from six.moves import range
-
-
-NETWORK_NAME = 'network'
-SUBNET_NAME = 'subnet'
-
-
-class MultiTenancyThroughputBenchmark(base.RFC2544ThroughputBenchmark):
-
- def __init__(self, name, params):
- base.RFC2544ThroughputBenchmark.__init__(self, name, params)
-
- if common.RELEASE == 'liberty':
- temp_name = 'stress_workload_liberty.yaml'
- else:
- temp_name = 'stress_workload.yaml'
-
- self.template_file = "{}{}".format(common.get_template_dir(),
- temp_name)
- self.stack_name = 'neighbour'
- self.neighbor_stack_names = list()
-
- def get_features(self):
- features = super(MultiTenancyThroughputBenchmark, self).get_features()
- features['description'] = \
- 'RFC 2544 Throughput calculation with ' \
- 'memory-bound noisy neighbors'
- features['parameters'].append('num_of_neighbours')
- features['parameters'].append('amount_of_ram')
- features['parameters'].append('number_of_cores')
- features['parameters'].append(NETWORK_NAME)
- features['parameters'].append(SUBNET_NAME)
- features['allowed_values']['num_of_neighbours'] = \
- ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
- features['allowed_values']['number_of_cores'] = \
- ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
- features['allowed_values']['amount_of_ram'] = \
- ['256M', '1G', '2G', '3G', '4G', '5G', '6G', '7G', '8G', '9G',
- '10G']
- features['default_values'][NETWORK_NAME] = ''
- features['default_values'][SUBNET_NAME] = ''
- features['default_values']['num_of_neighbours'] = '1'
- features['default_values']['number_of_cores'] = '1'
- features['default_values']['amount_of_ram'] = '256M'
- return features
-
- def init(self):
- """
- Initialize the benchmark
- return: None
- """
- common.replace_in_file(self.lua_file, 'local out_file = ""',
- 'local out_file = "' +
- self.results_file + '"')
- heat_param = dict()
- heat_param['cores'] = self.params['number_of_cores']
- heat_param['memory'] = self.params['amount_of_ram']
- heat_param['network'] = self.params[NETWORK_NAME]
- heat_param['subnet'] = self.params[SUBNET_NAME]
- for i in range(0, int(self.params['num_of_neighbours'])):
- stack_name = self.stack_name + str(i)
- common.DEPLOYMENT_UNIT.deploy_heat_template(self.template_file,
- stack_name,
- heat_param)
- self.neighbor_stack_names.append(stack_name)
-
- def finalize(self):
- """
- Finalizes the benchmark
- return: None
- """
- common.replace_in_file(self.lua_file, 'local out_file = "' +
- self.results_file + '"',
- 'local out_file = ""')
- # destroy neighbor stacks
- for stack_name in self.neighbor_stack_names:
- common.DEPLOYMENT_UNIT.destroy_heat_template(stack_name)
- self.neighbor_stack_names = list()
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/rfc2544_throughput_benchmark.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/rfc2544_throughput_benchmark.py
deleted file mode 100644
index 5c7b55e42..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/rfc2544_throughput_benchmark.py
+++ /dev/null
@@ -1,140 +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
-from six.moves import range
-
-from experimental_framework.benchmarks import benchmark_base_class
-from experimental_framework.packet_generators \
- import dpdk_packet_generator as dpdk
-import experimental_framework.common as common
-from experimental_framework.constants import framework_parameters as fp
-
-
-PACKET_SIZE = 'packet_size'
-VLAN_SENDER = 'vlan_sender'
-VLAN_RECEIVER = 'vlan_receiver'
-
-
-class RFC2544ThroughputBenchmark(benchmark_base_class.BenchmarkBaseClass):
- """
- Calculates the throughput of the VNF under test according to the RFC2544.
- """
-
- def __init__(self, name, params):
- benchmark_base_class.BenchmarkBaseClass.__init__(self, name, params)
- self.base_dir = common.get_base_dir() + \
- fp.EXPERIMENTAL_FRAMEWORK_DIR + fp.DPDK_PKTGEN_DIR
- self.results_file = self.base_dir + 'experiment.res'
- self.lua_file = self.base_dir + 'rfc2544.lua'
-
- def init(self):
- """
- Initialize the benchmark
- :return: None
- """
- pass
-
- def finalize(self):
- """
- :return: None
- """
- pass
-
- def get_features(self):
- """
- Returns the features associated to the benchmark
- :return:
- """
- features = dict()
- features['description'] = 'RFC 2544 Throughput calculation'
- features['parameters'] = [PACKET_SIZE, VLAN_SENDER, VLAN_RECEIVER]
- features['allowed_values'] = dict()
- features['allowed_values'][PACKET_SIZE] = ['64', '128', '256', '512',
- '1024', '1280', '1514']
- features['allowed_values'][VLAN_SENDER] = [str(x) for x in
- range(-1, 4096)]
- features['allowed_values'][VLAN_RECEIVER] = [str(x) for x in
- range(-1, 4096)]
- features['default_values'] = dict()
- features['default_values'][PACKET_SIZE] = '1280'
- features['default_values'][VLAN_SENDER] = '1007'
- features['default_values'][VLAN_RECEIVER] = '1006'
- return features
-
- def run(self):
- """
- Sends and receive traffic according to the RFC methodology in order
- to measure the throughput of the workload
- :return: Results of the testcase (type: dict)
- """
- packet_size = self._extract_packet_size_from_params()
-
- # Packetgen management
- packetgen = dpdk.DpdkPacketGenerator()
- self._configure_lua_file()
- packetgen.init_dpdk_pktgen(dpdk_interfaces=2,
- pcap_file_0='packet_' +
- packet_size + '.pcap',
- pcap_file_1='igmp.pcap',
- lua_script='rfc2544.lua',
- vlan_0=self.params[VLAN_SENDER],
- vlan_1=self.params[VLAN_RECEIVER])
- common.LOG.debug('Start the packet generator - packet size: ' +
- str(packet_size))
- packetgen.send_traffic()
- common.LOG.debug('Stop the packet generator')
-
- return self._get_results()
-
- def _extract_packet_size_from_params(self):
- """
- Extracts packet sizes from parameters
- :return: packet_sizes (list)
- """
- packet_size = '1280' # default value
- if PACKET_SIZE in list(self.params.keys()) and \
- isinstance(self.params[PACKET_SIZE], str):
- packet_size = self.params[PACKET_SIZE]
- return packet_size
-
- def _configure_lua_file(self):
- """
- Configure the packet gen to write the results into the right file
- :return: None
- """
- common.replace_in_file(self.lua_file, 'local out_file = ""',
- 'local out_file = "' +
- self.results_file + '"')
-
- def _reset_lua_file(self):
- """
- Sets back the configuration of the local file var to the default
- :return:
- """
- common.replace_in_file(self.lua_file, 'local out_file = "' +
- self.results_file + '"',
- 'local out_file = ""')
-
- def _get_results(self):
- """
- Returns the results of the experiment
- :return: None
- """
- throughput = common.get_file_first_line(self.results_file)
- ret_val = dict()
- try:
- ret_val['throughput'] = int(throughput)
- except:
- ret_val['throughput'] = 0
- return ret_val
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/test_benchmark.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/test_benchmark.py
deleted file mode 100644
index 5891832f2..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/test_benchmark.py
+++ /dev/null
@@ -1,39 +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 time
-
-from experimental_framework.benchmarks import benchmark_base_class as base
-
-
-class TestBenchmark(base.BenchmarkBaseClass):
-
- def init(self):
- pass
-
- def finalize(self):
- pass
-
- def get_features(self):
- features = dict()
- features['description'] = 'Test Benchmark'
- features['parameters'] = list()
- features['allowed_values'] = dict()
- features['default_values'] = dict()
- return features
-
- def run(self):
- time.sleep(10)
- return dict()
diff --git a/yardstick/vTC/apexlake/experimental_framework/common.py b/yardstick/vTC/apexlake/experimental_framework/common.py
deleted file mode 100644
index feea8bde6..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/common.py
+++ /dev/null
@@ -1,622 +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 re
-import six.moves.configparser
-import logging
-import fileinput
-from experimental_framework.constants import conf_file_sections as cf
-from experimental_framework.constants import framework_parameters as fp
-
-
-# ------------------------------------------------------
-# List of common variables
-# ------------------------------------------------------
-
-allowed_releases = ['liberty', 'kilo', 'juno']
-
-LOG = None
-CONF_FILE = None
-DEPLOYMENT_UNIT = None
-ITERATIONS = None
-RELEASE = None
-
-BASE_DIR = None
-RESULT_DIR = None
-TEMPLATE_DIR = None
-TEMPLATE_NAME = None
-TEMPLATE_FILE_EXTENSION = None
-
-PKTGEN = None
-PKTGEN_DIR = None
-PKTGEN_DPDK_DIRECTORY = None
-PKTGEN_PROGRAM = None
-PKTGEN_COREMASK = None
-PKTGEN_MEMCHANNEL = None
-PKTGEN_BUS_SLOT_NIC_1 = None
-PKTGEN_BUS_SLOT_NIC_2 = None
-PKTGEN_NAME_NIC_1 = None
-PKTGEN_NAME_NIC_2 = None
-
-INFLUXDB_IP = None
-INFLUXDB_PORT = None
-INFLUXDB_DB_NAME = None
-
-
-# ------------------------------------------------------
-# Initialization and Input 'heat_templates/'validation
-# ------------------------------------------------------
-
-def init(api=False):
- global BASE_DIR
- # BASE_DIR = os.getcwd()
- BASE_DIR = os.path.dirname(os.path.abspath(__file__))
- BASE_DIR = BASE_DIR.replace('/experimental_framework', '')
- BASE_DIR = InputValidation.validate_directory_exist_and_format(
- BASE_DIR, "Error 000001")
-
- init_conf_file(api)
- init_log()
- init_general_vars(api)
- if CONF_FILE.get_variable_list(cf.CFS_PKTGEN):
- init_pktgen()
-
-
-def init_conf_file(api=False):
- global CONF_FILE
- if api:
- CONF_FILE = ConfigurationFile(cf.get_sections_api(),
- '/tmp/apexlake/apexlake.conf')
- else:
- CONF_FILE = ConfigurationFile(cf.get_sections(),
- '/tmp/apexlake/apexlake.conf')
-
-
-def init_general_vars(api=False):
- global TEMPLATE_FILE_EXTENSION
- global TEMPLATE_NAME
- global TEMPLATE_DIR
- global RESULT_DIR
- global ITERATIONS
- global RELEASE
-
- TEMPLATE_FILE_EXTENSION = '.yaml'
-
- # Check Section in Configuration File
- InputValidation.\
- validate_configuration_file_section(
- cf.CFS_GENERAL,
- "Section " + cf.CFS_GENERAL +
- "is not present in configuration file")
-
- InputValidation.\
- validate_configuration_file_section(
- cf.CFS_OPENSTACK,
- "Section " + cf.CFS_OPENSTACK +
- "is not present in configuration file")
-
- TEMPLATE_DIR = '/tmp/apexlake/heat_templates/'
- # if not os.path.exists(TEMPLATE_DIR):
- # os.makedirs(TEMPLATE_DIR)
- # cmd = "cp /tmp/apexlake/heat_templates/*.yaml {}".format(TEMPLATE_DIR)
- # run_command(cmd)
-
- if not api:
- # Validate template name
- InputValidation.\
- validate_configuration_file_parameter(
- cf.CFS_GENERAL,
- cf.CFSG_TEMPLATE_NAME,
- "Parameter " + cf.CFSG_TEMPLATE_NAME +
- "is not present in configuration file")
- TEMPLATE_NAME = CONF_FILE.get_variable(cf.CFS_GENERAL,
- cf.CFSG_TEMPLATE_NAME)
- InputValidation.validate_file_exist(
- TEMPLATE_DIR + TEMPLATE_NAME,
- "The provided template file does not exist")
-
- RESULT_DIR = "/tmp/apexlake/results/"
- if not os.path.isdir(RESULT_DIR):
- os.makedirs(RESULT_DIR)
-
- if cf.CFSO_RELEASE in CONF_FILE.get_variable_list(cf.CFS_OPENSTACK):
- RELEASE = CONF_FILE.get_variable(cf.CFS_OPENSTACK, cf.CFSO_RELEASE)
- if RELEASE not in allowed_releases:
- raise ValueError("Release {} is not supported".format(RELEASE))
-
- # Validate and assign Iterations
- if cf.CFSG_ITERATIONS in CONF_FILE.get_variable_list(cf.CFS_GENERAL):
- ITERATIONS = int(CONF_FILE.get_variable(cf.CFS_GENERAL,
- cf.CFSG_ITERATIONS))
- else:
- ITERATIONS = 1
-
-
-def init_log():
- global LOG
- LOG = logging.getLogger()
- debug = CONF_FILE.get_variable(cf.CFS_GENERAL, cf.CFSG_DEBUG)
- if debug == 'true' or debug == 'True':
- LOG.setLevel(level=logging.DEBUG)
- else:
- LOG.setLevel(level=logging.INFO)
- log_formatter = logging.Formatter("%(asctime)s --- %(message)s")
- file_handler = logging.FileHandler("{0}/{1}.log".format("./", "benchmark"))
- file_handler.setFormatter(log_formatter)
- file_handler.setLevel(logging.DEBUG)
- LOG.addHandler(file_handler)
-
-
-# ------------------------------------------------------
-# InfluxDB conf variables
-# ------------------------------------------------------
-def init_influxdb():
- global INFLUXDB_IP
- global INFLUXDB_PORT
- global INFLUXDB_DB_NAME
-
- INFLUXDB_IP = CONF_FILE.get_variable(cf.CFS_INFLUXDB, cf.CFSI_IDB_IP)
- INFLUXDB_PORT = CONF_FILE.get_variable(cf.CFS_INFLUXDB, cf.CFSI_IDB_PORT)
- INFLUXDB_DB_NAME = CONF_FILE.get_variable(cf.CFS_INFLUXDB,
- cf.CFSI_IDB_DB_NAME)
-
-
-# ------------------------------------------------------
-# Packet Generator conf variables
-# ------------------------------------------------------
-def init_pktgen():
- global PKTGEN
- global PKTGEN_DIR
- global PKTGEN_PROGRAM
- global PKTGEN_COREMASK
- global PKTGEN_MEMCHANNEL
- global PKTGEN_BUS_SLOT_NIC_1
- global PKTGEN_BUS_SLOT_NIC_2
- global PKTGEN_DPDK_DIRECTORY
- global PKTGEN_NAME_NIC_1
- global PKTGEN_NAME_NIC_2
-
- msg = "Section {} is not present in the configuration file".\
- format(cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_section(cf.CFS_PKTGEN, msg)
-
- pktgen_var_list = CONF_FILE.get_variable_list(cf.CFS_PKTGEN)
- PKTGEN = 'dpdk_pktgen' # default value
- if cf.CFSP_PACKET_GENERATOR in pktgen_var_list:
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_PACKET_GENERATOR, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_PACKET_GENERATOR, msg)
- PKTGEN = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_PACKET_GENERATOR)
-
- if PKTGEN not in fp.get_supported_packet_generators():
- raise ValueError('The specified packet generator is not supported '
- 'by the framework')
-
- # Check if the packet gen is dpdk_pktgen
- if PKTGEN == cf.CFSP_PG_DPDK:
- # Validation of DPDK pktgen directory
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_PKTGEN_DIRECTORY, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_PKTGEN_DIRECTORY, msg)
- PKTGEN_DIR = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_PKTGEN_DIRECTORY)
- msg = "The directory {} does not exist.".format(PKTGEN_DIR)
- PKTGEN_DIR = InputValidation.validate_directory_exist_and_format(
- PKTGEN_DIR, msg)
-
- # Validation of the DPDK program name
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_PROGRAM_NAME, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_PROGRAM_NAME, msg)
- PKTGEN_PROGRAM = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_PROGRAM_NAME)
-
- # Validation of the DPDK Coremask parameter
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_COREMASK, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_COREMASK, msg)
- PKTGEN_COREMASK = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_COREMASK)
-
- # Validation of the DPDK Memory Channel parameter
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_MEMORY_CHANNEL, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_MEMORY_CHANNEL, msg)
- PKTGEN_MEMCHANNEL = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_MEMORY_CHANNEL)
-
- # Validation of the DPDK Bus Slot 1
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_BUS_SLOT_NIC_1, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_BUS_SLOT_NIC_1, msg)
- PKTGEN_BUS_SLOT_NIC_1 = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_BUS_SLOT_NIC_1)
-
- # Validation of the DPDK Bus Slot 2
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_BUS_SLOT_NIC_2, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_BUS_SLOT_NIC_2, msg)
- PKTGEN_BUS_SLOT_NIC_2 = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_BUS_SLOT_NIC_2)
-
- # Validation of the DPDK NIC 1
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_NAME_IF_1, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_NAME_IF_1, msg)
- PKTGEN_NAME_NIC_1 = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_NAME_IF_1)
-
- # Validation of the DPDK NIC 2
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_NAME_IF_2, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_NAME_IF_2, msg)
- PKTGEN_NAME_NIC_2 = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_NAME_IF_2)
-
- # Validation of DPDK directory parameter
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_DPDK_DIRECTORY, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_DPDK_DIRECTORY, msg)
- PKTGEN_DPDK_DIRECTORY = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_DPDK_DIRECTORY)
- msg = "Directory {} does not exist".format(
- cf.CFSP_DPDK_DPDK_DIRECTORY)
- PKTGEN_DPDK_DIRECTORY = InputValidation.\
- validate_directory_exist_and_format(PKTGEN_DPDK_DIRECTORY, msg)
-
-
-# ------------------------------------------------------
-# Configuration file access
-# ------------------------------------------------------
-
-class ConfigurationFile:
- """
- Used to extract data from the configuration file
- """
-
- def __init__(self, sections, config_file='conf.cfg'):
- """
- Reads configuration file sections
-
- :param sections: list of strings representing the sections to be
- loaded
- :param config_file: name of the configuration file (string)
- :return: None
- """
- InputValidation.validate_string(
- config_file, "The configuration file name must be a string")
- # config_file = BASE_DIR + config_file
- InputValidation.validate_file_exist(
- config_file, 'The provided configuration file does not exist')
- self.config = six.moves.configparser.ConfigParser()
- self.config.read(config_file)
- for section in sections:
- setattr(
- self, section, ConfigurationFile.
- _config_section_map(section, self.config))
-
- @staticmethod
- def _config_section_map(section, config_file):
- """
- Returns a dictionary with the configuration values for the specific
- section
-
- :param section: section to be loaded (string)
- :param config_file: name of the configuration file (string)
- :return: dict
- """
- dict1 = dict()
- options = config_file.options(section)
- for option in options:
- dict1[option] = config_file.get(section, option)
- return dict1
-
- def get_variable(self, section, variable_name):
- """
- Returns the value correspondent to a variable
-
- :param section: section to be loaded (string)
- :param variable_name: name of the variable (string)
- :return: string
- """
- message = "The variable name must be a string"
- InputValidation.validate_string(variable_name, message)
- if variable_name in self.get_variable_list(section):
- sect = getattr(self, section)
- return sect[variable_name]
- else:
- exc_msg = 'Parameter {} is not in the {} section of the ' \
- 'conf file'.format(variable_name, section)
- raise ValueError(exc_msg)
-
- def get_variable_list(self, section):
- """
- Returns the list of the available variables in a section
- :param section: section to be loaded (string)
- :return: list
- """
- try:
- return getattr(self, section)
- except:
- msg = 'Section {} not found in the configuration file'.\
- format(section)
- raise ValueError(msg)
-
-
-# ------------------------------------------------------
-# Get OpenStack Credentials
-# ------------------------------------------------------
-def get_credentials():
- """
- Returns the credentials for OpenStack access from the configuration file
- :return: dictionary
- """
- credentials = dict()
- credentials[cf.CFSO_IP_CONTROLLER] = CONF_FILE.get_variable(
- cf.CFS_OPENSTACK, cf.CFSO_IP_CONTROLLER)
- credentials[cf.CFSO_HEAT_URL] = CONF_FILE.get_variable(
- cf.CFS_OPENSTACK, cf.CFSO_HEAT_URL)
- credentials[cf.CFSO_USER] = CONF_FILE.get_variable(
- cf.CFS_OPENSTACK, cf.CFSO_USER)
- credentials[cf.CFSO_PASSWORD] = CONF_FILE.get_variable(
- cf.CFS_OPENSTACK, cf.CFSO_PASSWORD)
- credentials[cf.CFSO_AUTH_URI] = CONF_FILE.get_variable(
- cf.CFS_OPENSTACK, cf.CFSO_AUTH_URI)
- credentials[cf.CFSO_PROJECT] = CONF_FILE.get_variable(
- cf.CFS_OPENSTACK, cf.CFSO_PROJECT)
- return credentials
-
-
-# ------------------------------------------------------
-# Manage files
-# ------------------------------------------------------
-
-def get_heat_template_params():
- """
- Returns the list of deployment parameters from the configuration file
- for the heat template
-
- :return: dict
- """
- heat_parameters_list = CONF_FILE.get_variable_list(
- cf.CFS_DEPLOYMENT_PARAMETERS)
- testcase_parameters = dict()
- for param in heat_parameters_list:
- testcase_parameters[param] = CONF_FILE.get_variable(
- cf.CFS_DEPLOYMENT_PARAMETERS, param)
- return testcase_parameters
-
-
-def get_testcase_params():
- """
- Returns the list of testcase parameters from the configuration file
-
- :return: dict
- """
- testcase_parameters = dict()
- parameters = CONF_FILE.get_variable_list(cf.CFS_TESTCASE_PARAMETERS)
- for param in parameters:
- testcase_parameters[param] = CONF_FILE.get_variable(
- cf.CFS_TESTCASE_PARAMETERS, param)
- return testcase_parameters
-
-
-def get_file_first_line(file_name):
- """
- Returns the first line of a file
-
- :param file_name: name of the file to be read (str)
- :return: str
- """
- message = "The name of the file must be a string"
- InputValidation.validate_string(file_name, message)
- message = 'The file {} does not exist'.format(file_name)
- InputValidation.validate_file_exist(file_name, message)
- res = open(file_name, 'r')
- return res.readline()
-
-
-def replace_in_file(file, text_to_search, text_to_replace):
- """
- Replaces a string within a file
-
- :param file: name of the file (str)
- :param text_to_search: text to be replaced
- :param text_to_replace: new text that will replace the previous
- :return: None
- """
- message = 'The text to be replaced in the file must be a string'
- InputValidation.validate_string(text_to_search, message)
- message = 'The text to replace in the file must be a string'
- InputValidation.validate_string(text_to_replace, message)
- message = "The name of the file must be a string"
- InputValidation.validate_string(file, message)
- message = "The file does not exist"
- InputValidation.validate_file_exist(file, message)
- for line in fileinput.input(file, inplace=True):
- print((line.replace(text_to_search, text_to_replace).rstrip()))
-
-
-# ------------------------------------------------------
-# Shell interaction
-# ------------------------------------------------------
-def run_command(command):
- LOG.info("Running command: {}".format(command))
- return os.system(command)
-
-
-def push_data_influxdb(data):
- ip = INFLUXDB_IP
- port = INFLUXDB_PORT
- db_name = INFLUXDB_DB_NAME
- command = "curl -i -XPOST 'http://{}:{}/write?db={}' " \
- "--data-binary {}".format(ip, port, db_name, data)
- run_command(command)
-
-
-# ------------------------------------------------------
-# Expose variables to other modules
-# ------------------------------------------------------
-
-def get_base_dir():
- return BASE_DIR
-
-
-def get_template_dir():
- return TEMPLATE_DIR
-
-
-def get_result_dir():
- return RESULT_DIR
-
-
-def get_dpdk_pktgen_vars():
- if not (PKTGEN == 'dpdk_pktgen'):
- return dict()
- ret_val = dict()
- ret_val[cf.CFSP_DPDK_PKTGEN_DIRECTORY] = PKTGEN_DIR
- ret_val[cf.CFSP_DPDK_DPDK_DIRECTORY] = PKTGEN_DPDK_DIRECTORY
- ret_val[cf.CFSP_DPDK_PROGRAM_NAME] = PKTGEN_PROGRAM
- ret_val[cf.CFSP_DPDK_COREMASK] = PKTGEN_COREMASK
- ret_val[cf.CFSP_DPDK_MEMORY_CHANNEL] = PKTGEN_MEMCHANNEL
- ret_val[cf.CFSP_DPDK_BUS_SLOT_NIC_1] = PKTGEN_BUS_SLOT_NIC_1
- ret_val[cf.CFSP_DPDK_BUS_SLOT_NIC_2] = PKTGEN_BUS_SLOT_NIC_2
- ret_val[cf.CFSP_DPDK_NAME_IF_1] = PKTGEN_NAME_NIC_1
- ret_val[cf.CFSP_DPDK_NAME_IF_2] = PKTGEN_NAME_NIC_2
- return ret_val
-
-
-# ------------------------------------------------------
-# Configuration Variables from Config File
-# ------------------------------------------------------
-def get_deployment_configuration_variables_from_conf_file():
- variables = dict()
- types = dict()
- all_variables = CONF_FILE.get_variable_list(cf.CFS_EXPERIMENT_VNF)
- for var in all_variables:
- v = CONF_FILE.get_variable(cf.CFS_EXPERIMENT_VNF, var)
- type = re.findall(r'@\w*', v)
- values = re.findall(r'\"(.+?)\"', v)
- variables[var] = values
- try:
- types[var] = type[0][1:]
- except IndexError:
- LOG.debug("No type has been specified for variable " + var)
- return variables
-
-
-# ------------------------------------------------------
-# benchmarks from Config File
-# ------------------------------------------------------
-def get_benchmarks_from_conf_file():
- requested_benchmarks = list()
- benchmarks = \
- CONF_FILE.get_variable(cf.CFS_GENERAL, cf.CFSG_BENCHMARKS).split(', ')
- for benchmark in benchmarks:
- requested_benchmarks.append(benchmark)
- return requested_benchmarks
-
-
-class InputValidation(object):
-
- @staticmethod
- def validate_string(param, message):
- if not isinstance(param, str):
- raise ValueError(message)
- return True
-
- @staticmethod
- def validate_integer(param, message):
- if not isinstance(param, int):
- raise ValueError(message)
- return True
-
- @staticmethod
- def validate_dictionary(param, message):
- if not isinstance(param, dict):
- raise ValueError(message)
- return True
-
- @staticmethod
- def validate_file_exist(file_name, message):
- if not os.path.isfile(file_name):
- raise ValueError(message + ' ' + file_name)
- return True
-
- @staticmethod
- def validate_directory_exist_and_format(directory, message):
- if not os.path.isdir(directory):
- raise ValueError(message)
- if not directory.endswith('/'):
- return directory + '/'
- return directory
-
- @staticmethod
- def validate_configuration_file_parameter(section, parameter, message):
- params = CONF_FILE.get_variable_list(section)
- if parameter not in params:
- raise ValueError(message)
- return True
-
- @staticmethod
- def validate_configuration_file_section(section, message):
- if section not in cf.get_sections():
- raise ValueError(message)
- return True
-
- @staticmethod
- def validate_boolean(boolean, message):
- if isinstance(boolean, bool):
- return boolean
- if isinstance(boolean, str):
- if boolean == 'True':
- return True
- if boolean == 'False':
- return False
- raise ValueError(message)
-
- @staticmethod
- def validate_os_credentials(credentials):
- if not isinstance(credentials, dict):
- raise ValueError(
- 'The provided openstack_credentials '
- 'variable must be in dictionary format')
-
- credential_keys = ['ip_controller', 'heat_url', 'user', 'password',
- 'auth_uri', 'project']
- missing = [
- credential_key
- for credential_key in credential_keys
- if credential_key not in list(credentials.keys())
- ]
- if len(missing) == 0:
- return True
- msg = 'OpenStack Credentials Error! ' \
- 'The following parameters are missing: {}'.\
- format(", ".join(missing))
- raise ValueError(msg)
diff --git a/yardstick/vTC/apexlake/experimental_framework/constants/__init__.py b/yardstick/vTC/apexlake/experimental_framework/constants/__init__.py
deleted file mode 100644
index 8178e022d..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/constants/__init__.py
+++ /dev/null
@@ -1,17 +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.
-
-"""
-Constants
-"""
diff --git a/yardstick/vTC/apexlake/experimental_framework/constants/conf_file_sections.py b/yardstick/vTC/apexlake/experimental_framework/constants/conf_file_sections.py
deleted file mode 100644
index ce46d800a..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/constants/conf_file_sections.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.
-
-
-# ------------------------------------------------------
-# Configuration File Sections
-# ------------------------------------------------------
-CFS_PKTGEN = 'PacketGen'
-CFS_GENERAL = 'General'
-CFS_OPENSTACK = 'OpenStack'
-CFS_EXPERIMENT_VNF = 'Experiment-VNF'
-CFS_EXPERIMENT_GENERIC = 'Experiment-generic'
-CFS_TESTCASE_PARAMETERS = 'Testcase-parameters'
-CFS_DEPLOYMENT_PARAMETERS = 'Deployment-parameters'
-CFS_INFLUXDB = 'InfluxDB'
-
-
-def get_sections():
- return [
- CFS_PKTGEN,
- CFS_GENERAL,
- CFS_OPENSTACK,
- CFS_EXPERIMENT_VNF,
- # CFS_EXPERIMENT_GENERIC,
- CFS_TESTCASE_PARAMETERS,
- CFS_DEPLOYMENT_PARAMETERS,
- CFS_INFLUXDB
- # Add here eventually new sections in configuration file ...
- ]
-
-
-def get_sections_api():
- return [
- CFS_PKTGEN,
- CFS_GENERAL,
- CFS_INFLUXDB,
- CFS_OPENSTACK
- # Add here eventually new sections in configuration file ...
- ]
-
-# ------------------------------------------------------
-# General section parameters
-# ------------------------------------------------------
-CFSG_ITERATIONS = 'iterations'
-CFSG_TEMPLATE_DIR = 'template_dir'
-CFSG_TEMPLATE_NAME = 'template_base_name'
-CFSG_RESULT_DIRECTORY = 'results_directory'
-CFSG_BENCHMARKS = 'benchmarks'
-CFSG_DEBUG = 'debug'
-
-
-# ------------------------------------------------------
-# InfluxDB
-# ------------------------------------------------------
-CFSI_IDB_IP = 'influxdb_ip_address'
-CFSI_IDB_PORT = 'influxdb_port'
-CFSI_IDB_DB_NAME = 'influxdb_db_name'
-
-
-# ------------------------------------------------------
-# Packet generator section parameters
-# ------------------------------------------------------
-CFSP_PACKET_GENERATOR = 'packet_generator'
-CFSP_DPDK_PKTGEN_DIRECTORY = 'pktgen_directory'
-CFSP_DPDK_DPDK_DIRECTORY = 'dpdk_directory'
-CFSP_DPDK_PROGRAM_NAME = 'program_name'
-CFSP_DPDK_COREMASK = 'coremask'
-CFSP_DPDK_MEMORY_CHANNEL = 'memory_channels'
-CFSP_DPDK_BUS_SLOT_NIC_1 = 'bus_slot_nic_1'
-CFSP_DPDK_BUS_SLOT_NIC_2 = 'bus_slot_nic_2'
-CFSP_DPDK_NAME_IF_1 = 'name_if_1'
-CFSP_DPDK_NAME_IF_2 = 'name_if_2'
-
-
-# ------------------------------------------------------
-# Supported Packet generators
-# ------------------------------------------------------
-CFSP_PG_NONE = 'none'
-CFSP_PG_DPDK = 'dpdk_pktgen'
-
-
-# ------------------------------------------------------
-# OpenStack section variables
-# ------------------------------------------------------
-CFSO_IP_CONTROLLER = 'ip_controller'
-CFSO_HEAT_URL = 'heat_url'
-CFSO_USER = 'user'
-CFSO_PASSWORD = 'password'
-CFSO_AUTH_URI = 'auth_uri'
-CFSO_PROJECT = 'project'
-CFSO_RELEASE = 'release'
diff --git a/yardstick/vTC/apexlake/experimental_framework/constants/framework_parameters.py b/yardstick/vTC/apexlake/experimental_framework/constants/framework_parameters.py
deleted file mode 100644
index 6e651bf19..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/constants/framework_parameters.py
+++ /dev/null
@@ -1,34 +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
-from experimental_framework.constants import conf_file_sections as cfs
-
-# ------------------------------------------------------
-# Directories and file locations
-# ------------------------------------------------------
-EXPERIMENTAL_FRAMEWORK_DIR = 'experimental_framework/'
-EXPERIMENT_TEMPLATE_NAME = 'experiment'
-TEMPLATE_FILE_EXTENSION = '.yaml'
-DPDK_PKTGEN_DIR = 'packet_generators/dpdk_pktgen/'
-PCAP_DIR = 'packet_generators/pcap_files/'
-
-
-def get_supported_packet_generators():
- return [
- cfs.CFSP_PG_NONE,
- cfs.CFSP_PG_DPDK
- # Add here any other supported packet generator
- ]
diff --git a/yardstick/vTC/apexlake/experimental_framework/deployment_unit.py b/yardstick/vTC/apexlake/experimental_framework/deployment_unit.py
deleted file mode 100644
index 0bb507c51..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/deployment_unit.py
+++ /dev/null
@@ -1,120 +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 time
-
-from experimental_framework import heat_manager
-from experimental_framework import common
-
-MAX_RETRY = 3
-
-
-class DeploymentUnit:
- """
- This unit is in charge to manage the deployment of the workloads under
- test and any other workloads necessary to
- the benchmark
- """
-
- def __init__(self, openstack_credentials):
- self.heat_manager = heat_manager.HeatManager(openstack_credentials)
- self.deployed_stacks = list()
-
- def destroy_heat_template(self, stack_name):
- """
- Destroys a stack
- :param stack_name: Stack of the name to be destroyed (sting)
- :return: None
- """
- try:
- if self.heat_manager.check_stack_status(stack_name):
- if stack_name in self.deployed_stacks:
- self.deployed_stacks.remove(stack_name)
- self.heat_manager.delete_stack(stack_name)
-
- status = self.heat_manager.check_stack_status(stack_name)
- while status and 'DELETE_IN_PROGRESS' in status:
- common.LOG.info(status)
- time.sleep(5)
- status = self.heat_manager.check_stack_status(stack_name)
- return True
- except Exception:
- common.LOG.debug("check_stack_status", exc_info=True)
- return False
-
- def destroy_all_deployed_stacks(self):
- """
- Destroys all the stacks currently deployed
- :return: None
- """
- for stack in self.deployed_stacks:
- if self.heat_manager.is_stack_deployed(stack):
- self.destroy_heat_template(stack)
-
- def deploy_heat_template(self, template_file, stack_name, parameters,
- attempt=0):
- """
- Deploys a heat template and in case of failure retries 3 times
- :param template_file: full path file name of the heat template
- :param stack_name: name of the stack to deploy
- :param parameters: parameters to be given to the heat template
- :param attempt: number of current attempt
- :return: returns True in case the creation is completed
- returns False in case the creation is failed
- """
- if not os.path.isfile(template_file):
- raise ValueError('The specified file does not exist ("' +
- template_file + '")')
- try:
- self.heat_manager.create_stack(template_file, stack_name,
- parameters)
- deployed = True
- except Exception:
- common.LOG.debug("create_stack", exc_info=True)
- deployed = False
-
- if not deployed and 'COMPLETE' in \
- self.heat_manager.check_stack_status(stack_name):
- try:
- self.destroy_heat_template(stack_name)
- except Exception:
- common.LOG.debug("destroy_heat_template", exc_info=True)
-
- status = self.heat_manager.check_stack_status(stack_name)
- while status and 'CREATE_IN_PROGRESS' in status:
- time.sleep(5)
- status = self.heat_manager.check_stack_status(stack_name)
- if status and ('FAILED' in status or 'NOT_FOUND' in status):
- if attempt < MAX_RETRY:
- attempt += 1
- try:
- self.destroy_heat_template(stack_name)
- except Exception:
- common.LOG.debug("destroy_heat_template", exc_info=True)
- return self.deploy_heat_template(template_file, stack_name,
- parameters, attempt)
- else:
- try:
- self.destroy_heat_template(stack_name)
- except Exception:
- common.LOG.debug("destroy_heat_template", exc_info=True)
- finally:
- return False
- if self.heat_manager.check_stack_status(stack_name) and \
- 'COMPLETE' in self.heat_manager.\
- check_stack_status(stack_name):
- self.deployed_stacks.append(stack_name)
- return True
diff --git a/yardstick/vTC/apexlake/experimental_framework/heat_manager.py b/yardstick/vTC/apexlake/experimental_framework/heat_manager.py
deleted file mode 100644
index a3233349d..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/heat_manager.py
+++ /dev/null
@@ -1,103 +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
-from keystoneclient.v2_0 import client as keystoneClient
-from heatclient import client as heatClient
-from heatclient.common import template_utils
-
-import experimental_framework.common as common
-
-__author__ = 'vmriccox'
-
-
-class HeatManager:
-
- def __init__(self, credentials):
- self.ip_controller = credentials['ip_controller']
- self.heat_url = credentials['heat_url']
- self.user = credentials['user']
- self.password = credentials['password']
- self.auth_uri = credentials['auth_uri']
- self.project_id = credentials['project']
- self.heat = None
-
- def init_heat(self):
- keystone = keystoneClient.Client(username=self.user,
- password=self.password,
- tenant_name=self.project_id,
- auth_url=self.auth_uri)
- auth_token = keystone.auth_token
- self.heat_url = keystone.service_catalog.url_for(
- service_type='orchestration')
- self.heat = heatClient.Client('1', endpoint=self.heat_url,
- token=auth_token)
-
- def print_stacks(self, name=None):
- for stack in self.heat.stacks.list():
- if (name and stack.stack_name == name) or not name:
- common.LOG.info("Stack Name: " + stack.stack_name)
- common.LOG.info("Stack Status: " + stack.stack_status)
-
- def create_stack(self, template_file, stack_name, parameters):
- self.init_heat()
- # self.print_stacks()
- tpl_files, template = \
- template_utils.get_template_contents(template_file)
-
- fields = {
- 'template': template,
- 'files': dict(list(tpl_files.items()))
- }
- self.heat.stacks.create(stack_name=stack_name, files=fields['files'],
- template=template, parameters=parameters)
- self.print_stacks(stack_name)
-
- def is_stack_deployed(self, stack_name):
- self.init_heat()
- if stack_name in self.heat.stacks.list():
- return True
- return False
-
- def check_stack_status(self, stack_name):
- """
- Returns a string representing the status of a stack from Heat
- perspective
- :param stack_name: Name of the stack to be checked (type: str)
- :return: (type: str)
- """
- if self.heat:
- for stack in self.heat.stacks.list():
- if stack.stack_name == stack_name:
- return stack.stack_status
- return 'NOT_FOUND'
-
- def validate_heat_template(self, heat_template_file):
- self.init_heat()
- if not self.heat.stacks.validate(template=open(heat_template_file,
- 'r').read()):
- raise ValueError('The provided heat template "' +
- heat_template_file +
- '" is not in the correct format')
-
- def delete_stack(self, stack_name):
- self.init_heat()
- try:
- for stack in self.heat.stacks.list():
- if stack.stack_name == stack_name:
- self.heat.stacks.delete(stack.id)
- return True
- except Exception:
- common.LOG.debug("destroy_heat_template", exc_info=True)
- return False
diff --git a/yardstick/vTC/apexlake/experimental_framework/heat_template_generation.py b/yardstick/vTC/apexlake/experimental_framework/heat_template_generation.py
deleted file mode 100644
index bbf55853d..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/heat_template_generation.py
+++ /dev/null
@@ -1,236 +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.
-
-
-"""
-Generation of the heat templates from the base template
-"""
-
-from __future__ import absolute_import
-import os
-import shutil
-
-from oslo_serialization import jsonutils
-
-from experimental_framework import common
-from experimental_framework.constants import framework_parameters as fp
-
-
-class TreeNode:
- """
- This class represent the node of the configuration tree.\
- Each node represents a single configuration value for a single
- configuration parameter.
- """
-
- def __init__(self):
- self.up = None
- self.down = []
- self.variable_name = ''
- self.variable_value = 0
-
- def add_child(self, node):
- """
- Adds a node as a child for the current node
- :param node: node to be added as a child (type: TreeNode)
- :return: None
- """
- node.up = self
- self.down.append(node)
-
- def get_parent(self):
- """
- Returns the parent node of the current one
- :return type: TreeNode
- """
- return self.up
-
- def get_children(self):
- """
- Returns the children of the current node
- :return type: list of TreeNode
- """
- if len(self.down) == 0:
- # return [self]
- return []
- return self.down
-
- def get_variable_name(self):
- """
- Returns the name of the variable correspondent to the current node
- :return type: str
- """
- return self.variable_name
-
- def get_variable_value(self):
- """
- Returns the value of the variable correspondent to the current node
- :return type: str or int
- """
- return self.variable_value
-
- def set_variable_name(self, name):
- """
- Sets the name of the variable for the current node
- :param name: Name of the variable (type: str)
- :return None
- """
- self.variable_name = name
-
- def set_variable_value(self, value):
- """
- Sets the value of the variable for the current node
- :param value: value of the variable (type: str)
- :return None
- """
- self.variable_value = value
-
- def get_path(self):
- """
- Returns all the path from the current node to the root of the tree.
- :return type: list of TreeNode
- """
- ret_val = []
- if not self.up:
- ret_val.append(self)
- return ret_val
- for node in self.up.get_path():
- ret_val.append(node)
- ret_val.append(self)
- return ret_val
-
- def __str__(self):
- return str(self.variable_name) + " --> " + str(self.variable_value)
-
- def __repr__(self):
- return str(self.variable_name) + " = " + str(self.variable_value)
-
- @staticmethod
- def _get_leaves(node, leaves):
- """
- Returns all the leaves of a tree.
- It changes the "leaves" list.
- :param node: root of the tree (type: TreeNode)
- :param leaves: partial list of leaves (type: list of TreeNode)
- :return type: None
- """
- children = node.get_children()
- if len(children) == 0:
- leaves.append(node)
- return
- for child in children:
- TreeNode._get_leaves(child, leaves)
-
- @staticmethod
- def get_leaves(node):
- """
- Returns all the leaves of a tree.
- :param node: root of the tree (TreeNode)
- :return type: list
- """
- leaves = list()
- TreeNode._get_leaves(node, leaves)
- return leaves
-
-
-template_name = fp.EXPERIMENT_TEMPLATE_NAME
-
-
-def generates_templates(base_heat_template, deployment_configuration):
- """
- Generates the heat templates for the experiments
- :return: None
- """
- # Load useful parameters from file
- template_dir = common.get_template_dir()
- template_file_extension = fp.TEMPLATE_FILE_EXTENSION
- template_base_name = base_heat_template
-
- variables = deployment_configuration
-
- # Delete the templates eventually generated in previous running of the
- # framework
- common.LOG.info("Removing the heat templates previously generated")
- command = "rm {}{}_*".format(template_dir, template_name)
- os.system(command)
-
- # Creation of the tree with all the new configurations
- common.LOG.info("Creation of the tree with all the new configurations")
- tree = TreeNode()
- for variable in variables:
- leaves = TreeNode.get_leaves(tree)
- common.LOG.debug("LEAVES: " + str(leaves))
- common.LOG.debug("VALUES: " + str(variables[variable]))
-
- for value in variables[variable]:
- for leaf in leaves:
- new_node = TreeNode()
- new_node.set_variable_name(variable)
- new_node.set_variable_value(value)
- leaf.add_child(new_node)
-
- common.LOG.debug("CONFIGURATION TREE: " + str(tree))
-
- common.LOG.info("Heat Template and metadata file creation")
- leaves = TreeNode.get_leaves(tree)
- counter = 1
- for leaf in leaves:
- heat_template_vars = leaf.get_path()
- if os.path.isabs(template_base_name):
- base_template = template_base_name
- else:
- base_template = template_dir + template_base_name
- new_template = template_dir + template_name
- new_template += "_" + str(counter) + template_file_extension
- shutil.copy(base_template, new_template)
-
- metadata = {}
- for var in heat_template_vars:
- if var.get_variable_name():
- common.replace_in_file(new_template, "#" +
- var.get_variable_name(),
- var.get_variable_value())
- metadata[var.get_variable_name()] = var.get_variable_value()
-
- # Save the metadata on a JSON file
- with open(new_template + ".json", 'w') as outfile:
- # sort keys to maintain persistent order for git
- jsonutils.dump(metadata, outfile, sort_keys=True)
-
- common.LOG.debug("Heat Templates and Metadata file " + str(counter) +
- " created")
- counter += 1
-
- # Creation of the template files
- common.LOG.info(str(counter - 1) + " Heat Templates and Metadata files "
- "created")
-
-
-def get_all_heat_templates(template_dir, template_file_extension):
- """
- Loads and returns all the generated heat templates
- :param template_dir: directory to search in (type: str)
- :param template_file_extension: extension of the file for templates
- (type: str)
- :return: type: list
- """
- template_files = []
- for dirname, dirnames, filenames in os.walk(template_dir):
- for filename in filenames:
- if template_file_extension in filename and \
- filename.endswith(template_file_extension) and \
- template_name in filename:
- template_files.append(filename)
- template_files.sort()
- return template_files
diff --git a/yardstick/vTC/apexlake/experimental_framework/libraries/__init__.py b/yardstick/vTC/apexlake/experimental_framework/libraries/__init__.py
deleted file mode 100644
index 876e3ca31..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/libraries/__init__.py
+++ /dev/null
@@ -1,19 +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.
-
-"""
-Libraries to be used by the framework.
-"""
-
-__author__ = 'vmriccox'
diff --git a/yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/Makefile b/yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/Makefile
deleted file mode 100644
index 95a2b23b5..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/Makefile
+++ /dev/null
@@ -1,19 +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.
-
-
-CC=gcc
-LDFLAGS= -lpcap
-testsniffmake: test_sniff.c
- $(CC) $(CFLAGS) -o test_sniff test_sniff.c $(LDFLAGS)
diff --git a/yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/test_sniff.c b/yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/test_sniff.c
deleted file mode 100644
index a4eda3cff..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/test_sniff.c
+++ /dev/null
@@ -1,146 +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.
-
-#include <pcap.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netinet/if_ether.h>
-
-static int expected_tos = -1;
-static int cmatch = 0;
-
-
-/* 4 bytes IP address */
-typedef struct ip_address
-{
- u_char byte1;
- u_char byte2;
- u_char byte3;
- u_char byte4;
-} ip_address;
-
-
-/* IPv4 header */
-typedef struct ip_header
-{
- u_char ver_ihl;
- u_char tos;
- u_short tlen;
- u_short identification;
- u_short flags_fo;
- u_char ttl;
- u_char proto;
- u_short crc;
- ip_address saddr;
- ip_address daddr;
- u_int op_pad;
-} ip_header;
-
-
-/* UDP header*/
-typedef struct udp_header
-{
- u_short sport; // Source port
- u_short dport; // Destination port
- u_short len; // Datagram length
- u_short crc; // Checksum
-} udp_header;
-
-
-/* Save results on file */
-void save_and_exit(int sig)
-{
- write_file();
- exit(0);
-}
-
-
-/*
- * This callback function is called for each received packet
- */
-void stats_collection(u_char *useless,
- const struct pcap_pkthdr* pkthdr,
- const u_char* packet)
-{
- ip_header *ih;
- udp_header *uh;
- u_int ip_len;
- ih = (ip_header *) (packet + 14);
- ip_len = (ih->ver_ihl & 0xf) * 4;
- u_char tos = ih->tos;
- // Counter update
- if(tos==expected_tos)
- cmatch ++;
-}
-
-
-int main(int argc,char **argv)
-{
- int i;
- char *dev;
- char errbuf[PCAP_ERRBUF_SIZE];
- pcap_t* descr;
- const u_char *packet;
- struct pcap_pkthdr hdr;
- struct ether_header *eptr;
-
- if(argc != 3)
- {
- fprintf(stdout,"Usage: %s interface_name expected_tos\n", argv[0]);
- exit(1);
- }
-
- expected_tos = atoi(argv[2]);
-
- /* Setup signal to stop the sniffer */
- signal(SIGTERM, save_and_exit);
-
- /* Take a device to read from */
- dev = argv[1];
- if(dev == NULL)
- {
- printf("%s\n",errbuf);
- exit(1);
- }
-
- /* Open device for reading */
- descr = pcap_open_live(dev, BUFSIZ, 0, -1, errbuf);
- if(descr == NULL)
- {
- printf("pcap_open_live(): %s\n", errbuf);
- exit(1);
- }
-
- /* Start the loop to be run for each packet */
- pcap_loop(descr, -1, stats_collection, NULL);
- return 0;
-}
-
-
-int write_file()
-{
- FILE *f = fopen("/tmp/apexlake/results/packet_checker.res", "w");
- if (f == NULL)
- {
- printf("Error opening file!\n");
- exit(1);
- }
- fprintf(f, "%d\n", cmatch);
- fclose(f);
-}
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/__init__.py b/yardstick/vTC/apexlake/experimental_framework/packet_generators/__init__.py
deleted file mode 100644
index 935f144f4..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/__init__.py
+++ /dev/null
@@ -1,19 +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.
-
-"""
-Packet generators
-"""
-
-__author__ = 'vmriccox'
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/base_packet_generator.py b/yardstick/vTC/apexlake/experimental_framework/packet_generators/base_packet_generator.py
deleted file mode 100644
index 57f586463..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/base_packet_generator.py
+++ /dev/null
@@ -1,32 +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 abc
-
-
-class BasePacketGenerator:
-
- def __init__(self):
- pass
-
- @abc.abstractmethod
- def send_traffic(self):
- """
- Starts the traffic generation.
- According to the specific packet generator it requires prior
- initialization
- :return: None
- """
- raise NotImplementedError("Subclass must implement abstract method")
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_packet_generator.py b/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_packet_generator.py
deleted file mode 100644
index bd81527a2..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_packet_generator.py
+++ /dev/null
@@ -1,351 +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 time
-
-
-import experimental_framework.common as common
-from experimental_framework.constants import conf_file_sections as conf_file
-from experimental_framework.constants import framework_parameters as fp
-from experimental_framework.packet_generators import base_packet_generator
-
-
-class DpdkPacketGenerator(base_packet_generator.BasePacketGenerator):
-
- def __init__(self):
- base_packet_generator.BasePacketGenerator.__init__(self)
- self.command = ''
- self.directory = ''
- self.program_name = ''
- self.command_options = list()
- self.dpdk_interfaces = -1
-
- def send_traffic(self):
- """
- Calls the packet generator and starts to send traffic
- Blocking call
- """
- current_dir = os.path.dirname(os.path.realpath(__file__))
- DpdkPacketGenerator._chdir(self.directory)
- dpdk_vars = common.get_dpdk_pktgen_vars()
- self._init_physical_nics(self.dpdk_interfaces, dpdk_vars)
- common.run_command(self.command)
- self._finalize_physical_nics(self.dpdk_interfaces, dpdk_vars)
- DpdkPacketGenerator._chdir(current_dir)
-
- def init_dpdk_pktgen(self,
- dpdk_interfaces,
- lua_script='generic_test.lua',
- pcap_file_0='',
- pcap_file_1='',
- vlan_0='',
- vlan_1=''):
- """
- Initializes internal parameters and configuration of the module.
- Needs to be called before the send_traffic
- :param dpdk_interfaces: Number of interfaces to be used (type: int)
- :param lua_script: Full path of the Lua script to be used (type: str)
- :param pcap_file_0: Full path of the Pcap file to be used for port 0
- (type: str)
- :param pcap_file_1: Full path of the Pcap file to be used for port 1
- (type: str)
- :param vlan_0: VLAN tag to be used for port 0 (type: str)
- :param vlan_1: VLAN tag to be used for port 1 (type: str)
- :return:
- """
- # Input Validation
- if pcap_file_0 and not vlan_0:
- message = 'In order to use NIC_0, the parameter vlan_0 is required'
- raise ValueError(message)
- if dpdk_interfaces > 1 and pcap_file_1 and not vlan_1:
- message = 'in order to use NIC_1, the parameter vlan_1 is required'
- raise ValueError(message)
-
- self.dpdk_interfaces = dpdk_interfaces
- vars = common.get_dpdk_pktgen_vars()
-
- lua_directory = common.get_base_dir()
- lua_directory += fp.EXPERIMENTAL_FRAMEWORK_DIR
- lua_directory += fp.DPDK_PKTGEN_DIR
-
- pcap_directory = common.get_base_dir()
- pcap_directory += fp.EXPERIMENTAL_FRAMEWORK_DIR
- pcap_directory += fp.PCAP_DIR
-
- DpdkPacketGenerator._init_input_validation(pcap_file_0,
- pcap_file_1,
- lua_script,
- pcap_directory,
- lua_directory,
- vars)
-
- self.directory = vars[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY]
- self.program_name = vars[conf_file.CFSP_DPDK_PROGRAM_NAME]
-
- core_nics = DpdkPacketGenerator.\
- _get_core_nics(dpdk_interfaces, vars[conf_file.CFSP_DPDK_COREMASK])
- self.command_options = ['-c ' + vars[conf_file.CFSP_DPDK_COREMASK],
- '-n ' + vars[conf_file.
- CFSP_DPDK_MEMORY_CHANNEL],
- '--proc-type auto',
- '--file-prefix pg',
- '-- -T',
- '-P',
- '-m "' + core_nics + '"',
- '-f ' + lua_directory + lua_script,
- '-s 0:' + pcap_directory + pcap_file_0]
-
- if pcap_file_1:
- self.command_options.append('-s 1:' + pcap_directory + pcap_file_1)
-
- # Avoid to show the output of the packet generator
- self.command_options.append('> /dev/null')
- # Prepare the command to be invoked
- self.command = 'sudo ' + self.directory + self.program_name
- for opt in self.command_options:
- self.command += (' ' + opt)
- if pcap_file_0 and vlan_0:
- DpdkPacketGenerator._change_vlan(pcap_directory, pcap_file_0,
- vlan_0)
- if pcap_file_1 and vlan_1:
- DpdkPacketGenerator._change_vlan(pcap_directory, pcap_file_1,
- vlan_1)
-
- @staticmethod
- def _get_core_nics(dpdk_interfaces, coremask):
- """
- Retruns the core_nics string to be used in the dpdk pktgen command
- :param dpdk_interfaces: number of interfaces to be used in the pktgen
- (type: int)
- :param coremask: hexadecimal value representing the cores assigned to
- the pktgen (type: str)
- :return: Returns the core nics param for pktgen (type: str)
- """
- if dpdk_interfaces == 1:
- return DpdkPacketGenerator._cores_configuration(coremask, 1, 2, 0)
- elif dpdk_interfaces == 2:
- return DpdkPacketGenerator._cores_configuration(coremask, 1, 2, 2)
- raise ValueError("This framework only supports two ports to generate "
- "traffic")
-
- @staticmethod
- def _change_vlan(pcap_directory, pcap_file, vlan):
- common.LOG.info("Changing VLAN Tag on Packet: " + pcap_file +
- ". New VLAN Tag is " + vlan)
- command = "chmod +x {}{}".format(pcap_directory, 'vlan_tag.sh')
- common.run_command(command)
- command = pcap_directory + 'vlan_tag.sh '
- command += pcap_directory + pcap_file + ' ' + vlan
- common.run_command(command)
-
- @staticmethod
- def _init_input_validation(pcap_file_0, pcap_file_1, lua_script,
- pcap_directory, lua_directory, variables):
- """
- Validates the input parameters values and raises an exception if
- there is any non valid param
- :param pcap_file_0: file name of the pcap file for NIC 0
- (it does not includes the path) (type: str)
- :param pcap_file_1: file name of the pcap file for NIC 1
- (it does not includes the path) (type: str)
- :param lua_script: file name of the lua script to be used
- (it does not includes the path) (type: str)
- :param pcap_directory: directory where the pcap files are located
- (type: str)
- :param lua_directory: directory where the lua scripts are located
- (type: str)
- :param variables: variables for the packet gen from configuration file
- (type: dict)
- :return: None
- """
- if not pcap_directory:
- raise ValueError("pcap_directory not provided correctly")
- if not pcap_file_0:
- raise ValueError("pcap_file_0 not provided correctly")
- if not pcap_file_1:
- raise ValueError("pcap_file_1 not provided correctly")
- if not lua_script:
- raise ValueError("lua_script not provided correctly")
- if not os.path.isfile(pcap_directory + pcap_file_0):
- raise ValueError("The file " + pcap_file_0 + " does not exist")
- if not os.path.isfile(pcap_directory + pcap_file_1):
- raise ValueError("The file " + pcap_file_1 + " does not exist")
- if not os.path.isfile(lua_directory + lua_script):
- raise ValueError("The file " + lua_script + " does not exist")
- for var in [conf_file.CFSP_DPDK_PKTGEN_DIRECTORY,
- conf_file.CFSP_DPDK_PROGRAM_NAME,
- conf_file.CFSP_DPDK_COREMASK,
- conf_file.CFSP_DPDK_MEMORY_CHANNEL]:
- if variables.get(var, '') == '':
- raise ValueError("The variable " + var + " does not exist")
-
- @staticmethod
- def _chdir(directory):
- """
- Changes the current directory
- :param directory: directory where to move (type: str)
- :return: None
- """
- os.chdir(directory)
-
- def _init_physical_nics(self, dpdk_interfaces, dpdk_vars):
- """
- Initializes the physical interfaces
- :param dpdk_interfaces: Number of interfaces to be used (type: int)
- :param dpdk_vars: variables from config file related to DPDK pktgen
- (type: dict)
- :return: None
- """
- if not dpdk_interfaces == 1 and not dpdk_interfaces == 2:
- raise ValueError('The number of NICs can be 1 or 2')
- # Initialize NIC 1
- # bus_address_1 = dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1]
- interface_1 = dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_1]
- common.run_command('sudo ifconfig ' + interface_1 + ' down')
- common.run_command('sudo ' +
- dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
- 'tools/dpdk_nic_bind.py --unbind ' +
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1])
- common.run_command('sudo ' +
- dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
- 'tools/dpdk_nic_bind.py --bind=igb_uio ' +
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1])
- if dpdk_interfaces == 2:
- # Initialize NIC 2
- # bus_address_2 = dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2]
- interface_2 = dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_2]
- common.run_command('sudo ifconfig ' + interface_2 + ' down')
- common.run_command('sudo ' +
- dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
- 'tools/dpdk_nic_bind.py --unbind ' +
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2])
- common.run_command('sudo ' +
- dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
- 'tools/dpdk_nic_bind.py --bind=igb_uio ' +
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2])
-
- def _finalize_physical_nics(self, dpdk_interfaces, dpdk_vars):
- """
- Finalizes the physical interfaces
- :param dpdk_interfaces: Number of interfaces to be used (type: int)
- :param dpdk_vars: variables from config file related to DPDK pktgen
- (type: dict)
- :return: None
- """
- if not dpdk_interfaces == 1 and not dpdk_interfaces == 2:
- raise ValueError('No interfaces have been indicated for packet '
- 'generation usage. Please specify one or two '
- 'NICs')
- # Initialize NIC 1
- common.run_command('sudo ' +
- dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
- 'tools/dpdk_nic_bind.py --unbind ' +
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1])
- time.sleep(5)
- common.run_command('sudo ' +
- dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
- 'tools/dpdk_nic_bind.py --bind=ixgbe ' +
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1])
- common.run_command('sudo ifconfig ' +
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_1] +
- ' up')
- if dpdk_interfaces == 2:
- # Initialize NIC 2
- common.run_command('sudo ' +
- dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
- 'tools/dpdk_nic_bind.py --unbind ' +
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2])
- time.sleep(5)
- common.run_command('sudo ' +
- dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
- 'tools/dpdk_nic_bind.py --bind=ixgbe ' +
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2])
- common.run_command('sudo ifconfig ' +
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_2] +
- ' up')
-
- @staticmethod
- def _cores_configuration(coremask, pktgen_cores=1, nic_1_cores=2,
- nic_2_cores=2):
- """
- Calculation of the core_nics parameter which is necessary for the
- packet generator to run
-
- :param coremask: Hexadecimal value indicating the cores to be assigned
- to the whole dpdk pktgen software (included the
- ones to receive and send packets from NICs)
- (type: str)
- :param pktgen_cores: number of cores to be assigned to main thread of
- the pktgen directly
- :param nic_1_cores: number of cores to be assigned to the first NIC
- :param nic_2_nics: number of cores to be assigned to the second NIC
- :return: returns the core_nics parameter (type: str)
- """
- required_cores = pktgen_cores + nic_1_cores + nic_2_cores
- bin_coremask = bin(int(coremask, 16))[2:]
- index = len(bin_coremask)
- cores = []
- while index >= 0:
- index -= 1
- if bin_coremask[index] == '1':
- core = index
- cores.append(core)
- if len(cores) < required_cores:
- raise ValueError('The provided coremask does not provide'
- ' enough cores for the DPDK packet generator')
- # ret_pktgen_cores = []
- ret_nic_1_cores = []
- ret_nic_2_cores = []
- current_core = 0
-
- if nic_2_cores > 0:
- ret_nic_2_cores.append(cores[current_core])
- current_core += 1
- if nic_2_cores > 1:
- ret_nic_2_cores.append(cores[current_core])
- current_core += 1
-
- if nic_1_cores > 0:
- ret_nic_1_cores.append(cores[current_core])
- current_core += 1
- if nic_1_cores > 1:
- ret_nic_1_cores.append(cores[current_core])
- current_core += 1
-
- # for n in range(0, pktgen_cores):
- # ret_pktgen_cores.append(cores[n])
- # for n in range(0, nic_1_cores):
- # ret_nic_1_cores.append(cores[pktgen_cores + n])
- # for n in range(0, nic_2_cores):
- # ret_nic_2_cores.append(cores[pktgen_cores + nic_1_cores + n])
-
- corenics = ''
- if nic_1_cores > 0:
- if nic_1_cores < 2:
- corenics += str(ret_nic_1_cores[0]) + '.0'
- if nic_1_cores == 2:
- corenics += '[' + str(ret_nic_1_cores[0])
- corenics += ':' + str(ret_nic_1_cores[1])
- corenics += '].0'
- if nic_2_cores > 0:
- corenics += ','
- if nic_2_cores < 2:
- corenics += str(ret_nic_2_cores[0]) + '.1'
- if nic_2_cores == 2:
- corenics += '[' + str(ret_nic_2_cores[0])
- corenics += ':' + str(ret_nic_2_cores[1])
- corenics += '].1'
- return corenics
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_pktgen/constant_traffic.lua b/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_pktgen/constant_traffic.lua
deleted file mode 100644
index 3348b286b..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_pktgen/constant_traffic.lua
+++ /dev/null
@@ -1,74 +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.
------------------------------------------------------------------------------
-
------------------------------------
------ Constant traffic sender -----
------------------------------------
-
-package.path = package.path ..";?.lua;test/?.lua;app/?.lua;../?.lua"
-require "Pktgen";
-
------ Packet Gen Configuration
-local sendport = "0";
-pktgen.vlan(sendport, "on");
-pktgen.ping4("all");
-pktgen.icmp_echo("all", "on");
-pktgen.process("all", "on");
-
-
------ Script Configuration
-local traffic_delay = 0;
-local traffic_rate = 0;
-local out_file = "";
-
-
-function start_traffic(rate)
- local endStats, diff, prev, iteration, flag, found;
- flag = false;
- found = false;
-
- -- Send traffic at the specified rate
- print("Start Generation");
- pktgen.set(sendport, "rate", rate);
- sleep(1);
- pktgen.start(sendport);
- sleep(traffic_delay);
- pktgen.stop(sendport);
- print("Stop Generation");
-
- -- Collect statistics about the experiment
- endStats = pktgen.portStats("all", "port");
- sent_packets = endStats[0].opackets
- return sent_packets;
-end
-
-
-pktgen.clr();
-print("INSTANTIATION VALIDATION TEST")
-
--- Write output on log file
-file = io.open(out_file, "w");
-
--- Start experiment
-packets = start_traffic(traffic_rate);
-print("SENT PACKETS: " .. packets);
-file:write(packets);
-
--- Close the log file
-file:close();
-
--- Quit the environment
-os.exit(1);
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_pktgen/rfc2544.lua b/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_pktgen/rfc2544.lua
deleted file mode 100644
index d20a29b03..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_pktgen/rfc2544.lua
+++ /dev/null
@@ -1,132 +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.
------------------------------------------------------------------------------
-
--------------------------------
------ RFC-2544 throughput -----
--------------------------------
-
-package.path = package.path ..";?.lua;test/?.lua;app/?.lua;../?.lua"
-require "Pktgen";
-
------ Packet Gen Configuration
-local sendport = "0";
-local recvport = "1";
-pktgen.set(recvport, "rate", 1);
-pktgen.vlan(sendport, "on");
-pktgen.ping4("all");
-pktgen.icmp_echo("all", "on");
-pktgen.process("all", "on");
-
-
------ RFC2544 Configuration
-local traffic_delay = 60; -- Time in seconds to delay.
-local multicast_delay = 15; -- Time in seconds to delay.
-local starting_rate = 100; -- Initial Rate in %
-local step = 100; -- Initial Step in %
-local down_limit = 0;
-local up_limit = 100;
-
-
--- Creation of a module
---local rfc2544 = {}
-function start_traffic(rate)
- local endStats, diff, prev, iteration, flag, found;
- flag = false;
- found = false;
-
- print("PACKET GENERATION - " .. rate .. "%\n");
-
- -- Send packet to join the multicast group
- print("Join Multicast Group");
- pktgen.start(recvport);
- sleep(multicast_delay);
- pktgen.stop(recvport);
- pktgen.clr();
-
-
- -- Send traffic at the specified rate
- print("Start Generation");
- pktgen.set(sendport, "rate", rate);
- sleep(1);
- pktgen.start(sendport);
- sleep(traffic_delay);
- pktgen.stop(sendport);
- print("Stop Generation");
- sleep(5);
-
- -- Collect statistics about the experiment
- endStats = pktgen.portStats("all", "port");
- diff = endStats[0].opackets - endStats[1].ipackets;
- if ( endStats[0].opackets <= 0) then
- diff = 0;
- else
- diff = diff / endStats[0].opackets;
- end
- pktgen.clr();
-
- print("Missing packets: " .. (diff * 100));
-
- -- Adjust variable for the next race
- prev_rate = rate;
- step = step/2;
-
- if ( diff > 0.01) then
- if(endStats[0].opackets > 0) then
- up_limit = rate;
- rate = math.floor(rate - (step));
- end
- else
- down_limit = rate;
- rate = math.floor(rate + (step));
- print("\nRATE: " .. rate .. " RECEIVED PACKETS: " .. endStats[1].ipackets .. " ");
- found = true;
- end
-
- printf("DOWN LIMIT: %d\n", down_limit);
- printf("UP LIMIT: %d\n", up_limit);
-
- if ( rate >= 100 ) then
- rate = 100;
- end
-
- if ( prev ~= rate and rate < up_limit and rate >= down_limit and step >= 1 ) then
- if (step < 1 and not found ) or (step >= 1 ) then
- return start_traffic(rate);
- end
- end
- sleep(3);
- return down_limit;
-end
-local out_file = "";
-local starting_rate = 100;
-
-pktgen.clr();
-print("RFC 2544 THROUGHPUT CALCULATION");
-
--- Write output on log file
-file = io.open(out_file, "w");
-
--- Start experiment
---rate = rfc2544.start_traffic(starting_rate)
-rate = start_traffic(starting_rate);
-print("RATE: " .. rate);
-file:write(rate);
-
--- Close the log file
-file:close();
-
--- Quit the environment
-os.exit(1);
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/LICENSE.rst b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/LICENSE.rst
deleted file mode 100644
index 9223be6c9..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/LICENSE.rst
+++ /dev/null
@@ -1,26 +0,0 @@
-Copyright (c) 2015 MediaNetLab of National Center of Scientific Research "Demokritos".
-
-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.
-
-
-This license is related to the following files included in this directory:
-
-- igmp.pcap
-- packet_1024.pcap
-- packet_1280.pcap
-- packet_128.pcap
-- packet_1514.pcap
-- packet_1518.pcap
-- packet_256.pcap
-- packet_512.pcap
-- packet_64.pcap
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/igmp.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/igmp.pcap
deleted file mode 100644
index 1b8f24b29..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/igmp.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1024.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1024.pcap
deleted file mode 100644
index 445f05a26..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1024.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_128.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_128.pcap
deleted file mode 100644
index df91f9bb9..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_128.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1280.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1280.pcap
deleted file mode 100644
index 58cb704f9..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1280.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1514.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1514.pcap
deleted file mode 100644
index be23d4e96..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1514.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1518.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1518.pcap
deleted file mode 100644
index a99c4480a..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1518.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_256.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_256.pcap
deleted file mode 100644
index 21c34c2c2..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_256.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_512.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_512.pcap
deleted file mode 100644
index 8e52ecdd8..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_512.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_64.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_64.pcap
deleted file mode 100644
index 9438270bc..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_64.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/vlan_tag.sh b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/vlan_tag.sh
deleted file mode 100755
index 8564ddd42..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/vlan_tag.sh
+++ /dev/null
@@ -1,21 +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.
-
-
-#!/bin/bash
-
-INPUT_FILE=$1
-VLAN_TAG=$2
-
-tcprewrite --enet-vlan=add --enet-vlan-tag=$VLAN_TAG --enet-vlan-cfi=0 --enet-vlan-pri=0 --infile=$INPUT_FILE --outfile=$INPUT_FILE