diff options
author | Cedric Ollivier <cedric.ollivier@orange.com> | 2018-01-30 19:11:27 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-01-30 19:11:27 +0000 |
commit | 8296b68bbb2e6da34676af2c1e81e264c626296c (patch) | |
tree | 328f928cedd788ae9ea86b698f1edd9a87586b1e /functest/opnfv_tests/openstack/snaps/snaps_utils.py | |
parent | 03c3f4c2bd1635383cb64168b52e4d8540056942 (diff) | |
parent | 3b36c06f9223322e23e3885759355593b3c598a3 (diff) |
Merge "Remove duplicated code related to snaps creds"
Diffstat (limited to 'functest/opnfv_tests/openstack/snaps/snaps_utils.py')
-rw-r--r-- | functest/opnfv_tests/openstack/snaps/snaps_utils.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_utils.py b/functest/opnfv_tests/openstack/snaps/snaps_utils.py index 1153b63d..6b0ee497 100644 --- a/functest/opnfv_tests/openstack/snaps/snaps_utils.py +++ b/functest/opnfv_tests/openstack/snaps/snaps_utils.py @@ -11,6 +11,7 @@ from functest.utils.constants import CONST +from snaps.openstack.tests import openstack_tests from snaps.openstack.utils import neutron_utils, nova_utils @@ -40,3 +41,21 @@ def get_active_compute_cnt(os_creds): nova = nova_utils.nova_client(os_creds) computes = nova_utils.get_availability_zone_hosts(nova, zone_name='nova') return len(computes) + + +def get_credentials(proxy_settings_str=None, ssh_proxy_cmd=None): + """ + Returns snaps OSCreds object instance + :param: proxy_settings_str: proxy settings string <host>:<port> + :param: ssh_proxy_cmd: the SSH proxy command for the environment + :return: an instance of snaps OSCreds object + """ + creds_override = None + if hasattr(CONST, 'snaps_os_creds_override'): + creds_override = CONST.__getattribute__( + 'snaps_os_creds_override') + os_creds = openstack_tests.get_credentials( + os_env_file=CONST.__getattribute__('openstack_creds'), + proxy_settings_str=proxy_settings_str, ssh_proxy_cmd=ssh_proxy_cmd, + overrides=creds_override) + return os_creds |