blob: 6a496c22db54a43977b066db70459724d57fa195 [file] [log] [blame]
Attila Fazekasaeeeefd2013-08-06 17:01:56 +02001# All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15from tempest.common import commands
16from tempest import config
17
18from tempest.openstack.common import log as logging
19
Sean Dague86bd8422013-12-20 09:56:44 -050020CONF = config.CONF
Attila Fazekasaeeeefd2013-08-06 17:01:56 +020021LOG = logging.getLogger(__name__)
22
23tables = ['filter', 'nat', 'mangle']
24
25
26def log_ip_ns():
Sean Dague86bd8422013-12-20 09:56:44 -050027 if not CONF.debug.enable:
Attila Fazekasaeeeefd2013-08-06 17:01:56 +020028 return
29 LOG.info("Host Addr:\n" + commands.ip_addr_raw())
30 LOG.info("Host Route:\n" + commands.ip_route_raw())
31 for table in ['filter', 'nat', 'mangle']:
32 LOG.info('Host %s table:\n%s', table, commands.iptables_raw(table))
33 ns_list = commands.ip_ns_list()
34 LOG.info("Host ns list" + str(ns_list))
35 for ns in ns_list:
36 LOG.info("ns(%s) Addr:\n%s", ns, commands.ip_ns_addr(ns))
37 LOG.info("ns(%s) Route:\n%s", ns, commands.ip_ns_route(ns))
38 for table in ['filter', 'nat', 'mangle']:
39 LOG.info('ns(%s) table(%s):\n%s', ns, table,
40 commands.iptables_ns(ns, table))
Attila Fazekas6bfd6492014-02-26 21:25:53 +010041
42
43def log_ovs_db():
44 if not CONF.debug.enable or not CONF.service_available.neutron:
45 return
46 db_dump = commands.ovs_db_dump()
47 LOG.info("OVS DB:\n" + db_dump)
48
49
50def log_net_debug():
51 log_ip_ns()
52 log_ovs_db()