summaryrefslogtreecommitdiffstats
path: root/test/functest/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functest/utils.py')
-rw-r--r--test/functest/utils.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/functest/utils.py b/test/functest/utils.py
index be08572..b75cb3b 100644
--- a/test/functest/utils.py
+++ b/test/functest/utils.py
@@ -269,3 +269,26 @@ def wait_for_bgp_router_assocs(neutron_client, bgpvpn_id, *args):
for id in args]
# Return True if all associations succeeded
return all(check)
+
+
+def wait_before_subtest(*args, **kwargs):
+ ''' This is a placeholder.
+ TODO: Replace delay with polling logic. '''
+ time.sleep(30)
+
+
+def assert_and_get_compute_nodes(nova_client, required_node_number=2):
+ """Get the compute nodes in the deployment
+
+ Exit if the deployment doesn't have enough compute nodes"""
+ compute_nodes = os_utils.get_hypervisors(nova_client)
+
+ num_compute_nodes = len(compute_nodes)
+ if num_compute_nodes < 2:
+ logger.error("There are %s compute nodes in the deployment. "
+ "Minimum number of nodes to complete the test is 2."
+ % num_compute_nodes)
+ sys.exit(-1)
+
+ logger.debug("Compute nodes: %s" % compute_nodes)
+ return compute_nodes