summaryrefslogtreecommitdiffstats
path: root/sdnvpn/test
diff options
context:
space:
mode:
Diffstat (limited to 'sdnvpn/test')
-rw-r--r--sdnvpn/test/functest/run_sdnvpn_tests.py51
-rw-r--r--sdnvpn/test/functest/run_tempest.py6
-rw-r--r--sdnvpn/test/functest/testcase_1.py6
-rw-r--r--sdnvpn/test/functest/testcase_10.py31
-rw-r--r--sdnvpn/test/functest/testcase_11.py9
-rw-r--r--sdnvpn/test/functest/testcase_12.py11
-rw-r--r--sdnvpn/test/functest/testcase_13.py5
-rw-r--r--sdnvpn/test/functest/testcase_2.py5
-rw-r--r--sdnvpn/test/functest/testcase_3.py5
-rw-r--r--sdnvpn/test/functest/testcase_4.py5
-rw-r--r--sdnvpn/test/functest/testcase_7.py5
-rw-r--r--sdnvpn/test/functest/testcase_8.py5
-rw-r--r--sdnvpn/test/functest/testcase_9.py5
13 files changed, 67 insertions, 82 deletions
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())