From: Juan Vidal Date: Tue, 21 Feb 2017 13:10:47 +0000 (+0000) Subject: [odl-sfc] Fix wait_for_vnf returning vnf_id on timeout X-Git-Tag: danube.1.RC1~108^2 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F47%2F29147%2F2;p=functest.git [odl-sfc] Fix wait_for_vnf returning vnf_id on timeout If the VNF does not properly boot after timeout, wait_for_vnf should return "None" to flag the error. Also, refresh the VNF on every iteration. Change-Id: I9ed7c399e689dfbace7c5c8914552e77bf45fc8f Signed-off-by: Juan Vidal --- diff --git a/functest/utils/openstack_tacker.py b/functest/utils/openstack_tacker.py index 07acc8b3a..8327fdbe2 100644 --- a/functest/utils/openstack_tacker.py +++ b/functest/utils/openstack_tacker.py @@ -176,6 +176,11 @@ def wait_for_vnf(tacker_client, vnf_id=None, vnf_name=None, timeout=60): elif vnf['status'] == 'PENDING_CREATE': time.sleep(3) timeout -= 3 + vnf = get_vnf(tacker_client, vnf_id, vnf_name) + + if (timeout < 0): + raise Exception('Timeout when booting vnf %s' % vnf['id']) + return vnf['id'] except Exception, e: logger.error("error [wait_for_vnf(tacker_client, '%s', '%s')]: %s"