aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/VIM/OpenStack
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2016-04-25 09:27:21 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2016-04-25 14:22:34 +0200
commit423db209c5efe182fd1b82c2eec0df7c38dc7c8d (patch)
treeb4eabba2f645b0e1b2879d99bf377f18465de24a /testcases/VIM/OpenStack
parentf1c352869e0114a54830d46ea3407006096138e6 (diff)
Remove backslashs for line continuation
JIRA: FUNCTEST-213 Change-Id: Ia50521cf8fcf60a847aa44fe0ea59b6e64830e92 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'testcases/VIM/OpenStack')
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/clean_openstack.py6
-rwxr-xr-xtestcases/VIM/OpenStack/CI/libraries/run_rally-cert.py116
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/run_tempest.py49
3 files changed, 83 insertions, 88 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
index c5cfb07a8..7c82a4b93 100644
--- a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
+++ b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
@@ -270,10 +270,8 @@ def remove_ports(neutron_client, ports, network_ids):
elif port['device_owner'] == 'network:router_interface':
logger.debug("Detaching port %s (subnet %s) from router %s ..."
% (port_id, subnet_id, router_id))
- if openstack_utils.\
- remove_interface_router(neutron_client,
- router_id,
- subnet_id):
+ if openstack_utils.remove_interface_router(
+ neutron_client, router_id, subnet_id):
time.sleep(5) # leave 5 seconds to detach
logger.debug(" > Done!")
else:
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
index 562c2e58e..7d37df901 100755
--- a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
@@ -99,8 +99,8 @@ with open("/home/opnfv/functest/conf/config_functest.yaml") as f:
f.close()
HOME = os.environ['HOME'] + "/"
-SCENARIOS_DIR = REPO_PATH + functest_yaml.get("general"). \
- get("directories").get("dir_rally_scn")
+SCENARIOS_DIR = REPO_PATH + functest_yaml.get("general").get(
+ "directories").get("dir_rally_scn")
TEMPLATE_DIR = SCENARIOS_DIR + "scenario/templates"
SUPPORT_DIR = SCENARIOS_DIR + "scenario/support"
@@ -110,22 +110,22 @@ TENANTS_AMOUNT = 3
ITERATIONS_AMOUNT = 10
CONCURRENCY = 4
-RESULTS_DIR = functest_yaml.get("general").get("directories"). \
- get("dir_rally_res")
-TEMPEST_CONF_FILE = functest_yaml.get("general").get("directories"). \
- get("dir_results") + '/tempest/tempest.conf'
+RESULTS_DIR = functest_yaml.get("general").get("directories").get(
+ "dir_rally_res")
+TEMPEST_CONF_FILE = functest_yaml.get("general").get("directories").get(
+ "dir_results") + '/tempest/tempest.conf'
TEST_DB = functest_yaml.get("results").get("test_db_url")
-PRIVATE_NETWORK = functest_yaml.get("general"). \
- get("openstack").get("neutron_private_net_name")
-
-GLANCE_IMAGE_NAME = functest_yaml.get("general"). \
- get("openstack").get("image_name")
-GLANCE_IMAGE_FILENAME = functest_yaml.get("general"). \
- get("openstack").get("image_file_name")
-GLANCE_IMAGE_FORMAT = functest_yaml.get("general"). \
- get("openstack").get("image_disk_format")
-GLANCE_IMAGE_PATH = functest_yaml.get("general"). \
- get("directories").get("dir_functest_data") + "/" + GLANCE_IMAGE_FILENAME
+PRIVATE_NETWORK = functest_yaml.get("general").get("openstack").get(
+ "neutron_private_net_name")
+
+GLANCE_IMAGE_NAME = functest_yaml.get("general").get("openstack").get(
+ "image_name")
+GLANCE_IMAGE_FILENAME = functest_yaml.get("general").get("openstack").get(
+ "image_file_name")
+GLANCE_IMAGE_FORMAT = functest_yaml.get("general").get("openstack").get(
+ "image_disk_format")
+GLANCE_IMAGE_PATH = functest_yaml.get("general").get("directories").get(
+ "dir_functest_data") + "/" + GLANCE_IMAGE_FILENAME
CINDER_VOLUME_TYPE_NAME = "volume_test"
@@ -188,9 +188,9 @@ def task_succeed(json_raw):
def live_migration_supported():
config = iniparse.ConfigParser()
- if config.read(TEMPEST_CONF_FILE) and \
- config.has_section('compute-feature-enabled') and \
- config.has_option('compute-feature-enabled', 'live_migration'):
+ if (config.read(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')
return False
@@ -242,12 +242,12 @@ def get_output(proc, test_name):
if args.verbose:
result += line
else:
- if "Load duration" in line or \
- "started" in line or \
- "finished" in line or \
- " Preparing" in line or \
- "+-" in line or \
- "|" in line:
+ if ("Load duration" in line or
+ "started" in line or
+ "finished" in line or
+ " Preparing" in line or
+ "+-" in line or
+ "|" in line):
result += line
elif "test scenario" in line:
result += "\n" + line
@@ -255,13 +255,13 @@ def get_output(proc, test_name):
result += line + "\n\n"
# parse output for summary report
- if "| " in line and \
- "| action" not in line and \
- "| Starting" not in line and \
- "| Completed" not in line and \
- "| ITER" not in line and \
- "| " not in line and \
- "| total" not in line:
+ if ("| " in line and
+ "| action" not in line and
+ "| Starting" not in line and
+ "| Completed" not in line and
+ "| ITER" not in line and
+ "| " not in line and
+ "| total" not in line):
nb_tests += 1
elif "| total" in line:
percentage = ((line.split('|')[8]).strip(' ')).strip('%')
@@ -316,9 +316,9 @@ def run_task(test_name):
logger.debug('Scenario fetched from : {}'.format(test_file_name))
- cmd_line = "rally task start --abort-on-sla-failure " + \
- "--task {} ".format(task_file) + \
- "--task-args \"{}\" ".format(build_task_args(test_name))
+ cmd_line = ("rally task start --abort-on-sla-failure " +
+ "--task {} ".format(task_file) +
+ "--task-args \"{}\" ".format(build_task_args(test_name)))
logger.debug('running command line : {}'.format(cmd_line))
p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE,
@@ -385,9 +385,8 @@ def main():
neutron_client = neutronclient.Client(**creds_neutron)
creds_keystone = openstack_utils.get_credentials("keystone")
keystone_client = keystoneclient.Client(**creds_keystone)
- glance_endpoint = keystone_client.\
- service_catalog.url_for(service_type='image',
- endpoint_type='publicURL')
+ glance_endpoint = keystone_client.service_catalog.url_for(
+ service_type='image', endpoint_type='publicURL')
glance_client = glanceclient.Client(1, glance_endpoint,
token=keystone_client.auth_token)
creds_cinder = openstack_utils.get_credentials("cinder")
@@ -402,8 +401,8 @@ def main():
volume_types = openstack_utils.list_volume_types(cinder_client,
private=False)
if not volume_types:
- volume_type = openstack_utils.\
- create_volume_type(cinder_client, CINDER_VOLUME_TYPE_NAME)
+ volume_type = openstack_utils.create_volume_type(
+ cinder_client, CINDER_VOLUME_TYPE_NAME)
if not volume_type:
logger.error("Failed to create volume type...")
exit(-1)
@@ -442,17 +441,17 @@ def main():
logger.debug("Test name: " + args.test_name)
run_task(args.test_name)
- report = "\n"\
- " "\
- "\n"\
- " Rally Summary Report\n"\
- "\n"\
- "+===================+============+===============+===========+"\
- "\n"\
- "| Module | Duration | nb. Test Run | Success |"\
- "\n"\
- "+===================+============+===============+===========+"\
- "\n"
+ report = ("\n"
+ " "
+ "\n"
+ " Rally Summary Report\n"
+ "\n"
+ "+===================+============+===============+===========+"
+ "\n"
+ "| Module | Duration | nb. Test Run | Success |"
+ "\n"
+ "+===================+============+===============+===========+"
+ "\n")
payload = []
# for each scenario we draw a row for the table
@@ -469,10 +468,11 @@ def main():
total_nb_tests += int(s['nb_tests'])
success = "{0:<10}".format(str(s['success']) + '%')
total_success += float(s['success'])
- report += "" + \
- "| " + name + " | " + duration + " | " + \
- nb_tests + " | " + success + "|\n" + \
- "+-------------------+------------+---------------+-----------+\n"
+ report += ("" +
+ "| " + name + " | " + duration + " | " +
+ nb_tests + " | " + success + "|\n" +
+ "+-------------------+------------"
+ "+---------------+-----------+\n")
payload.append({'module': name,
'details': {'duration': s['overall_duration'],
'nb tests': s['nb_tests'],
@@ -485,8 +485,8 @@ def main():
total_success_str = "{0:<10}".format(str(total_success) + '%')
report += "+===================+============+===============+===========+"
report += "\n"
- report += "| TOTAL: | " + total_duration_str2 + " | " + \
- total_nb_tests_str + " | " + total_success_str + "|\n"
+ report += ("| TOTAL: | " + total_duration_str2 + " | " +
+ total_nb_tests_str + " | " + total_success_str + "|\n")
report += "+===================+============+===============+===========+"
report += "\n"
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
index 8407da2c6..d8c477b37 100644
--- a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
@@ -79,25 +79,22 @@ f.close()
TEST_DB = functest_yaml.get("results").get("test_db_url")
MODE = "smoke"
-TENANT_NAME = functest_yaml.get("tempest").\
- get("identity").get("tenant_name")
-TENANT_DESCRIPTION = functest_yaml.get("tempest").\
- get("identity").get("tenant_description")
-USER_NAME = functest_yaml.get("tempest").\
- get("identity").get("user_name")
-USER_PASSWORD = functest_yaml.get("tempest").\
- get("identity").get("user_password")
-SSH_USER_REGEX = functest_yaml.get("tempest").\
- get("input-scenario").get("ssh_user_regex")
-DEPLOYMENT_MAME = functest_yaml.get("rally").\
- get("deployment_name")
-RALLY_INSTALLATION_DIR = functest_yaml.get("general").\
- get("directories").get("dir_rally_inst")
-RESULTS_DIR = functest_yaml.get("general").\
- get("directories").get("dir_results")
+TENANT_NAME = functest_yaml.get("tempest").get("identity").get("tenant_name")
+TENANT_DESCRIPTION = functest_yaml.get("tempest").get("identity").get(
+ "tenant_description")
+USER_NAME = functest_yaml.get("tempest").get("identity").get("user_name")
+USER_PASSWORD = functest_yaml.get("tempest").get("identity").get(
+ "user_password")
+SSH_USER_REGEX = functest_yaml.get("tempest").get("input-scenario").get(
+ "ssh_user_regex")
+DEPLOYMENT_MAME = functest_yaml.get("rally").get("deployment_name")
+RALLY_INSTALLATION_DIR = functest_yaml.get("general").get("directories").get(
+ "dir_rally_inst")
+RESULTS_DIR = functest_yaml.get("general").get("directories").get(
+ "dir_results")
TEMPEST_RESULTS_DIR = RESULTS_DIR + '/tempest'
-TEST_LIST_DIR = functest_yaml.get("general").\
- get("directories").get("dir_tempest_cases")
+TEST_LIST_DIR = functest_yaml.get("general").get("directories").get(
+ "dir_tempest_cases")
TEMPEST_LIST_FILE = REPO_PATH + TEST_LIST_DIR + 'test_list.txt'
TEMPEST_DEFCORE = REPO_PATH + TEST_LIST_DIR + 'defcore_req.txt'
@@ -199,8 +196,8 @@ def configure_tempest(mode):
if deployment_uuid == "":
logger.debug(" Rally deployment NOT found")
return False
- deployment_dir = RALLY_INSTALLATION_DIR + "/tempest/for-deployment-" + \
- deployment_uuid
+ deployment_dir = (RALLY_INSTALLATION_DIR + "/tempest/for-deployment-" +
+ deployment_uuid)
logger.debug("Finding tempest.conf file...")
tempest_conf_file = deployment_dir + "/tempest.conf"
@@ -255,12 +252,12 @@ def run_tempest(OPTION):
if CI_DEBUG == "true" or CI_DEBUG == "True":
subprocess.call(cmd_line, shell=True, stderr=subprocess.STDOUT)
else:
- header = "Tempest environment:\n"\
- " Installer: %s\n Scenario: %s\n Node: %s\n Date: %s\n" % \
- (os.getenv('INSTALLER_TYPE', 'Unknown'),
- os.getenv('DEPLOY_SCENARIO', 'Unknown'),
- os.getenv('NODE_NAME', 'Unknown'),
- time.strftime("%a %b %d %H:%M:%S %Z %Y"))
+ header = ("Tempest environment:\n"
+ " Installer: %s\n Scenario: %s\n Node: %s\n Date: %s\n" %
+ (os.getenv('INSTALLER_TYPE', 'Unknown'),
+ os.getenv('DEPLOY_SCENARIO', 'Unknown'),
+ os.getenv('NODE_NAME', 'Unknown'),
+ time.strftime("%a %b %d %H:%M:%S %Z %Y")))
f_stdout = open(TEMPEST_RESULTS_DIR + "/tempest.log", 'w+')
f_stderr = open(TEMPEST_RESULTS_DIR + "/tempest-error.log", 'w+')