Use ipv4 subnet in Heat scenario tests

Previously we used first subnet from network and it was correct, because
there was only one subnet in network by default. According to the last changes
in devstack new ipv6 subnet was added to the all default networks.
This patch adds function to the base class, which allows to choose
subnet based on ip version. All scenario tests were updated to use only ipv4
subnet.

Also was added property for FIP, which specify ip of vip.

Change-Id: I199075909b97fe98e1a3c1d175b0b4cf7100403d
Closes-Bug: #1449896
This commit is contained in:
Sergey Kraynev 2015-04-29 05:31:54 -04:00
parent 43674fd320
commit 368962044b
5 changed files with 15 additions and 6 deletions

View File

@ -172,6 +172,12 @@ class HeatIntegrationTest(testscenarios.WithScenarios,
if net['name'] == net_name:
return net
def _get_subnet_by_version(self, network, ip_version=4):
for subnet_id in self.net['subnets']:
subnet_info = self.network_client.show_subnet(subnet_id)
if subnet_info['subnet']['ip_version'] == ip_version:
return subnet_id
@staticmethod
def _stack_output(stack, output_key):
"""Return a stack output value for a given key."""

View File

@ -25,6 +25,7 @@ class ScenarioTestsBase(test.HeatIntegrationTest):
if not self.conf.fixed_network_name:
raise self.skipException("No default network configured to test")
self.net = self._get_network()
self.subnet_v4 = self._get_subnet_by_version(self.net)
if not self.conf.image_ref:
raise self.skipException("No image configured to test")

View File

@ -106,6 +106,8 @@ resources:
floating_network: { get_param: external_network_id }
port_id:
{ get_attr: [test_pool, vip, 'port_id'] }
fixed_ip_address:
{ get_attr: [test_pool, vip, 'address'] }
LBaaS:
type: OS::Neutron::LoadBalancer

View File

@ -55,7 +55,7 @@ class NeutronLoadBalancerTest(scenario_base.ScenarioTestsBase):
'key_name': self.keypair_name,
'flavor': self.conf.minimal_instance_type,
'image': self.conf.image_ref,
'private_subnet_id': self.net['subnets'][0],
'private_subnet_id': self.subnet_v4,
'external_network_id': self.public_net['id'],
'timeout': self.conf.build_timeout
}

View File

@ -91,11 +91,11 @@ class CfnInitIntegrationTest(scenario_base.ScenarioTestsBase):
via generated keypair.
"""
parameters = {
"key_name": self.keypair_name,
"flavor": self.conf.instance_type,
"image": self.conf.image_ref,
"timeout": self.conf.build_timeout,
"subnet": self.net["subnets"][0],
'key_name': self.keypair_name,
'flavor': self.conf.instance_type,
'image': self.conf.image_ref,
'timeout': self.conf.build_timeout,
'subnet': self.subnet_v4,
}
# Launch stack