diff options
author | jose.lausuch <jose.lausuch@ericsson.com> | 2016-04-21 10:39:19 +0200 |
---|---|---|
committer | jose.lausuch <jose.lausuch@ericsson.com> | 2016-04-21 10:46:44 +0200 |
commit | cd0cd3e5a5a099715c41ac9ad6f5697554d931c7 (patch) | |
tree | 81564de37a68af8c4d59177aa6e37b7e60c590dd /testcases/vPing/CI/libraries/vPing_userdata.py | |
parent | ef62824e0471d07a4a3a40c401fc433070d961c6 (diff) |
Remove cleanup from vPing scripts, and use the existing cleanup script
JIRA: FUNCTEST-215
Change-Id: I1ec494097a9b70de142da9f90136256535af5100
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'testcases/vPing/CI/libraries/vPing_userdata.py')
-rw-r--r-- | testcases/vPing/CI/libraries/vPing_userdata.py | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/testcases/vPing/CI/libraries/vPing_userdata.py b/testcases/vPing/CI/libraries/vPing_userdata.py index 1fc9e1d37..20a47aeaf 100644 --- a/testcases/vPing/CI/libraries/vPing_userdata.py +++ b/testcases/vPing/CI/libraries/vPing_userdata.py @@ -36,9 +36,6 @@ parser.add_argument("-d", "--debug", help="Debug mode", action="store_true") parser.add_argument("-r", "--report", help="Create json result file", action="store_true") -parser.add_argument("-n", "--noclean", - help="Don't clean the created resources for this test.", - action="store_true") args = parser.parse_args() @@ -251,80 +248,6 @@ def create_security_group(neutron_client): return sg_id -def cleanup(nova, neutron, image_id, network_dic): - if args.noclean: - logger.debug("The OpenStack resources are not deleted.") - return True - - # delete both VMs - logger.info("Cleaning up...") - if not image_exists: - logger.debug("Deleting image...") - if not openstack_utils.delete_glance_image(nova, image_id): - logger.error("Error deleting the glance image") - - vm1 = openstack_utils.get_instance_by_name(nova, NAME_VM_1) - if vm1: - logger.debug("Deleting '%s'..." % NAME_VM_1) - nova.servers.delete(vm1) - # wait until VMs are deleted - if not waitVmDeleted(nova, vm1): - logger.error( - "Instance '%s' with cannot be deleted. Status is '%s'" % ( - NAME_VM_1, openstack_utils.get_instance_status(nova, vm1))) - else: - logger.debug("Instance %s terminated." % NAME_VM_1) - - vm2 = openstack_utils.get_instance_by_name(nova, NAME_VM_2) - - if vm2: - logger.debug("Deleting '%s'..." % NAME_VM_2) - vm2 = nova.servers.find(name=NAME_VM_2) - nova.servers.delete(vm2) - - if not waitVmDeleted(nova, vm2): - logger.error( - "Instance '%s' with cannot be deleted. Status is '%s'" % ( - NAME_VM_2, openstack_utils.get_instance_status(nova, vm2))) - else: - logger.debug("Instance %s terminated." % NAME_VM_2) - - # delete created network - logger.info("Deleting network '%s'..." % NEUTRON_PRIVATE_NET_NAME) - net_id = network_dic["net_id"] - subnet_id = network_dic["subnet_id"] - router_id = network_dic["router_id"] - - if not openstack_utils.remove_interface_router(neutron, router_id, - subnet_id): - logger.error("Unable to remove subnet '%s' from router '%s'" % ( - subnet_id, router_id)) - return False - - logger.debug("Interface removed successfully") - if not openstack_utils.delete_neutron_router(neutron, router_id): - logger.error("Unable to delete router '%s'" % router_id) - return False - - logger.debug("Router deleted successfully") - - if not openstack_utils.delete_neutron_subnet(neutron, subnet_id): - logger.error("Unable to delete subnet '%s'" % subnet_id) - return False - - logger.debug( - "Subnet '%s' deleted successfully" % NEUTRON_PRIVATE_SUBNET_NAME) - - if not openstack_utils.delete_neutron_net(neutron, net_id): - logger.error("Unable to delete network '%s'" % net_id) - return False - - logger.debug( - "Network '%s' deleted successfully" % NEUTRON_PRIVATE_NET_NAME) - - return True - - def push_results(start_time_ts, duration, test_status): try: logger.debug("Pushing result into DB...") @@ -439,7 +362,6 @@ def main(): logger.error("Instance '%s' cannot be booted. Status is '%s'" % ( NAME_VM_1, openstack_utils.get_instance_status(nova_client, vm1))) - cleanup(nova_client, neutron_client, image_id, network_dic) return (EXIT_CODE) else: logger.info("Instance '%s' is ACTIVE." % NAME_VM_1) @@ -475,8 +397,6 @@ def main(): if not waitVmActive(nova_client, vm2): logger.error("Instance '%s' cannot be booted. Status is '%s'" % ( NAME_VM_2, openstack_utils.get_instance_status(nova_client, vm2))) - cleanup(nova_client, neutron_client, image_id, network_dic, - port_id1, port_id2) return (EXIT_CODE) else: logger.info("Instance '%s' is ACTIVE." % NAME_VM_2) @@ -528,8 +448,6 @@ def main(): duration = 0 logger.error("vPing FAILED") - cleanup(nova_client, neutron_client, image_id, network_dic) - if args.report: push_results(start_time_ts, duration, test_status) |