[odl-sfc] Fix wait_for_vnf returning vnf_id on timeout 47/29147/2
authorJuan Vidal <juan.vidal.allende@ericsson.com>
Tue, 21 Feb 2017 13:10:47 +0000 (13:10 +0000)
committerJuan Vidal <juan.vidal.allende@ericsson.com>
Tue, 21 Feb 2017 13:59:03 +0000 (13:59 +0000)
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>
functest/utils/openstack_tacker.py

index 07acc8b..8327fdb 100644 (file)
@@ -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"