import time
import uuid
-import iniparse
import pkg_resources
import yaml
from functest.core import testcase
from functest.energy import energy
from functest.opnfv_tests.openstack.snaps import snaps_utils
+from functest.opnfv_tests.openstack.tempest import conf_utils
from functest.utils.constants import CONST
from snaps.openstack.create_flavor import FlavorSettings, OpenStackFlavor
ITERATIONS_AMOUNT = 10
CONCURRENCY = 4
RESULTS_DIR = os.path.join(CONST.__getattribute__('dir_results'), 'rally')
- TEMPEST_CONF_FILE = os.path.join(CONST.__getattribute__('dir_results'),
- 'tempest/tempest.conf')
BLACKLIST_FILE = os.path.join(RALLY_DIR, "blacklist.txt")
TEMP_DIR = os.path.join(RALLY_DIR, "var")
self.start_time = None
self.result = None
self.details = None
+ self.compute_cnt = 0
def _build_task_args(self, test_file_name):
task_args = {'service_list': [test_file_name]}
if not os.path.exists(self.TEMP_DIR):
os.makedirs(self.TEMP_DIR)
- self.apply_blacklist(scenario_file_name, test_file_name)
+ self._apply_blacklist(scenario_file_name, test_file_name)
return test_file_name
@staticmethod
return True
- @staticmethod
- def live_migration_supported():
- """Determine if live migration is supported."""
- config = iniparse.ConfigParser()
- if (config.read(RallyBase.TEMPEST_CONF_FILE) and
- config.has_section('compute-feature-enabled') and
- config.has_option('compute-feature-enabled',
- 'live_migration')):
- return config.getboolean('compute-feature-enabled',
- 'live_migration')
+ def _migration_supported(self):
+ """Determine if migration is supported."""
+ if self.compute_cnt > 1:
+ return True
return False
else:
return False
- @staticmethod
- def excl_func():
+ def excl_func(self):
"""Exclude functionalities."""
black_tests = []
func_list = []
with open(RallyBase.BLACKLIST_FILE, 'r') as black_list_file:
black_list_yaml = yaml.safe_load(black_list_file)
- if not RallyBase.live_migration_supported():
- func_list.append("no_live_migration")
+ if not self._migration_supported():
+ func_list.append("no_migration")
if 'functionality' in black_list_yaml.keys():
for item in black_list_yaml['functionality']:
return black_tests
- @staticmethod
- def apply_blacklist(case_file_name, result_file_name):
+ def _apply_blacklist(self, case_file_name, result_file_name):
"""Apply blacklist."""
LOGGER.debug("Applying blacklist...")
cases_file = open(case_file_name, 'r')
result_file = open(result_file_name, 'w')
- black_tests = list(set(RallyBase.excl_func() +
- RallyBase.excl_scenario()))
+ black_tests = list(set(self.excl_func() +
+ self.excl_scenario()))
if black_tests:
LOGGER.debug("Blacklisted tests: " + str(black_tests))
self.flavor_name = self.FLAVOR_NAME + self.guid
self.flavor_alt_name = self.FLAVOR_ALT_NAME + self.guid
self.ext_net_name = snaps_utils.get_ext_net_name(self.os_creds)
+ self.compute_cnt = snaps_utils.get_active_compute_cnt(self.os_creds)
LOGGER.debug("Creating image '%s'...", self.image_name)
image_creator = deploy_utils.create_image(
"""Run testcase."""
self.start_time = time.time()
try:
+ conf_utils.create_rally_deployment()
self._prepare_env()
self._run_tests()
self._generate_report()