From 303268d0464127c52f11443404fb1baae03d615f Mon Sep 17 00:00:00 2001 From: Periyasamy Palanisamy Date: Mon, 16 Apr 2018 15:09:16 +0200 Subject: Make sdnvpn logging proper * Currently no log messages are getting written into log file due to file handler is registered for logger object created at different modules. Now corresponding handler is registered for logger objects. * Making sdnvpn Feature class to use its parent class logger object to avoid unnecessary logger object creation. Change-Id: I4ec61951ba4ac39cecc137dbb818da72f0b43b35 Signed-off-by: Periyasamy Palanisamy --- sdnvpn/lib/config.py | 4 +-- sdnvpn/lib/logutil.py | 23 +++++++++++++ sdnvpn/lib/openstack_utils.py | 5 ++- sdnvpn/lib/quagga.py | 4 +-- sdnvpn/lib/results.py | 4 +-- sdnvpn/lib/utils.py | 58 +++++++++++++++++--------------- sdnvpn/test/functest/run_sdnvpn_tests.py | 51 ++++++++++++++-------------- sdnvpn/test/functest/run_tempest.py | 6 ++-- sdnvpn/test/functest/testcase_1.py | 6 ++-- sdnvpn/test/functest/testcase_10.py | 31 +++++++++-------- sdnvpn/test/functest/testcase_11.py | 9 +++-- sdnvpn/test/functest/testcase_12.py | 11 +++--- sdnvpn/test/functest/testcase_13.py | 5 ++- sdnvpn/test/functest/testcase_2.py | 5 ++- sdnvpn/test/functest/testcase_3.py | 5 ++- sdnvpn/test/functest/testcase_4.py | 5 ++- sdnvpn/test/functest/testcase_7.py | 5 ++- sdnvpn/test/functest/testcase_8.py | 5 ++- sdnvpn/test/functest/testcase_9.py | 5 ++- 19 files changed, 128 insertions(+), 119 deletions(-) create mode 100644 sdnvpn/lib/logutil.py (limited to 'sdnvpn') diff --git a/sdnvpn/lib/config.py b/sdnvpn/lib/config.py index ebb5520..e63574b 100644 --- a/sdnvpn/lib/config.py +++ b/sdnvpn/lib/config.py @@ -8,13 +8,13 @@ # http://www.apache.org/licenses/LICENSE-2.0 import yaml -import logging import pkg_resources from functest.utils import config import functest.utils.functest_utils as ft_utils +from sdnvpn.lib import logutil -logger = logging.getLogger('sdnvpn_test_config') +logger = logutil.getLogger('sdnvpn_test_config') class CommonConfig(object): diff --git a/sdnvpn/lib/logutil.py b/sdnvpn/lib/logutil.py new file mode 100644 index 0000000..3710ca1 --- /dev/null +++ b/sdnvpn/lib/logutil.py @@ -0,0 +1,23 @@ +#!/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 os.path.exists(log_file): + feature.Feature.configure_logger(logger, log_file) + else: + logger.setLevel(logging.DEBUG) + return logger diff --git a/sdnvpn/lib/openstack_utils.py b/sdnvpn/lib/openstack_utils.py index 8089137..990fa7c 100644 --- a/sdnvpn/lib/openstack_utils.py +++ b/sdnvpn/lib/openstack_utils.py @@ -8,7 +8,6 @@ # http://www.apache.org/licenses/LICENSE-2.0 # -import logging import os.path import shutil import sys @@ -24,10 +23,10 @@ from novaclient import client as novaclient from keystoneclient import client as keystoneclient from neutronclient.neutron import client as neutronclient -from functest.utils import config from functest.utils import env +from sdnvpn.lib import logutil -logger = logging.getLogger(__name__) +logger = logutil.getLogger(__name__) DEFAULT_API_VERSION = '2' DEFAULT_HEAT_API_VERSION = '1' diff --git a/sdnvpn/lib/quagga.py b/sdnvpn/lib/quagga.py index e072f1c..27bf122 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 = logging.getLogger('sdnvpn-quagga') +logger = logutil.getLogger('sdnvpn-quagga') COMMON_CONFIG = config.CommonConfig() diff --git a/sdnvpn/lib/results.py b/sdnvpn/lib/results.py index e1a5e5a..42d1865 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 = logging.getLogger('sdnvpn-results') +logger = logutil.getLogger('sdnvpn-results') class Results(object): diff --git a/sdnvpn/lib/utils.py b/sdnvpn/lib/utils.py index ad8215c..aafd69b 100644 --- a/sdnvpn/lib/utils.py +++ b/sdnvpn/lib/utils.py @@ -7,7 +7,6 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -import logging import os import time import requests @@ -19,8 +18,9 @@ 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 = logging.getLogger('sdnvpn_test_utils') +logger = logutil.getLogger('sdnvpn_test_utils') common_config = sdnvpn_config.CommonConfig() @@ -34,6 +34,7 @@ class ExtraRoute(object): """ Class to represent extra route for a router """ + def __init__(self, destination, nexthop): self.destination = destination self.nexthop = nexthop @@ -43,6 +44,7 @@ class AllowedAddressPair(object): """ Class to represent allowed address pair for a neutron port """ + def __init__(self, ipaddress, macaddress): self.ipaddress = ipaddress self.macaddress = macaddress @@ -638,9 +640,9 @@ def cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, interfaces, if len(floatingip_ids) != 0: for floatingip_id in floatingip_ids: if not os_utils.delete_floating_ip(neutron_client, floatingip_id): - logging.error('Fail to delete all floating ips. ' - 'Floating ip with id {} was not deleted.'. - format(floatingip_id)) + logger.error('Fail to delete all floating ips. ' + 'Floating ip with id {} was not deleted.'. + format(floatingip_id)) return False if len(bgpvpn_ids) != 0: @@ -651,39 +653,39 @@ def cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, interfaces, for router_id, subnet_id in interfaces: if not os_utils.remove_interface_router(neutron_client, router_id, subnet_id): - logging.error('Fail to delete all interface routers. ' - 'Interface router with id {} was not deleted.'. - format(router_id)) + logger.error('Fail to delete all interface routers. ' + 'Interface router with id {} was not deleted.'. + format(router_id)) if len(router_ids) != 0: for router_id in router_ids: if not os_utils.remove_gateway_router(neutron_client, router_id): - logging.error('Fail to delete all gateway routers. ' - 'Gateway router with id {} was not deleted.'. - format(router_id)) + logger.error('Fail to delete all gateway routers. ' + 'Gateway router with id {} was not deleted.'. + format(router_id)) if len(subnet_ids) != 0: for subnet_id in subnet_ids: if not os_utils.delete_neutron_subnet(neutron_client, subnet_id): - logging.error('Fail to delete all subnets. ' - 'Subnet with id {} was not deleted.'. - format(subnet_id)) + logger.error('Fail to delete all subnets. ' + 'Subnet with id {} was not deleted.'. + format(subnet_id)) return False if len(router_ids) != 0: for router_id in router_ids: if not os_utils.delete_neutron_router(neutron_client, router_id): - logging.error('Fail to delete all routers. ' - 'Router with id {} was not deleted.'. - format(router_id)) + logger.error('Fail to delete all routers. ' + 'Router with id {} was not deleted.'. + format(router_id)) return False if len(network_ids) != 0: for network_id in network_ids: if not os_utils.delete_neutron_net(neutron_client, network_id): - logging.error('Fail to delete all networks. ' - 'Network with id {} was not deleted.'. - format(network_id)) + logger.error('Fail to delete all networks. ' + 'Network with id {} was not deleted.'. + format(network_id)) return False return True @@ -695,9 +697,9 @@ def cleanup_nova(nova_client, instance_ids, flavor_ids=None): if len(instance_ids) != 0: for instance_id in instance_ids: if not os_utils.delete_instance(nova_client, instance_id): - logging.error('Fail to delete all instances. ' - 'Instance with id {} was not deleted.'. - format(instance_id)) + logger.error('Fail to delete all instances. ' + 'Instance with id {} was not deleted.'. + format(instance_id)) return False return True @@ -706,9 +708,9 @@ def cleanup_glance(glance_client, image_ids): if len(image_ids) != 0: for image_id in image_ids: if not os_utils.delete_glance_image(glance_client, image_id): - logging.error('Fail to delete all images. ' - 'Image with id {} was not deleted.'. - format(image_id)) + logger.error('Fail to delete all images. ' + 'Image with id {} was not deleted.'. + format(image_id)) return False return True @@ -779,8 +781,8 @@ def is_fail_mode_secure(): is_secure[openstack_node.name] = True else: # failure - logging.error('The fail_mode for br-int was not secure ' - 'in {} node'.format(openstack_node.name)) + logger.error('The fail_mode for br-int was not secure ' + 'in {} node'.format(openstack_node.name)) is_secure[openstack_node.name] = False return is_secure diff --git a/sdnvpn/test/functest/run_sdnvpn_tests.py b/sdnvpn/test/functest/run_sdnvpn_tests.py index 224ef9b..211269e 100644 --- a/sdnvpn/test/functest/run_sdnvpn_tests.py +++ b/sdnvpn/test/functest/run_sdnvpn_tests.py @@ -21,13 +21,12 @@ from sdnvpn.lib import openstack_utils as os_utils from sdnvpn.lib.gather_logs import gather_logs from sdnvpn.lib import utils as test_utils + COMMON_CONFIG = sdnvpn_config.CommonConfig() class SdnvpnFunctest(feature.Feature): - __logger = logging.getLogger(__name__) - def execute(self): nova_client = os_utils.get_nova_client() @@ -43,8 +42,8 @@ class SdnvpnFunctest(feature.Feature): neutron_quota['port'], neutron_quota['router']) instances_quota = test_utils.get_nova_instances_quota(nova_client) - self.__logger.info("Setting net/subnet/port/router " - "quota to unlimited") + self.logger.info("Setting net/subnet/port/router " + "quota to unlimited") test_utils.update_nw_subnet_port_quota( neutron_client, tenant_id, @@ -56,7 +55,7 @@ class SdnvpnFunctest(feature.Feature): # Workaround for # https://jira.opnfv.org/projects/SDNVPN/issues/SDNVPN-115 - self.__logger.info("Setting instances quota class to unlimited") + self.logger.info("Setting instances quota class to unlimited") test_utils.update_instance_quota_class( nova_client, COMMON_CONFIG.nova_instances_quota_class) @@ -72,37 +71,37 @@ class SdnvpnFunctest(feature.Feature): test_descr = testcases[tc]['description'] title = ("Running '%s - %s'" % (test_name, test_descr)) - self.__logger.info(title) - self.__logger.info("%s\n" % ("=" * len(title))) + self.logger.info(title) + self.logger.info("%s\n" % ("=" * len(title))) try: - self.__logger.info("Importing the testcase %s" % test_name) + self.logger.info("Importing the testcase %s" % test_name) t = importlib.import_module(test_name, package=None) - self.__logger.info("Calling the testcase %s main method" - % test_name) + self.logger.info("Calling the testcase %s main method" + % test_name) result = t.main() - self.__logger.info("Execution is complete for the testcase %s" - % test_name) + self.logger.info("Execution is complete for the" + " testcase %s" % test_name) except Exception as ex: result = -1 - self.__logger.info("Caught Exception in %s: %s Trace: %s" - % (test_name, ex, - traceback.format_exc())) + self.logger.info("Caught Exception in %s: %s Trace: %s" + % (test_name, ex, + traceback.format_exc())) if result < 0: status = "FAIL" overall_status = "FAIL" - self.__logger.info("Testcase %s failed" % test_name) + self.logger.info("Testcase %s failed" % test_name) else: status = result.get("status") self.details.update( {test_name: {'status': status, 'details': result.get("details")}}) - self.__logger.info("Results of test case '%s - %s':\n%s\n" - % (test_name, test_descr, result)) + self.logger.info("Results of test case '%s - %s':\n%s\n" + % (test_name, test_descr, result)) if status == "FAIL": overall_status = "FAIL" - self.__logger.info("Resetting subnet/net/port quota") + self.logger.info("Resetting subnet/net/port quota") test_utils.update_nw_subnet_port_quota(neutron_client, tenant_id, neutron_nw_quota, @@ -110,7 +109,7 @@ class SdnvpnFunctest(feature.Feature): neutron_port_quota, neutron_router_quota) - self.__logger.info("Resetting instances quota class") + self.logger.info("Resetting instances quota class") test_utils.update_instance_quota_class(nova_client, instances_quota) try: @@ -118,13 +117,13 @@ class SdnvpnFunctest(feature.Feature): if installer_type in ["fuel", "apex"]: gather_logs('overall') else: - self.__logger.info("Skipping log gathering because installer" - "type %s is neither fuel nor apex" % - installer_type) + self.logger.info("Skipping log gathering because installer" + "type %s is neither fuel nor apex" % + installer_type) except Exception as ex: - self.__logger.error(('Something went wrong in the Log gathering.' - 'Ex: %s, Trace: %s') - % (ex, traceback.format_exc())) + self.logger.error(('Something went wrong in the Log gathering.' + 'Ex: %s, Trace: %s') + % (ex, traceback.format_exc())) if overall_status == "PASS": self.result = 100 diff --git a/sdnvpn/test/functest/run_tempest.py b/sdnvpn/test/functest/run_tempest.py index 2661507..801a889 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 = logging.getLogger('sdnvpn-tempest') +logger = logutil.getLogger('sdnvpn-tempest') def main(): @@ -27,7 +27,6 @@ def main(): src_tempest_dir = tempest_utils.get_verifier_deployment_dir( verifier_id, deployment_id) - if not src_tempest_dir: logger.error("Rally deployment not found.") exit(-1) @@ -106,5 +105,4 @@ def main(): if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) main() diff --git a/sdnvpn/test/functest/testcase_1.py b/sdnvpn/test/functest/testcase_1.py index 55d71ce..b1f3dae 100644 --- a/sdnvpn/test/functest/testcase_1.py +++ b/sdnvpn/test/functest/testcase_1.py @@ -8,17 +8,16 @@ # http://www.apache.org/licenses/LICENSE-2.0 # -import logging import sys -import time from random import randint 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 = logging.getLogger(__name__) +logger = logutil.getLogger(__name__) COMMON_CONFIG = sdnvpn_config.CommonConfig() TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig( @@ -255,5 +254,4 @@ def main(): if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) sys.exit(main()) diff --git a/sdnvpn/test/functest/testcase_10.py b/sdnvpn/test/functest/testcase_10.py index d4ab664..f776ecf 100644 --- a/sdnvpn/test/functest/testcase_10.py +++ b/sdnvpn/test/functest/testcase_10.py @@ -8,7 +8,6 @@ # http://www.apache.org/licenses/LICENSE-2.0 # -import logging import re import sys import time @@ -18,9 +17,10 @@ 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 = logging.getLogger('__name__') +logger = logutil.getLogger('__name__') std_out_lock = Lock() @@ -46,20 +46,20 @@ def monitor(in_data, out_data, vm): format(vm.name)) # Atomic write to std out with std_out_lock: - logging.error("Failure during ping from " - "instance {}: {}". - format(vm.name, console_line)) + logger.error("Failure during ping from " + "instance {}: {}". + format(vm.name, console_line)) elif re.match(r'ping.*OK', console_line): # Atomic write to std out with std_out_lock: - logging.info("Ping from instance {}: {}". - format(vm.name, console_line)) + logger.info("Ping from instance {}: {}". + format(vm.name, console_line)) lines_offset = len(vm_console_out_lines) except: # Atomic write to std out with std_out_lock: - logging.error("Failure in monitor_thread of instance {}". - format(vm.name)) + logger.error("Failure in monitor_thread of instance {}". + format(vm.name)) # Return to main process return @@ -173,11 +173,11 @@ def main(): thread_inputs = [monitor_input1, monitor_input2, monitor_input3] thread_outputs = [monitor_output1, monitor_output2, monitor_output3] try: - logging.info("Starting all monitor threads") + logger.info("Starting all monitor threads") # Start all monitor threads for thread in threads: thread.start() - logging.info("Wait before subtest") + logger.info("Wait before subtest") test_utils.wait_before_subtest() monitor_err_msg = "" for thread_output in thread_outputs: @@ -193,8 +193,8 @@ def main(): # Stop monitor thread 2 and delete instance vm_2 thread_inputs[1]["stop_thread"] = True if not os_utils.delete_instance(nova_client, vm_2.id): - logging.error("Fail to delete vm_2 instance during " - "testing process") + logger.error("Fail to delete vm_2 instance during " + "testing process") raise Exception("Fail to delete instance vm_2.") for thread_input in thread_inputs: thread_input["stop_thread"] = True @@ -232,7 +232,7 @@ def main(): threads.append(monitor_thread4) thread_inputs.append(monitor_input4) thread_outputs.append(monitor_output4) - logging.info("Starting monitor thread of vm_4") + logger.info("Starting monitor thread of vm_4") threads[0].start() test_utils.wait_before_subtest() monitor_err_msg = "" @@ -253,7 +253,7 @@ def main(): raise finally: # Give a stop signal to all threads - logging.info("Sending stop signal to monitor thread") + logger.info("Sending stop signal to monitor thread") for thread_input in thread_inputs: thread_input["stop_thread"] = True # Wait for all threads to stop and return to the main process @@ -270,5 +270,4 @@ def main(): if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) sys.exit(main()) diff --git a/sdnvpn/test/functest/testcase_11.py b/sdnvpn/test/functest/testcase_11.py index 60ce4d0..9c3dcaa 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 = logging.getLogger(__name__) +logger = logutil.getLogger(__name__) COMMON_CONFIG = sdnvpn_config.CommonConfig() TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig( @@ -99,7 +99,7 @@ def main(): logger.error("One or more instances is down") # TODO: Handle this appropriately - logging.info("Wait before subtest") + logger.info("Wait before subtest") test_utils.wait_before_subtest() # Get added OVS groups added_ovs_groups = (len(initial_ovs_groups) - @@ -137,7 +137,7 @@ def main(): for compute_node in compute_nodes: compute_node.run_cmd("sudo ovs-vsctl set-controller {} {}". format(ovs_br, ovs_controller_conn)) - logging.info("Wait before subtest") + logger.info("Wait before subtest") test_utils.wait_before_subtest() # Get OVS groups added after the reconnection added_ovs_groups = (len(initial_ovs_groups) - @@ -162,5 +162,4 @@ def main(): if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) sys.exit(main()) diff --git a/sdnvpn/test/functest/testcase_12.py b/sdnvpn/test/functest/testcase_12.py index df81f8a..5c91775 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 = logging.getLogger(__name__) +logger = logutil.getLogger(__name__) COMMON_CONFIG = sdnvpn_config.CommonConfig() TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig( @@ -100,7 +100,7 @@ def main(): if not instances_up: logger.error("One or more instances is down") - logging.info("Wait before subtest") + logger.info("Wait before subtest") test_utils.wait_before_subtest() # Get added OVS flows and groups added_ovs_flows = len(test_utils.get_ovs_flows(compute_nodes, @@ -140,7 +140,7 @@ def main(): compute_node.run_cmd("sudo ovs-vsctl set-controller {} {}". format(ovs_br, ovs_controller_conn)) - logging.info("Wait before subtest resync type 1") + logger.info("Wait before subtest resync type 1") test_utils.wait_before_subtest() # Get OVS flows added after the reconnection resynced_ovs_flows = len(test_utils.get_ovs_flows( @@ -164,7 +164,7 @@ def main(): compute_node.run_cmd("sudo iptables -D OUTPUT -p tcp --dport 6653" " -j DROP") - logging.info("Wait before subtest resync type 2") + logger.info("Wait before subtest resync type 2") test_utils.wait_before_subtest() # Get OVS flows added after the reconnection resynced_ovs_flows = len(test_utils.get_ovs_flows( @@ -222,5 +222,4 @@ def record_test_result(expected_flow_count, actual_flow_count, if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) sys.exit(main()) diff --git a/sdnvpn/test/functest/testcase_13.py b/sdnvpn/test/functest/testcase_13.py index bc11533..1c1f985 100644 --- a/sdnvpn/test/functest/testcase_13.py +++ b/sdnvpn/test/functest/testcase_13.py @@ -8,7 +8,6 @@ # http://www.apache.org/licenses/LICENSE-2.0 # -import logging import sys from random import randint @@ -16,8 +15,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 = logging.getLogger(__name__) +logger = logutil.getLogger(__name__) COMMON_CONFIG = sdnvpn_config.CommonConfig() TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig( @@ -206,5 +206,4 @@ def main(): if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) sys.exit(main()) diff --git a/sdnvpn/test/functest/testcase_2.py b/sdnvpn/test/functest/testcase_2.py index 67c9650..250ac4f 100644 --- a/sdnvpn/test/functest/testcase_2.py +++ b/sdnvpn/test/functest/testcase_2.py @@ -8,7 +8,6 @@ # http://www.apache.org/licenses/LICENSE-2.0 # -import logging import sys from random import randint @@ -16,8 +15,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 = logging.getLogger(__name__) +logger = logutil.getLogger(__name__) COMMON_CONFIG = sdnvpn_config.CommonConfig() TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig( @@ -277,5 +277,4 @@ def main(): if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) sys.exit(main()) diff --git a/sdnvpn/test/functest/testcase_3.py b/sdnvpn/test/functest/testcase_3.py index a09f95d..4475fb8 100644 --- a/sdnvpn/test/functest/testcase_3.py +++ b/sdnvpn/test/functest/testcase_3.py @@ -14,7 +14,6 @@ # - Add the functest Quagga as a neighbor # - Verify that the OpenDaylight and gateway Quagga peer -import logging import os import sys @@ -23,9 +22,10 @@ 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 = logging.getLogger(__name__) +logger = logutil.getLogger(__name__) COMMON_CONFIG = sdnvpn_config.CommonConfig() TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig( @@ -298,5 +298,4 @@ def main(): if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) sys.exit(main()) diff --git a/sdnvpn/test/functest/testcase_4.py b/sdnvpn/test/functest/testcase_4.py index 40648d5..c0100ce 100644 --- a/sdnvpn/test/functest/testcase_4.py +++ b/sdnvpn/test/functest/testcase_4.py @@ -8,7 +8,6 @@ # http://www.apache.org/licenses/LICENSE-2.0 # -import logging import sys from random import randint @@ -16,9 +15,10 @@ 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 = logging.getLogger(__name__) +logger = logutil.getLogger(__name__) COMMON_CONFIG = sdnvpn_config.CommonConfig() TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig( @@ -268,5 +268,4 @@ def main(): if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) sys.exit(main()) diff --git a/sdnvpn/test/functest/testcase_7.py b/sdnvpn/test/functest/testcase_7.py index cb47cd7..6594045 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 = logging.getLogger(__name__) +logger = logutil.getLogger(__name__) COMMON_CONFIG = sdnvpn_config.CommonConfig() TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig( @@ -177,5 +177,4 @@ def main(): if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) sys.exit(main()) diff --git a/sdnvpn/test/functest/testcase_8.py b/sdnvpn/test/functest/testcase_8.py index 33bd69e..10c0653 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 = logging.getLogger(__name__) +logger = logutil.getLogger(__name__) COMMON_CONFIG = sdnvpn_config.CommonConfig() TESTCASE_CONFIG = sdnvpn_config.TestcaseConfig( @@ -177,5 +177,4 @@ def main(): if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) sys.exit(main()) diff --git a/sdnvpn/test/functest/testcase_9.py b/sdnvpn/test/functest/testcase_9.py index 93f615b..a4cfa5a 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 = logging.getLogger('__name__') +logger = logutil.getLogger('__name__') def main(): @@ -67,5 +67,4 @@ def main(): if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) sys.exit(main()) -- cgit 1.2.3-korg