From a29f1fcf91f130f74dbd9d7c83bb7445faec6136 Mon Sep 17 00:00:00 2001 From: vijayendra Radhakrishna Date: Wed, 24 May 2017 10:12:57 +0000 Subject: functest_logger changes fix - Recently there is removal of functest logger utils. - This uses the default python logging mechanism Change-Id: I3aba38041bbed8b1e5a3de93bc9f639253f262d8 Signed-off-by: Vijayendra Radhakrishna --- sfc/lib/cleanup.py | 4 ++-- sfc/lib/config.py | 4 ++-- sfc/lib/results.py | 4 ++-- sfc/lib/topology_shuffler.py | 4 ++-- sfc/lib/utils.py | 4 ++-- sfc/tests/functest/run_tests.py | 7 +++++-- sfc/tests/functest/sfc_one_chain_two_service_functions.py | 7 +++++-- sfc/tests/functest/sfc_symmetric_chain.py | 7 +++++-- sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py | 7 +++++-- 9 files changed, 30 insertions(+), 18 deletions(-) diff --git a/sfc/lib/cleanup.py b/sfc/lib/cleanup.py index 8c1f0d09..6259736a 100644 --- a/sfc/lib/cleanup.py +++ b/sfc/lib/cleanup.py @@ -1,12 +1,12 @@ import sys -import functest.utils.functest_logger as ft_logger +import logging import functest.utils.openstack_utils as os_utils import functest.utils.openstack_tacker as os_tacker import sfc.lib.utils as utils -logger = ft_logger.Logger(__name__).getLogger() +logger = logging.getLogger(__name__) def delete_odl_resources(odl_ip, odl_port, resource): diff --git a/sfc/lib/config.py b/sfc/lib/config.py index 3a8247e3..c1e73e46 100644 --- a/sfc/lib/config.py +++ b/sfc/lib/config.py @@ -12,11 +12,11 @@ import os import yaml from functest.utils.constants import CONST -import functest.utils.functest_logger as ft_logger +import logging import functest.utils.functest_utils as ft_utils -logger = ft_logger.Logger(__name__).getLogger() +logger = logging.getLogger(__name__) class CommonConfig(object): diff --git a/sfc/lib/results.py b/sfc/lib/results.py index c5172cb2..15d82e02 100644 --- a/sfc/lib/results.py +++ b/sfc/lib/results.py @@ -8,9 +8,9 @@ # http://www.apache.org/licenses/LICENSE-2.0 # -import functest.utils.functest_logger as ft_logger +import logging -logger = ft_logger.Logger(__name__).getLogger() +logger = logging.getLogger(__name__) class Results(object): diff --git a/sfc/lib/topology_shuffler.py b/sfc/lib/topology_shuffler.py index 7e957e97..1a97e270 100644 --- a/sfc/lib/topology_shuffler.py +++ b/sfc/lib/topology_shuffler.py @@ -1,9 +1,9 @@ import datetime import random -import functest.utils.functest_logger as ft_logger +import logging import sfc.lib.utils as sfc_utils -logger = ft_logger.Logger(__name__).getLogger() +logger = logging.getLogger(__name__) # The possible topologies we are testing TOPOLOGIES = [ diff --git a/sfc/lib/utils.py b/sfc/lib/utils.py index e7e93e15..36124d92 100644 --- a/sfc/lib/utils.py +++ b/sfc/lib/utils.py @@ -16,13 +16,13 @@ import time import xmltodict import yaml -import functest.utils.functest_logger as ft_logger +import logging import functest.utils.functest_utils as ft_utils import functest.utils.openstack_utils as os_utils import functest.utils.openstack_tacker as os_tacker -logger = ft_logger.Logger(__name__).getLogger() +logger = logging.getLogger(__name__) SSH_OPTIONS = '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' FUNCTEST_RESULTS_DIR = os.path.join("home", "opnfv", "functest", "results", "odl-sfc") diff --git a/sfc/tests/functest/run_tests.py b/sfc/tests/functest/run_tests.py index 88a351a0..6760e168 100644 --- a/sfc/tests/functest/run_tests.py +++ b/sfc/tests/functest/run_tests.py @@ -15,19 +15,20 @@ import sys import time import yaml -import functest.utils.functest_logger as ft_logger +import logging import functest.utils.functest_utils as ft_utils import functest.utils.openstack_utils as os_utils import opnfv.utils.ovs_logger as ovs_log import sfc.lib.cleanup as sfc_cleanup import sfc.lib.config as sfc_config import sfc.lib.utils as sfc_utils +from functest.utils.constants import CONST from collections import OrderedDict from opnfv.deployment.factory import Factory as DeploymentFactory -logger = ft_logger.Logger(__name__).getLogger() +logger = logging.getLogger(__name__) COMMON_CONFIG = sfc_config.CommonConfig() @@ -171,6 +172,8 @@ def main(report=False): if __name__ == '__main__': + logging.config.fileConfig( + CONST.__getattribute__('dir_functest_logging_cfg')) parser = argparse.ArgumentParser() parser.add_argument("-r", "--report", help="Create json result file", diff --git a/sfc/tests/functest/sfc_one_chain_two_service_functions.py b/sfc/tests/functest/sfc_one_chain_two_service_functions.py index 801a57b2..c65ed8a9 100644 --- a/sfc/tests/functest/sfc_one_chain_two_service_functions.py +++ b/sfc/tests/functest/sfc_one_chain_two_service_functions.py @@ -12,7 +12,8 @@ import os import sys import threading -import functest.utils.functest_logger as ft_logger +import logging +from functest.utils.constants import CONST import functest.utils.openstack_tacker as os_tacker import functest.utils.openstack_utils as os_utils import opnfv.utils.ovs_logger as ovs_log @@ -24,7 +25,7 @@ from opnfv.deployment.factory import Factory as DeploymentFactory import sfc.lib.topology_shuffler as topo_shuffler """ logging configuration """ -logger = ft_logger.Logger(__name__).getLogger() +logger = logging.getLogger(__name__) CLIENT = "client" SERVER = "server" @@ -274,4 +275,6 @@ def main(): if __name__ == '__main__': + logging.config.fileConfig( + CONST.__getattribute__('dir_functest_logging_cfg')) main() diff --git a/sfc/tests/functest/sfc_symmetric_chain.py b/sfc/tests/functest/sfc_symmetric_chain.py index 29ecee24..e3fd26f3 100644 --- a/sfc/tests/functest/sfc_symmetric_chain.py +++ b/sfc/tests/functest/sfc_symmetric_chain.py @@ -13,7 +13,7 @@ import os import sys import threading -import functest.utils.functest_logger as ft_logger +import logging import functest.utils.openstack_tacker as os_tacker import functest.utils.openstack_utils as os_utils import opnfv.utils.ovs_logger as ovs_log @@ -25,7 +25,8 @@ from sfc.lib.results import Results import sfc.lib.topology_shuffler as topo_shuffler -logger = ft_logger.Logger(__name__).getLogger() +from functest.utils.constants import CONST +logger = logging.getLogger(__name__) CLIENT = "client" SERVER = "server" @@ -249,4 +250,6 @@ def main(): if __name__ == '__main__': + logging.config.fileConfig( + CONST.__getattribute__('dir_functest_logging_cfg')) main() diff --git a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py index 7cde7433..07bf5166 100644 --- a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py +++ b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py @@ -12,7 +12,7 @@ import os import sys import threading -import functest.utils.functest_logger as ft_logger +import logging import functest.utils.openstack_tacker as os_tacker import functest.utils.openstack_utils as os_utils import opnfv.utils.ovs_logger as ovs_log @@ -23,8 +23,9 @@ from sfc.lib.results import Results from opnfv.deployment.factory import Factory as DeploymentFactory import sfc.lib.topology_shuffler as topo_shuffler +from functest.utils.constants import CONST -logger = ft_logger.Logger(__name__).getLogger() +logger = logging.getLogger(__name__) CLIENT = "client" SERVER = "server" @@ -320,4 +321,6 @@ def main(): if __name__ == '__main__': + logging.config.fileConfig( + CONST.__getattribute__('dir_functest_logging_cfg')) main() -- cgit 1.2.3-korg