Use network 'heat-net' for integration_tests

Neutron support for ipv6 is not complete yet (ex. LBaaS
only supports ipv4). We'had some gate issues after dual
stack was enabled in devstack. We had put some tactical
fixes to resolve those[1][2].

This fix adds usage of heat-net/heat-subnet(only ipv4)
for integration tests. This also rolls back the earlier
tactical changes.

https://review.openstack.org/#/c/178576
https://review.openstack.org/#/c/178933/

Change-Id: Ia863edb8932b8dea5c4fa110c97dcfdadca85bb9
This commit is contained in:
Rabi Mishra 2015-05-23 02:20:47 +05:30
parent bf669cbf13
commit 3db5d3a8b7
12 changed files with 55 additions and 32 deletions

View File

@ -25,7 +25,6 @@ from novaclient import exceptions
from novaclient import shell as novashell from novaclient import shell as novashell
from oslo_config import cfg from oslo_config import cfg
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from oslo_utils import netutils
from oslo_utils import uuidutils from oslo_utils import uuidutils
import six import six
from six.moves.urllib import parse as urlparse from six.moves.urllib import parse as urlparse
@ -417,9 +416,7 @@ echo -e '%s\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
else: else:
for n in server.networks: for n in server.networks:
if len(server.networks[n]) > 0: if len(server.networks[n]) > 0:
for addr in server.networks[n]: return server.networks[n][0]
if netutils.is_valid_ipv4(addr):
return addr
def get_server(self, server): def get_server(self, server):
try: try:

View File

@ -62,10 +62,10 @@ IntegrationTestGroup = [
default=1200, default=1200,
help="Timeout in seconds to wait for a stack to build."), help="Timeout in seconds to wait for a stack to build."),
cfg.StrOpt('network_for_ssh', cfg.StrOpt('network_for_ssh',
default='private', default='heat-net',
help="Network used for SSH connections."), help="Network used for SSH connections."),
cfg.StrOpt('fixed_network_name', cfg.StrOpt('fixed_network_name',
default='private', default='heat-net',
help="Visible fixed network name "), help="Visible fixed network name "),
cfg.StrOpt('floating_network_name', cfg.StrOpt('floating_network_name',
default='public', default='public',
@ -77,7 +77,7 @@ IntegrationTestGroup = [
"resource type Heat::InstallConfigAgent. Needs to " "resource type Heat::InstallConfigAgent. Needs to "
"be appropriate for the image_ref."), "be appropriate for the image_ref."),
cfg.StrOpt('fixed_subnet_name', cfg.StrOpt('fixed_subnet_name',
default='private-subnet', default='heat-subnet',
help="Visible fixed sub-network name "), help="Visible fixed sub-network name "),
cfg.IntOpt('ssh_timeout', cfg.IntOpt('ssh_timeout',
default=300, default=300,

View File

@ -174,17 +174,6 @@ class HeatIntegrationTest(testscenarios.WithScenarios,
if net['name'] == net_name: if net['name'] == net_name:
return net 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
def _get_server_ip_by_version(self, addresses, ip_version=4):
for address in addresses:
if address['version'] == ip_version:
return address['addr']
@staticmethod @staticmethod
def _stack_output(stack, output_key): def _stack_output(stack, output_key):
"""Return a stack output value for a given key.""" """Return a stack output value for a given key."""

View File

@ -116,6 +116,8 @@ parameters:
type: string type: string
image: image:
type: string type: string
network:
type: string
resources: resources:
server: server:
@ -123,6 +125,7 @@ resources:
properties: properties:
image: {get_param: image} image: {get_param: image}
flavor: {get_param: flavor} flavor: {get_param: flavor}
networks: [{network: {get_param: network} }]
user_data_format: SOFTWARE_CONFIG user_data_format: SOFTWARE_CONFIG
user_data: {get_param: user_data} user_data: {get_param: user_data}
''' '''
@ -369,6 +372,7 @@ resources:
parms = {'flavor': self.conf.minimal_instance_type, parms = {'flavor': self.conf.minimal_instance_type,
'image': self.conf.minimal_image_ref, 'image': self.conf.minimal_image_ref,
'network': self.conf.fixed_network_name,
'user_data': ''} 'user_data': ''}
name = self._stack_rand_name() name = self._stack_rand_name()

View File

@ -19,5 +19,6 @@ set -x
export DEST=${DEST:-/opt/stack/new} export DEST=${DEST:-/opt/stack/new}
source $DEST/devstack/accrc/admin/admin source $DEST/devstack/accrc/admin/admin
sudo -E $DEST/heat/heat_integrationtests/prepare_test_env.sh sudo -E $DEST/heat/heat_integrationtests/prepare_test_env.sh
sudo -E $DEST/heat/heat_integrationtests/prepare_test_network.sh
source $DEST/devstack/accrc/demo/demo source $DEST/devstack/accrc/demo/demo
sudo -E tox -eintegration sudo -E tox -eintegration

View File

@ -0,0 +1,29 @@
#!/bin/bash
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# This script creates default tenant networks for the tests
set -x
source $DEST/devstack/accrc/admin/admin
PUB_SUBNET_ID=`neutron subnet-list | grep ' public-subnet ' | awk '{split($0,a,"|"); print a[2]}'`
ROUTER_GW_IP=`neutron port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' -v subnet_id="${PUB_SUBNET_ID//[[:space:]]/}" '$4 == subnet_id { print $8; }'`
# create a heat specific private network (default 'private' network has ipv6 subnet)
source $DEST/devstack/accrc/demo/demo
HEAT_PRIVATE_SUBNET_CIDR=10.0.5.0/24
neutron net-create heat-net
neutron subnet-create --name heat-subnet heat-net $HEAT_PRIVATE_SUBNET_CIDR
neutron router-interface-add router1 heat-subnet
sudo route add -net $HEAT_PRIVATE_SUBNET_CIDR gw $ROUTER_GW_IP

View File

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

View File

@ -11,7 +11,7 @@ parameters:
type: string type: string
label: Capacity label: Capacity
description: Auto-scaling group desired capacity description: Auto-scaling group desired capacity
fixed_subnet_name: fixed_subnet:
type: string type: string
label: fixed subnetwork ID label: fixed subnetwork ID
description: subnetwork ID used for autoscaling description: subnetwork ID used for autoscaling
@ -28,7 +28,7 @@ resources:
lb_method: ROUND_ROBIN lb_method: ROUND_ROBIN
name: test_pool name: test_pool
protocol: HTTP protocol: HTTP
subnet: { get_param: fixed_subnet_name } subnet: { get_param: fixed_subnet }
vip: { vip: {
"description": "Test VIP", "description": "Test VIP",
"protocol_port": 80, "protocol_port": 80,
@ -49,6 +49,7 @@ resources:
properties: properties:
AvailabilityZones : ["nova"] AvailabilityZones : ["nova"]
LaunchConfigurationName : { get_resource : launch_config } LaunchConfigurationName : { get_resource : launch_config }
VPCZoneIdentifier: [{ get_param: fixed_subnet }]
MinSize : 1 MinSize : 1
MaxSize : 5 MaxSize : 5
DesiredCapacity: { get_param: capacity } DesiredCapacity: { get_param: capacity }

View File

@ -10,6 +10,8 @@ parameters:
type: string type: string
image: image:
type: string type: string
network:
type: string
private_subnet_id: private_subnet_id:
type: string type: string
external_network_id: external_network_id:
@ -66,6 +68,7 @@ resources:
image: { get_param: image } image: { get_param: image }
flavor: { get_param: flavor } flavor: { get_param: flavor }
key_name: { get_param: key_name } key_name: { get_param: key_name }
networks: [{network: {get_param: network} }]
security_groups: [{ get_resource: sec_group }] security_groups: [{ get_resource: sec_group }]
user_data_format: SOFTWARE_CONFIG user_data_format: SOFTWARE_CONFIG
user_data: { get_resource: config } user_data: { get_resource: config }
@ -77,6 +80,7 @@ resources:
image: { get_param: image } image: { get_param: image }
flavor: { get_param: flavor } flavor: { get_param: flavor }
key_name: { get_param: key_name } key_name: { get_param: key_name }
networks: [{network: {get_param: network} }]
security_groups: [{ get_resource: sec_group }] security_groups: [{ get_resource: sec_group }]
user_data_format: SOFTWARE_CONFIG user_data_format: SOFTWARE_CONFIG
user_data: { get_resource: config } user_data: { get_resource: config }
@ -119,10 +123,10 @@ resources:
- { get_resource: server1 } - { get_resource: server1 }
outputs: outputs:
serv1_addresses: serv1_ip:
value: {get_attr: [server1, addresses, private]} value: {get_attr: [server1, networks, { get_param: network }, 0]}
serv2_addresses: serv2_ip:
value: {get_attr: [server2, addresses, private]} value: {get_attr: [server2, networks, { get_param: network }, 0]}
vip: vip:
value: {get_attr: [test_pool, vip, address]} value: {get_attr: [test_pool, vip, address]}
fip: fip:

View File

@ -40,7 +40,7 @@ class NeutronAutoscalingTest(scenario_base.ScenarioTestsBase):
"image_id": self.conf.minimal_image_ref, "image_id": self.conf.minimal_image_ref,
"capacity": "1", "capacity": "1",
"instance_type": self.conf.minimal_instance_type, "instance_type": self.conf.minimal_instance_type,
"fixed_subnet_name": self.conf.fixed_subnet_name, "fixed_subnet": self.net['subnets'][0],
} }
# Launch stack # Launch stack

View File

@ -55,7 +55,8 @@ class NeutronLoadBalancerTest(scenario_base.ScenarioTestsBase):
'key_name': self.keypair_name, 'key_name': self.keypair_name,
'flavor': self.conf.minimal_instance_type, 'flavor': self.conf.minimal_instance_type,
'image': self.conf.image_ref, 'image': self.conf.image_ref,
'private_subnet_id': self.subnet_v4, 'network': self.net['name'],
'private_subnet_id': self.net['subnets'][0],
'external_network_id': self.public_net['id'], 'external_network_id': self.public_net['id'],
'timeout': self.conf.build_timeout 'timeout': self.conf.build_timeout
} }
@ -69,10 +70,8 @@ class NeutronLoadBalancerTest(scenario_base.ScenarioTestsBase):
stack = self.client.stacks.get(sid) stack = self.client.stacks.get(sid)
floating_ip = self._stack_output(stack, 'fip') floating_ip = self._stack_output(stack, 'fip')
vip = self._stack_output(stack, 'vip') vip = self._stack_output(stack, 'vip')
server1_ip = self._get_server_ip_by_version( server1_ip = self._stack_output(stack, 'serv1_ip')
self._stack_output(stack, 'serv1_addresses')) server2_ip = self._stack_output(stack, 'serv2_ip')
server2_ip = self._get_server_ip_by_version(
self._stack_output(stack, 'serv2_addresses'))
# Check connection and info about received responses # Check connection and info about received responses
self.check_connectivity(server1_ip) self.check_connectivity(server1_ip)
self.collect_responses(server1_ip, {'server1\n'}) self.collect_responses(server1_ip, {'server1\n'})

View File

@ -95,7 +95,7 @@ class CfnInitIntegrationTest(scenario_base.ScenarioTestsBase):
'flavor': self.conf.instance_type, 'flavor': self.conf.instance_type,
'image': self.conf.image_ref, 'image': self.conf.image_ref,
'timeout': self.conf.build_timeout, 'timeout': self.conf.build_timeout,
'subnet': self.subnet_v4, 'subnet': self.net['subnets'][0],
} }
# Launch stack # Launch stack