aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPanagiotis Karalis <pkaralis@intracom-telecom.com>2018-05-25 11:53:57 +0300
committerPanagiotis Karalis <pkaralis@intracom-telecom.com>2018-06-05 16:44:22 +0300
commit7d4bbcc9fe1819f11c7b757f8c074db488baee4b (patch)
treef21353c0318bdee7985df80e86a309025ec42708
parent7f8a775dec72e03d6cae2400b7a49d7a097c8957 (diff)
Fix the logging to be compatible with functest
In order to collect logs from SFC test scenarios running through functest framework (mainly for troubleshooting purposes), the logging mechanism has been updated accordingly. JIRA: SFC-125 Change-Id: Ide7c32519afa6ece299d0ac1dcb168609a2e3945 Signed-off-by: Panagiotis Karalis <pkaralis@intracom-telecom.com>
-rw-r--r--sfc/lib/cleanup.py4
-rw-r--r--sfc/lib/config.py10
-rw-r--r--sfc/lib/odl_utils.py12
-rw-r--r--sfc/lib/openstack_utils.py5
-rw-r--r--sfc/lib/results.py5
-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.py12
-rw-r--r--sfc/tests/functest/sfc_chain_deletion.py5
-rw-r--r--sfc/tests/functest/sfc_one_chain_two_service_functions.py5
-rw-r--r--sfc/tests/functest/sfc_symmetric_chain.py5
-rw-r--r--sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py6
12 files changed, 42 insertions, 37 deletions
diff --git a/sfc/lib/cleanup.py b/sfc/lib/cleanup.py
index 13018aa8..d3ce2609 100644
--- a/sfc/lib/cleanup.py
+++ b/sfc/lib/cleanup.py
@@ -1,11 +1,11 @@
+import logging
import sys
import time
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 = 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 b8b0c148..69e1769d 100644
--- a/sfc/lib/config.py
+++ b/sfc/lib/config.py
@@ -8,18 +8,20 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
+
+import logging
import os
+import sfc
import yaml
+import functest
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 = logger.Logger(__name__).getLogger()
+logger = logging.getLogger(__name__)
class CommonConfig(object):
diff --git a/sfc/lib/odl_utils.py b/sfc/lib/odl_utils.py
index ac967847..7879eab9 100644
--- a/sfc/lib/odl_utils.py
+++ b/sfc/lib/odl_utils.py
@@ -1,15 +1,15 @@
import ConfigParser
+import functools
+import json
+import logging
import os
+import re
import requests
import time
-import json
-import re
-import functools
-import sfc.lib.openstack_utils as os_sfc_utils
-from opnfv.utils import opnfv_logger as logger
+import sfc.lib.openstack_utils as os_sfc_utils
-logger = logger.Logger(__name__).getLogger()
+logger = logging.getLogger(__name__)
ODL_MODULE_EXCEPTIONS = {
diff --git a/sfc/lib/openstack_utils.py b/sfc/lib/openstack_utils.py
index f21552d5..cfce41b1 100644
--- a/sfc/lib/openstack_utils.py
+++ b/sfc/lib/openstack_utils.py
@@ -1,9 +1,10 @@
import os
import time
import json
+import logging
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
@@ -24,7 +25,7 @@ from snaps.config.vm_inst import VmInstanceConfig, FloatingIpConfig
from snaps.openstack.utils import (
nova_utils, neutron_utils, heat_utils, keystone_utils)
-logger = logger.Logger(__name__).getLogger()
+logger = logging.getLogger(__name__)
DEFAULT_TACKER_API_VERSION = '1.0'
diff --git a/sfc/lib/results.py b/sfc/lib/results.py
index 2673099b..2f2edfc0 100644
--- a/sfc/lib/results.py
+++ b/sfc/lib/results.py
@@ -7,10 +7,9 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
#
+import logging
-from opnfv.utils import opnfv_logger as logger
-
-logger = logger.Logger(__name__).getLogger()
+logger = logging.getLogger(__name__)
class Results(object):
diff --git a/sfc/lib/test_utils.py b/sfc/lib/test_utils.py
index 16e5762c..36b52755 100644
--- a/sfc/lib/test_utils.py
+++ b/sfc/lib/test_utils.py
@@ -12,10 +12,9 @@ import subprocess
import time
import shutil
import urllib
+import logging
-from opnfv.utils import opnfv_logger as logger
-
-logger = 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/lib/topology_shuffler.py b/sfc/lib/topology_shuffler.py
index 7721972d..f678137a 100644
--- a/sfc/lib/topology_shuffler.py
+++ b/sfc/lib/topology_shuffler.py
@@ -1,9 +1,8 @@
import datetime
import random
+import logging
-from opnfv.utils import opnfv_logger as logger
-
-logger = logger.Logger(__name__).getLogger()
+logger = logging.getLogger(__name__)
# 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 dba73b98..be407514 100644
--- a/sfc/tests/functest/run_sfc_tests.py
+++ b/sfc/tests/functest/run_sfc_tests.py
@@ -11,20 +11,19 @@
import importlib
import os
import time
-import yaml
+import logging
import sys
+import yaml
-from xtesting.core import testcase
+from collections import OrderedDict
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 xtesting.core import testcase
-from collections import OrderedDict
-
-logger = logger.Logger(__name__).getLogger()
+logger = logging.getLogger(__name__)
COMMON_CONFIG = sfc_config.CommonConfig()
@@ -188,5 +187,6 @@ 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 700b39a3..623bca77 100644
--- a/sfc/tests/functest/sfc_chain_deletion.py
+++ b/sfc/tests/functest/sfc_chain_deletion.py
@@ -11,6 +11,8 @@
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
@@ -18,11 +20,10 @@ 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
-logger = logger.Logger(__name__).getLogger()
+logger = logging.getLogger(__name__)
CLIENT = "client"
SERVER = "server"
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 e2f423ef..21d37d18 100644
--- a/sfc/tests/functest/sfc_one_chain_two_service_functions.py
+++ b/sfc/tests/functest/sfc_one_chain_two_service_functions.py
@@ -10,6 +10,8 @@
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
@@ -17,12 +19,11 @@ 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
""" logging configuration """
-logger = logger.Logger(__name__).getLogger()
+logger = logging.getLogger(__name__)
CLIENT = "client"
SERVER = "server"
diff --git a/sfc/tests/functest/sfc_symmetric_chain.py b/sfc/tests/functest/sfc_symmetric_chain.py
index 4ee45047..1085e071 100644
--- a/sfc/tests/functest/sfc_symmetric_chain.py
+++ b/sfc/tests/functest/sfc_symmetric_chain.py
@@ -12,6 +12,8 @@
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
@@ -19,12 +21,11 @@ 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
""" logging configuration """
-logger = logger.Logger(__name__).getLogger()
+logger = logging.getLogger(__name__)
CLIENT = "client"
SERVER = "server"
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 a57fa745..b9a22baf 100644
--- a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
+++ b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
@@ -11,6 +11,8 @@
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
@@ -18,12 +20,12 @@ 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
+
""" logging configuration """
-logger = logger.Logger(__name__).getLogger()
+logger = logging.getLogger(__name__)
CLIENT = "client"
SERVER = "server"