aboutsummaryrefslogtreecommitdiffstats
path: root/functest
diff options
context:
space:
mode:
Diffstat (limited to 'functest')
-rwxr-xr-xfunctest/ci/check_os.sh24
-rw-r--r--functest/ci/config_functest.yaml2
-rw-r--r--[-rwxr-xr-x]functest/ci/generate_report.py9
-rw-r--r--functest/ci/logging.ini70
-rw-r--r--functest/ci/logging.json29
-rwxr-xr-xfunctest/ci/prepare_env.py7
-rwxr-xr-xfunctest/ci/run_tests.py10
-rw-r--r--functest/cli/cli_base.py6
-rw-r--r--functest/core/feature.py19
-rw-r--r--functest/core/testcase.py17
-rw-r--r--functest/core/vnf_base.py41
-rw-r--r--functest/opnfv_tests/features/barometer.py6
-rwxr-xr-xfunctest/opnfv_tests/openstack/examples/create_instance_and_ip.py128
-rw-r--r--functest/opnfv_tests/openstack/rally/rally.py4
-rw-r--r--functest/opnfv_tests/openstack/refstack_client/defcore.txt9
-rwxr-xr-xfunctest/opnfv_tests/openstack/refstack_client/refstack_client.py5
-rwxr-xr-xfunctest/opnfv_tests/openstack/refstack_client/tempest_conf.py5
-rw-r--r--functest/opnfv_tests/openstack/tempest/conf_utils.py13
-rw-r--r--functest/opnfv_tests/openstack/tempest/tempest.py4
-rwxr-xr-xfunctest/opnfv_tests/openstack/vping/vping_ssh.py5
-rwxr-xr-xfunctest/opnfv_tests/openstack/vping/vping_userdata.py5
-rwxr-xr-xfunctest/opnfv_tests/sdn/odl/odl.py33
-rw-r--r--functest/opnfv_tests/sdn/onos/onos.py4
-rwxr-xr-xfunctest/opnfv_tests/sdn/onos/sfc/sfc.py7
-rw-r--r--functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py5
-rw-r--r--functest/opnfv_tests/sdn/onos/teston/adapters/client.py4
-rw-r--r--functest/opnfv_tests/sdn/onos/teston/adapters/connection.py4
-rw-r--r--functest/opnfv_tests/sdn/onos/teston/adapters/environment.py4
-rwxr-xr-xfunctest/opnfv_tests/vnf/aaa/aaa.py5
-rw-r--r--functest/opnfv_tests/vnf/ims/clearwater_ims_base.py4
-rw-r--r--functest/opnfv_tests/vnf/ims/cloudify_ims.py4
-rw-r--r--functest/opnfv_tests/vnf/ims/opera_ims.py4
-rwxr-xr-xfunctest/opnfv_tests/vnf/ims/orchestra_ims.py5
-rw-r--r--functest/opnfv_tests/vnf/ims/orchestrator_cloudify.py5
-rw-r--r--functest/tests/unit/core/test_feature.py2
-rw-r--r--functest/tests/unit/odl/test_odl.py12
-rw-r--r--functest/tests/unit/utils/test_functest_logger.py48
-rw-r--r--functest/tests/unit/utils/test_openstack_utils.py50
-rw-r--r--functest/utils/functest_logger.py83
-rw-r--r--functest/utils/functest_utils.py4
-rw-r--r--functest/utils/openstack/cinder.py7
-rw-r--r--functest/utils/openstack/glance.py7
-rw-r--r--functest/utils/openstack/keystone.py7
-rw-r--r--functest/utils/openstack/neutron.py7
-rw-r--r--functest/utils/openstack/nova.py7
-rwxr-xr-xfunctest/utils/openstack_clean.py5
-rwxr-xr-xfunctest/utils/openstack_snapshot.py5
-rw-r--r--functest/utils/openstack_tacker.py4
-rw-r--r--functest/utils/openstack_utils.py21
49 files changed, 286 insertions, 489 deletions
diff --git a/functest/ci/check_os.sh b/functest/ci/check_os.sh
index 83f9f476d..ce0bc20c6 100755
--- a/functest/ci/check_os.sh
+++ b/functest/ci/check_os.sh
@@ -86,30 +86,6 @@ if [ $RETVAL -ne 0 ]; then
fi
echo " ...OK"
-adminURL=$(openstack catalog show identity |awk '/admin/ {print $4}')
-if [ -z ${adminURL} ]; then
- echo "ERROR: Cannot determine the admin URL."
- openstack catalog show identity
- exit 1
-fi
-adminIP=$(echo $adminURL|sed 's/^.*http.*\:\/\///'|sed 's/.[^:]*$//')
-adminPort=$(echo $adminURL|grep -Po '(?<=:)\d+')
-https_enabled=$(echo $adminURL | grep 'https')
-if [[ -n $https_enabled ]]; then
- echo ">>Verifying SSL connectivity to the admin endpoint $adminIP:$adminPort..."
- verify_SSL_connectivity $adminIP $adminPort
-else
- echo ">>Verifying connectivity to the admin endpoint $adminIP:$adminPort..."
- verify_connectivity $adminIP $adminPort
-fi
-RETVAL=$?
-if [ $RETVAL -ne 0 ]; then
- echo "ERROR: Cannot talk to the admin endpoint $adminIP:$adminPort ."
- echo "$adminURL"
- exit 1
-fi
-echo " ...OK"
-
echo "Checking Required OpenStack services:"
for service in $MANDATORY_SERVICES; do
diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml
index f291cf1f6..fd663abca 100644
--- a/functest/ci/config_functest.yaml
+++ b/functest/ci/config_functest.yaml
@@ -34,7 +34,7 @@ general:
functest: /home/opnfv/functest
functest_test: /home/opnfv/repos/functest/functest/opnfv_tests
results: /home/opnfv/functest/results
- functest_logging_cfg: /home/opnfv/repos/functest/functest/ci/logging.json
+ functest_logging_cfg: /home/opnfv/repos/functest/functest/ci/logging.ini
functest_conf: /home/opnfv/functest/conf
functest_data: /home/opnfv/functest/data
ims_data: /home/opnfv/functest/data/ims/
diff --git a/functest/ci/generate_report.py b/functest/ci/generate_report.py
index 3872a07ed..7a25fd952 100755..100644
--- a/functest/ci/generate_report.py
+++ b/functest/ci/generate_report.py
@@ -6,10 +6,10 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
import json
+import logging
import re
import urllib2
-import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
from functest.utils.constants import CONST
@@ -23,7 +23,7 @@ COL_5_LEN = 75
# and then we can print the url to the specific test result
-logger = ft_logger.Logger("generate_report").getLogger()
+logger = logging.getLogger(__name__)
def init(tiers_to_run=[]):
@@ -146,8 +146,3 @@ def main(args=[]):
str += print_separator('-')
logger.info("\n\n\n%s" % str)
-
-
-if __name__ == '__main__':
- import sys
- main(sys.argv[1:])
diff --git a/functest/ci/logging.ini b/functest/ci/logging.ini
new file mode 100644
index 000000000..8036ed292
--- /dev/null
+++ b/functest/ci/logging.ini
@@ -0,0 +1,70 @@
+[loggers]
+keys=root,functest,ci,cli,core,opnfv_tests,utils
+
+[handlers]
+keys=console,wconsole,file,null
+
+[formatters]
+keys=standard
+
+[logger_root]
+level=NOTSET
+handlers=null
+
+[logger_functest]
+level=NOTSET
+handlers=file
+qualname=functest
+
+[logger_ci]
+level=NOTSET
+handlers=console
+qualname=functest.ci
+
+[logger_cli]
+level=NOTSET
+handlers=wconsole
+qualname=functest.cli
+
+[logger_core]
+level=NOTSET
+handlers=console
+qualname=functest.core
+
+[logger_opnfv_tests]
+level=NOTSET
+handlers=wconsole
+qualname=functest.opnfv_tests
+
+[logger_utils]
+level=NOTSET
+handlers=wconsole
+qualname=functest.utils
+
+[handler_null]
+class=NullHandler
+level=NOTSET
+formatter=standard
+args=()
+
+[handler_console]
+class=StreamHandler
+level=INFO
+formatter=standard
+args=(sys.stdout,)
+
+[handler_wconsole]
+class=StreamHandler
+level=WARN
+formatter=standard
+args=(sys.stdout,)
+
+[handler_file]
+class=FileHandler
+level=DEBUG
+formatter=standard
+args=("/home/opnfv/functest/results/functest.log",)
+
+[formatter_standard]
+format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
+datefmt=
diff --git a/functest/ci/logging.json b/functest/ci/logging.json
deleted file mode 100644
index 2a2399d38..000000000
--- a/functest/ci/logging.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "version": 1,
- "disable_existing_loggers": false,
- "formatters": {
- "standard": {
- "format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
- }
- },
- "handlers": {
- "console": {
- "level": "INFO",
- "class": "logging.StreamHandler",
- "formatter": "standard"
- },
- "file": {
- "level": "DEBUG",
- "class": "logging.FileHandler",
- "formatter": "standard",
- "filename": "/home/opnfv/functest/results/functest.log"
- }
- },
- "loggers": {
- "": {
- "handlers": ["console", "file"],
- "level": "DEBUG",
- "propagate": "yes"
- }
- }
-}
diff --git a/functest/ci/prepare_env.py b/functest/ci/prepare_env.py
index e9a470f9c..08badf176 100755
--- a/functest/ci/prepare_env.py
+++ b/functest/ci/prepare_env.py
@@ -8,6 +8,8 @@
import argparse
import json
+import logging
+import logging.config
import os
import re
import subprocess
@@ -16,7 +18,6 @@ import fileinput
import yaml
-import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
import functest.utils.openstack_utils as os_utils
from functest.utils.constants import CONST
@@ -27,7 +28,7 @@ from opnfv.deployment import factory
actions = ['start', 'check']
""" logging configuration """
-logger = ft_logger.Logger("prepare_env").getLogger()
+logger = logging.getLogger('functest.ci.prepare_env')
handler = None
# set the architecture to default
pod_arch = None
@@ -377,6 +378,8 @@ def main(**kwargs):
if __name__ == '__main__':
+ logging.config.fileConfig(
+ CONST.__getattribute__('dir_functest_logging_cfg'))
parser = PrepareEnvParser()
args = parser.parse_args(sys.argv[1:])
sys.exit(main(**args))
diff --git a/functest/ci/run_tests.py b/functest/ci/run_tests.py
index e68901b89..d13612603 100755
--- a/functest/ci/run_tests.py
+++ b/functest/ci/run_tests.py
@@ -12,6 +12,8 @@ import argparse
import datetime
import enum
import importlib
+import logging
+import logging.config
import os
import re
import sys
@@ -19,16 +21,14 @@ import sys
import functest.ci.generate_report as generate_report
import functest.ci.tier_builder as tb
import functest.core.testcase as testcase
-import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
import functest.utils.openstack_clean as os_clean
import functest.utils.openstack_snapshot as os_snapshot
import functest.utils.openstack_utils as os_utils
from functest.utils.constants import CONST
-
-""" logging configuration """
-logger = ft_logger.Logger("run_tests").getLogger()
+# __name__ cannot be used here
+logger = logging.getLogger('functest.ci.run_tests')
class Result(enum.Enum):
@@ -270,6 +270,8 @@ def main(**kwargs):
if __name__ == '__main__':
+ logging.config.fileConfig(
+ CONST.__getattribute__('dir_functest_logging_cfg'))
parser = RunTestsParser()
args = parser.parse_args(sys.argv[1:])
sys.exit(main(**args).value)
diff --git a/functest/cli/cli_base.py b/functest/cli/cli_base.py
index cc697ed7e..2104e125c 100644
--- a/functest/cli/cli_base.py
+++ b/functest/cli/cli_base.py
@@ -8,11 +8,14 @@
#
import click
+import logging.config
from functest.cli.commands.cli_env import CliEnv
from functest.cli.commands.cli_os import CliOpenStack
from functest.cli.commands.cli_testcase import CliTestcase
from functest.cli.commands.cli_tier import CliTier
+from functest.utils.constants import CONST
+
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@@ -20,7 +23,8 @@ CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@click.group(context_settings=CONTEXT_SETTINGS)
@click.version_option(version='opnfv colorado.0.1 ')
def cli():
- pass
+ logging.config.fileConfig(
+ CONST.__getattribute__('dir_functest_logging_cfg'))
_env = CliEnv()
diff --git a/functest/core/feature.py b/functest/core/feature.py
index d65f5a3c1..8563c9257 100644
--- a/functest/core/feature.py
+++ b/functest/core/feature.py
@@ -13,11 +13,11 @@ Feature is considered as TestCase offered by Third-party. It offers
helpers to run any python method or any bash command.
"""
+import logging
import time
import functest.core.testcase as base
import functest.utils.functest_utils as ft_utils
-import functest.utils.functest_logger as ft_logger
from functest.utils.constants import CONST
__author__ = ("Serena Feng <feng.xiaowei@zte.com.cn>, "
@@ -27,11 +27,12 @@ __author__ = ("Serena Feng <feng.xiaowei@zte.com.cn>, "
class Feature(base.TestCase):
"""Base model for single feature."""
+ __logger = logging.getLogger(__name__)
+
def __init__(self, **kwargs):
super(Feature, self).__init__(**kwargs)
self.result_file = "{}/{}.log".format(
- CONST.__getattribute__('dir_results'), self.project_name)
- self.logger = ft_logger.Logger(self.project_name).getLogger()
+ CONST.__getattribute__('dir_results'), self.case_name)
def execute(self, **kwargs):
"""Execute the Python method.
@@ -82,10 +83,10 @@ class Feature(base.TestCase):
ft_utils.logger_test_results(
self.project_name, self.case_name,
self.result, self.details)
- self.logger.info("%s %s", self.project_name, self.result)
+ self.__logger.info("%s %s", self.project_name, self.result)
except Exception: # pylint: disable=broad-except
- self.logger.exception("%s FAILED", self.project_name)
- self.logger.info("Test result is stored in '%s'", self.result_file)
+ self.__logger.exception("%s FAILED", self.project_name)
+ self.__logger.info("Test result is stored in '%s'", self.result_file)
self.stop_time = time.time()
return exit_code
@@ -93,6 +94,8 @@ class Feature(base.TestCase):
class BashFeature(Feature):
"""Class designed to run any bash command."""
+ __logger = logging.getLogger(__name__)
+
def execute(self, **kwargs):
"""Execute the cmd passed as arg
@@ -108,7 +111,7 @@ class BashFeature(Feature):
cmd = kwargs["cmd"]
ret = ft_utils.execute_command(cmd, output_file=self.result_file)
except KeyError:
- self.logger.error("Please give cmd as arg. kwargs: %s", kwargs)
+ self.__logger.error("Please give cmd as arg. kwargs: %s", kwargs)
except Exception: # pylint: disable=broad-except
- self.logger.exception("Execute cmd: %s failed", cmd)
+ self.__logger.exception("Execute cmd: %s failed", cmd)
return ret
diff --git a/functest/core/testcase.py b/functest/core/testcase.py
index 3f191b407..217f07e51 100644
--- a/functest/core/testcase.py
+++ b/functest/core/testcase.py
@@ -9,9 +9,9 @@
"""Define the parent class of all Functest TestCases."""
+import logging
import os
-import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
__author__ = "Cedric Ollivier <cedric.ollivier@orange.com>"
@@ -32,7 +32,7 @@ class TestCase(object):
EX_TESTCASE_FAILED = os.EX_SOFTWARE - 2
"""results are false"""
- logger = ft_logger.Logger(__name__).getLogger()
+ __logger = logging.getLogger(__name__)
def __init__(self, **kwargs):
self.details = {}
@@ -65,12 +65,12 @@ class TestCase(object):
# It must be removed as soon as TestCase subclasses
# stop setting result = 'PASS' or 'FAIL'.
# In this case criteria is unread.
- self.logger.warning(
+ self.__logger.warning(
"Please update result which must be an int!")
if self.result == 'PASS':
return TestCase.EX_OK
except AssertionError:
- self.logger.error("Please run test before checking the results")
+ self.__logger.error("Please run test before checking the results")
return TestCase.EX_TESTCASE_FAILED
def run(self, **kwargs):
@@ -96,7 +96,7 @@ class TestCase(object):
TestCase.EX_RUN_ERROR.
"""
# pylint: disable=unused-argument
- self.logger.error("Run must be implemented")
+ self.__logger.error("Run must be implemented")
return TestCase.EX_RUN_ERROR
def push_to_db(self):
@@ -128,11 +128,12 @@ class TestCase(object):
if ft_utils.push_results_to_db(
self.project_name, self.case_name, self.start_time,
self.stop_time, pub_result, self.details):
- self.logger.info("The results were successfully pushed to DB")
+ self.__logger.info(
+ "The results were successfully pushed to DB")
return TestCase.EX_OK
else:
- self.logger.error("The results cannot be pushed to DB")
+ self.__logger.error("The results cannot be pushed to DB")
return TestCase.EX_PUSH_TO_DB_ERROR
except Exception: # pylint: disable=broad-except
- self.logger.exception("The results cannot be pushed to DB")
+ self.__logger.exception("The results cannot be pushed to DB")
return TestCase.EX_PUSH_TO_DB_ERROR
diff --git a/functest/core/vnf_base.py b/functest/core/vnf_base.py
index fe4e427fa..90bc80b38 100644
--- a/functest/core/vnf_base.py
+++ b/functest/core/vnf_base.py
@@ -8,18 +8,18 @@
# http://www.apache.org/licenses/LICENSE-2.0
import inspect
+import logging
import time
import functest.core.testcase as base
from functest.utils.constants import CONST
-import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
import functest.utils.openstack_utils as os_utils
class VnfOnBoardingBase(base.TestCase):
- logger = ft_logger.Logger(__name__).getLogger()
+ __logger = logging.getLogger(__name__)
def __init__(self, **kwargs):
super(VnfOnBoardingBase, self).__init__(**kwargs)
@@ -44,28 +44,28 @@ class VnfOnBoardingBase(base.TestCase):
'vnf_{}_tenant_description'.format(self.case_name))
except Exception:
# raise Exception("Unknown VNF case=" + self.case_name)
- self.logger.error("Unknown VNF case={}".format(self.case_name))
+ self.__logger.error("Unknown VNF case={}".format(self.case_name))
try:
self.images = CONST.__getattribute__(
'vnf_{}_tenant_images'.format(self.case_name))
except Exception:
- self.logger.warn("No tenant image defined for this VNF")
+ self.__logger.warn("No tenant image defined for this VNF")
def execute(self):
self.start_time = time.time()
# Prepare the test (Create Tenant, User, ...)
try:
- self.logger.info("Create VNF Onboarding environment")
+ self.__logger.info("Create VNF Onboarding environment")
self.prepare()
except Exception:
- self.logger.error("Error during VNF Onboarding environment" +
- "creation", exc_info=True)
+ self.__logger.error("Error during VNF Onboarding environment"
+ "creation", exc_info=True)
return base.TestCase.EX_TESTCASE_FAILED
# Deploy orchestrator
try:
- self.logger.info("Deploy orchestrator (if necessary)")
+ self.__logger.info("Deploy orchestrator (if necessary)")
orchestrator_ready_time = time.time()
res_orchestrator = self.deploy_orchestrator()
# orchestrator is not mandatory
@@ -77,11 +77,11 @@ class VnfOnBoardingBase(base.TestCase):
self.details['orchestrator']['duration'] = round(
orchestrator_ready_time - self.start_time, 1)
except Exception:
- self.logger.warn("Problem with the Orchestrator", exc_info=True)
+ self.__logger.warn("Problem with the Orchestrator", exc_info=True)
# Deploy VNF
try:
- self.logger.info("Deploy VNF " + self.case_name)
+ self.__logger.info("Deploy VNF " + self.case_name)
res_deploy_vnf = self.deploy_vnf()
vnf_ready_time = time.time()
self.details['vnf']['status'] = res_deploy_vnf['status']
@@ -89,12 +89,12 @@ class VnfOnBoardingBase(base.TestCase):
self.details['vnf']['duration'] = round(
vnf_ready_time - orchestrator_ready_time, 1)
except Exception:
- self.logger.error("Error during VNF deployment", exc_info=True)
+ self.__logger.error("Error during VNF deployment", exc_info=True)
return base.TestCase.EX_TESTCASE_FAILED
# Test VNF
try:
- self.logger.info("Test VNF")
+ self.__logger.info("Test VNF")
res_test_vnf = self.test_vnf()
test_vnf_done_time = time.time()
self.details['test_vnf']['status'] = res_test_vnf['status']
@@ -102,7 +102,7 @@ class VnfOnBoardingBase(base.TestCase):
self.details['test_vnf']['duration'] = round(
test_vnf_done_time - vnf_ready_time, 1)
except Exception:
- self.logger.error("Error when running VNF tests", exc_info=True)
+ self.__logger.error("Error when running VNF tests", exc_info=True)
return base.TestCase.EX_TESTCASE_FAILED
# Clean the system
@@ -121,7 +121,8 @@ class VnfOnBoardingBase(base.TestCase):
self.creds = os_utils.get_credentials()
self.keystone_client = os_utils.get_keystone_client()
- self.logger.info("Prepare OpenStack plateform(create tenant and user)")
+ self.__logger.info(
+ "Prepare OpenStack plateform(create tenant and user)")
admin_user_id = os_utils.get_user_id(self.keystone_client,
self.creds['username'])
if not admin_user_id:
@@ -164,7 +165,7 @@ class VnfOnBoardingBase(base.TestCase):
os_utils.add_role_user(self.keystone_client, user_id,
role_id, tenant_id)
- self.logger.info("Update OpenStack creds informations")
+ self.__logger.info("Update OpenStack creds informations")
self.admin_creds = self.creds.copy()
self.admin_creds.update({
"tenant": self.tenant_name
@@ -183,21 +184,21 @@ class VnfOnBoardingBase(base.TestCase):
# TODO see how to use built-in exception from releng module
def deploy_vnf(self):
- self.logger.error("VNF must be deployed")
+ self.__logger.error("VNF must be deployed")
raise Exception("VNF not deployed")
def test_vnf(self):
- self.logger.error("VNF must be tested")
+ self.__logger.error("VNF must be tested")
raise Exception("VNF not tested")
# clean before openstack clean run
def clean(self):
- self.logger.info("test cleaning")
+ self.__logger.info("test cleaning")
def parse_results(self):
exit_code = self.EX_OK
self.result = "PASS"
- self.logger.info(self.details)
+ self.__logger.info(self.details)
# The 2 VNF steps must be OK to get a PASS result
if (self.details['vnf']['status'] is not "PASS" or
self.details['test_vnf']['status'] is not "PASS"):
@@ -213,7 +214,7 @@ class VnfOnBoardingBase(base.TestCase):
def step_failure(self, error_msg):
part = inspect.stack()[1][3]
- self.logger.error("Step {0} failed: {1}".format(part, error_msg))
+ self.__logger.error("Step {0} failed: {1}".format(part, error_msg))
try:
step_name = self.details_step_mapping[part]
part_info = self.details[step_name]
diff --git a/functest/opnfv_tests/features/barometer.py b/functest/opnfv_tests/features/barometer.py
index 8a409406b..cbfe7d9a8 100644
--- a/functest/opnfv_tests/features/barometer.py
+++ b/functest/opnfv_tests/features/barometer.py
@@ -6,6 +6,8 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
+import logging
+
from baro_tests import collectd
import functest.core.feature as base
@@ -16,5 +18,7 @@ class BarometerCollectd(base.Feature):
Class for executing barometercollectd testcase.
'''
+ __logger = logging.getLogger(__name__)
+
def execute(self):
- return collectd.main(self.logger)
+ return collectd.main(self.__logger)
diff --git a/functest/opnfv_tests/openstack/examples/create_instance_and_ip.py b/functest/opnfv_tests/openstack/examples/create_instance_and_ip.py
deleted file mode 100755
index b44008642..000000000
--- a/functest/opnfv_tests/openstack/examples/create_instance_and_ip.py
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (c) 2015 All rights reserved
-# This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# This script boots an instance and assigns a floating ip
-#
-
-import argparse
-import os
-import sys
-
-from functest.utils.constants import CONST
-import functest.utils.functest_logger as ft_logger
-import functest.utils.openstack_utils as os_utils
-
-parser = argparse.ArgumentParser()
-
-parser.add_argument("-r", "--report",
- help="Create json result file",
- action="store_true")
-
-args = parser.parse_args()
-
-""" logging configuration """
-logger = ft_logger.Logger("create_instance_and_ip").getLogger()
-
-HOME = CONST.dir_home + "/"
-
-VM_BOOT_TIMEOUT = 180
-
-EXAMPLE_INSTANCE_NAME = CONST.example_vm_name
-EXAMPLE_FLAVOR = CONST.example_flavor
-EXAMPLE_IMAGE_NAME = CONST.example_image_name
-IMAGE_FILENAME = CONST.openstack_image_file_name
-IMAGE_FORMAT = CONST.openstack_image_disk_format
-IMAGE_PATH = os.path.join(CONST.dir_functest_data, IMAGE_FILENAME)
-
-# NEUTRON Private Network parameters
-
-EXAMPLE_PRIVATE_NET_NAME = CONST.example_private_net_name
-EXAMPLE_PRIVATE_SUBNET_NAME = CONST.example_private_subnet_name
-EXAMPLE_PRIVATE_SUBNET_CIDR = CONST.example_private_subnet_cidr
-EXAMPLE_ROUTER_NAME = CONST.example_router_name
-
-EXAMPLE_SECGROUP_NAME = CONST.example_sg_name
-EXAMPLE_SECGROUP_DESCR = CONST.example_sg_desc
-
-
-def main():
-
- nova_client = os_utils.get_nova_client()
- neutron_client = os_utils.get_neutron_client()
- glance_client = os_utils.get_glance_client()
-
- image_id = os_utils.create_glance_image(glance_client,
- EXAMPLE_IMAGE_NAME,
- IMAGE_PATH,
- disk=IMAGE_FORMAT,
- container="bare",
- public=True)
-
- network_dic = os_utils.create_network_full(
- neutron_client,
- EXAMPLE_PRIVATE_NET_NAME,
- EXAMPLE_PRIVATE_SUBNET_NAME,
- EXAMPLE_ROUTER_NAME,
- EXAMPLE_PRIVATE_SUBNET_CIDR)
- if not network_dic:
- logger.error(
- "There has been a problem when creating the neutron network")
- sys.exit(-1)
-
- network_id = network_dic["net_id"]
-
- sg_id = os_utils.create_security_group_full(neutron_client,
- EXAMPLE_SECGROUP_NAME,
- EXAMPLE_SECGROUP_DESCR)
-
- # boot INTANCE
- logger.info("Creating instance '%s'..." % EXAMPLE_INSTANCE_NAME)
- logger.debug(
- "Configuration:\n name=%s \n flavor=%s \n image=%s \n "
- "network=%s \n"
- % (EXAMPLE_INSTANCE_NAME, EXAMPLE_FLAVOR, image_id, network_id))
- instance = os_utils.create_instance_and_wait_for_active(
- EXAMPLE_FLAVOR,
- image_id,
- network_id,
- EXAMPLE_INSTANCE_NAME)
-
- if instance is None:
- logger.error("Error while booting instance.")
- sys.exit(-1)
- # Retrieve IP of INSTANCE
- instance_ip = instance.networks.get(EXAMPLE_PRIVATE_NET_NAME)[0]
- logger.debug("Instance '%s' got private ip '%s'." %
- (EXAMPLE_INSTANCE_NAME, instance_ip))
-
- logger.info("Adding '%s' to security group '%s'..."
- % (EXAMPLE_INSTANCE_NAME, EXAMPLE_SECGROUP_NAME))
- os_utils.add_secgroup_to_instance(nova_client, instance.id, sg_id)
-
- logger.info("Creating floating IP for VM '%s'..." % EXAMPLE_INSTANCE_NAME)
- floatip_dic = os_utils.create_floating_ip(neutron_client)
- floatip = floatip_dic['fip_addr']
- # floatip_id = floatip_dic['fip_id']
-
- if floatip is None:
- logger.error("Cannot create floating IP.")
- sys.exit(-1)
- logger.info("Floating IP created: '%s'" % floatip)
-
- logger.info("Associating floating ip: '%s' to VM '%s' "
- % (floatip, EXAMPLE_INSTANCE_NAME))
- if not os_utils.add_floating_ip(nova_client, instance.id, floatip):
- logger.error("Cannot associate floating IP to VM.")
- sys.exit(-1)
-
- sys.exit(0)
-
-
-if __name__ == '__main__':
- main()
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py
index e07e2a8df..f762383af 100644
--- a/functest/opnfv_tests/openstack/rally/rally.py
+++ b/functest/opnfv_tests/openstack/rally/rally.py
@@ -9,6 +9,7 @@
#
import json
+import logging
import os
import re
import subprocess
@@ -19,11 +20,10 @@ import yaml
from functest.core import testcase
from functest.utils.constants import CONST
-import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
import functest.utils.openstack_utils as os_utils
-logger = ft_logger.Logger('Rally').getLogger()
+logger = logging.getLogger(__name__)
class RallyBase(testcase.TestCase):
diff --git a/functest/opnfv_tests/openstack/refstack_client/defcore.txt b/functest/opnfv_tests/openstack/refstack_client/defcore.txt
index be8fd8998..0a1787ef3 100644
--- a/functest/opnfv_tests/openstack/refstack_client/defcore.txt
+++ b/functest/opnfv_tests/openstack/refstack_client/defcore.txt
@@ -1,4 +1,11 @@
-# Set of DefCore tempest test cases not flagged and required. It only contains OpenStack core (no object storage)
+# Set of DefCore tempest test cases not flagged and required.
+# According to https://github.com/openstack/interop/blob/master/2016.08/procedure.rst,
+# some tests are still flagged due to outstanding bugs in the Tempest library,
+# particularly tests that require SSH. Refstack developers
+# are working on correcting these bugs upstream. Please note that although some tests
+# are flagged because of bugs, there is still an expectation that the capabilities
+# covered by the tests are available.
+# It only contains Openstack core compute (no object storage)
# The approved guidelines (2016.08) are valid for Kilo, Liberty, Mitaka and Newton releases of OpenStack
# The list can be generated using the Rest API from RefStack project:
# https://refstack.openstack.org/api/v1/guidelines/2016.08/tests?target=compute&type=required&alias=true&flag=false
diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
index 2f2fc00f7..ebae4b867 100755
--- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
+++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
@@ -6,6 +6,7 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
import argparse
+import logging
import os
import re
import sys
@@ -15,12 +16,11 @@ import time
from functest.core import testcase
from functest.opnfv_tests.openstack.tempest import conf_utils
from functest.utils.constants import CONST
-import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
from tempest_conf import TempestConf
""" logging configuration """
-logger = ft_logger.Logger("refstack_defcore").getLogger()
+logger = logging.getLogger(__name__)
class RefstackClient(testcase.TestCase):
@@ -220,6 +220,7 @@ class RefstackClientParser(object):
if __name__ == '__main__':
+ logging.basicConfig()
refstackclient = RefstackClient()
parser = RefstackClientParser()
args = parser.parse_args(sys.argv[1:])
diff --git a/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py b/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py
index d01f08727..5c04253c3 100755
--- a/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py
+++ b/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py
@@ -5,15 +5,15 @@
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
+import logging
import os
from functest.opnfv_tests.openstack.tempest import conf_utils
from functest.utils import openstack_utils
from functest.utils.constants import CONST
-import functest.utils.functest_logger as ft_logger
""" logging configuration """
-logger = ft_logger.Logger("refstack_defcore").getLogger()
+logger = logging.getLogger(__name__)
class TempestConf(object):
@@ -48,5 +48,6 @@ class TempestConf(object):
if __name__ == '__main__':
+ logging.basicConfig()
tempestconf = TempestConf()
tempestconf.main()
diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py
index f4a94f654..54f7428ca 100644
--- a/functest/opnfv_tests/openstack/tempest/conf_utils.py
+++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py
@@ -8,13 +8,13 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
import ConfigParser
+import logging
import os
import re
import shutil
import subprocess
from functest.utils.constants import CONST
-import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
import functest.utils.openstack_utils as os_utils
@@ -42,7 +42,7 @@ CI_INSTALLER_TYPE = CONST.INSTALLER_TYPE
CI_INSTALLER_IP = CONST.INSTALLER_IP
""" logging configuration """
-logger = ft_logger.Logger("Tempest").getLogger()
+logger = logging.getLogger(__name__)
def create_tempest_resources(use_custom_images=False,
@@ -279,12 +279,20 @@ def configure_tempest_update_params(tempest_conf_file,
config.set('identity', 'tenant_name', CONST.tempest_identity_tenant_name)
config.set('identity', 'username', CONST.tempest_identity_user_name)
config.set('identity', 'password', CONST.tempest_identity_user_password)
+ config.set('identity', 'region', 'RegionOne')
config.set(
'validation', 'ssh_timeout', CONST.tempest_validation_ssh_timeout)
config.set('object-storage', 'operator_role',
CONST.tempest_object_storage_operator_role)
if CONST.OS_ENDPOINT_TYPE is not None:
+ sections = config.sections()
+ if os_utils.is_keystone_v3():
+ config.set('identity', 'v3_endpoint_type', CONST.OS_ENDPOINT_TYPE)
+ if 'identity-feature-enabled' not in sections:
+ config.add_section('identity-feature-enabled')
+ config.set('identity-feature-enabled', 'api_v2', False)
+ config.set('identity-feature-enabled', 'api_v2_admin', False)
services_list = ['compute',
'volume',
'image',
@@ -292,7 +300,6 @@ def configure_tempest_update_params(tempest_conf_file,
'data-processing',
'object-storage',
'orchestration']
- sections = config.sections()
for service in services_list:
if service not in sections:
config.add_section(service)
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py
index e6c6b44f7..984e2a1b7 100644
--- a/functest/opnfv_tests/openstack/tempest/tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/tempest.py
@@ -8,6 +8,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
+import logging
import os
import re
import shutil
@@ -19,11 +20,10 @@ import yaml
from functest.core import testcase
from functest.opnfv_tests.openstack.tempest import conf_utils
from functest.utils.constants import CONST
-import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
""" logging configuration """
-logger = ft_logger.Logger("Tempest").getLogger()
+logger = logging.getLogger(__name__)
class TempestCommon(testcase.TestCase):
diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py
index c26c4e0c0..e87da3636 100755
--- a/functest/opnfv_tests/openstack/vping/vping_ssh.py
+++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py
@@ -7,6 +7,7 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
+import logging
import os
import re
import sys
@@ -16,7 +17,6 @@ import argparse
import paramiko
from scp import SCPClient
-import functest.utils.functest_logger as ft_logger
import functest.utils.openstack_utils as os_utils
import vping_base
import functest.core.testcase as testcase
@@ -28,7 +28,7 @@ class VPingSSH(vping_base.VPingBase):
if "case_name" not in kwargs:
kwargs["case_name"] = "vping_ssh"
super(VPingSSH, self).__init__(**kwargs)
- self.logger = ft_logger.Logger(self.case_name).getLogger()
+ self.logger = logging.getLogger(__name__)
def do_vping(self, vm, test_ip):
floatip = self.add_float_ip(vm)
@@ -166,6 +166,7 @@ class VPingSSH(vping_base.VPingBase):
if __name__ == '__main__':
+ logging.basicConfig()
args_parser = argparse.ArgumentParser()
args_parser.add_argument("-r", "--report",
help="Create json result file",
diff --git a/functest/opnfv_tests/openstack/vping/vping_userdata.py b/functest/opnfv_tests/openstack/vping/vping_userdata.py
index 1b00ca23a..05dda9dea 100755
--- a/functest/opnfv_tests/openstack/vping/vping_userdata.py
+++ b/functest/opnfv_tests/openstack/vping/vping_userdata.py
@@ -7,12 +7,12 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
+import logging
import sys
import time
import argparse
-import functest.utils.functest_logger as ft_logger
import vping_base
@@ -22,7 +22,7 @@ class VPingUserdata(vping_base.VPingBase):
if "case_name" not in kwargs:
kwargs["case_name"] = "vping_userdata"
super(VPingUserdata, self).__init__(**kwargs)
- self.logger = ft_logger.Logger(self.case_name).getLogger()
+ self.logger = logging.getLogger(__name__)
def boot_vm_preparation(self, config, vmname, test_ip):
config['config_drive'] = True
@@ -74,6 +74,7 @@ class VPingUserdata(vping_base.VPingBase):
if __name__ == '__main__':
+ logging.basicConfig()
args_parser = argparse.ArgumentParser()
args_parser.add_argument("-r", "--report",
help="Create json result file",
diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py
index 6f4acf6dd..f92cb95da 100755
--- a/functest/opnfv_tests/sdn/odl/odl.py
+++ b/functest/opnfv_tests/sdn/odl/odl.py
@@ -19,6 +19,7 @@ Example:
import argparse
import errno
import fileinput
+import logging
import os
import re
import sys
@@ -30,7 +31,6 @@ import robot.run
from robot.utils.robottime import timestamp_to_secs
from functest.core import testcase
-import functest.utils.functest_logger as ft_logger
import functest.utils.openstack_utils as op_utils
__author__ = "Cedric Ollivier <cedric.ollivier@orange.com>"
@@ -70,7 +70,7 @@ class ODLTests(testcase.TestCase):
"csit/suites/integration/basic")
default_suites = [basic_suite_dir, neutron_suite_dir]
res_dir = '/home/opnfv/functest/results/odl/'
- logger = ft_logger.Logger("opendaylight").getLogger()
+ __logger = logging.getLogger(__name__)
@classmethod
def set_robotframework_vars(cls, odlusername="admin", odlpassword="admin"):
@@ -91,7 +91,7 @@ class ODLTests(testcase.TestCase):
line.rstrip())
return True
except Exception as ex: # pylint: disable=broad-except
- cls.logger.error("Cannot set ODL creds: %s", str(ex))
+ cls.__logger.error("Cannot set ODL creds: %s", str(ex))
return False
def parse_results(self):
@@ -154,15 +154,15 @@ class ODLTests(testcase.TestCase):
'PORT:' + kwargs['odlwebport'],
'RESTCONFPORT:' + kwargs['odlrestconfport']]
except KeyError as ex:
- self.logger.error("Cannot run ODL testcases. Please check "
- "%s", str(ex))
+ self.__logger.error("Cannot run ODL testcases. Please check "
+ "%s", str(ex))
return self.EX_RUN_ERROR
if self.set_robotframework_vars(odlusername, odlpassword):
try:
os.makedirs(self.res_dir)
except OSError as ex:
if ex.errno != errno.EEXIST:
- self.logger.exception(
+ self.__logger.exception(
"Cannot create %s", self.res_dir)
return self.EX_RUN_ERROR
stdout_file = os.path.join(self.res_dir, 'stdout.txt')
@@ -174,19 +174,19 @@ class ODLTests(testcase.TestCase):
report='NONE',
stdout=stdout)
stdout.seek(0, 0)
- self.logger.info("\n" + stdout.read())
- self.logger.info("ODL results were successfully generated")
+ self.__logger.info("\n" + stdout.read())
+ self.__logger.info("ODL results were successfully generated")
try:
self.parse_results()
- self.logger.info("ODL results were successfully parsed")
+ self.__logger.info("ODL results were successfully parsed")
except RobotError as ex:
- self.logger.error("Run tests before publishing: %s",
- ex.message)
+ self.__logger.error("Run tests before publishing: %s",
+ ex.message)
return self.EX_RUN_ERROR
try:
os.remove(stdout_file)
except OSError:
- self.logger.warning("Cannot remove %s", stdout_file)
+ self.__logger.warning("Cannot remove %s", stdout_file)
return self.EX_OK
else:
return self.EX_RUN_ERROR
@@ -237,12 +237,12 @@ class ODLTests(testcase.TestCase):
else:
kwargs['odlip'] = os.environ['SDN_CONTROLLER_IP']
except KeyError as ex:
- self.logger.error("Cannot run ODL testcases. "
- "Please check env var: "
- "%s", str(ex))
+ self.__logger.error("Cannot run ODL testcases. "
+ "Please check env var: "
+ "%s", str(ex))
return self.EX_RUN_ERROR
except Exception: # pylint: disable=broad-except
- self.logger.exception("Cannot run ODL testcases.")
+ self.__logger.exception("Cannot run ODL testcases.")
return self.EX_RUN_ERROR
return self.main(suites, **kwargs)
@@ -301,6 +301,7 @@ class ODLParser(object): # pylint: disable=too-few-public-methods
if __name__ == '__main__':
+ logging.basicConfig()
ODL = ODLTests()
PARSER = ODLParser()
ARGS = PARSER.parse_args(sys.argv[1:])
diff --git a/functest/opnfv_tests/sdn/onos/onos.py b/functest/opnfv_tests/sdn/onos/onos.py
index 4d489d674..d7a2d38ed 100644
--- a/functest/opnfv_tests/sdn/onos/onos.py
+++ b/functest/opnfv_tests/sdn/onos/onos.py
@@ -7,6 +7,7 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
+import logging
import os
import re
import subprocess
@@ -16,7 +17,6 @@ import urlparse
from functest.core import testcase
from functest.utils.constants import CONST
-import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
import functest.utils.openstack_utils as openstack_utils
@@ -30,7 +30,7 @@ class OnosBase(testcase.TestCase):
onos_sfc_path = os.path.join(CONST.__getattribute__('dir_repo_functest'),
CONST.__getattribute__('dir_onos_sfc'))
installer_type = CONST.__getattribute__('INSTALLER_TYPE')
- logger = ft_logger.Logger(__name__).getLogger()
+ logger = logging.getLogger(__name__)
def __init__(self, **kwargs):
if "case_name" not in kwargs:
diff --git a/functest/opnfv_tests/sdn/onos/sfc/sfc.py b/functest/opnfv_tests/sdn/onos/sfc/sfc.py
index 22412270a..0155d24d7 100755
--- a/functest/opnfv_tests/sdn/onos/sfc/sfc.py
+++ b/functest/opnfv_tests/sdn/onos/sfc/sfc.py
@@ -1,4 +1,3 @@
-"""Script to Test the SFC scenarios in ONOS."""
# !/usr/bin/python
#
# Copyright (c) CREATED5 All rights reserved
@@ -22,13 +21,14 @@
# Testcase 7 : Cleanup
# ###########################################################################
#
+"""Script to Test the SFC scenarios in ONOS."""
+import logging
import time
-import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
from sfc_onos import SfcOnos
-logger = ft_logger.Logger("sfc").getLogger()
+logger = logging.getLogger(__name__)
Sfc_obj = SfcOnos()
OK = 200
@@ -174,4 +174,5 @@ def main():
if __name__ == '__main__':
+ logging.basicConfig()
main()
diff --git a/functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py b/functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py
index c21986902..1101f2394 100644
--- a/functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py
+++ b/functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py
@@ -1,3 +1,4 @@
+import logging
import os
import re
import time
@@ -8,8 +9,6 @@ from multiprocessing import Process
from multiprocessing import Queue
from pexpect import pxssh
-import functest.utils.functest_logger as ft_logger
-
from functest.utils.constants import CONST
OK = 200
@@ -23,7 +22,7 @@ class SfcOnos(object):
def __init__(self):
"""Initialization of variables."""
- self.logger = ft_logger.Logger("sfc_fun").getLogger()
+ self.logger = logging.getLogger(__name__)
self.osver = "v2.0"
self.token_id = 0
self.net_id = 0
diff --git a/functest/opnfv_tests/sdn/onos/teston/adapters/client.py b/functest/opnfv_tests/sdn/onos/teston/adapters/client.py
index 81d5f7d79..a88d2f067 100644
--- a/functest/opnfv_tests/sdn/onos/teston/adapters/client.py
+++ b/functest/opnfv_tests/sdn/onos/teston/adapters/client.py
@@ -11,17 +11,17 @@ Description:
#
"""
import json
+import logging
import pexpect
import requests
import time
from environment import Environment
-import functest.utils.functest_logger as ft_logger
class Client(Environment):
- logger = ft_logger.Logger("client").getLogger()
+ logger = logging.getLogger(__name__)
def __init__(self):
Environment.__init__(self)
diff --git a/functest/opnfv_tests/sdn/onos/teston/adapters/connection.py b/functest/opnfv_tests/sdn/onos/teston/adapters/connection.py
index 3786945d2..dfaa5cc14 100644
--- a/functest/opnfv_tests/sdn/onos/teston/adapters/connection.py
+++ b/functest/opnfv_tests/sdn/onos/teston/adapters/connection.py
@@ -13,17 +13,17 @@ Description:
# http://www.apache.org/licenses/LICENSE-2.0
#
"""
+import logging
import os
import pexpect
import re
from foundation import Foundation
-import functest.utils.functest_logger as ft_logger
class Connection(Foundation):
- logger = ft_logger.Logger("connection").getLogger()
+ logger = logging.getLogger(__name__)
def __init__(self):
Foundation.__init__(self)
diff --git a/functest/opnfv_tests/sdn/onos/teston/adapters/environment.py b/functest/opnfv_tests/sdn/onos/teston/adapters/environment.py
index 046a821d4..cb75b5c3c 100644
--- a/functest/opnfv_tests/sdn/onos/teston/adapters/environment.py
+++ b/functest/opnfv_tests/sdn/onos/teston/adapters/environment.py
@@ -15,6 +15,7 @@ Description:
#
"""
+import logging
import pexpect
import pxssh
import re
@@ -23,12 +24,11 @@ import sys
import time
from connection import Connection
-import functest.utils.functest_logger as ft_logger
class Environment(Connection):
- logger = ft_logger.Logger("environment").getLogger()
+ logger = logging.getLogger(__name__)
def __init__(self):
Connection.__init__(self)
diff --git a/functest/opnfv_tests/vnf/aaa/aaa.py b/functest/opnfv_tests/vnf/aaa/aaa.py
index 9c94cfb1a..1a484ddfb 100755
--- a/functest/opnfv_tests/vnf/aaa/aaa.py
+++ b/functest/opnfv_tests/vnf/aaa/aaa.py
@@ -7,18 +7,18 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
+import logging
import sys
import argparse
import functest.core.testcase as testcase
import functest.core.vnf_base as vnf_base
-import functest.utils.functest_logger as ft_logger
class AaaVnf(vnf_base.VnfOnBoardingBase):
- logger = ft_logger.Logger("VNF AAA").getLogger()
+ logger = logging.getLogger(__name__)
def __init__(self, **kwargs):
if "case_name" not in kwargs:
@@ -60,6 +60,7 @@ class AaaVnf(vnf_base.VnfOnBoardingBase):
if __name__ == '__main__':
+ logging.basicConfig()
parser = argparse.ArgumentParser()
args = vars(parser.parse_args())
aaa_vnf = AaaVnf()
diff --git a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
index 494633f4f..f3bb30126 100644
--- a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
+++ b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
@@ -7,6 +7,7 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
import json
+import logging
import os
import shutil
@@ -14,14 +15,13 @@ import requests
import functest.core.vnf_base as vnf_base
from functest.utils.constants import CONST
-import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
class ClearwaterOnBoardingBase(vnf_base.VnfOnBoardingBase):
def __init__(self, **kwargs):
- self.logger = ft_logger.Logger(__name__).getLogger()
+ self.logger = logging.getLogger(__name__)
super(ClearwaterOnBoardingBase, self).__init__(**kwargs)
self.case_dir = os.path.join(CONST.dir_functest_test, 'vnf', 'ims')
self.data_dir = CONST.dir_ims_data
diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
index 0e6d47970..ba4c57901 100644
--- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py
+++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
@@ -7,6 +7,7 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
+import logging
import os
import sys
import time
@@ -18,7 +19,6 @@ from functest.opnfv_tests.vnf.ims.clearwater import Clearwater
import functest.opnfv_tests.vnf.ims.clearwater_ims_base as clearwater_ims_base
from functest.opnfv_tests.vnf.ims.orchestrator_cloudify import Orchestrator
from functest.utils.constants import CONST
-import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
import functest.utils.openstack_utils as os_utils
@@ -29,7 +29,7 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
if "case_name" not in kwargs:
kwargs["case_name"] = "cloudify_ims"
super(CloudifyIms, self).__init__(**kwargs)
- self.logger = ft_logger.Logger(__name__).getLogger()
+ self.logger = logging.getLogger(__name__)
# Retrieve the configuration
try:
diff --git a/functest/opnfv_tests/vnf/ims/opera_ims.py b/functest/opnfv_tests/vnf/ims/opera_ims.py
index 64f2ace06..8defdee67 100644
--- a/functest/opnfv_tests/vnf/ims/opera_ims.py
+++ b/functest/opnfv_tests/vnf/ims/opera_ims.py
@@ -8,6 +8,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
import json
+import logging
import os
import time
@@ -16,7 +17,6 @@ import requests
import functest.opnfv_tests.vnf.ims.clearwater_ims_base as clearwater_ims_base
from functest.utils.constants import CONST
-import functest.utils.functest_logger as ft_logger
class OperaIms(clearwater_ims_base.ClearwaterOnBoardingBase):
@@ -24,7 +24,7 @@ class OperaIms(clearwater_ims_base.ClearwaterOnBoardingBase):
def __init__(self, project='functest', case_name='opera_ims',
repo=CONST.dir_repo_opera, cmd=''):
super(OperaIms, self).__init__(project, case_name, repo, cmd)
- self.logger = ft_logger.Logger(__name__).getLogger()
+ self.logger = logging.getLogger(__name__)
self.ellis_file = os.path.join(self.result_dir, 'ellis.info')
self.live_test_file = os.path.join(self.result_dir,
'live_test_report.json')
diff --git a/functest/opnfv_tests/vnf/ims/orchestra_ims.py b/functest/opnfv_tests/vnf/ims/orchestra_ims.py
index 351c5fbe2..95751d47f 100755
--- a/functest/opnfv_tests/vnf/ims/orchestra_ims.py
+++ b/functest/opnfv_tests/vnf/ims/orchestra_ims.py
@@ -8,13 +8,13 @@
# http://www.apache.org/licenses/LICENSE-2.0
import json
+import logging
import socket
import sys
import time
import yaml
import functest.core.vnf_base as vnf_base
-import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
import functest.utils.openstack_utils as os_utils
import os
@@ -87,7 +87,7 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
self.ob_port = "8080"
self.ob_ip = "localhost"
self.ob_instance_id = ""
- self.logger = ft_logger.Logger("orchestra_ims").getLogger()
+ self.logger = logging.getLogger(__name__)
self.case_dir = os.path.join(CONST.dir_functest_test, 'vnf/ims/')
self.data_dir = CONST.dir_ims_data
self.test_dir = CONST.dir_repo_vims_test
@@ -495,6 +495,7 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
if __name__ == '__main__':
+ logging.basicConfig()
test = ImsVnf()
test.deploy_orchestrator()
test.deploy_vnf()
diff --git a/functest/opnfv_tests/vnf/ims/orchestrator_cloudify.py b/functest/opnfv_tests/vnf/ims/orchestrator_cloudify.py
index 82a9dca05..4ceeb25f8 100644
--- a/functest/opnfv_tests/vnf/ims/orchestrator_cloudify.py
+++ b/functest/opnfv_tests/vnf/ims/orchestrator_cloudify.py
@@ -11,6 +11,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
########################################################################
+import logging
import os
import shutil
import subprocess32 as subprocess
@@ -18,8 +19,6 @@ import yaml
from git import Repo
-import functest.utils.functest_logger as ft_logger
-
class Orchestrator(object):
@@ -29,7 +28,7 @@ class Orchestrator(object):
self.input_file = 'inputs.yaml'
self.manager_blueprint = False
self.config = inputs
- self.logger = ft_logger.Logger("Orchestrator").getLogger()
+ self.logger = logging.getLogger(__name__)
self.manager_up = False
def set_credentials(self, username, password, tenant_name, auth_url):
diff --git a/functest/tests/unit/core/test_feature.py b/functest/tests/unit/core/test_feature.py
index 993da5a03..8de42ec50 100644
--- a/functest/tests/unit/core/test_feature.py
+++ b/functest/tests/unit/core/test_feature.py
@@ -28,7 +28,7 @@ class FeatureTestingBase(unittest.TestCase):
_project_name = "bar"
_repo = "dir_repo_copper"
_cmd = "cd /home/opnfv/repos/foo/tests && bash run.sh && cd -"
- _output_file = '/home/opnfv/functest/results/bar.log'
+ _output_file = '/home/opnfv/functest/results/foo.log'
feature = None
@mock.patch('time.time', side_effect=[1, 2])
diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py
index 54d6da72c..f3d37c650 100644
--- a/functest/tests/unit/odl/test_odl.py
+++ b/functest/tests/unit/odl/test_odl.py
@@ -337,9 +337,11 @@ class ODLMainTesting(ODLTesting):
with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
mock.patch.object(odl, 'open', mock.mock_open(),
- create=True), \
+ create=True) as mock_open, \
mock.patch.object(self.test, 'parse_results'):
self._test_main(testcase.TestCase.EX_OK, *args)
+ mock_open.assert_called_once_with(
+ os.path.join(odl.ODLTests.res_dir, 'stdout.txt'), 'w+')
@mock.patch('os.remove')
@mock.patch('robot.run', return_value=1)
@@ -348,9 +350,11 @@ class ODLMainTesting(ODLTesting):
with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
mock.patch.object(odl, 'open', mock.mock_open(),
- create=True), \
+ create=True) as mock_open, \
mock.patch.object(self.test, 'parse_results'):
self._test_main(testcase.TestCase.EX_OK, *args)
+ mock_open.assert_called_once_with(
+ os.path.join(odl.ODLTests.res_dir, 'stdout.txt'), 'w+')
@mock.patch('os.remove', side_effect=OSError)
@mock.patch('robot.run')
@@ -359,9 +363,11 @@ class ODLMainTesting(ODLTesting):
with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
mock.patch.object(odl, 'open', mock.mock_open(),
- create=True), \
+ create=True) as mock_open, \
mock.patch.object(self.test, 'parse_results'):
self._test_main(testcase.TestCase.EX_OK, *args)
+ mock_open.assert_called_once_with(
+ os.path.join(odl.ODLTests.res_dir, 'stdout.txt'), 'w+')
class ODLRunTesting(ODLTesting):
diff --git a/functest/tests/unit/utils/test_functest_logger.py b/functest/tests/unit/utils/test_functest_logger.py
deleted file mode 100644
index 42e41a141..000000000
--- a/functest/tests/unit/utils/test_functest_logger.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-
-import logging
-import unittest
-
-import mock
-
-from functest.utils import functest_logger
-from functest.utils.constants import CONST
-
-
-class OSUtilsLogger(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
-
- def setUp(self):
- with mock.patch('__builtin__.open', mock.mock_open()):
- with mock.patch('functest.utils.functest_logger.os.path.exists',
- return_value=True), \
- mock.patch('functest.utils.functest_logger.'
- 'json.load'), \
- mock.patch('functest.utils.functest_logger.'
- 'logging.config.dictConfig') as m:
- self.logger = functest_logger.Logger('os_utils')
- self.assertTrue(m.called)
- with mock.patch('functest.utils.functest_logger.os.path.exists',
- return_value=False), \
- mock.patch('functest.utils.functest_logger.'
- 'logging.basicConfig') as m:
- self.logger = functest_logger.Logger('os_utils')
- self.assertTrue(m.called)
-
- def test_is_debug_false(self):
- CONST.CI_DEBUG = False
- self.assertFalse(self.logger.is_debug())
-
- def test_is_debug_true(self):
- CONST.CI_DEBUG = "True"
- self.assertTrue(self.logger.is_debug())
-
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
diff --git a/functest/tests/unit/utils/test_openstack_utils.py b/functest/tests/unit/utils/test_openstack_utils.py
index 7f3995d03..a7df264c9 100644
--- a/functest/tests/unit/utils/test_openstack_utils.py
+++ b/functest/tests/unit/utils/test_openstack_utils.py
@@ -418,21 +418,45 @@ class OSUtilsTesting(unittest.TestCase):
mock_logger_info.assert_called_once_with("OS_IDENTITY_API_VERSION is "
"set in env as '%s'", '3')
- def test_get_keystone_client(self):
+ @mock.patch('functest.utils.openstack_utils.get_session')
+ @mock.patch('functest.utils.openstack_utils.keystoneclient.Client')
+ @mock.patch('functest.utils.openstack_utils.get_keystone_client_version',
+ return_value='3')
+ @mock.patch('functest.utils.openstack_utils.os.getenv',
+ return_value='public')
+ def test_get_keystone_client_with_interface(self, mock_os_getenv,
+ mock_keystoneclient_version,
+ mock_key_client,
+ mock_get_session):
mock_keystone_obj = mock.Mock()
mock_session_obj = mock.Mock()
- with mock.patch('functest.utils.openstack_utils'
- '.get_keystone_client_version', return_value='3'), \
- mock.patch('functest.utils.openstack_utils'
- '.keystoneclient.Client',
- return_value=mock_keystone_obj) \
- as mock_key_client, \
- mock.patch('functest.utils.openstack_utils.get_session',
- return_value=mock_session_obj):
- self.assertEqual(openstack_utils.get_keystone_client(),
- mock_keystone_obj)
- mock_key_client.assert_called_once_with('3',
- session=mock_session_obj)
+ mock_key_client.return_value = mock_keystone_obj
+ mock_get_session.return_value = mock_session_obj
+ self.assertEqual(openstack_utils.get_keystone_client(),
+ mock_keystone_obj)
+ mock_key_client.assert_called_once_with('3',
+ session=mock_session_obj,
+ interface='public')
+
+ @mock.patch('functest.utils.openstack_utils.get_session')
+ @mock.patch('functest.utils.openstack_utils.keystoneclient.Client')
+ @mock.patch('functest.utils.openstack_utils.get_keystone_client_version',
+ return_value='3')
+ @mock.patch('functest.utils.openstack_utils.os.getenv',
+ return_value='admin')
+ def test_get_keystone_client_no_interface(self, mock_os_getenv,
+ mock_keystoneclient_version,
+ mock_key_client,
+ mock_get_session):
+ mock_keystone_obj = mock.Mock()
+ mock_session_obj = mock.Mock()
+ mock_key_client.return_value = mock_keystone_obj
+ mock_get_session.return_value = mock_session_obj
+ self.assertEqual(openstack_utils.get_keystone_client(),
+ mock_keystone_obj)
+ mock_key_client.assert_called_once_with('3',
+ session=mock_session_obj,
+ interface='admin')
@mock.patch('functest.utils.openstack_utils.os.getenv',
return_value=None)
diff --git a/functest/utils/functest_logger.py b/functest/utils/functest_logger.py
deleted file mode 100644
index ba52829f7..000000000
--- a/functest/utils/functest_logger.py
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/env python
-#
-# jose.lausuch@ericsson.com
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Logging levels:
-# Level Numeric value
-# CRITICAL 50
-# ERROR 40
-# WARNING 30
-# INFO 20
-# DEBUG 10
-# NOTSET 0
-#
-# Usage:
-# import functest_logger as fl
-# logger = fl.Logger("script_name").getLogger()
-# logger.info("message to be shown with - INFO - ")
-# logger.debug("message to be shown with - DEBUG -")
-import logging
-import logging.config
-import os
-
-import json
-
-from functest.utils.constants import CONST
-
-ignore = ["paramiko",
- "stevedore.extension",
- "keystoneauth.session",
- "keystoneauth.identity.v3.base",
- "novaclient.v2.client",
- "neutronclient.v2_0.client",
- "glanceclient.common.http",
- "cinderclient.v2.client",
- "cinderclient.client"]
-
-
-class Logger(object):
-
- instance = None
-
- def __new__(cls, logger_name):
- if cls.instance is None:
- cls.instance = object.__new__(cls)
- return cls.instance
-
- def __init__(self, logger_name):
- self.setup_logging()
- self.logger = logging.getLogger(logger_name)
- for module_name in ignore:
- logging.getLogger(module_name).setLevel(logging.WARNING)
-
- def getLogger(self):
- return self.logger
-
- def is_debug(self):
- if CONST.CI_DEBUG and CONST.CI_DEBUG.lower() == "true":
- return True
- return False
-
- def setup_logging(self, default_path=CONST.dir_functest_logging_cfg,
- default_level=logging.INFO,
- env_key='LOG_CFG'):
- path = default_path
- value = os.getenv(env_key, None)
- if value:
- path = value
- if os.path.exists(path):
- with open(path, 'rt') as f:
- config = json.load(f)
- if (config['handlers'] and
- config['handlers']['console']):
- stream_level = logging.INFO
- if self.is_debug():
- stream_level = logging.DEBUG
- config['handlers']['console']['level'] = stream_level
- logging.config.dictConfig(config)
- else:
- logging.basicConfig(level=default_level)
diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py
index 7d993cbfc..3e85b9e46 100644
--- a/functest/utils/functest_utils.py
+++ b/functest/utils/functest_utils.py
@@ -9,6 +9,7 @@
#
import functools
import json
+import logging
import os
import re
import shutil
@@ -24,9 +25,8 @@ import yaml
from git import Repo
from functest.utils import decorators
-import functest.utils.functest_logger as ft_logger
-logger = ft_logger.Logger("functest_utils").getLogger()
+logger = logging.getLogger(__name__)
# ----------------------------------------------------------
diff --git a/functest/utils/openstack/cinder.py b/functest/utils/openstack/cinder.py
deleted file mode 100644
index f966468a3..000000000
--- a/functest/utils/openstack/cinder.py
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env python
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-#
diff --git a/functest/utils/openstack/glance.py b/functest/utils/openstack/glance.py
deleted file mode 100644
index f966468a3..000000000
--- a/functest/utils/openstack/glance.py
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env python
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-#
diff --git a/functest/utils/openstack/keystone.py b/functest/utils/openstack/keystone.py
deleted file mode 100644
index f966468a3..000000000
--- a/functest/utils/openstack/keystone.py
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env python
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-#
diff --git a/functest/utils/openstack/neutron.py b/functest/utils/openstack/neutron.py
deleted file mode 100644
index f966468a3..000000000
--- a/functest/utils/openstack/neutron.py
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env python
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-#
diff --git a/functest/utils/openstack/nova.py b/functest/utils/openstack/nova.py
deleted file mode 100644
index f966468a3..000000000
--- a/functest/utils/openstack/nova.py
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env python
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-#
diff --git a/functest/utils/openstack_clean.py b/functest/utils/openstack_clean.py
index ce61fcacf..29106d9ed 100755
--- a/functest/utils/openstack_clean.py
+++ b/functest/utils/openstack_clean.py
@@ -24,13 +24,13 @@
import time
+import logging
import yaml
-import functest.utils.functest_logger as ft_logger
import functest.utils.openstack_utils as os_utils
from functest.utils.constants import CONST
-logger = ft_logger.Logger("openstack_clean").getLogger()
+logger = logging.getLogger(__name__)
OS_SNAPSHOT_FILE = CONST.openstack_snapshot_file
@@ -428,4 +428,5 @@ def main():
if __name__ == '__main__':
+ logging.basicConfig()
main()
diff --git a/functest/utils/openstack_snapshot.py b/functest/utils/openstack_snapshot.py
index e64030f75..952fb7bbb 100755
--- a/functest/utils/openstack_snapshot.py
+++ b/functest/utils/openstack_snapshot.py
@@ -20,13 +20,13 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
+import logging
import yaml
-import functest.utils.functest_logger as ft_logger
import functest.utils.openstack_utils as os_utils
from functest.utils.constants import CONST
-logger = ft_logger.Logger("openstack_snapshot").getLogger()
+logger = logging.getLogger(__name__)
OS_SNAPSHOT_FILE = CONST.openstack_snapshot_file
@@ -162,4 +162,5 @@ def main():
if __name__ == '__main__':
+ logging.basicConfig()
main()
diff --git a/functest/utils/openstack_tacker.py b/functest/utils/openstack_tacker.py
index 8327fdbe2..9fd9d5c47 100644
--- a/functest/utils/openstack_tacker.py
+++ b/functest/utils/openstack_tacker.py
@@ -11,13 +11,13 @@
# http://www.apache.org/licenses/LICENSE-2.0
##########################################################################
+import logging
from tackerclient.v1_0 import client as tackerclient
-import functest.utils.functest_logger as ft_logger
import functest.utils.openstack_utils as os_utils
import time
-logger = ft_logger.Logger("tacker_utils").getLogger()
+logger = logging.getLogger(__name__)
def get_tacker_client(other_creds={}):
diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py
index 929a761e0..7e00a269c 100644
--- a/functest/utils/openstack_utils.py
+++ b/functest/utils/openstack_utils.py
@@ -8,7 +8,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
-import os
+import logging
import os.path
import re
import sys
@@ -23,10 +23,9 @@ from novaclient import client as novaclient
from keystoneclient import client as keystoneclient
from neutronclient.neutron import client as neutronclient
-import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
-logger = ft_logger.Logger("openstack_utils").getLogger()
+logger = logging.getLogger(__name__)
DEFAULT_API_VERSION = '2'
DEFAULT_HEAT_API_VERSION = '1'
@@ -139,11 +138,11 @@ def get_credentials_for_rally():
endpoint_types = [('internalURL', 'internal'),
('publicURL', 'public'), ('adminURL', 'admin')]
- endpoint_type = os.getenv('OS_ENDPOINT_TYPE')
+ endpoint_type = get_endpoint_type_from_env()
if endpoint_type is not None:
cred_key = env_cred_dict.get('OS_ENDPOINT_TYPE')
for k, v in endpoint_types:
- if endpoint_type == k:
+ if endpoint_type == v:
rally_conf[cred_key] = v
region_name = os.getenv('OS_REGION_NAME')
@@ -158,6 +157,14 @@ def get_credentials_for_rally():
return rally_conf
+def get_endpoint_type_from_env():
+ endpoint_type = os.environ.get("OS_ENDPOINT_TYPE",
+ os.environ.get("OS_INTERFACE"))
+ if endpoint_type and "URL" in endpoint_type:
+ endpoint_type = endpoint_type.replace("URL", "")
+ return endpoint_type
+
+
def get_session_auth(other_creds={}):
loader = loading.get_plugin_loader('password')
creds = get_credentials(other_creds)
@@ -198,7 +205,9 @@ def get_keystone_client_version():
def get_keystone_client(other_creds={}):
sess = get_session(other_creds)
- return keystoneclient.Client(get_keystone_client_version(), session=sess)
+ return keystoneclient.Client(get_keystone_client_version(),
+ session=sess,
+ interface=os.getenv('OS_INTERFACE', 'admin'))
def get_nova_client_version():