From 420d5c7987f8ff7473d70697e5606f07ccfe7c1d Mon Sep 17 00:00:00 2001 From: Jakub Libosvar Date: Fri, 18 Mar 2016 12:51:23 +0000 Subject: [PATCH] conn_testers: Bump timeout for ICMPv6 echo tests In IPv6 scenarios NDP can increase round-trip time of ICMPv6 packets over 1 seconds. The patch increases timeout for ICMPv6 to 2 seconds. Note that this will extend scenarios when ping is supposed to fail. Change-Id: Iec7d3138aee3fc904312dbc45ef76854ad0ea789 Closes-Bug: 1557946 --- neutron/tests/common/conn_testers.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/neutron/tests/common/conn_testers.py b/neutron/tests/common/conn_testers.py index f8b302ef1e9..78460c01d6a 100644 --- a/neutron/tests/common/conn_testers.py +++ b/neutron/tests/common/conn_testers.py @@ -15,13 +15,24 @@ import functools import fixtures +from neutron_lib import constants as n_consts from oslo_utils import uuidutils from neutron.agent import firewall +from neutron.agent.linux import ip_lib from neutron.common import constants from neutron.tests.common import machine_fixtures from neutron.tests.common import net_helpers +# NOTE: IPv6 uses NDP for obtaining destination endpoints link address that +# extends round-trip packet time in ICMP tests. The timeout value should be +# sufficient for correct scenarios but not too high because of negative +# tests. +ICMP_VERSION_TIMEOUTS = { + n_consts.IP_VERSION_4: 1, + n_consts.IP_VERSION_6: 2, +} + class ConnectionTesterException(Exception): pass @@ -139,8 +150,11 @@ class ConnectionTester(fixtures.Fixture): def _test_icmp_connectivity(self, direction, protocol, src_port, dst_port): src_namespace, ip_address = self._get_namespace_and_address(direction) + ip_version = ip_lib.get_ip_version(ip_address) + icmp_timeout = ICMP_VERSION_TIMEOUTS[ip_version] try: - net_helpers.assert_ping(src_namespace, ip_address) + net_helpers.assert_ping(src_namespace, ip_address, + timeout=icmp_timeout) except RuntimeError: raise ConnectionTesterException( "ICMP packets can't get from %s namespace to %s address" % (