diff options
Diffstat (limited to 'yardstick/vTC/apexlake/experimental_framework/benchmarks')
6 files changed, 36 insertions, 19 deletions
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/benchmark_base_class.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/benchmark_base_class.py index ac7fad88e..96cce2265 100644 --- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/benchmark_base_class.py +++ b/yardstick/vTC/apexlake/experimental_framework/benchmarks/benchmark_base_class.py @@ -13,6 +13,7 @@ # limitations under the License. +from __future__ import absolute_import import abc @@ -30,7 +31,7 @@ class BenchmarkBaseClass(object): raise ValueError("Parameters need to be provided in a dict") for param in self.get_features()['parameters']: - if param not in params.keys(): + if param not in list(params.keys()): params[param] = self.get_features()['default_values'][param] for param in self.get_features()['parameters']: diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py index 320becae5..db9d449ef 100644 --- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py +++ b/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py @@ -12,16 +12,19 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import absolute_import import os -import commands # 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' @@ -36,7 +39,7 @@ class InstantiationValidationBenchmark(base.BenchmarkBaseClass): def __init__(self, name, params): base.BenchmarkBaseClass.__init__(self, name, params) - self.base_dir = "{}{}{}".format( + 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 @@ -45,10 +48,11 @@ class InstantiationValidationBenchmark(base.BenchmarkBaseClass): self.interface_name = '' # Set the packet checker command - self.pkt_checker_command = common.get_base_dir() - self.pkt_checker_command += 'experimental_framework/libraries/' - self.pkt_checker_command += 'packet_checker/' - self.pkt_checker_command += PACKET_CHECKER_PROGRAM_NAME + ' ' + self.pkt_checker_command = os.path.join( + common.get_base_dir(), + 'experimental_framework/libraries/', + 'packet_checker/', + PACKET_CHECKER_PROGRAM_NAME + ' ') def init(self): """ @@ -69,9 +73,11 @@ class InstantiationValidationBenchmark(base.BenchmarkBaseClass): features['description'] = 'Instantiation Validation Benchmark' features['parameters'] = [THROUGHPUT, VLAN_SENDER, VLAN_RECEIVER] features['allowed_values'] = dict() - features['allowed_values'][THROUGHPUT] = map(str, range(0, 100)) - features['allowed_values'][VLAN_SENDER] = map(str, range(-1, 4096)) - features['allowed_values'][VLAN_RECEIVER] = map(str, range(-1, 4096)) + 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' @@ -203,7 +209,7 @@ class InstantiationValidationBenchmark(base.BenchmarkBaseClass): # Start the packet checker current_dir = os.path.dirname(os.path.realpath(__file__)) dir_list = self.pkt_checker_command.split('/') - directory = '/'.join(dir_list[0:len(dir_list)-1]) + directory = os.pathsep.join(dir_list[0:len(dir_list) - 1]) os.chdir(directory) command = "make" common.run_command(command) @@ -245,10 +251,10 @@ class InstantiationValidationBenchmark(base.BenchmarkBaseClass): processes currently running on the host :return: type: list of int """ - output = commands.getoutput("ps -ef |pgrep " + - PACKET_CHECKER_PROGRAM_NAME) + output = subprocess.check_output( + 'pgrep "{}"'.format(PACKET_CHECKER_PROGRAM_NAME)) if not output: pids = [] else: - pids = map(int, output.split('\n')) + 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 index 1eab70c67..5569b6c12 100644 --- 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 @@ -13,8 +13,11 @@ # limitations under the License. -import instantiation_validation_benchmark as base +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' @@ -38,7 +41,7 @@ class InstantiationValidationNoisyNeighborsBenchmark( self.template_file = common.get_template_dir() + \ temp_name self.stack_name = 'neighbour' - self.neighbor_stack_names = list() + self.neighbor_stack_names = [] def get_features(self): features = super(InstantiationValidationNoisyNeighborsBenchmark, 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 index f2a87b2b2..44c9f327a 100644 --- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py +++ b/yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py @@ -13,9 +13,11 @@ # 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' diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/rfc2544_throughput_benchmark.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/rfc2544_throughput_benchmark.py index 9db62e639..5c7b55e42 100644 --- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/rfc2544_throughput_benchmark.py +++ b/yardstick/vTC/apexlake/experimental_framework/benchmarks/rfc2544_throughput_benchmark.py @@ -11,6 +11,8 @@ # 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 \ @@ -60,8 +62,10 @@ class RFC2544ThroughputBenchmark(benchmark_base_class.BenchmarkBaseClass): features['allowed_values'] = dict() features['allowed_values'][PACKET_SIZE] = ['64', '128', '256', '512', '1024', '1280', '1514'] - features['allowed_values'][VLAN_SENDER] = map(str, range(-1, 4096)) - features['allowed_values'][VLAN_RECEIVER] = map(str, range(-1, 4096)) + 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' @@ -99,7 +103,7 @@ class RFC2544ThroughputBenchmark(benchmark_base_class.BenchmarkBaseClass): :return: packet_sizes (list) """ packet_size = '1280' # default value - if PACKET_SIZE in self.params.keys() and \ + if PACKET_SIZE in list(self.params.keys()) and \ isinstance(self.params[PACKET_SIZE], str): packet_size = self.params[PACKET_SIZE] return packet_size diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/test_benchmark.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/test_benchmark.py index cbb930d21..5891832f2 100644 --- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/test_benchmark.py +++ b/yardstick/vTC/apexlake/experimental_framework/benchmarks/test_benchmark.py @@ -12,6 +12,7 @@ # 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 |