From 0f5113627629c6f858b697a0b3ff141c9492d564 Mon Sep 17 00:00:00 2001 From: "jose.lausuch" Date: Tue, 19 Jul 2016 14:18:08 +0200 Subject: Exit with -1 return code if something fails in vping tests Also, turn off debug info from paramiko python module in vping_ssh JIRA: FUNCTEST-373 JIRA: FUNCTEST-374 Change-Id: I6168cae85db91b2dd6ceac591f12dd9295786b59 Signed-off-by: jose.lausuch --- testcases/OpenStack/vPing/vPing_ssh.py | 22 +++++++++++----------- testcases/OpenStack/vPing/vPing_userdata.py | 8 ++++---- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'testcases/OpenStack') diff --git a/testcases/OpenStack/vPing/vPing_ssh.py b/testcases/OpenStack/vPing/vPing_ssh.py index 2ef2dfc10..60e7baaf8 100755 --- a/testcases/OpenStack/vPing/vPing_ssh.py +++ b/testcases/OpenStack/vPing/vPing_ssh.py @@ -43,7 +43,7 @@ args = parser.parse_args() """ logging configuration """ logger = ft_logger.Logger("vping_ssh").getLogger() -paramiko.util.log_to_file("/var/log/paramiko.log") +# paramiko.util.log_to_file("/var/log/paramiko.log") REPO_PATH = os.environ['repos_dir'] + '/functest/' if not os.path.exists(REPO_PATH): @@ -195,7 +195,7 @@ def main(): GLANCE_IMAGE_PATH) if not image_id: logger.error("Failed to create a Glance image...") - return(EXIT_CODE) + exit(EXIT_CODE) logger.debug("Image '%s' with ID=%s created successfully." % (GLANCE_IMAGE_NAME, image_id)) @@ -208,7 +208,7 @@ def main(): if not network_dic: logger.error( "There has been a problem when creating the neutron network") - return(EXIT_CODE) + exit(EXIT_CODE) network_id = network_dic["net_id"] @@ -222,7 +222,7 @@ def main(): logger.error("Flavor '%s' not found." % FLAVOR) logger.info("Available flavors are: ") pMsg(nova_client.flavor.list()) - return(EXIT_CODE) + exit(EXIT_CODE) # Deleting instances if they exist servers = nova_client.servers.list() @@ -253,7 +253,7 @@ def main(): if not waitVmActive(nova_client, vm1): logger.error("Instance '%s' cannot be booted. Status is '%s'" % ( NAME_VM_1, os_utils.get_instance_status(nova_client, vm1))) - return (EXIT_CODE) + exit(EXIT_CODE) else: logger.info("Instance '%s' is ACTIVE." % NAME_VM_1) @@ -280,7 +280,7 @@ def main(): if not waitVmActive(nova_client, vm2): logger.error("Instance '%s' cannot be booted. Status is '%s'" % ( NAME_VM_2, os_utils.get_instance_status(nova_client, vm2))) - return (EXIT_CODE) + exit(EXIT_CODE) else: logger.info("Instance '%s' is ACTIVE." % NAME_VM_2) @@ -295,14 +295,14 @@ def main(): if floatip is None: logger.error("Cannot create floating IP.") - return (EXIT_CODE) + exit(EXIT_CODE) logger.info("Floating IP created: '%s'" % floatip) logger.info("Associating floating ip: '%s' to VM '%s' " % (floatip, NAME_VM_2)) if not os_utils.add_floating_ip(nova_client, vm2.id, floatip): logger.error("Cannot associate floating IP to VM.") - return (EXIT_CODE) + exit(EXIT_CODE) logger.info("Trying to establish SSH connection to %s..." % floatip) username = 'cirros' @@ -341,7 +341,7 @@ def main(): if "inet addr:" + cidr_first_octet in console_log and not got_ip: got_ip = True logger.debug("The instance '%s' succeeded to get the IP " - "from the dhcp agent.") + "from the dhcp agent." % NAME_VM_2) # if dhcp doesnt work,it shows "No lease, failing".The test will fail if "No lease, failing" in console_log and not nolease and not got_ip: @@ -354,7 +354,7 @@ def main(): if timeout == 0: # 300 sec timeout (5 min) logger.error("Cannot establish connection to IP '%s'. Aborting" % floatip) - return (EXIT_CODE) + exit(EXIT_CODE) scp = SCPClient(ssh.get_transport()) @@ -364,7 +364,7 @@ def main(): except: logger.error("Cannot SCP the file '%s' to VM '%s'" % (ping_script, floatip)) - return (EXIT_CODE) + exit(EXIT_CODE) cmd = 'chmod 755 ~/ping.sh' (stdin, stdout, stderr) = ssh.exec_command(cmd) diff --git a/testcases/OpenStack/vPing/vPing_userdata.py b/testcases/OpenStack/vPing/vPing_userdata.py index 8ea7d7905..164aea66f 100755 --- a/testcases/OpenStack/vPing/vPing_userdata.py +++ b/testcases/OpenStack/vPing/vPing_userdata.py @@ -195,7 +195,7 @@ def main(): GLANCE_IMAGE_PATH) if not image_id: logger.error("Failed to create a Glance image...") - return(EXIT_CODE) + exit(EXIT_CODE) logger.debug("Image '%s' with ID=%s created successfully." % (GLANCE_IMAGE_NAME, image_id)) @@ -208,7 +208,7 @@ def main(): if not network_dic: logger.error( "There has been a problem when creating the neutron network") - return(EXIT_CODE) + exit(EXIT_CODE) network_id = network_dic["net_id"] create_security_group(neutron_client) @@ -259,7 +259,7 @@ def main(): logger.error("Instance '%s' cannot be booted. Status is '%s'" % ( NAME_VM_1, os_utils.get_instance_status(nova_client, vm1))) - return (EXIT_CODE) + exit(EXIT_CODE) else: logger.info("Instance '%s' is ACTIVE." % NAME_VM_1) @@ -294,7 +294,7 @@ def main(): if not waitVmActive(nova_client, vm2): logger.error("Instance '%s' cannot be booted. Status is '%s'" % ( NAME_VM_2, os_utils.get_instance_status(nova_client, vm2))) - return (EXIT_CODE) + exit(EXIT_CODE) else: logger.info("Instance '%s' is ACTIVE." % NAME_VM_2) -- cgit 1.2.3-korg