Merge "Use network 'heat-net' for integration_tests"
This commit is contained in:
commit
a079f653e0
@ -25,7 +25,6 @@ from novaclient import exceptions
|
||||
from novaclient import shell as novashell
|
||||
from oslo_config import cfg
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import netutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from six.moves.urllib import parse as urlparse
|
||||
@ -418,9 +417,7 @@ echo -e '%s\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
|
||||
else:
|
||||
for n in server.networks:
|
||||
if len(server.networks[n]) > 0:
|
||||
for addr in server.networks[n]:
|
||||
if netutils.is_valid_ipv4(addr):
|
||||
return addr
|
||||
return server.networks[n][0]
|
||||
|
||||
def get_server(self, server):
|
||||
try:
|
||||
|
@ -62,10 +62,10 @@ IntegrationTestGroup = [
|
||||
default=1200,
|
||||
help="Timeout in seconds to wait for a stack to build."),
|
||||
cfg.StrOpt('network_for_ssh',
|
||||
default='private',
|
||||
default='heat-net',
|
||||
help="Network used for SSH connections."),
|
||||
cfg.StrOpt('fixed_network_name',
|
||||
default='private',
|
||||
default='heat-net',
|
||||
help="Visible fixed network name "),
|
||||
cfg.StrOpt('floating_network_name',
|
||||
default='public',
|
||||
@ -77,7 +77,7 @@ IntegrationTestGroup = [
|
||||
"resource type Heat::InstallConfigAgent. Needs to "
|
||||
"be appropriate for the image_ref."),
|
||||
cfg.StrOpt('fixed_subnet_name',
|
||||
default='private-subnet',
|
||||
default='heat-subnet',
|
||||
help="Visible fixed sub-network name "),
|
||||
cfg.IntOpt('ssh_timeout',
|
||||
default=300,
|
||||
|
@ -174,17 +174,6 @@ 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
|
||||
|
||||
def _get_server_ip_by_version(self, addresses, ip_version=4):
|
||||
for address in addresses:
|
||||
if address['version'] == ip_version:
|
||||
return address['addr']
|
||||
|
||||
@staticmethod
|
||||
def _stack_output(stack, output_key):
|
||||
"""Return a stack output value for a given key."""
|
||||
|
@ -116,6 +116,8 @@ parameters:
|
||||
type: string
|
||||
image:
|
||||
type: string
|
||||
network:
|
||||
type: string
|
||||
|
||||
resources:
|
||||
server:
|
||||
@ -123,6 +125,7 @@ resources:
|
||||
properties:
|
||||
image: {get_param: image}
|
||||
flavor: {get_param: flavor}
|
||||
networks: [{network: {get_param: network} }]
|
||||
user_data_format: SOFTWARE_CONFIG
|
||||
user_data: {get_param: user_data}
|
||||
'''
|
||||
@ -369,6 +372,7 @@ resources:
|
||||
|
||||
parms = {'flavor': self.conf.minimal_instance_type,
|
||||
'image': self.conf.minimal_image_ref,
|
||||
'network': self.conf.fixed_network_name,
|
||||
'user_data': ''}
|
||||
name = self._stack_rand_name()
|
||||
|
||||
|
@ -19,5 +19,6 @@ set -x
|
||||
export DEST=${DEST:-/opt/stack/new}
|
||||
source $DEST/devstack/accrc/admin/admin
|
||||
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
|
||||
sudo -E tox -eintegration
|
||||
|
29
heat_integrationtests/prepare_test_network.sh
Executable file
29
heat_integrationtests/prepare_test_network.sh
Executable 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
|
@ -25,7 +25,6 @@ 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")
|
||||
|
@ -11,7 +11,7 @@ parameters:
|
||||
type: string
|
||||
label: Capacity
|
||||
description: Auto-scaling group desired capacity
|
||||
fixed_subnet_name:
|
||||
fixed_subnet:
|
||||
type: string
|
||||
label: fixed subnetwork ID
|
||||
description: subnetwork ID used for autoscaling
|
||||
@ -28,7 +28,7 @@ resources:
|
||||
lb_method: ROUND_ROBIN
|
||||
name: test_pool
|
||||
protocol: HTTP
|
||||
subnet: { get_param: fixed_subnet_name }
|
||||
subnet: { get_param: fixed_subnet }
|
||||
vip: {
|
||||
"description": "Test VIP",
|
||||
"protocol_port": 80,
|
||||
@ -49,6 +49,7 @@ resources:
|
||||
properties:
|
||||
AvailabilityZones : ["nova"]
|
||||
LaunchConfigurationName : { get_resource : launch_config }
|
||||
VPCZoneIdentifier: [{ get_param: fixed_subnet }]
|
||||
MinSize : 1
|
||||
MaxSize : 5
|
||||
DesiredCapacity: { get_param: capacity }
|
||||
|
@ -10,6 +10,8 @@ parameters:
|
||||
type: string
|
||||
image:
|
||||
type: string
|
||||
network:
|
||||
type: string
|
||||
private_subnet_id:
|
||||
type: string
|
||||
external_network_id:
|
||||
@ -66,6 +68,7 @@ resources:
|
||||
image: { get_param: image }
|
||||
flavor: { get_param: flavor }
|
||||
key_name: { get_param: key_name }
|
||||
networks: [{network: {get_param: network} }]
|
||||
security_groups: [{ get_resource: sec_group }]
|
||||
user_data_format: SOFTWARE_CONFIG
|
||||
user_data: { get_resource: config }
|
||||
@ -77,6 +80,7 @@ resources:
|
||||
image: { get_param: image }
|
||||
flavor: { get_param: flavor }
|
||||
key_name: { get_param: key_name }
|
||||
networks: [{network: {get_param: network} }]
|
||||
security_groups: [{ get_resource: sec_group }]
|
||||
user_data_format: SOFTWARE_CONFIG
|
||||
user_data: { get_resource: config }
|
||||
@ -119,10 +123,10 @@ resources:
|
||||
- { get_resource: server1 }
|
||||
|
||||
outputs:
|
||||
serv1_addresses:
|
||||
value: {get_attr: [server1, addresses, private]}
|
||||
serv2_addresses:
|
||||
value: {get_attr: [server2, addresses, private]}
|
||||
serv1_ip:
|
||||
value: {get_attr: [server1, networks, { get_param: network }, 0]}
|
||||
serv2_ip:
|
||||
value: {get_attr: [server2, networks, { get_param: network }, 0]}
|
||||
vip:
|
||||
value: {get_attr: [test_pool, vip, address]}
|
||||
fip:
|
||||
|
@ -40,7 +40,7 @@ class NeutronAutoscalingTest(scenario_base.ScenarioTestsBase):
|
||||
"image_id": self.conf.minimal_image_ref,
|
||||
"capacity": "1",
|
||||
"instance_type": self.conf.minimal_instance_type,
|
||||
"fixed_subnet_name": self.conf.fixed_subnet_name,
|
||||
"fixed_subnet": self.net['subnets'][0],
|
||||
}
|
||||
|
||||
# Launch stack
|
||||
|
@ -55,7 +55,8 @@ 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.subnet_v4,
|
||||
'network': self.net['name'],
|
||||
'private_subnet_id': self.net['subnets'][0],
|
||||
'external_network_id': self.public_net['id'],
|
||||
'timeout': self.conf.build_timeout
|
||||
}
|
||||
@ -69,10 +70,8 @@ class NeutronLoadBalancerTest(scenario_base.ScenarioTestsBase):
|
||||
stack = self.client.stacks.get(sid)
|
||||
floating_ip = self._stack_output(stack, 'fip')
|
||||
vip = self._stack_output(stack, 'vip')
|
||||
server1_ip = self._get_server_ip_by_version(
|
||||
self._stack_output(stack, 'serv1_addresses'))
|
||||
server2_ip = self._get_server_ip_by_version(
|
||||
self._stack_output(stack, 'serv2_addresses'))
|
||||
server1_ip = self._stack_output(stack, 'serv1_ip')
|
||||
server2_ip = self._stack_output(stack, 'serv2_ip')
|
||||
# Check connection and info about received responses
|
||||
self.check_connectivity(server1_ip)
|
||||
self.collect_responses(server1_ip, {'server1\n'})
|
||||
|
@ -95,7 +95,7 @@ class CfnInitIntegrationTest(scenario_base.ScenarioTestsBase):
|
||||
'flavor': self.conf.instance_type,
|
||||
'image': self.conf.image_ref,
|
||||
'timeout': self.conf.build_timeout,
|
||||
'subnet': self.subnet_v4,
|
||||
'subnet': self.net['subnets'][0],
|
||||
}
|
||||
|
||||
# Launch stack
|
||||
|
Loading…
x
Reference in New Issue
Block a user