summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Buil <mbuil@suse.com>2018-05-03 16:25:25 +0200
committerManuel Buil <mbuil@suse.com>2018-05-08 08:02:43 +0000
commit059613f1759e2f86d4d3ecda1680105b720d2197 (patch)
tree07e3c68166a2dc6aa8d5446a9d06668f0071414f
parent3f77ff56f24660500cec13f0953d462ea2cd4948 (diff)
Bug fix: Use opnfv.logger object
JIRA: SFC-125 If we don't use the opnfv.logger from functest, logs are not printed when exeucting tests through the functest framework Change-Id: I6d58ff3977fd94221720eea978e0efde07a576a2 Signed-off-by: Manuel Buil <mbuil@suse.com>
-rw-r--r--sfc/lib/cleanup.py4
-rw-r--r--sfc/lib/config.py12
-rw-r--r--sfc/lib/odl_utils.py4
-rw-r--r--sfc/lib/openstack_utils.py14
-rw-r--r--sfc/lib/results.py4
-rw-r--r--sfc/lib/test_utils.py5
-rw-r--r--sfc/lib/topology_shuffler.py5
-rw-r--r--sfc/tests/functest/run_sfc_tests.py5
-rw-r--r--sfc/tests/functest/sfc_chain_deletion.py11
-rw-r--r--sfc/tests/functest/sfc_one_chain_two_service_functions.py10
-rw-r--r--sfc/tests/functest/sfc_symmetric_chain.py12
-rw-r--r--sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py12
12 files changed, 39 insertions, 59 deletions
diff --git a/sfc/lib/cleanup.py b/sfc/lib/cleanup.py
index 32835fa8..13018aa8 100644
--- a/sfc/lib/cleanup.py
+++ b/sfc/lib/cleanup.py
@@ -1,11 +1,11 @@
import sys
import time
-import logging
import sfc.lib.openstack_utils as os_sfc_utils
import sfc.lib.odl_utils as odl_utils
+from opnfv.utils import opnfv_logger as logger
-logger = logging.getLogger(__name__)
+logger = logger.Logger(__name__).getLogger()
def delete_odl_resources(odl_ip, odl_port, resource):
diff --git a/sfc/lib/config.py b/sfc/lib/config.py
index a4f5d67b..8adf668c 100644
--- a/sfc/lib/config.py
+++ b/sfc/lib/config.py
@@ -8,20 +8,18 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
-import logging
import os
import yaml
-import functest
-
-from functest.utils import config
-from functest.utils import env
import functest.utils.functest_utils as ft_utils
-
import sfc
import sfc.lib.test_utils as test_utils
+import functest
+from functest.utils import config
+from functest.utils import env
+from opnfv.utils import opnfv_logger as logger
-logger = logging.getLogger(__name__)
+logger = logger.Logger(__name__).getLogger()
class CommonConfig(object):
diff --git a/sfc/lib/odl_utils.py b/sfc/lib/odl_utils.py
index e1980423..ac967847 100644
--- a/sfc/lib/odl_utils.py
+++ b/sfc/lib/odl_utils.py
@@ -4,12 +4,12 @@ import requests
import time
import json
import re
-import logging
import functools
import sfc.lib.openstack_utils as os_sfc_utils
+from opnfv.utils import opnfv_logger as logger
-logger = logging.getLogger(__name__)
+logger = logger.Logger(__name__).getLogger()
ODL_MODULE_EXCEPTIONS = {
diff --git a/sfc/lib/openstack_utils.py b/sfc/lib/openstack_utils.py
index b7254bf1..ffbc2088 100644
--- a/sfc/lib/openstack_utils.py
+++ b/sfc/lib/openstack_utils.py
@@ -1,38 +1,30 @@
-import logging
import os
import time
import json
import yaml
+
+from opnfv.utils import opnfv_logger as logger
from tackerclient.tacker import client as tackerclient
from functest.utils import constants
from functest.utils import env
-
from snaps.openstack.tests import openstack_tests
-
from snaps.openstack.create_image import OpenStackImage
from snaps.config.image import ImageConfig
-
from snaps.config.flavor import FlavorConfig
from snaps.openstack.create_flavor import OpenStackFlavor
-
from snaps.config.network import NetworkConfig, SubnetConfig, PortConfig
from snaps.openstack.create_network import OpenStackNetwork
-
from snaps.config.router import RouterConfig
from snaps.openstack.create_router import OpenStackRouter
-
from snaps.config.security_group import (
Protocol, SecurityGroupRuleConfig, Direction, SecurityGroupConfig)
-
from snaps.openstack.create_security_group import OpenStackSecurityGroup
-
import snaps.openstack.create_instance as cr_inst
from snaps.config.vm_inst import VmInstanceConfig, FloatingIpConfig
-
from snaps.openstack.utils import (
nova_utils, neutron_utils, heat_utils, keystone_utils)
-logger = logging.getLogger(__name__)
+logger = logger.Logger(__name__).getLogger()
DEFAULT_TACKER_API_VERSION = '1.0'
diff --git a/sfc/lib/results.py b/sfc/lib/results.py
index 15d82e02..2673099b 100644
--- a/sfc/lib/results.py
+++ b/sfc/lib/results.py
@@ -8,9 +8,9 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
-import logging
+from opnfv.utils import opnfv_logger as logger
-logger = logging.getLogger(__name__)
+logger = logger.Logger(__name__).getLogger()
class Results(object):
diff --git a/sfc/lib/test_utils.py b/sfc/lib/test_utils.py
index 18c55dc1..16e5762c 100644
--- a/sfc/lib/test_utils.py
+++ b/sfc/lib/test_utils.py
@@ -13,10 +13,9 @@ import time
import shutil
import urllib
-import logging
+from opnfv.utils import opnfv_logger as logger
-
-logger = logging.getLogger(__name__)
+logger = logger.Logger(__name__).getLogger()
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/lib/topology_shuffler.py b/sfc/lib/topology_shuffler.py
index f678137a..7721972d 100644
--- a/sfc/lib/topology_shuffler.py
+++ b/sfc/lib/topology_shuffler.py
@@ -1,8 +1,9 @@
import datetime
import random
-import logging
-logger = logging.getLogger(__name__)
+from opnfv.utils import opnfv_logger as logger
+
+logger = logger.Logger(__name__).getLogger()
# The possible topologies we are testing
TOPOLOGIES = [
diff --git a/sfc/tests/functest/run_sfc_tests.py b/sfc/tests/functest/run_sfc_tests.py
index 64c5b385..dba73b98 100644
--- a/sfc/tests/functest/run_sfc_tests.py
+++ b/sfc/tests/functest/run_sfc_tests.py
@@ -16,15 +16,15 @@ import sys
from xtesting.core import testcase
from opnfv.utils import ovs_logger as ovs_log
+from opnfv.utils import opnfv_logger as logger
from opnfv.deployment.factory import Factory as DeploymentFactory
from sfc.lib import cleanup as sfc_cleanup
from sfc.lib import config as sfc_config
from sfc.lib import odl_utils as odl_utils
from collections import OrderedDict
-import logging
-logger = logging.getLogger(__name__)
+logger = logger.Logger(__name__).getLogger()
COMMON_CONFIG = sfc_config.CommonConfig()
@@ -188,6 +188,5 @@ class SfcFunctest(testcase.TestCase):
def main():
- logging.basicConfig(level=logging.INFO)
SFC = SfcFunctest()
sys.exit(SFC.run())
diff --git a/sfc/tests/functest/sfc_chain_deletion.py b/sfc/tests/functest/sfc_chain_deletion.py
index 9fde460f..c1d5d335 100644
--- a/sfc/tests/functest/sfc_chain_deletion.py
+++ b/sfc/tests/functest/sfc_chain_deletion.py
@@ -11,20 +11,18 @@
import os
import sys
import threading
-import logging
-
import sfc.lib.openstack_utils as os_sfc_utils
import sfc.lib.odl_utils as odl_utils
import opnfv.utils.ovs_logger as ovs_log
-
+import sfc.lib.topology_shuffler as topo_shuffler
import sfc.lib.config as sfc_config
import sfc.lib.test_utils as test_utils
+
+from opnfv.utils import opnfv_logger as logger
from sfc.lib.results import Results
from opnfv.deployment.factory import Factory as DeploymentFactory
-import sfc.lib.topology_shuffler as topo_shuffler
-
-logger = logging.getLogger(__name__)
+logger = logger.Logger(__name__).getLogger()
CLIENT = "client"
SERVER = "server"
@@ -264,5 +262,4 @@ def main():
if __name__ == '__main__':
- logging.config.fileConfig(COMMON_CONFIG.functest_logging_api)
main()
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 07f7814c..ae70814a 100644
--- a/sfc/tests/functest/sfc_one_chain_two_service_functions.py
+++ b/sfc/tests/functest/sfc_one_chain_two_service_functions.py
@@ -10,20 +10,19 @@
import os
import sys
import threading
-import logging
-
import sfc.lib.openstack_utils as os_sfc_utils
import sfc.lib.odl_utils as odl_utils
import opnfv.utils.ovs_logger as ovs_log
-
import sfc.lib.config as sfc_config
import sfc.lib.test_utils as test_utils
+import sfc.lib.topology_shuffler as topo_shuffler
+
+from opnfv.utils import opnfv_logger as logger
from sfc.lib.results import Results
from opnfv.deployment.factory import Factory as DeploymentFactory
-import sfc.lib.topology_shuffler as topo_shuffler
""" logging configuration """
-logger = logging.getLogger(__name__)
+logger = logger.Logger(__name__).getLogger()
CLIENT = "client"
SERVER = "server"
@@ -282,5 +281,4 @@ def main():
if __name__ == '__main__':
- logging.config.fileConfig(COMMON_CONFIG.functest_logging_api)
main()
diff --git a/sfc/tests/functest/sfc_symmetric_chain.py b/sfc/tests/functest/sfc_symmetric_chain.py
index 43599d62..aa30e011 100644
--- a/sfc/tests/functest/sfc_symmetric_chain.py
+++ b/sfc/tests/functest/sfc_symmetric_chain.py
@@ -12,20 +12,19 @@
import os
import sys
import threading
-import logging
-
import sfc.lib.openstack_utils as os_sfc_utils
import sfc.lib.odl_utils as odl_utils
import opnfv.utils.ovs_logger as ovs_log
-from opnfv.deployment.factory import Factory as DeploymentFactory
-
import sfc.lib.config as sfc_config
import sfc.lib.test_utils as test_utils
-from sfc.lib.results import Results
import sfc.lib.topology_shuffler as topo_shuffler
+from opnfv.utils import opnfv_logger as logger
+from sfc.lib.results import Results
+from opnfv.deployment.factory import Factory as DeploymentFactory
-logger = logging.getLogger(__name__)
+""" logging configuration """
+logger = logger.Logger(__name__).getLogger()
CLIENT = "client"
SERVER = "server"
@@ -330,5 +329,4 @@ def wait_for_classification_rules(ovs_logger, compute_nodes,
if __name__ == '__main__':
- logging.config.fileConfig(COMMON_CONFIG.functest_logging_api)
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 a5133f00..82f58b7b 100644
--- a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
+++ b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
@@ -11,20 +11,19 @@
import os
import sys
import threading
-import logging
-
import sfc.lib.openstack_utils as os_sfc_utils
import sfc.lib.odl_utils as odl_utils
import opnfv.utils.ovs_logger as ovs_log
-
import sfc.lib.config as sfc_config
import sfc.lib.test_utils as test_utils
-from sfc.lib.results import Results
-from opnfv.deployment.factory import Factory as DeploymentFactory
import sfc.lib.topology_shuffler as topo_shuffler
+from opnfv.utils import opnfv_logger as logger
+from sfc.lib.results import Results
+from opnfv.deployment.factory import Factory as DeploymentFactory
-logger = logging.getLogger(__name__)
+""" logging configuration """
+logger = logger.Logger(__name__).getLogger()
CLIENT = "client"
SERVER = "server"
@@ -310,5 +309,4 @@ def main():
if __name__ == '__main__':
- logging.config.fileConfig(COMMON_CONFIG.functest_logging_api)
main()