aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests
diff options
context:
space:
mode:
authorJose Lausuch <jose.lausuch@ericsson.com>2017-05-05 07:51:35 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-05-05 07:51:35 +0000
commite9b9d37c1c8268c9cde8db48458e39bce1f5b133 (patch)
tree685694273ab372360642ed5fcfd91148dcc06b13 /functest/opnfv_tests
parent533e08503e5888adb7a7cfa8b112502385130a8f (diff)
parent3154346cfd22a3d500dc2fd01495e181308d12d6 (diff)
Merge "Define loggers as class-private members"
Diffstat (limited to 'functest/opnfv_tests')
-rw-r--r--functest/opnfv_tests/features/barometer.py6
-rwxr-xr-xfunctest/opnfv_tests/sdn/odl/odl.py30
2 files changed, 20 insertions, 16 deletions
diff --git a/functest/opnfv_tests/features/barometer.py b/functest/opnfv_tests/features/barometer.py
index 8a409406..cbfe7d9a 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/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py
index 00745d07..f92cb95d 100755
--- a/functest/opnfv_tests/sdn/odl/odl.py
+++ b/functest/opnfv_tests/sdn/odl/odl.py
@@ -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 = logging.getLogger(__name__)
+ __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)