Merge "conn_testers: Bump timeout for ICMPv6 echo tests"

This commit is contained in:
Jenkins 2016-03-21 12:05:18 +00:00 committed by Gerrit Code Review
commit 05748350ed

View File

@ -15,13 +15,24 @@
import functools import functools
import fixtures import fixtures
from neutron_lib import constants as n_consts
from oslo_utils import uuidutils from oslo_utils import uuidutils
from neutron.agent import firewall from neutron.agent import firewall
from neutron.agent.linux import ip_lib
from neutron.common import constants from neutron.common import constants
from neutron.tests.common import machine_fixtures from neutron.tests.common import machine_fixtures
from neutron.tests.common import net_helpers 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): class ConnectionTesterException(Exception):
pass pass
@ -139,8 +150,11 @@ class ConnectionTester(fixtures.Fixture):
def _test_icmp_connectivity(self, direction, protocol, src_port, dst_port): def _test_icmp_connectivity(self, direction, protocol, src_port, dst_port):
src_namespace, ip_address = self._get_namespace_and_address(direction) 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: try:
net_helpers.assert_ping(src_namespace, ip_address) net_helpers.assert_ping(src_namespace, ip_address,
timeout=icmp_timeout)
except RuntimeError: except RuntimeError:
raise ConnectionTesterException( raise ConnectionTesterException(
"ICMP packets can't get from %s namespace to %s address" % ( "ICMP packets can't get from %s namespace to %s address" % (