aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/vTC/apexlake/experimental_framework
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/vTC/apexlake/experimental_framework')
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/__init__.py9
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/api.py1
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarking_unit.py14
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/benchmark_base_class.py3
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py32
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_noisy_neighbors_benchmark.py7
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py2
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/rfc2544_throughput_benchmark.py10
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/test_benchmark.py1
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/common.py14
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/constants/framework_parameters.py1
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/deployment_unit.py23
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/heat_manager.py6
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/heat_template_generation.py1
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/base_packet_generator.py1
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_packet_generator.py10
16 files changed, 83 insertions, 52 deletions
diff --git a/yardstick/vTC/apexlake/experimental_framework/__init__.py b/yardstick/vTC/apexlake/experimental_framework/__init__.py
index d4ab29e9d..9c4eef12d 100644
--- a/yardstick/vTC/apexlake/experimental_framework/__init__.py
+++ b/yardstick/vTC/apexlake/experimental_framework/__init__.py
@@ -12,6 +12,11 @@
# 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
index e0209befd..24dd1f89a 100644
--- a/yardstick/vTC/apexlake/experimental_framework/api.py
+++ b/yardstick/vTC/apexlake/experimental_framework/api.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 experimental_framework.benchmarking_unit as b_unit
from experimental_framework import heat_template_generation, common
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarking_unit.py b/yardstick/vTC/apexlake/experimental_framework/benchmarking_unit.py
index 1963696f8..d5de308c7 100644
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarking_unit.py
+++ b/yardstick/vTC/apexlake/experimental_framework/benchmarking_unit.py
@@ -18,6 +18,7 @@ initialization, execution and finalization
'''
+from __future__ import absolute_import
import json
import time
import inspect
@@ -27,6 +28,7 @@ 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:
@@ -116,10 +118,10 @@ class BenchmarkingUnit:
"""
common.LOG.info('Run Benchmarking Unit')
- experiment = dict()
- result = dict()
- for iteration in range(0, self.iterations):
- common.LOG.info('Iteration ' + str(iteration))
+ 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)
@@ -238,7 +240,7 @@ class BenchmarkingUnit:
:return: (str) Experiment Name
"""
strings = template_file_name.split('.')
- return ".".join(strings[:(len(strings)-1)])
+ return ".".join(strings[:(len(strings) - 1)])
@staticmethod
def get_benchmark_class(complete_module_name):
@@ -253,7 +255,7 @@ class BenchmarkingUnit:
"""
strings = complete_module_name.split('.')
class_name = 'experimental_framework.benchmarks.{}'.format(strings[0])
- pkg = __import__(class_name, globals(), locals(), [], -1)
+ pkg = __import__(class_name, globals(), locals(), [], 0)
module = getattr(getattr(pkg, 'benchmarks'), strings[0])
members = inspect.getmembers(module)
for m in members:
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
diff --git a/yardstick/vTC/apexlake/experimental_framework/common.py b/yardstick/vTC/apexlake/experimental_framework/common.py
index 4bacd38a6..feea8bde6 100644
--- a/yardstick/vTC/apexlake/experimental_framework/common.py
+++ b/yardstick/vTC/apexlake/experimental_framework/common.py
@@ -12,9 +12,11 @@
# 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 ConfigParser
+import six.moves.configparser
import logging
import fileinput
from experimental_framework.constants import conf_file_sections as cf
@@ -70,7 +72,7 @@ def init(api=False):
init_conf_file(api)
init_log()
init_general_vars(api)
- if len(CONF_FILE.get_variable_list(cf.CFS_PKTGEN)) > 0:
+ if CONF_FILE.get_variable_list(cf.CFS_PKTGEN):
init_pktgen()
@@ -129,7 +131,7 @@ def init_general_vars(api=False):
RESULT_DIR = "/tmp/apexlake/results/"
if not os.path.isdir(RESULT_DIR):
- os.mkdir(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)
@@ -311,7 +313,7 @@ class ConfigurationFile:
# config_file = BASE_DIR + config_file
InputValidation.validate_file_exist(
config_file, 'The provided configuration file does not exist')
- self.config = ConfigParser.ConfigParser()
+ self.config = six.moves.configparser.ConfigParser()
self.config.read(config_file)
for section in sections:
setattr(
@@ -457,7 +459,7 @@ def replace_in_file(file, text_to_search, text_to_replace):
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())
+ print((line.replace(text_to_search, text_to_replace).rstrip()))
# ------------------------------------------------------
@@ -610,7 +612,7 @@ class InputValidation(object):
missing = [
credential_key
for credential_key in credential_keys
- if credential_key not in credentials.keys()
+ if credential_key not in list(credentials.keys())
]
if len(missing) == 0:
return True
diff --git a/yardstick/vTC/apexlake/experimental_framework/constants/framework_parameters.py b/yardstick/vTC/apexlake/experimental_framework/constants/framework_parameters.py
index 4ee3a8aa3..6e651bf19 100644
--- a/yardstick/vTC/apexlake/experimental_framework/constants/framework_parameters.py
+++ b/yardstick/vTC/apexlake/experimental_framework/constants/framework_parameters.py
@@ -13,6 +13,7 @@
# limitations under the License.
+from __future__ import absolute_import
from experimental_framework.constants import conf_file_sections as cfs
# ------------------------------------------------------
diff --git a/yardstick/vTC/apexlake/experimental_framework/deployment_unit.py b/yardstick/vTC/apexlake/experimental_framework/deployment_unit.py
index 22fec1392..0bb507c51 100644
--- a/yardstick/vTC/apexlake/experimental_framework/deployment_unit.py
+++ b/yardstick/vTC/apexlake/experimental_framework/deployment_unit.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 os
import time
@@ -50,8 +51,8 @@ class DeploymentUnit:
time.sleep(5)
status = self.heat_manager.check_stack_status(stack_name)
return True
- except Exception as e:
- common.LOG.debug(e.message)
+ except Exception:
+ common.LOG.debug("check_stack_status", exc_info=True)
return False
def destroy_all_deployed_stacks(self):
@@ -81,17 +82,16 @@ class DeploymentUnit:
self.heat_manager.create_stack(template_file, stack_name,
parameters)
deployed = True
- except Exception as e:
- common.LOG.debug(e.message)
+ 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 as e:
- common.LOG.debug(e.message)
- pass
+ 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:
@@ -102,16 +102,15 @@ class DeploymentUnit:
attempt += 1
try:
self.destroy_heat_template(stack_name)
- except Exception as e:
- common.LOG.debug(e.message)
- pass
+ 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 as e:
- common.LOG.debug(e.message)
+ except Exception:
+ common.LOG.debug("destroy_heat_template", exc_info=True)
finally:
return False
if self.heat_manager.check_stack_status(stack_name) and \
diff --git a/yardstick/vTC/apexlake/experimental_framework/heat_manager.py b/yardstick/vTC/apexlake/experimental_framework/heat_manager.py
index 7400ebd21..a3233349d 100644
--- a/yardstick/vTC/apexlake/experimental_framework/heat_manager.py
+++ b/yardstick/vTC/apexlake/experimental_framework/heat_manager.py
@@ -12,6 +12,7 @@
# 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
@@ -97,7 +98,6 @@ class HeatManager:
if stack.stack_name == stack_name:
self.heat.stacks.delete(stack.id)
return True
- except Exception as e:
- common.LOG.debug(e.message)
- pass
+ 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
index e0c1a667f..0f0af8b05 100644
--- a/yardstick/vTC/apexlake/experimental_framework/heat_template_generation.py
+++ b/yardstick/vTC/apexlake/experimental_framework/heat_template_generation.py
@@ -17,6 +17,7 @@
Generation of the heat templates from the base template
'''
+from __future__ import absolute_import
import json
import os
import shutil
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
index 4d2c6fe72..57f586463 100644
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/base_packet_generator.py
+++ b/yardstick/vTC/apexlake/experimental_framework/packet_generators/base_packet_generator.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 abc
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
index 6dc32b671..959003628 100644
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_packet_generator.py
+++ b/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_packet_generator.py
@@ -12,12 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import absolute_import
import os
-import base_packet_generator
-import experimental_framework.common as common
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):
@@ -186,8 +189,7 @@ class DpdkPacketGenerator(base_packet_generator.BasePacketGenerator):
conf_file.CFSP_DPDK_PROGRAM_NAME,
conf_file.CFSP_DPDK_COREMASK,
conf_file.CFSP_DPDK_MEMORY_CHANNEL]:
- if var not in variables.keys() or (var in variables.keys() and
- variables[var] is ''):
+ if variables.get(var, '') == '':
raise ValueError("The variable " + var + " does not exist")
@staticmethod