# Initialization and Input 'heat_templates/'validation
# ------------------------------------------------------
+
def init(api=False):
global BASE_DIR
# BASE_DIR = os.getcwd()
log_init()
general_vars_init(api)
+
def conf_file_init(api=False):
global CONF_FILE
if api:
# Check Section in Configuration File
InputValidation.validate_configuration_file_section(
- files.GENERAL,
- "Section " + files.GENERAL +
- "is not present in configuration file")
+ files.GENERAL,
+ "Section " + files.GENERAL +
+ "is not present in configuration file")
InputValidation.validate_configuration_file_section(
- files.OPENSTACK,
- "Section " + files.OPENSTACK +
- "is not present in configuration file")
+ files.OPENSTACK,
+ "Section " + files.OPENSTACK +
+ "is not present in configuration file")
TEMPLATE_DIR = '/tmp/heat_templates/'
if not api:
# Validate template name
InputValidation.validate_configuration_file_parameter(
- files.GENERAL,
- files.TEMPLATE_NAME,
- "Parameter " + files.TEMPLATE_NAME +
- "is not present in configuration file")
+ files.GENERAL,
+ files.TEMPLATE_NAME,
+ "Parameter " + files.TEMPLATE_NAME +
+ "is not present in configuration file")
TEMPLATE_NAME = CONF_FILE.get_variable(files.GENERAL,
files.TEMPLATE_NAME)
InputValidation.validate_file_exist(
# Configuration file access
# ------------------------------------------------------
+
class ConfigurationFile:
"""
Used to extract data from the configuration file
# Manage files
# ------------------------------------------------------
+
def get_heat_template_params():
"""
Returns the list of deployment parameters from the configuration file
files.DEPLOYMENT_PARAMETERS, param)
return testcase_parameters
+
def get_testcase_params():
"""
Returns the list of testcase parameters from the configuration file
files.TESTCASE_PARAMETERS, param)
return testcase_parameters
+
def get_file_first_line(file_name):
"""
Returns the first line of a file
# ------------------------------------------------------
# Shell interaction
# ------------------------------------------------------
+
+
def run_command(command):
LOG.info("Running command: {}".format(command))
return os.system(command)
# Expose variables to other modules
# ------------------------------------------------------
+
def get_base_dir():
return BASE_DIR
+
def get_template_dir():
return TEMPLATE_DIR
# ------------------------------------------------------
# Configuration Variables from Config File
# ------------------------------------------------------
+
+
def get_deployment_configuration_variables_from_conf_file():
variables = dict()
types = dict()
# ------------------------------------------------------
# benchmarks from Config File
# ------------------------------------------------------
+
+
def get_benchmarks_from_conf_file():
requested_benchmarks = list()
- benchmarks = CONF_FILE.get_variable(files.GENERAL, files.BENCHMARKS).split(', ')
+ benchmarks = CONF_FILE.get_variable(
+ files.GENERAL, files.BENCHMARKS).split(', ')
for benchmark in benchmarks:
requested_benchmarks.append(benchmark)
return requested_benchmarks
+
class InputValidation(object):
@staticmethod