Merge "Add iptables and listening sockets to debug info"
diff --git a/neutron_tempest_plugin/common/ip.py b/neutron_tempest_plugin/common/ip.py
index 7b172b0..9fe49db 100644
--- a/neutron_tempest_plugin/common/ip.py
+++ b/neutron_tempest_plugin/common/ip.py
@@ -383,6 +383,23 @@
return arp_table
+def list_iptables(version=constants.IP_VERSION_4, namespace=None):
+ cmd = ''
+ if namespace:
+ cmd = 'sudo ip netns exec %s ' % namespace
+ cmd += ('iptables-save' if version == constants.IP_VERSION_4 else
+ 'ip6tables-save')
+ return shell.execute(cmd).stdout
+
+
+def list_listening_sockets(namespace=None):
+ cmd = ''
+ if namespace:
+ cmd = 'sudo ip netns exec %s ' % namespace
+ cmd += 'netstat -nlp'
+ return shell.execute(cmd).stdout
+
+
class Route(HasProperties,
collections.namedtuple('Route',
['dest', 'properties'])):
diff --git a/neutron_tempest_plugin/scenario/base.py b/neutron_tempest_plugin/scenario/base.py
index c29585f..8591c89 100644
--- a/neutron_tempest_plugin/scenario/base.py
+++ b/neutron_tempest_plugin/scenario/base.py
@@ -346,7 +346,9 @@
try:
local_ips = ip_utils.IPCommand(namespace=ns_name).list_addresses()
local_routes = ip_utils.IPCommand(namespace=ns_name).list_routes()
- arp_table = ip_utils.arp_table()
+ arp_table = ip_utils.arp_table(namespace=ns_name)
+ iptables = ip_utils.list_iptables(namespace=ns_name)
+ lsockets = ip_utils.list_listening_sockets(namespace=ns_name)
except exceptions.ShellCommandFailed:
LOG.debug('Namespace %s has been deleted synchronously during the '
'host network collection process', ns_name)
@@ -358,6 +360,8 @@
ns_name, '\n'.join(str(r) for r in local_routes))
LOG.debug('Namespace %s; Local ARP table:\n%s',
ns_name, '\n'.join(str(r) for r in arp_table))
+ LOG.debug('Namespace %s; Local iptables:\n%s', ns_name, iptables)
+ LOG.debug('Namespace %s; Listening sockets:\n%s', ns_name, lsockets)
def _check_remote_connectivity(self, source, dest, count,
should_succeed=True,