aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/vTC/apexlake/experimental_framework/benchmarks
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/vTC/apexlake/experimental_framework/benchmarks')
-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
7 files changed, 0 insertions, 732 deletions
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()