From 6ff2161dd0af56bcbac49fd1417dc52031c55bf5 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Mon, 30 Jul 2018 02:13:30 +0200 Subject: Fix clean() in cloudify ims and router MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It raised exceptions in both branches [1] [1] https://build.opnfv.org/ci/view/functest/job/functest-compass-baremetal-daily-master/209/console Change-Id: I87b33cedae768f92296efa4570d2a47cd9cdbdf2 Signed-off-by: Cédric Ollivier --- functest/opnfv_tests/vnf/ims/cloudify_ims.py | 11 +++++++---- functest/opnfv_tests/vnf/router/cloudify_vrouter.py | 6 +++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py index 7ec647c69..c5003e1c6 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py @@ -97,13 +97,12 @@ class CloudifyIms(cloudify.Cloudify): "overlapping)") def execute(self): - assert super(CloudifyIms, self).execute() == 0 - # pylint: disable=too-many-locals,too-many-statements """ Deploy Cloudify Manager. network, security group, fip, VM creation """ + assert super(CloudifyIms, self).execute() == 0 start_time = time.time() self.orig_cloud.set_network_quotas( self.project.project.name, @@ -199,7 +198,7 @@ class CloudifyIms(cloudify.Cloudify): return False ellis_ip = self.cfy_client.deployments.outputs.get( - self.vnf['descriptor'].get('name'))['outputs']['ellis_ip'] + self.vnf['descriptor'].get('name'))['outputs']['ellis_ip'] self.clearwater = clearwater.ClearwaterTesting(self.case_name, ellis_ip) self.clearwater.availability_check_by_creating_numbers() @@ -247,7 +246,7 @@ class CloudifyIms(cloudify.Cloudify): dep_name = self.vnf['descriptor'].get('name') # kill existing execution self.__logger.info('Deleting the current deployment') - exec_list = self.cfy_client.executions.list(dep_name) + exec_list = self.cfy_client.executions.list() for execution in exec_list: if execution['status'] == "started": try: @@ -271,6 +270,10 @@ class CloudifyIms(cloudify.Cloudify): self.__logger.exception("Some issue during the undeployment ..") super(CloudifyIms, self).clean() + if self.image_alt: + self.cloud.delete_image(self.image_alt) + if self.flavor_alt: + self.orig_cloud.delete_flavor(self.flavor_alt.id) # ---------------------------------------------------------- diff --git a/functest/opnfv_tests/vnf/router/cloudify_vrouter.py b/functest/opnfv_tests/vnf/router/cloudify_vrouter.py index 8d9ddbd1f..79e8d801a 100644 --- a/functest/opnfv_tests/vnf/router/cloudify_vrouter.py +++ b/functest/opnfv_tests/vnf/router/cloudify_vrouter.py @@ -230,7 +230,7 @@ class CloudifyVrouter(cloudify.Cloudify): dep_name = self.vnf['descriptor'].get('name') # kill existing execution self.__logger.info('Deleting the current deployment') - exec_list = self.cfy_client.executions.list(dep_name) + exec_list = self.cfy_client.executions.list() for execution in exec_list: if execution['status'] == "started": try: @@ -251,6 +251,10 @@ class CloudifyVrouter(cloudify.Cloudify): self.__logger.exception("Some issue during the undeployment ..") super(CloudifyVrouter, self).clean() + if self.image_alt: + self.cloud.delete_image(self.image_alt) + if self.flavor_alt: + self.orig_cloud.delete_flavor(self.flavor_alt.id) def wait_for_execution(client, execution, logger, timeout=7200, ): -- cgit 1.2.3-korg