summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeriyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>2018-05-31 16:59:54 +0200
committerPeriyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>2018-05-31 16:59:54 +0200
commite08e7c43c85fa04dc78a1fcf8a11ab877a78dfb9 (patch)
tree30fd13084546d7c2cb0d495a9003f57e03c9dc3c
parent1fc59dc868766cc845ecf2a2b7f1fef853d2d7e5 (diff)
Fix the logging to be compatible with functest
Change-Id: I62b432497175e79bcf2cd241be54d8a7f5db2799 Signed-off-by: Periyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>
-rw-r--r--sdnvpn/lib/config.py4
-rw-r--r--sdnvpn/lib/logutil.py22
-rw-r--r--sdnvpn/lib/openstack_utils.py4
-rw-r--r--sdnvpn/lib/quagga.py4
-rw-r--r--sdnvpn/lib/results.py4
-rw-r--r--sdnvpn/lib/utils.py4
-rw-r--r--sdnvpn/test/functest/run_tempest.py4
-rw-r--r--sdnvpn/test/functest/testcase_1.py4
-rw-r--r--sdnvpn/test/functest/testcase_10.py5
-rw-r--r--sdnvpn/test/functest/testcase_11.py4
-rw-r--r--sdnvpn/test/functest/testcase_12.py4
-rw-r--r--sdnvpn/test/functest/testcase_13.py4
-rw-r--r--sdnvpn/test/functest/testcase_2.py4
-rw-r--r--sdnvpn/test/functest/testcase_3.py4
-rw-r--r--sdnvpn/test/functest/testcase_4.py4
-rw-r--r--sdnvpn/test/functest/testcase_7.py4
-rw-r--r--sdnvpn/test/functest/testcase_8.py4
-rw-r--r--sdnvpn/test/functest/testcase_9.py4
18 files changed, 34 insertions, 57 deletions
diff --git a/sdnvpn/lib/config.py b/sdnvpn/lib/config.py
index e63574b..81d895b 100644
--- a/sdnvpn/lib/config.py
+++ b/sdnvpn/lib/config.py
@@ -7,14 +7,14 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
+import logging
import yaml
import pkg_resources
from functest.utils import config
import functest.utils.functest_utils as ft_utils
-from sdnvpn.lib import logutil
-logger = logutil.getLogger('sdnvpn_test_config')
+logger = logging.getLogger('sdnvpn_test_config')
class CommonConfig(object):
diff --git a/sdnvpn/lib/logutil.py b/sdnvpn/lib/logutil.py
deleted file mode 100644
index 3765734..0000000
--- a/sdnvpn/lib/logutil.py
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2018 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 os.path
-
-from xtesting.core import feature
-
-
-def getLogger(module_name):
- logger = logging.getLogger(module_name)
- log_file = "{}/{}.log".format("/var/lib/xtesting/results", "bgpvpn")
- if not os.path.exists(log_file):
- open(log_file, 'w+')
- feature.Feature.configure_logger(logger, log_file)
- return logger
diff --git a/sdnvpn/lib/openstack_utils.py b/sdnvpn/lib/openstack_utils.py
index 447e87b..a7ac80b 100644
--- a/sdnvpn/lib/openstack_utils.py
+++ b/sdnvpn/lib/openstack_utils.py
@@ -8,6 +8,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
+import logging
import os.path
import shutil
import sys
@@ -24,9 +25,8 @@ from keystoneclient import client as keystoneclient
from neutronclient.neutron import client as neutronclient
from functest.utils import env
-from sdnvpn.lib import logutil
-logger = logutil.getLogger(__name__)
+logger = logging.getLogger(__name__)
DEFAULT_API_VERSION = '2'
DEFAULT_HEAT_API_VERSION = '1'
diff --git a/sdnvpn/lib/quagga.py b/sdnvpn/lib/quagga.py
index 27bf122..e072f1c 100644
--- a/sdnvpn/lib/quagga.py
+++ b/sdnvpn/lib/quagga.py
@@ -9,15 +9,15 @@
#
"""Utilities for setting up quagga peering"""
+import logging
import re
import time
import functest.utils.functest_utils as ft_utils
import sdnvpn.lib.config as config
from sdnvpn.lib.utils import run_odl_cmd, exec_cmd
-from sdnvpn.lib import logutil
-logger = logutil.getLogger('sdnvpn-quagga')
+logger = logging.getLogger('sdnvpn-quagga')
COMMON_CONFIG = config.CommonConfig()
diff --git a/sdnvpn/lib/results.py b/sdnvpn/lib/results.py
index 42d1865..e1a5e5a 100644
--- a/sdnvpn/lib/results.py
+++ b/sdnvpn/lib/results.py
@@ -7,12 +7,12 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
#
+import logging
import time
import functest.utils.functest_utils as ft_utils
-from sdnvpn.lib import logutil
-logger = logutil.getLogger('sdnvpn-results')
+logger = logging.getLogger('sdnvpn-results')
class Results(object):
diff --git a/sdnvpn/lib/utils.py b/sdnvpn/lib/utils.py
index aafd69b..0748803 100644
--- a/sdnvpn/lib/utils.py
+++ b/sdnvpn/lib/utils.py
@@ -7,6 +7,7 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
#
+import logging
import os
import time
import requests
@@ -18,9 +19,8 @@ from opnfv.deployment.factory import Factory as DeploymentFactory
from sdnvpn.lib import config as sdnvpn_config
import sdnvpn.lib.openstack_utils as os_utils
-from sdnvpn.lib import logutil
-logger = logutil.getLogger('sdnvpn_test_utils')
+logger = logging.getLogger('sdnvpn_test_utils')
common_config = sdnvpn_config.CommonConfig()
diff --git a/sdnvpn/test/functest/run_tempest.py b/sdnvpn/test/functest/run_tempest.py
index 68045fa..a1ef004 100644
--- a/sdnvpn/test/functest/run_tempest.py
+++ b/sdnvpn/test/functest/run_tempest.py
@@ -9,14 +9,14 @@
#
#
import ConfigParser
+import logging
import os
import re
import shutil
import functest.opnfv_tests.openstack.tempest.conf_utils as tempest_utils
-from sdnvpn.lib import logutil
-logger = logutil.getLogger('sdnvpn-tempest')
+logger = logging.getLogger('sdnvpn-tempest')
def main():
diff --git a/sdnvpn/test/functest/testcase_1.py b/sdnvpn/test/functest/testcase_1.py
index b1f3dae..35e32b2 100644
--- a/sdnvpn/test/functest/testcase_1.py
+++ b/sdnvpn/test/functest/testcase_1.py
@@ -8,6 +8,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
+import logging
import sys
from random import randint
@@ -15,9 +16,8 @@ from sdnvpn.lib import config as sdnvpn_config
from sdnvpn.lib import openstack_utils as os_utils
from sdnvpn.lib import utils as test_utils
from sdnvpn.lib.results import Results
-from sdnvpn.lib import logutil
-logger = logutil.getLogger(__name__)
+logger = logging.getLogger(__name__)
COMMON_CONFIG = sdnvpn_config.CommonConfig()
TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig(
diff --git a/sdnvpn/test/functest/testcase_10.py b/sdnvpn/test/functest/testcase_10.py
index f776ecf..aebc146 100644
--- a/sdnvpn/test/functest/testcase_10.py
+++ b/sdnvpn/test/functest/testcase_10.py
@@ -8,6 +8,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
+import logging
import re
import sys
import time
@@ -17,10 +18,8 @@ from sdnvpn.lib import config as sdnvpn_config
from sdnvpn.lib import openstack_utils as os_utils
from sdnvpn.lib import utils as test_utils
from sdnvpn.lib.results import Results
-from sdnvpn.lib import logutil
-
-logger = logutil.getLogger('__name__')
+logger = logging.getLogger('__name__')
std_out_lock = Lock()
diff --git a/sdnvpn/test/functest/testcase_11.py b/sdnvpn/test/functest/testcase_11.py
index 9c3dcaa..c597c4d 100644
--- a/sdnvpn/test/functest/testcase_11.py
+++ b/sdnvpn/test/functest/testcase_11.py
@@ -8,15 +8,15 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
+import logging
import sys
from sdnvpn.lib import config as sdnvpn_config
from sdnvpn.lib import openstack_utils as os_utils
from sdnvpn.lib import utils as test_utils
from sdnvpn.lib.results import Results
-from sdnvpn.lib import logutil
-logger = logutil.getLogger(__name__)
+logger = logging.getLogger(__name__)
COMMON_CONFIG = sdnvpn_config.CommonConfig()
TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig(
diff --git a/sdnvpn/test/functest/testcase_12.py b/sdnvpn/test/functest/testcase_12.py
index 5c91775..3e13d69 100644
--- a/sdnvpn/test/functest/testcase_12.py
+++ b/sdnvpn/test/functest/testcase_12.py
@@ -8,15 +8,15 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
+import logging
import sys
from sdnvpn.lib import config as sdnvpn_config
from sdnvpn.lib import openstack_utils as os_utils
from sdnvpn.lib import utils as test_utils
from sdnvpn.lib.results import Results
-from sdnvpn.lib import logutil
-logger = logutil.getLogger(__name__)
+logger = logging.getLogger(__name__)
COMMON_CONFIG = sdnvpn_config.CommonConfig()
TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig(
diff --git a/sdnvpn/test/functest/testcase_13.py b/sdnvpn/test/functest/testcase_13.py
index 1c1f985..35a1a31 100644
--- a/sdnvpn/test/functest/testcase_13.py
+++ b/sdnvpn/test/functest/testcase_13.py
@@ -8,6 +8,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
+import logging
import sys
from random import randint
@@ -15,9 +16,8 @@ from sdnvpn.lib import config as sdnvpn_config
from sdnvpn.lib import openstack_utils as os_utils
from sdnvpn.lib import utils as test_utils
from sdnvpn.lib.results import Results
-from sdnvpn.lib import logutil
-logger = logutil.getLogger(__name__)
+logger = logging.getLogger(__name__)
COMMON_CONFIG = sdnvpn_config.CommonConfig()
TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig(
diff --git a/sdnvpn/test/functest/testcase_2.py b/sdnvpn/test/functest/testcase_2.py
index 250ac4f..ee74d8d 100644
--- a/sdnvpn/test/functest/testcase_2.py
+++ b/sdnvpn/test/functest/testcase_2.py
@@ -8,6 +8,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
+import logging
import sys
from random import randint
@@ -15,9 +16,8 @@ from sdnvpn.lib import config as sdnvpn_config
from sdnvpn.lib import openstack_utils as os_utils
from sdnvpn.lib import utils as test_utils
from sdnvpn.lib.results import Results
-from sdnvpn.lib import logutil
-logger = logutil.getLogger(__name__)
+logger = logging.getLogger(__name__)
COMMON_CONFIG = sdnvpn_config.CommonConfig()
TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig(
diff --git a/sdnvpn/test/functest/testcase_3.py b/sdnvpn/test/functest/testcase_3.py
index 4475fb8..373e5a8 100644
--- a/sdnvpn/test/functest/testcase_3.py
+++ b/sdnvpn/test/functest/testcase_3.py
@@ -14,6 +14,7 @@
# - Add the functest Quagga as a neighbor
# - Verify that the OpenDaylight and gateway Quagga peer
+import logging
import os
import sys
@@ -22,10 +23,9 @@ from sdnvpn.lib import openstack_utils as os_utils
from sdnvpn.lib import utils as test_utils
from sdnvpn.lib import config as sdnvpn_config
from sdnvpn.lib.results import Results
-from sdnvpn.lib import logutil
-logger = logutil.getLogger(__name__)
+logger = logging.getLogger(__name__)
COMMON_CONFIG = sdnvpn_config.CommonConfig()
TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig(
diff --git a/sdnvpn/test/functest/testcase_4.py b/sdnvpn/test/functest/testcase_4.py
index c0100ce..9b11cc3 100644
--- a/sdnvpn/test/functest/testcase_4.py
+++ b/sdnvpn/test/functest/testcase_4.py
@@ -8,6 +8,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
+import logging
import sys
from random import randint
@@ -15,10 +16,9 @@ from sdnvpn.lib import config as sdnvpn_config
from sdnvpn.lib import openstack_utils as os_utils
from sdnvpn.lib import utils as test_utils
from sdnvpn.lib.results import Results
-from sdnvpn.lib import logutil
-logger = logutil.getLogger(__name__)
+logger = logging.getLogger(__name__)
COMMON_CONFIG = sdnvpn_config.CommonConfig()
TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig(
diff --git a/sdnvpn/test/functest/testcase_7.py b/sdnvpn/test/functest/testcase_7.py
index 6594045..ada45a5 100644
--- a/sdnvpn/test/functest/testcase_7.py
+++ b/sdnvpn/test/functest/testcase_7.py
@@ -18,16 +18,16 @@ network associated:
- Assign a floating IP to a VM
- Ping it
"""
+import logging
import sys
from sdnvpn.lib import config as sdnvpn_config
from sdnvpn.lib import openstack_utils as os_utils
from sdnvpn.lib import utils as test_utils
from sdnvpn.lib.results import Results
-from sdnvpn.lib import logutil
-logger = logutil.getLogger(__name__)
+logger = logging.getLogger(__name__)
COMMON_CONFIG = sdnvpn_config.CommonConfig()
TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig(
diff --git a/sdnvpn/test/functest/testcase_8.py b/sdnvpn/test/functest/testcase_8.py
index afdfef5..e667dba 100644
--- a/sdnvpn/test/functest/testcase_8.py
+++ b/sdnvpn/test/functest/testcase_8.py
@@ -16,16 +16,16 @@
# - Try to ping from one VM to the other
# - Assign a floating IP to the VM in the router assoc network
# - Ping it the floating ip
+import logging
import sys
from sdnvpn.lib import config as sdnvpn_config
from sdnvpn.lib import openstack_utils as os_utils
from sdnvpn.lib import utils as test_utils
from sdnvpn.lib.results import Results
-from sdnvpn.lib import logutil
-logger = logutil.getLogger(__name__)
+logger = logging.getLogger(__name__)
COMMON_CONFIG = sdnvpn_config.CommonConfig()
TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig(
diff --git a/sdnvpn/test/functest/testcase_9.py b/sdnvpn/test/functest/testcase_9.py
index a4cfa5a..b77360d 100644
--- a/sdnvpn/test/functest/testcase_9.py
+++ b/sdnvpn/test/functest/testcase_9.py
@@ -13,18 +13,18 @@
# - Start a BGP router with OpenDaylight
# - Add the functest Quagga as a neighbor
# - Verify that the OpenDaylight and gateway Quagga peer
+import logging
import sys
from sdnvpn.lib import config as sdnvpn_config
from sdnvpn.lib import utils as test_utils
from sdnvpn.lib.results import Results
-from sdnvpn.lib import logutil
COMMON_CONFIG = sdnvpn_config.CommonConfig()
TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig(
"sdnvpn.test.functest.testcase_9")
-logger = logutil.getLogger('__name__')
+logger = logging.getLogger('__name__')
def main():