Merge ""_log_ns_network_status" log if namespace does not exist"

This commit is contained in:
Zuul 2020-11-18 13:28:54 +00:00 committed by Gerrit Code Review
commit 40aa4e56ec
1 changed files with 9 additions and 3 deletions

View File

@ -307,13 +307,19 @@ class BaseTempestTestCase(base_api.BaseNetworkTest):
self._log_ns_network_status(ns_name=ns_name)
def _log_ns_network_status(self, ns_name=None):
local_ips = ip_utils.IPCommand(namespace=ns_name).list_addresses()
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()
except exceptions.ShellCommandFailed:
LOG.debug('Namespace %s has been deleted synchronously during the '
'host network collection process', ns_name)
return
LOG.debug('Namespace %s; IP Addresses:\n%s',
ns_name, '\n'.join(str(r) for r in local_ips))
local_routes = ip_utils.IPCommand(namespace=ns_name).list_routes()
LOG.debug('Namespace %s; Local routes:\n%s',
ns_name, '\n'.join(str(r) for r in local_routes))
arp_table = ip_utils.arp_table()
LOG.debug('Namespace %s; Local ARP table:\n%s',
ns_name, '\n'.join(str(r) for r in arp_table))