Merge "Enhance IPv6 scenario - Ping default GW"

This commit is contained in:
Jenkins 2015-08-06 07:56:53 +00:00 committed by Gerrit Code Review
commit 0982f41597

View File

@ -27,13 +27,17 @@ LOG = logging.getLogger(__name__)
class TestGettingAddress(manager.NetworkScenarioTest): class TestGettingAddress(manager.NetworkScenarioTest):
"""Create network with subnets: one IPv4 and """Test Summary:
one or few IPv6 in a given address mode
Boot 2 VMs on this network 1. Create network with subnets:
Allocate and assign 2 FIP4 1.1. one IPv4 and
Check that vNICs of all VMs gets all addresses actually assigned 1.2. one or more IPv6 in a given address mode
Ping4 to one VM from another one 2. Boot 2 VMs on this network
If ping6 available in VM, do ping6 to all v6 addresses 3. Allocate and assign 2 FIP4
4. Check that vNICs of all VMs gets all addresses actually assigned
5. Each VM will ping the other's v4 private address
6. If ping6 available in VM, each VM will ping all of the other's v6
addresses as well as the router's
""" """
@classmethod @classmethod
@ -74,12 +78,13 @@ class TestGettingAddress(manager.NetworkScenarioTest):
self.network = self._create_network(tenant_id=self.tenant_id) self.network = self._create_network(tenant_id=self.tenant_id)
sub4 = self._create_subnet(network=self.network, sub4 = self._create_subnet(network=self.network,
namestart='sub4', namestart='sub4',
ip_version=4,) ip_version=4)
router = self._get_router(tenant_id=self.tenant_id) router = self._get_router(tenant_id=self.tenant_id)
sub4.add_to_router(router_id=router['id']) sub4.add_to_router(router_id=router['id'])
self.addCleanup(sub4.delete) self.addCleanup(sub4.delete)
self.subnets_v6 = []
for _ in range(n_subnets6): for _ in range(n_subnets6):
sub6 = self._create_subnet(network=self.network, sub6 = self._create_subnet(network=self.network,
namestart='sub6', namestart='sub6',
@ -89,6 +94,7 @@ class TestGettingAddress(manager.NetworkScenarioTest):
sub6.add_to_router(router_id=router['id']) sub6.add_to_router(router_id=router['id'])
self.addCleanup(sub6.delete) self.addCleanup(sub6.delete)
self.subnets_v6.append(sub6)
@staticmethod @staticmethod
def define_server_ips(srv): def define_server_ips(srv):
@ -145,23 +151,32 @@ class TestGettingAddress(manager.NetworkScenarioTest):
self.assertTrue(test.call_until_true(srv2_v6_addr_assigned, self.assertTrue(test.call_until_true(srv2_v6_addr_assigned,
CONF.compute.ping_timeout, 1)) CONF.compute.ping_timeout, 1))
result = sshv4_1.ping_host(ips_from_api_2['4']) self._check_connectivity(sshv4_1, ips_from_api_2['4'])
self.assertIn('0% packet loss', result) self._check_connectivity(sshv4_2, ips_from_api_1['4'])
result = sshv4_2.ping_host(ips_from_api_1['4'])
self.assertIn('0% packet loss', result)
# Some VM (like cirros) may not have ping6 utility # Some VM (like cirros) may not have ping6 utility
result = sshv4_1.exec_command('whereis ping6') result = sshv4_1.exec_command('whereis ping6')
is_ping6 = False if result == 'ping6:\n' else True is_ping6 = False if result == 'ping6:\n' else True
if is_ping6: if is_ping6:
for i in range(n_subnets6): for i in range(n_subnets6):
result = sshv4_1.ping_host(ips_from_api_2['6'][i]) self._check_connectivity(sshv4_1,
self.assertIn('0% packet loss', result) ips_from_api_2['6'][i])
result = sshv4_2.ping_host(ips_from_api_1['6'][i]) self._check_connectivity(sshv4_1,
self.assertIn('0% packet loss', result) self.subnets_v6[i].gateway_ip)
self._check_connectivity(sshv4_2,
ips_from_api_1['6'][i])
self._check_connectivity(sshv4_2,
self.subnets_v6[i].gateway_ip)
else: else:
LOG.warning('Ping6 is not available, skipping') LOG.warning('Ping6 is not available, skipping')
def _check_connectivity(self, source, dest):
self.assertTrue(
self._check_remote_connectivity(source, dest),
"Timed out waiting for %s to become reachable from %s" %
(dest, source.ssh_client.host)
)
@test.idempotent_id('2c92df61-29f0-4eaa-bee3-7c65bef62a43') @test.idempotent_id('2c92df61-29f0-4eaa-bee3-7c65bef62a43')
@test.services('compute', 'network') @test.services('compute', 'network')
def test_slaac_from_os(self): def test_slaac_from_os(self):