diff options
author | Juan Vidal <juan.vidal.allende@ericsson.com> | 2017-02-21 13:10:47 +0000 |
---|---|---|
committer | Juan Vidal <juan.vidal.allende@ericsson.com> | 2017-02-21 13:59:03 +0000 |
commit | f4691faa65c542654d776aeb0614d35c41ab42fd (patch) | |
tree | 3b593eb07490bc6c353dc23aa4e9d8bd962df3fc /functest/utils | |
parent | c860e5488c5a1ebe69fe6dbe734372a67304f301 (diff) |
[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 <juan.vidal.allende@ericsson.com>
Diffstat (limited to 'functest/utils')
-rw-r--r-- | functest/utils/openstack_tacker.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/functest/utils/openstack_tacker.py b/functest/utils/openstack_tacker.py index 07acc8b3..8327fdbe 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" |