aboutsummaryrefslogtreecommitdiffstats
path: root/functest/utils
diff options
context:
space:
mode:
Diffstat (limited to 'functest/utils')
-rw-r--r--functest/utils/env.py11
-rw-r--r--functest/utils/functest_utils.py47
2 files changed, 53 insertions, 5 deletions
diff --git a/functest/utils/env.py b/functest/utils/env.py
index ba8d6ce55..2e312726c 100644
--- a/functest/utils/env.py
+++ b/functest/utils/env.py
@@ -29,18 +29,19 @@ INPUTS = {
'NODE_NAME': env.INPUTS['NODE_NAME'],
'POD_ARCH': None,
'TEST_DB_URL': env.INPUTS['TEST_DB_URL'],
- 'ENERGY_RECORDER_API_URL': env.INPUTS['ENERGY_RECORDER_API_URL'],
- 'ENERGY_RECORDER_API_USER': env.INPUTS['ENERGY_RECORDER_API_USER'],
- 'ENERGY_RECORDER_API_PASSWORD': env.INPUTS['ENERGY_RECORDER_API_PASSWORD'],
'VOLUME_DEVICE_NAME': 'vdb',
'IMAGE_PROPERTIES': '',
'FLAVOR_EXTRA_SPECS': '',
'NAMESERVER': '8.8.8.8',
'NEW_USER_ROLE': 'Member',
'USE_DYNAMIC_CREDENTIALS': 'True',
- 'BLOCK_MIGRATION': 'True',
+ 'BLOCK_MIGRATION': 'False',
'CLEAN_ORPHAN_SECURITY_GROUPS': 'True',
- 'PUBLIC_ENDPOINT_ONLY': 'False'
+ 'SKIP_DOWN_HYPERVISORS': 'False',
+ 'PUBLIC_ENDPOINT_ONLY': 'False',
+ 'DASHBOARD_URL': '',
+ 'VMTP_HYPERVISORS': '',
+ 'NO_TENANT_NETWORK': 'False'
}
diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py
index c953dca81..98121199b 100644
--- a/functest/utils/functest_utils.py
+++ b/functest/utils/functest_utils.py
@@ -11,10 +11,12 @@
from __future__ import print_function
import logging
+import os
import subprocess
import sys
import yaml
+from openstack.cloud import _utils
import six
LOGGER = logging.getLogger(__name__)
@@ -138,6 +140,51 @@ def get_openstack_version(cloud):
return "Unknown"
+def list_services(cloud):
+ # pylint: disable=protected-access
+ """Search Keystone services via $OS_INTERFACE.
+
+ It mainly conforms with `Shade
+ <https://docs.openstack.org/shade/latest>`_ but allows testing vs
+ public endpoints. It's worth mentioning that it doesn't support keystone
+ v2.
+
+ :returns: a list of ``munch.Munch`` containing the services description
+
+ :raises: ``OpenStackCloudException`` if something goes wrong during the
+ openstack API call.
+ """
+ url, key = '/services', 'services'
+ data = cloud._identity_client.get(
+ url, endpoint_filter={
+ 'interface': os.environ.get('OS_INTERFACE', 'public')},
+ error_message="Failed to list services")
+ services = cloud._get_and_munchify(key, data)
+ return _utils.normalize_keystone_services(services)
+
+
+def search_services(cloud, name_or_id=None, filters=None):
+ # pylint: disable=protected-access
+ """Search Keystone services ia $OS_INTERFACE.
+
+ It mainly conforms with `Shade
+ <https://docs.openstack.org/shade/latest>`_ but allows testing vs
+ public endpoints. It's worth mentioning that it doesn't support keystone
+ v2.
+
+ :param name_or_id: Name or id of the desired service.
+ :param filters: a dict containing additional filters to use. e.g.
+ {'type': 'network'}.
+
+ :returns: a list of ``munch.Munch`` containing the services description
+
+ :raises: ``OpenStackCloudException`` if something goes wrong during the
+ openstack API call.
+ """
+ services = list_services(cloud)
+ return _utils._filter_list(services, name_or_id, filters)
+
+
def convert_dict_to_ini(value):
"Convert dict to oslo.conf input"
assert isinstance(value, dict)