From 6bfd6497c404a86417cfff7df3795715e276826a Mon Sep 17 00:00:00 2001 From: Attila Fazekas Date: Wed, 26 Feb 2014 21:25:53 +0100 Subject: [PATCH] Extend network debug infos on network failures After the https://review.openstack.org/#/c/76640/ is merge tempest will be allowed to dump the ovs db. The ovs db dump can help in identifying trunk/access port miss configuration issues. Change-Id: Ia751dc5046ce07369b9044eda3b20c63d38bac99 --- tempest/common/commands.py | 4 ++++ tempest/common/debug.py | 12 ++++++++++++ tempest/scenario/test_minimum_basic.py | 2 +- tempest/scenario/test_network_basic_ops.py | 4 ++-- tempest/scenario/test_security_groups_basic_ops.py | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/tempest/common/commands.py b/tempest/common/commands.py index 6405eaab9d..c31a0385b6 100644 --- a/tempest/common/commands.py +++ b/tempest/common/commands.py @@ -73,3 +73,7 @@ def ip_ns_route(ns): def iptables_ns(ns, table): return ip_ns_exec(ns, "iptables -v -S -t " + table) + + +def ovs_db_dump(): + return sudo_cmd_call("ovsdb-client dump") diff --git a/tempest/common/debug.py b/tempest/common/debug.py index 8325d4d012..6a496c22db 100644 --- a/tempest/common/debug.py +++ b/tempest/common/debug.py @@ -38,3 +38,15 @@ def log_ip_ns(): for table in ['filter', 'nat', 'mangle']: LOG.info('ns(%s) table(%s):\n%s', ns, table, commands.iptables_ns(ns, table)) + + +def log_ovs_db(): + if not CONF.debug.enable or not CONF.service_available.neutron: + return + db_dump = commands.ovs_db_dump() + LOG.info("OVS DB:\n" + db_dump) + + +def log_net_debug(): + log_ip_ns() + log_ovs_db() diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py index 39b776045b..24d2677d2b 100644 --- a/tempest/scenario/test_minimum_basic.py +++ b/tempest/scenario/test_minimum_basic.py @@ -97,7 +97,7 @@ class TestMinimumBasicScenario(manager.OfficialClientTest): except Exception: LOG.exception('ssh to server failed') self._log_console_output() - debug.log_ip_ns() + debug.log_net_debug() raise def check_partitions(self): diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py index 998a474a87..450d85e25f 100644 --- a/tempest/scenario/test_network_basic_ops.py +++ b/tempest/scenario/test_network_basic_ops.py @@ -199,7 +199,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest): except Exception: LOG.exception('Tenant connectivity check failed') self._log_console_output(servers=self.servers.keys()) - debug.log_ip_ns() + debug.log_net_debug() raise def _create_and_associate_floating_ips(self): @@ -231,7 +231,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest): ex_msg += ": " + msg LOG.exception(ex_msg) self._log_console_output(servers=self.servers.keys()) - debug.log_ip_ns() + debug.log_net_debug() raise def _disassociate_floating_ips(self): diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py index a26e0cfd01..0d131086ae 100644 --- a/tempest/scenario/test_security_groups_basic_ops.py +++ b/tempest/scenario/test_security_groups_basic_ops.py @@ -366,7 +366,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest): should_succeed), msg) except Exception: - debug.log_ip_ns() + debug.log_net_debug() raise def _test_in_tenant_block(self, tenant):