aboutsummaryrefslogtreecommitdiffstats
path: root/testcases
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
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')
-rw-r--r--testcases/Controllers/ONOS/Teston/CI/adapters/client.py4
-rw-r--r--testcases/Controllers/ONOS/Teston/CI/adapters/environment.py16
-rw-r--r--testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py4
-rw-r--r--testcases/Controllers/ONOS/Teston/CI/onosfunctest.py8
-rw-r--r--testcases/SECTests/OpenSCAP.py12
-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
-rwxr-xr-xtestcases/config_functest.py76
-rw-r--r--testcases/features/promise.py17
-rw-r--r--testcases/functest_utils.py8
-rw-r--r--testcases/openstack_utils.py135
-rw-r--r--testcases/tests/TestFunctestUtils.py5
-rw-r--r--testcases/vIMS/CI/orchestrator.py32
-rw-r--r--testcases/vIMS/CI/vIMS.py25
-rw-r--r--testcases/vPing/CI/libraries/vPing_ssh.py70
-rw-r--r--testcases/vPing/CI/libraries/vPing_userdata.py64
17 files changed, 313 insertions, 334 deletions
diff --git a/testcases/Controllers/ONOS/Teston/CI/adapters/client.py b/testcases/Controllers/ONOS/Teston/CI/adapters/client.py
index 15bb73c91..77de092e4 100644
--- a/testcases/Controllers/ONOS/Teston/CI/adapters/client.py
+++ b/testcases/Controllers/ONOS/Teston/CI/adapters/client.py
@@ -36,8 +36,8 @@ class client(environment):
self.ChangeTestCasePara(testname, self.masterusername,
self.masterpassword)
runhandle = handle
- runtest = self.home + "/OnosSystemTest/TestON/bin/cli.py run " + \
- testname
+ runtest = (self.home + "/OnosSystemTest/TestON/bin/cli.py run " +
+ testname)
runhandle.sendline(runtest)
circletime = 0
lastshowscreeninfo = ''
diff --git a/testcases/Controllers/ONOS/Teston/CI/adapters/environment.py b/testcases/Controllers/ONOS/Teston/CI/adapters/environment.py
index 4fc636aba..49f7f9632 100644
--- a/testcases/Controllers/ONOS/Teston/CI/adapters/environment.py
+++ b/testcases/Controllers/ONOS/Teston/CI/adapters/environment.py
@@ -136,8 +136,8 @@ class environment(connection):
print "try to connect " + str(host)
result = self.CheckSshNoPasswd(host)
if not result:
- print "ssh lgin failed,try to copy master publickey" + \
- "to agent " + str(host)
+ print ("ssh lgin failed,try to copy master publickey" +
+ "to agent " + str(host))
self.CopyPublicKey(host)
self.OnosPushKeys(handle, "onos-push-keys " + self.OCT, masterpass)
self.OnosPushKeys(handle, "onos-push-keys " + self.OC1, agentpass)
@@ -201,18 +201,18 @@ class environment(connection):
filepath = '/root/'
else:
filepath = '/home/' + self.masterusername + '/'
- filepath = filepath + "OnosSystemTest/TestON/tests/" \
- + testcase + "/" + testcase + ".topo"
+ filepath = (filepath + "OnosSystemTest/TestON/tests/" +
+ testcase + "/" + testcase + ".topo")
line = open(filepath, 'r').readlines()
lenall = len(line) - 1
for i in range(lenall - 2):
if("localhost" in line[i]) or ("OCT" in line[i]):
line[i + 1] = re.sub(">\w+", ">" + user, line[i + 1])
line[i + 2] = re.sub(">\w+", ">" + password, line[i + 2])
- if "OC1" in line[i] or "OC2" in line[i] or "OC3" in line[i] or \
- "OCN" in line[i] or "OCN2" in line[i]:
- line[i + 1] = re.sub(">\w+", ">root", line[i + 1])
- line[i + 2] = re.sub(">\w+", ">root", line[i + 2])
+ if ("OC1" in line[i] or "OC2" in line[i] or "OC3" in line[i] or
+ "OCN" in line[i] or "OCN2" in line[i]):
+ line[i + 1] = re.sub(">\w+", ">root", line[i + 1])
+ line[i + 2] = re.sub(">\w+", ">root", line[i + 2])
NewFile = open(filepath, 'w')
NewFile.writelines(line)
NewFile.close
diff --git a/testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py b/testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py
index a4591ac72..d4a145566 100644
--- a/testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py
+++ b/testcases/Controllers/ONOS/Teston/CI/adapters/foundation.py
@@ -67,8 +67,8 @@ class foundation:
get("onoscli_username"))
self.agentpassword = str(functest_yaml.get("ONOS").get("general").
get("onoscli_password"))
- self.runtimeout = functest_yaml.get("ONOS").\
- get("general").get("runtimeout")
+ self.runtimeout = functest_yaml.get("ONOS").get("general").get(
+ "runtimeout")
self.OCT = str(functest_yaml.get("ONOS").get("environment").get("OCT"))
self.OC1 = str(functest_yaml.get("ONOS").get("environment").get("OC1"))
self.OC2 = str(functest_yaml.get("ONOS").get("environment").get("OC2"))
diff --git a/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py b/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
index 8186e7da6..f6b7f61c7 100644
--- a/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
+++ b/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
@@ -47,10 +47,10 @@ f.close()
# onos parameters
TEST_DB = functest_yaml.get("results").get("test_db_url")
-ONOS_REPO_PATH = functest_yaml.get("general").\
- get("directories").get("dir_repos")
-ONOS_CONF_DIR = functest_yaml.get("general").\
- get("directories").get("dir_functest_conf")
+ONOS_REPO_PATH = functest_yaml.get("general").get("directories").get(
+ "dir_repos")
+ONOS_CONF_DIR = functest_yaml.get("general").get("directories").get(
+ "dir_functest_conf")
REPO_PATH = ONOS_REPO_PATH + '/functest/'
if not os.path.exists(REPO_PATH):
logger.error("Functest repository directory not found '%s'" % REPO_PATH)
diff --git a/testcases/SECTests/OpenSCAP.py b/testcases/SECTests/OpenSCAP.py
index 0ab0ce3d7..40d155c1a 100644
--- a/testcases/SECTests/OpenSCAP.py
+++ b/testcases/SECTests/OpenSCAP.py
@@ -147,12 +147,12 @@ def run_scanner():
parserout.password,
com)
elif args['which'] == 'oval':
- com = '{0} oval eval --results {1}/{2}' + \
- ' --report {1}/{3} {4}'.format(oscap,
- tmpdir.rstrip(),
- parserout.results,
- parserout.report,
- parserout.secpolicy)
+ com = ('{0} oval eval --results {1}/{2}' +
+ ' --report {1}/{3} {4}'.format(oscap,
+ tmpdir.rstrip(),
+ parserout.results,
+ parserout.report,
+ parserout.secpolicy))
connect = connect.connectionManager(parserout.host,
parserout.user,
parserout.password,
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+')
diff --git a/testcases/config_functest.py b/testcases/config_functest.py
index 6db2e2b1e..942805527 100755
--- a/testcases/config_functest.py
+++ b/testcases/config_functest.py
@@ -20,8 +20,8 @@ from neutronclient.v2_0 import client as neutronclient
actions = ['start', 'check', 'clean']
parser = argparse.ArgumentParser()
-parser.add_argument("action", help="Possible actions are: \
- '{d[0]}|{d[1]}|{d[2]}' ".format(d=actions))
+parser.add_argument("action", help="Possible actions are: "
+ "'{d[0]}|{d[1]}|{d[2]}' ".format(d=actions))
parser.add_argument("-d", "--debug", help="Debug mode", action="store_true")
parser.add_argument("-f", "--force", help="Force", action="store_true")
args = parser.parse_args()
@@ -57,40 +57,40 @@ f.close()
""" global variables """
# Directories
-RALLY_DIR = FUNCTEST_REPO + functest_yaml.get("general").\
- get("directories").get("dir_rally")
-RALLY_REPO_DIR = functest_yaml.get("general").\
- get("directories").get("dir_repo_rally")
-RALLY_INSTALLATION_DIR = functest_yaml.get("general").\
- get("directories").get("dir_rally_inst")
-RALLY_RESULT_DIR = functest_yaml.get("general").\
- get("directories").get("dir_rally_res")
-TEMPEST_REPO_DIR = functest_yaml.get("general").\
- get("directories").get("dir_repo_tempest")
-VPING_DIR = FUNCTEST_REPO + functest_yaml.\
- get("general").get("directories").get("dir_vping")
-ODL_DIR = FUNCTEST_REPO + functest_yaml.\
- get("general").get("directories").get("dir_odl")
-DATA_DIR = functest_yaml.get("general").\
- get("directories").get("dir_functest_data")
+RALLY_DIR = FUNCTEST_REPO + functest_yaml.get("general").get(
+ "directories").get("dir_rally")
+RALLY_REPO_DIR = functest_yaml.get("general").get(
+ "directories").get("dir_repo_rally")
+RALLY_INSTALLATION_DIR = functest_yaml.get("general").get(
+ "directories").get("dir_rally_inst")
+RALLY_RESULT_DIR = functest_yaml.get("general").get(
+ "directories").get("dir_rally_res")
+TEMPEST_REPO_DIR = functest_yaml.get("general").get(
+ "directories").get("dir_repo_tempest")
+VPING_DIR = FUNCTEST_REPO + functest_yaml.get("general").get(
+ "directories").get("dir_vping")
+ODL_DIR = FUNCTEST_REPO + functest_yaml.get("general").get(
+ "directories").get("dir_odl")
+DATA_DIR = functest_yaml.get("general").get(
+ "directories").get("dir_functest_data")
# Tempest/Rally configuration details
DEPLOYMENT_MAME = functest_yaml.get("rally").get("deployment_name")
# Image (cirros)
-IMAGE_FILE_NAME = functest_yaml.get("general").\
- get("openstack").get("image_file_name")
+IMAGE_FILE_NAME = functest_yaml.get("general").get("openstack").get(
+ "image_file_name")
IMAGE_PATH = DATA_DIR + "/" + IMAGE_FILE_NAME
# NEUTRON Private Network parameters
-NEUTRON_PRIVATE_NET_NAME = functest_yaml.get("general"). \
- get("openstack").get("neutron_private_net_name")
-NEUTRON_PRIVATE_SUBNET_NAME = functest_yaml.get("general"). \
- get("openstack").get("neutron_private_subnet_name")
-NEUTRON_PRIVATE_SUBNET_CIDR = functest_yaml.get("general"). \
- get("openstack").get("neutron_private_subnet_cidr")
-NEUTRON_ROUTER_NAME = functest_yaml.get("general"). \
- get("openstack").get("neutron_router_name")
+NEUTRON_PRIVATE_NET_NAME = functest_yaml.get("general").get(
+ "openstack").get("neutron_private_net_name")
+NEUTRON_PRIVATE_SUBNET_NAME = functest_yaml.get("general").get(
+ "openstack").get("neutron_private_subnet_name")
+NEUTRON_PRIVATE_SUBNET_CIDR = functest_yaml.get("general").get(
+ "openstack").get("neutron_private_subnet_cidr")
+NEUTRON_ROUTER_NAME = functest_yaml.get("general").get(
+ "openstack").get("neutron_router_name")
creds_neutron = openstack_utils.get_credentials("neutron")
neutron_client = neutronclient.Client(**creds_neutron)
@@ -205,8 +205,8 @@ def install_rally():
functest_utils.execute_command(cmd, logger)
logger.debug("Installing tempest from existing repo...")
- cmd = "rally verify install --source " + TEMPEST_REPO_DIR + \
- " --system-wide"
+ cmd = ("rally verify install --source " + TEMPEST_REPO_DIR +
+ " --system-wide")
functest_utils.execute_command(cmd, logger)
cmd = "rally deployment check"
@@ -248,8 +248,8 @@ def check_rally():
def create_private_neutron_net(neutron):
neutron.format = 'json'
logger.info("Creating network '%s'..." % NEUTRON_PRIVATE_NET_NAME)
- network_id = openstack_utils. \
- create_neutron_net(neutron, NEUTRON_PRIVATE_NET_NAME)
+ network_id = openstack_utils.create_neutron_net(
+ neutron, NEUTRON_PRIVATE_NET_NAME)
if not network_id:
return False
@@ -263,17 +263,15 @@ def create_private_neutron_net(neutron):
logger.info("Updating neutron network '%s' failed" % network_id)
logger.info("Creating Subnet....")
- subnet_id = openstack_utils. \
- create_neutron_subnet(neutron,
- NEUTRON_PRIVATE_SUBNET_NAME,
- NEUTRON_PRIVATE_SUBNET_CIDR,
- network_id)
+ subnet_id = openstack_utils.create_neutron_subnet(
+ neutron, NEUTRON_PRIVATE_SUBNET_NAME, NEUTRON_PRIVATE_SUBNET_CIDR,
+ network_id)
if not subnet_id:
return False
logger.debug("Subnet '%s' created successfully." % subnet_id)
logger.info("Creating Router...")
- router_id = openstack_utils. \
- create_neutron_router(neutron, NEUTRON_ROUTER_NAME)
+ router_id = openstack_utils.create_neutron_router(neutron,
+ NEUTRON_ROUTER_NAME)
if not router_id:
return False
diff --git a/testcases/features/promise.py b/testcases/features/promise.py
index 72c5ecb3f..794841fbf 100644
--- a/testcases/features/promise.py
+++ b/testcases/features/promise.py
@@ -53,12 +53,12 @@ FLAVOR_RAM = functest_yaml.get('promise').get('general').get('flavor_ram')
FLAVOR_DISK = functest_yaml.get('promise').get('general').get('flavor_disk')
-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
+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
""" logging configuration """
logger = logging.getLogger('Promise')
@@ -141,9 +141,8 @@ def main():
"project_id": TENANT_NAME,
})
- glance_endpoint = keystone.\
- service_catalog.url_for(service_type='image',
- endpoint_type='publicURL')
+ glance_endpoint = keystone.service_catalog.url_for(
+ service_type='image', endpoint_type='publicURL')
glance = glclient.Client(1, glance_endpoint, token=keystone.auth_token)
nova = nvclient.Client("2", **nv_creds)
diff --git a/testcases/functest_utils.py b/testcases/functest_utils.py
index ded740e0d..8eba43be8 100644
--- a/testcases/functest_utils.py
+++ b/testcases/functest_utils.py
@@ -160,10 +160,10 @@ def push_results_to_db(db_url, project, case_name, logger, pod_name,
logger.debug(r)
return True
except Exception, e:
- print "Error [push_results_to_db('%s', '%s', '%s', " + \
- "'%s', '%s', '%s', '%s', '%s', '%s')]:" \
- % (db_url, project, case_name, pod_name, version,
- scenario, criteria, build_tag, payload), e
+ print ("Error [push_results_to_db('%s', '%s', '%s', " +
+ "'%s', '%s', '%s', '%s', '%s', '%s')]:" %
+ (db_url, project, case_name, pod_name, version,
+ scenario, criteria, build_tag, payload), e)
return False
diff --git a/testcases/openstack_utils.py b/testcases/openstack_utils.py
index 32eadd8af..ff3968d67 100644
--- a/testcases/openstack_utils.py
+++ b/testcases/openstack_utils.py
@@ -68,8 +68,8 @@ def get_credentials(service):
"ca_file": cacert})
creds.update({"insecure": "True", "https_insecure": "True"})
if not os.path.isfile(cacert):
- print "WARNING: The 'OS_CACERT' environment variable is " + \
- "set to %s but the file does not exist." % cacert
+ print ("WARNING: The 'OS_CACERT' environment variable is " +
+ "set to %s but the file does not exist." % cacert)
return creds
@@ -90,8 +90,8 @@ def get_instance_status(nova_client, instance):
instance = nova_client.servers.get(instance.id)
return instance.status
except:
- # print "Error [get_instance_status(nova_client, '%s')]:" % \
- # str(instance), e
+ # print ("Error [get_instance_status(nova_client, '%s')]:" %
+ # str(instance), e)
return None
@@ -100,8 +100,8 @@ def get_instance_by_name(nova_client, instance_name):
instance = nova_client.servers.find(name=instance_name)
return instance
except Exception, e:
- print "Error [get_instance_by_name(nova_client, '%s')]:" % \
- instance_name, e
+ print ("Error [get_instance_by_name(nova_client, '%s')]:" %
+ instance_name, e)
return None
@@ -138,8 +138,8 @@ def create_flavor(nova_client, flavor_name, ram, disk, vcpus):
try:
flavor = nova_client.flavors.create(flavor_name, ram, vcpus, disk)
except Exception, e:
- print "Error [create_flavor(nova_client, '%s', '%s', '%s', "\
- "'%s')]:" % (flavor_name, ram, disk, vcpus), e
+ print ("Error [create_flavor(nova_client, '%s', '%s', '%s', "
+ "'%s')]:" % (flavor_name, ram, disk, vcpus), e)
return None
return flavor.id
@@ -162,8 +162,8 @@ def add_floating_ip(nova_client, server_id, floatingip_id):
nova_client.servers.add_floating_ip(server_id, floatingip_id)
return True
except Exception, e:
- print "Error [add_floating_ip(nova_client, '%s', '%s')]:" % \
- (server_id, floatingip_id), e
+ print ("Error [add_floating_ip(nova_client, '%s', '%s')]:" %
+ (server_id, floatingip_id), e)
return False
@@ -181,8 +181,8 @@ def delete_floating_ip(nova_client, floatingip_id):
nova_client.floating_ips.delete(floatingip_id)
return True
except Exception, e:
- print "Error [delete_floating_ip(nova_client, '%s')]:" \
- % floatingip_id, e
+ print ("Error [delete_floating_ip(nova_client, '%s')]:" %
+ floatingip_id, e)
return False
@@ -295,8 +295,8 @@ def create_neutron_subnet(neutron_client, name, cidr, net_id):
subnet = neutron_client.create_subnet(body=json_body)
return subnet['subnets'][0]['id']
except Exception, e:
- print "Error [create_neutron_subnet(neutron_client, '%s', '%s', "\
- "'%s')]:" % (name, cidr, net_id), e
+ print ("Error [create_neutron_subnet(neutron_client, '%s', '%s', "
+ "'%s')]:" % (name, cidr, net_id), e)
return False
@@ -321,8 +321,8 @@ def create_neutron_port(neutron_client, name, network_id, ip):
port = neutron_client.create_port(body=json_body)
return port['port']['id']
except Exception, e:
- print "Error [create_neutron_port(neutron_client, '%s', '%s', "\
- "'%s')]:" % (name, network_id, ip), e
+ print ("Error [create_neutron_port(neutron_client, '%s', '%s', "
+ "'%s')]:" % (name, network_id, ip), e)
return False
@@ -332,8 +332,8 @@ def update_neutron_net(neutron_client, network_id, shared=False):
neutron_client.update_network(network_id, body=json_body)
return True
except Exception, e:
- print "Error [update_neutron_net(neutron_client, '%s', '%s')]:" % \
- (network_id, str(shared)), e
+ print ("Error [update_neutron_net(neutron_client, '%s', '%s')]:" %
+ (network_id, str(shared)), e)
return False
@@ -346,8 +346,8 @@ def update_neutron_port(neutron_client, port_id, device_owner):
body=json_body)
return port['port']['id']
except Exception, e:
- print "Error [update_neutron_port(neutron_client, '%s', '%s')]:" % \
- (port_id, device_owner), e
+ print ("Error [update_neutron_port(neutron_client, '%s', '%s')]:" %
+ (port_id, device_owner), e)
return False
@@ -357,8 +357,8 @@ def add_interface_router(neutron_client, router_id, subnet_id):
neutron_client.add_interface_router(router=router_id, body=json_body)
return True
except Exception, e:
- print "Error [add_interface_router(neutron_client, '%s', '%s')]:" % \
- (router_id, subnet_id), e
+ print ("Error [add_interface_router(neutron_client, '%s', '%s')]:" %
+ (router_id, subnet_id), e)
return False
@@ -369,8 +369,8 @@ def add_gateway_router(neutron_client, router_id):
neutron_client.add_gateway_router(router_id, router_dict)
return True
except Exception, e:
- print "Error [add_gateway_router(neutron_client, '%s')]:" \
- % router_id, e
+ print ("Error [add_gateway_router(neutron_client, '%s')]:" %
+ router_id, e)
return False
@@ -379,8 +379,8 @@ def delete_neutron_net(neutron_client, network_id):
neutron_client.delete_network(network_id)
return True
except Exception, e:
- print "Error [delete_neutron_net(neutron_client, '%s')]:" \
- % network_id, e
+ print ("Error [delete_neutron_net(neutron_client, '%s')]:" %
+ network_id, e)
return False
@@ -389,8 +389,8 @@ def delete_neutron_subnet(neutron_client, subnet_id):
neutron_client.delete_subnet(subnet_id)
return True
except Exception, e:
- print "Error [delete_neutron_subnet(neutron_client, '%s')]:" \
- % subnet_id, e
+ print ("Error [delete_neutron_subnet(neutron_client, '%s')]:" %
+ subnet_id, e)
return False
@@ -399,8 +399,8 @@ def delete_neutron_router(neutron_client, router_id):
neutron_client.delete_router(router=router_id)
return True
except Exception, e:
- print "Error [delete_neutron_router(neutron_client, '%s')]:" % \
- router_id, e
+ print ("Error [delete_neutron_router(neutron_client, '%s')]:" %
+ router_id, e)
return False
@@ -420,8 +420,8 @@ def remove_interface_router(neutron_client, router_id, subnet_id):
body=json_body)
return True
except Exception, e:
- print "Error [remove_interface_router(neutron_client, '%s', '%s')]:" \
- % (router_id, subnet_id), e
+ print ("Error [remove_interface_router(neutron_client, '%s', '%s')]:" %
+ (router_id, subnet_id), e)
return False
@@ -430,8 +430,8 @@ def remove_gateway_router(neutron_client, router_id):
neutron_client.remove_gateway_router(router_id)
return True
except Exception, e:
- print "Error [remove_gateway_router(neutron_client, '%s')]:" \
- % router_id, e
+ print ("Error [remove_gateway_router(neutron_client, '%s')]:" %
+ router_id, e)
return False
@@ -465,8 +465,8 @@ def create_security_group(neutron_client, sg_name, sg_description):
secgroup = neutron_client.create_security_group(json_body)
return secgroup['security_group']
except Exception, e:
- print "Error [create_security_group(neutron_client, '%s', '%s')]:" % \
- (sg_name, sg_description), e
+ print ("Error [create_security_group(neutron_client, '%s', '%s')]:" %
+ (sg_name, sg_description), e)
return False
@@ -483,20 +483,20 @@ def create_secgroup_rule(neutron_client, sg_id, direction, protocol,
'port_range_max': port_range_max,
'protocol': protocol}}
else:
- print "Error [create_secgroup_rule(neutron_client, '%s', '%s', "\
- "'%s', '%s', '%s', '%s')]:" % (neutron_client, sg_id, direction,
- port_range_min, port_range_max,
- protocol),\
- " Invalid values for port_range_min, port_range_max"
+ print ("Error [create_secgroup_rule(neutron_client, '%s', '%s', "
+ "'%s', '%s', '%s', '%s')]:" % (neutron_client, sg_id, direction,
+ port_range_min, port_range_max,
+ protocol),
+ " Invalid values for port_range_min, port_range_max")
return False
try:
neutron_client.create_security_group_rule(json_body)
return True
except Exception, e:
- print "Error [create_secgroup_rule(neutron_client, '%s', '%s', "\
- "'%s', '%s', '%s', '%s')]:" % (neutron_client, sg_id, direction,
- port_range_min, port_range_max,
- protocol), e
+ print ("Error [create_secgroup_rule(neutron_client, '%s', '%s', "
+ "'%s', '%s', '%s', '%s')]:" % (neutron_client, sg_id, direction,
+ port_range_min, port_range_max,
+ protocol), e)
return False
@@ -505,8 +505,8 @@ def add_secgroup_to_instance(nova_client, instance_id, secgroup_id):
nova_client.servers.add_security_group(instance_id, secgroup_id)
return True
except Exception, e:
- print "Error [add_secgroup_to_instance(nova_client, '%s', '%s')]: " % \
- (instance_id, secgroup_id), e
+ print ("Error [add_secgroup_to_instance(nova_client, '%s', '%s')]: " %
+ (instance_id, secgroup_id), e)
return False
@@ -521,8 +521,8 @@ def update_sg_quota(neutron_client, tenant_id, sg_quota, sg_rule_quota):
body=json_body)
return True
except Exception, e:
- print "Error [update_sg_quota(neutron_client, '%s', '%s', " \
- "'%s')]:" % (tenant_id, sg_quota, sg_rule_quota), e
+ print ("Error [update_sg_quota(neutron_client, '%s', '%s', "
+ "'%s')]:" % (tenant_id, sg_quota, sg_rule_quota), e)
return False
@@ -531,8 +531,8 @@ def delete_security_group(neutron_client, secgroup_id):
neutron_client.delete_security_group(secgroup_id)
return True
except Exception, e:
- print "Error [delete_security_group(neutron_client, '%s')]:" \
- % secgroup_id, e
+ print ("Error [delete_security_group(neutron_client, '%s')]:" %
+ secgroup_id, e)
return False
@@ -571,8 +571,8 @@ def create_glance_image(glance_client, image_name, file_path, public=True):
data=fimage)
return image.id
except Exception, e:
- print "Error [create_glance_image(glance_client, '%s', '%s', "\
- "'%s')]:" % (image_name, file_path, str(public)), e
+ print ("Error [create_glance_image(glance_client, '%s', '%s', "
+ "'%s')]:" % (image_name, file_path, str(public)), e)
return False
@@ -581,7 +581,7 @@ def delete_glance_image(nova_client, image_id):
nova_client.images.delete(image_id)
return True
except Exception, e:
- print "Error [delete_glance_image(nova_client, '%s')]:" % image_id, e
+ print ("Error [delete_glance_image(nova_client, '%s')]:" % image_id, e)
return False
@@ -629,9 +629,9 @@ def update_cinder_quota(cinder_client, tenant_id, vols_quota,
cinder_client.quotas.update(tenant_id, **quotas_values)
return True
except Exception, e:
- print "Error [update_cinder_quota(cinder_client, '%s', '%s', '%s'" \
- "'%s')]:" % (tenant_id, vols_quota,
- snapshots_quota, gigabytes_quota), e
+ print ("Error [update_cinder_quota(cinder_client, '%s', '%s', '%s'"
+ "'%s')]:" % (tenant_id, vols_quota,
+ snapshots_quota, gigabytes_quota), e)
return False
@@ -647,8 +647,8 @@ def delete_volume(cinder_client, volume_id, forced=False):
cinder_client.volumes.delete(volume_id)
return True
except Exception, e:
- print "Error [delete_volume(cinder_client, '%s', '%s')]:" % \
- (volume_id, str(forced)), e
+ print ("Error [delete_volume(cinder_client, '%s', '%s')]:" %
+ (volume_id, str(forced)), e)
return False
@@ -657,8 +657,8 @@ def delete_volume_type(cinder_client, volume_type):
cinder_client.volume_types.delete(volume_type)
return True
except Exception, e:
- print "Error [delete_volume_type(cinder_client, '%s')]:" \
- % volume_type, e
+ print ("Error [delete_volume_type(cinder_client, '%s')]:" %
+ volume_type, e)
return False
@@ -720,8 +720,8 @@ def create_tenant(keystone_client, tenant_name, tenant_description):
enabled=True)
return tenant.id
except Exception, e:
- print "Error [create_tenant(cinder_client, '%s', '%s')]:" % \
- (tenant_name, tenant_description), e
+ print ("Error [create_tenant(cinder_client, '%s', '%s')]:" %
+ (tenant_name, tenant_description), e)
return False
@@ -733,8 +733,9 @@ def create_user(keystone_client, user_name, user_password,
enabled=True)
return user.id
except Exception, e:
- print "Error [create_user(keystone_client, '%s', '%s', '%s'" \
- "'%s')]:" % (user_name, user_password, user_email, tenant_id), e
+ print ("Error [create_user(keystone_client, '%s', '%s', '%s'"
+ "'%s')]:" % (user_name, user_password, user_email, tenant_id),
+ e)
return False
@@ -743,8 +744,8 @@ def add_role_user(keystone_client, user_id, role_id, tenant_id):
keystone_client.roles.add_user_role(user_id, role_id, tenant_id)
return True
except Exception, e:
- print "Error [add_role_user(keystone_client, '%s', '%s'" \
- "'%s')]:" % (user_id, role_id, tenant_id), e
+ print ("Error [add_role_user(keystone_client, '%s', '%s'"
+ "'%s')]:" % (user_id, role_id, tenant_id), e)
return False
diff --git a/testcases/tests/TestFunctestUtils.py b/testcases/tests/TestFunctestUtils.py
index e1f81ecdf..4e06b3e48 100644
--- a/testcases/tests/TestFunctestUtils.py
+++ b/testcases/tests/TestFunctestUtils.py
@@ -83,8 +83,9 @@ class TestFunctestUtils(unittest.TestCase):
test = generateTestcaseList(functest_yaml)
- expected_list = "vping_ssh vping_userdata tempest odl doctor " + \
- "promise policy-test odl-vpn_service-tests vims rally "
+ expected_list = ("vping_ssh vping_userdata tempest odl doctor " +
+ "promise policy-test odl-vpn_service-tests vims " +
+ "rally ")
self.assertEqual(test, expected_list)
def tearDown(self):
diff --git a/testcases/vIMS/CI/orchestrator.py b/testcases/vIMS/CI/orchestrator.py
index 7dbbda716..c61f654ca 100644
--- a/testcases/vIMS/CI/orchestrator.py
+++ b/testcases/vIMS/CI/orchestrator.py
@@ -101,16 +101,16 @@ class orchestrator:
if self.logger:
self.logger.info("Launching the cloudify-manager deployment")
script = "set -e; "
- script += "source " + self.testcase_dir + \
- "venv_cloudify/bin/activate; "
+ script += ("source " + self.testcase_dir +
+ "venv_cloudify/bin/activate; ")
script += "cd " + self.testcase_dir + "; "
script += "cfy init -r; "
script += "cd cloudify-manager-blueprint; "
- script += "cfy local create-requirements -o requirements.txt " + \
- "-p openstack-manager-blueprint.yaml; "
+ script += ("cfy local create-requirements -o requirements.txt " +
+ "-p openstack-manager-blueprint.yaml; ")
script += "pip install -r requirements.txt; "
- script += "timeout 1800 cfy bootstrap --install-plugins " + \
- "-p openstack-manager-blueprint.yaml -i inputs.yaml; "
+ script += ("timeout 1800 cfy bootstrap --install-plugins " +
+ "-p openstack-manager-blueprint.yaml -i inputs.yaml; ")
cmd = "/bin/bash -c '" + script + "'"
error = execute_command(cmd, self.logger)
if error:
@@ -166,14 +166,14 @@ class orchestrator:
if self.logger:
self.logger.info("Launching the {0} deployment".format(bp_name))
script = "source " + self.testcase_dir + "venv_cloudify/bin/activate; "
- script += "cd " + self.testcase_dir + \
- blueprint['destination_folder'] + "; "
- script += "cfy blueprints upload -b " + \
- bp_name + " -p openstack-blueprint.yaml; "
- script += "cfy deployments create -b " + bp_name + \
- " -d " + dep_name + " --inputs inputs.yaml; "
- script += "cfy executions start -w install -d " \
- + dep_name + " --timeout 1800; "
+ script += ("cd " + self.testcase_dir +
+ blueprint['destination_folder'] + "; ")
+ script += ("cfy blueprints upload -b " +
+ bp_name + " -p openstack-blueprint.yaml; ")
+ script += ("cfy deployments create -b " + bp_name +
+ " -d " + dep_name + " --inputs inputs.yaml; ")
+ script += ("cfy executions start -w install -d " +
+ dep_name + " --timeout 1800; ")
cmd = "/bin/bash -c '" + script + "'"
error = execute_command(cmd, self.logger)
@@ -187,8 +187,8 @@ class orchestrator:
self.logger.info("Launching the {0} undeployment".format(dep_name))
script = "source " + self.testcase_dir + "venv_cloudify/bin/activate; "
script += "cd " + self.testcase_dir + "; "
- script += "cfy executions start -w uninstall -d " + dep_name \
- + " --timeout 1800 ; "
+ script += ("cfy executions start -w uninstall -d " + dep_name +
+ " --timeout 1800 ; ")
script += "cfy deployments delete -d " + dep_name + "; "
cmd = "/bin/bash -c '" + script + "'"
diff --git a/testcases/vIMS/CI/vIMS.py b/testcases/vIMS/CI/vIMS.py
index 555015838..6f99d5930 100644
--- a/testcases/vIMS/CI/vIMS.py
+++ b/testcases/vIMS/CI/vIMS.py
@@ -69,8 +69,8 @@ with open("/home/opnfv/functest/conf/config_functest.yaml") as f:
f.close()
# Cloudify parameters
-VIMS_DIR = REPO_PATH + \
- functest_yaml.get("general").get("directories").get("dir_vIMS")
+VIMS_DIR = (REPO_PATH +
+ functest_yaml.get("general").get("directories").get("dir_vIMS"))
VIMS_DATA_DIR = functest_yaml.get("general").get(
"directories").get("dir_vIMS_data") + "/"
VIMS_TEST_DIR = functest_yaml.get("general").get(
@@ -219,12 +219,12 @@ def test_clearwater():
resolvconf += "\nnameserver " + ns
if dns_ip != "":
- script = 'echo -e "nameserver ' + dns_ip + resolvconf + \
- '" > /etc/resolv.conf; '
+ script = ('echo -e "nameserver ' + dns_ip + resolvconf +
+ '" > /etc/resolv.conf; ')
script += 'source /etc/profile.d/rvm.sh; '
script += 'cd ' + VIMS_TEST_DIR + '; '
- script += 'rake test[' + \
- CW_INPUTS["public_domain"] + '] SIGNUP_CODE="secret"'
+ script += ('rake test[' + CW_INPUTS["public_domain"] +
+ '] SIGNUP_CODE="secret"')
cmd = "/bin/bash -c '" + script + "'"
output_file = "output.txt"
@@ -329,9 +329,8 @@ def main():
})
logger.info("Upload some OS images if it doesn't exist")
- glance_endpoint = keystone.\
- service_catalog.url_for(service_type='image',
- endpoint_type='publicURL')
+ glance_endpoint = keystone.service_catalog.url_for(
+ service_type='image', endpoint_type='publicURL')
glance = glclient.Client(1, glance_endpoint, token=keystone.auth_token)
for img in IMAGES.keys():
@@ -397,8 +396,8 @@ def main():
logger.error(
"Failed to find %s flavor. "
"Try with ram range default requirement !" % flavor_name)
- flavor_id = openstack_utils.\
- get_flavor_id_by_ram_range(nova, 4000, 8196)
+ flavor_id = openstack_utils.get_flavor_id_by_ram_range(
+ nova, 4000, 8196)
if flavor_id == '':
step_failure("orchestrator",
@@ -474,8 +473,8 @@ def main():
logger.error(
"Failed to find %s flavor. Try with ram range "
"default requirement !" % flavor_name)
- flavor_id = openstack_utils.\
- get_flavor_id_by_ram_range(nova, 4000, 8196)
+ flavor_id = openstack_utils.get_flavor_id_by_ram_range(
+ nova, 4000, 8196)
if flavor_id == '':
step_failure(
diff --git a/testcases/vPing/CI/libraries/vPing_ssh.py b/testcases/vPing/CI/libraries/vPing_ssh.py
index f7e9884ee..66b3f10e0 100644
--- a/testcases/vPing/CI/libraries/vPing_ssh.py
+++ b/testcases/vPing/CI/libraries/vPing_ssh.py
@@ -81,31 +81,28 @@ TEST_DB = functest_yaml.get("results").get("test_db_url")
NAME_VM_1 = functest_yaml.get("vping").get("vm_name_1")
NAME_VM_2 = functest_yaml.get("vping").get("vm_name_2")
GLANCE_IMAGE_NAME = functest_yaml.get("vping").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
-
+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
FLAVOR = functest_yaml.get("vping").get("vm_flavor")
# NEUTRON Private Network parameters
-NEUTRON_PRIVATE_NET_NAME = functest_yaml.get("vping"). \
- get("vping_private_net_name")
-NEUTRON_PRIVATE_SUBNET_NAME = functest_yaml.get("vping"). \
- get("vping_private_subnet_name")
-NEUTRON_PRIVATE_SUBNET_CIDR = functest_yaml.get("vping"). \
- get("vping_private_subnet_cidr")
-NEUTRON_ROUTER_NAME = functest_yaml.get("vping"). \
- get("vping_router_name")
+NEUTRON_PRIVATE_NET_NAME = functest_yaml.get("vping").get(
+ "vping_private_net_name")
+NEUTRON_PRIVATE_SUBNET_NAME = functest_yaml.get("vping").get(
+ "vping_private_subnet_name")
+NEUTRON_PRIVATE_SUBNET_CIDR = functest_yaml.get("vping").get(
+ "vping_private_subnet_cidr")
+NEUTRON_ROUTER_NAME = functest_yaml.get("vping").get(
+ "vping_router_name")
-SECGROUP_NAME = functest_yaml.get("vping"). \
- get("vping_sg_name")
-SECGROUP_DESCR = functest_yaml.get("vping"). \
- get("vping_sg_descr")
+SECGROUP_NAME = functest_yaml.get("vping").get("vping_sg_name")
+SECGROUP_DESCR = functest_yaml.get("vping").get("vping_sg_descr")
def pMsg(value):
@@ -170,24 +167,22 @@ def create_private_neutron_net(neutron):
neutron.format = 'json'
logger.info('Creating neutron network %s...'
% NEUTRON_PRIVATE_NET_NAME)
- network_id = openstack_utils. \
- create_neutron_net(neutron, NEUTRON_PRIVATE_NET_NAME)
+ network_id = openstack_utils.create_neutron_net(
+ neutron, NEUTRON_PRIVATE_NET_NAME)
if not network_id:
return False
logger.debug("Network '%s' created successfully" % network_id)
logger.debug('Creating Subnet....')
- subnet_id = openstack_utils. \
- create_neutron_subnet(neutron,
- NEUTRON_PRIVATE_SUBNET_NAME,
- NEUTRON_PRIVATE_SUBNET_CIDR,
- network_id)
+ subnet_id = openstack_utils.create_neutron_subnet(
+ neutron, NEUTRON_PRIVATE_SUBNET_NAME, NEUTRON_PRIVATE_SUBNET_CIDR,
+ network_id)
if not subnet_id:
return False
logger.debug("Subnet '%s' created successfully" % subnet_id)
logger.debug('Creating Router...')
- router_id = openstack_utils. \
- create_neutron_router(neutron, NEUTRON_ROUTER_NAME)
+ router_id = openstack_utils.create_neutron_router(
+ neutron, NEUTRON_ROUTER_NAME)
if not router_id:
return False
@@ -240,15 +235,13 @@ def create_security_group(neutron_client):
logger.debug("Adding SSH rules in security group '%s'..."
% SECGROUP_NAME)
- if not openstack_utils.\
- create_secgroup_rule(neutron_client, sg_id,
- 'ingress', 'tcp', '22', '22'):
+ if not openstack_utils.create_secgroup_rule(
+ neutron_client, sg_id, 'ingress', 'tcp', '22', '22'):
logger.error("Failed to create the security group rule...")
return False
- if not openstack_utils.\
- create_secgroup_rule(neutron_client, sg_id,
- 'egress', 'tcp', '22', '22'):
+ if not openstack_utils.create_secgroup_rule(
+ neutron_client, sg_id, 'egress', 'tcp', '22', '22'):
logger.error("Failed to create the security group rule...")
return False
return sg_id
@@ -285,9 +278,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)
EXIT_CODE = -1
@@ -438,8 +430,8 @@ def main():
console_log = vm2.get_console_output()
# print each "Sending discover" captured on the console log
- if len(re.findall("Sending discover", console_log)) > discover_count \
- and not got_ip:
+ if (len(re.findall("Sending discover", console_log)) >
+ discover_count and not got_ip):
discover_count += 1
logger.debug("Console-log '%s': Sending discover..."
% NAME_VM_2)
diff --git a/testcases/vPing/CI/libraries/vPing_userdata.py b/testcases/vPing/CI/libraries/vPing_userdata.py
index 798cf1c63..09acb2df2 100644
--- a/testcases/vPing/CI/libraries/vPing_userdata.py
+++ b/testcases/vPing/CI/libraries/vPing_userdata.py
@@ -78,31 +78,28 @@ TEST_DB = functest_yaml.get("results").get("test_db_url")
NAME_VM_1 = functest_yaml.get("vping").get("vm_name_1")
NAME_VM_2 = functest_yaml.get("vping").get("vm_name_2")
GLANCE_IMAGE_NAME = functest_yaml.get("vping").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
+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
FLAVOR = functest_yaml.get("vping").get("vm_flavor")
# NEUTRON Private Network parameters
-NEUTRON_PRIVATE_NET_NAME = functest_yaml.get("vping"). \
- get("vping_private_net_name")
-NEUTRON_PRIVATE_SUBNET_NAME = functest_yaml.get("vping"). \
- get("vping_private_subnet_name")
-NEUTRON_PRIVATE_SUBNET_CIDR = functest_yaml.get("vping"). \
- get("vping_private_subnet_cidr")
-NEUTRON_ROUTER_NAME = functest_yaml.get("vping"). \
- get("vping_router_name")
+NEUTRON_PRIVATE_NET_NAME = functest_yaml.get("vping").get(
+ "vping_private_net_name")
+NEUTRON_PRIVATE_SUBNET_NAME = functest_yaml.get("vping").get(
+ "vping_private_subnet_name")
+NEUTRON_PRIVATE_SUBNET_CIDR = functest_yaml.get("vping").get(
+ "vping_private_subnet_cidr")
+NEUTRON_ROUTER_NAME = functest_yaml.get("vping").get("vping_router_name")
-SECGROUP_NAME = functest_yaml.get("vping"). \
- get("vping_sg_name")
-SECGROUP_DESCR = functest_yaml.get("vping"). \
- get("vping_sg_descr")
+SECGROUP_NAME = functest_yaml.get("vping").get("vping_sg_name")
+SECGROUP_DESCR = functest_yaml.get("vping").get("vping_sg_descr")
def pMsg(value):
@@ -165,24 +162,22 @@ def create_private_neutron_net(neutron):
else:
neutron.format = 'json'
logger.info('Creating neutron network %s..' % NEUTRON_PRIVATE_NET_NAME)
- network_id = openstack_utils. \
- create_neutron_net(neutron, NEUTRON_PRIVATE_NET_NAME)
+ network_id = openstack_utils.create_neutron_net(
+ neutron, NEUTRON_PRIVATE_NET_NAME)
if not network_id:
return False
logger.debug("Network '%s' created successfully" % network_id)
logger.debug('Creating Subnet....')
- subnet_id = openstack_utils. \
- create_neutron_subnet(neutron,
- NEUTRON_PRIVATE_SUBNET_NAME,
- NEUTRON_PRIVATE_SUBNET_CIDR,
- network_id)
+ subnet_id = openstack_utils.create_neutron_subnet(
+ neutron, NEUTRON_PRIVATE_SUBNET_NAME, NEUTRON_PRIVATE_SUBNET_CIDR,
+ network_id)
if not subnet_id:
return False
logger.debug("Subnet '%s' created successfully" % subnet_id)
logger.debug('Creating Router...')
- router_id = openstack_utils. \
- create_neutron_router(neutron, NEUTRON_ROUTER_NAME)
+ router_id = openstack_utils.create_neutron_router(
+ neutron, NEUTRON_ROUTER_NAME)
if not router_id:
return False
@@ -279,9 +274,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)
EXIT_CODE = -1
@@ -375,9 +369,9 @@ def main():
# the long chain corresponds to the ping procedure converted with base 64
# tune (e.g. flavor, images, network) to your specific openstack
# configuration here
- u = "#!/bin/sh\n\nwhile true; do\n ping -c 1 %s 2>&1 >/dev/null\n " \
- "RES=$?\n if [ \"Z$RES\" = \"Z0\" ] ; then\n echo 'vPing OK'\n " \
- "break\n else\n echo 'vPing KO'\n fi\n sleep 1\ndone\n" % test_ip
+ u = ("#!/bin/sh\n\nwhile true; do\n ping -c 1 %s 2>&1 >/dev/null\n "
+ "RES=$?\n if [ \"Z$RES\" = \"Z0\" ] ; then\n echo 'vPing OK'\n "
+ "break\n else\n echo 'vPing KO'\n fi\n sleep 1\ndone\n" % test_ip)
# create VM
logger.info("Creating instance '%s'..." % NAME_VM_2)
@@ -421,8 +415,8 @@ def main():
logger.info("vPing duration:'%s'" % duration)
EXIT_CODE = 0
break
- elif "failed to read iid from metadata" in console_log or \
- metadata_tries > 5:
+ elif ("failed to read iid from metadata" in console_log or
+ metadata_tries > 5):
EXIT_CODE = -2
break
elif sec == PING_TIMEOUT: