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
(cherry picked from commit 420d5c7987)
This commit is contained in:
Jakub Libosvar 2016-03-18 12:51:23 +00:00 committed by Ihar Hrachyshka
parent 6d9774b058
commit 4504a74319
1 changed files with 15 additions and 1 deletions

View File

@ -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" % (