Add ironic_base test case
Scenario: 1. Create cluster 2. Add 1 controller node 3. Add 1 compute node 4. Add 1 ironic node 5. Launch OSTF tests Partially Implements: blueprint fuel-integrate-ironic Change-Id: I3a5b15f61d41ab7936de684166eacd542c00e0de
This commit is contained in:
parent
55bbc908f7
commit
ec8de99714
|
@ -157,6 +157,11 @@ Test Zabbix
|
|||
.. automodule:: fuelweb_test.tests.test_zabbix
|
||||
:members:
|
||||
|
||||
Test Ironic
|
||||
-----------
|
||||
.. automodule:: fuelweb_test.tests.test_ironic_base
|
||||
:members:
|
||||
|
||||
|
||||
GD based tests
|
||||
==============
|
||||
|
|
|
@ -445,7 +445,8 @@ class FuelWebClient(object):
|
|||
|
||||
for option in settings:
|
||||
section = False
|
||||
if option in ('sahara', 'murano', 'ceilometer', 'mongo'):
|
||||
if option in ('sahara', 'murano', 'ceilometer', 'mongo',
|
||||
'ironic'):
|
||||
section = 'additional_components'
|
||||
if option in ('mongo_db_name', 'mongo_replset', 'mongo_user',
|
||||
'hosts_ip', 'mongo_password'):
|
||||
|
@ -500,6 +501,11 @@ class FuelWebClient(object):
|
|||
hpv_data = attributes['editable']['common']['use_vcenter']
|
||||
hpv_data['value'] = True
|
||||
|
||||
# Updating attributes is needed before calling
|
||||
# update_network_configuration() because addtional networks
|
||||
# may be created by new components like ironic
|
||||
self.client.update_cluster_attributes(cluster_id, attributes)
|
||||
|
||||
if MULTIPLE_NETWORKS:
|
||||
node_groups = {n['name']: [] for n in NODEGROUPS}
|
||||
self.update_nodegroups(cluster_id, node_groups)
|
||||
|
@ -1254,6 +1260,9 @@ class FuelWebClient(object):
|
|||
'eth4': ['storage'],
|
||||
}
|
||||
|
||||
if self.get_cluster_additional_components(cluster_id)['ironic']:
|
||||
assigned_networks['eth5'] = ['baremetal']
|
||||
|
||||
if not nailgun_nodes:
|
||||
nailgun_nodes = self.client.list_cluster_nodes(cluster_id)
|
||||
for node in nailgun_nodes:
|
||||
|
@ -1275,6 +1284,9 @@ class FuelWebClient(object):
|
|||
cluster_id)
|
||||
|
||||
self.update_floating_ranges(new_settings)
|
||||
for net in net_config['networks']:
|
||||
if 'baremetal' in net['name']:
|
||||
self.update_baremetal_ranges(new_settings)
|
||||
self.client.update_network(
|
||||
cluster_id=cluster_id,
|
||||
networking_parameters=new_settings["networking_parameters"],
|
||||
|
@ -1325,8 +1337,16 @@ class FuelWebClient(object):
|
|||
# This feature moved to 8.0: LP#1371363, LP#1490578
|
||||
nc["floating_ranges"] = self.get_range(float_range, 1)
|
||||
|
||||
def update_baremetal_ranges(self, network_configuration):
|
||||
nc = network_configuration["networking_parameters"]
|
||||
|
||||
baremetal_net = self.environment.d_env.get_network(
|
||||
name='ironic').ip_network
|
||||
|
||||
nc["baremetal_ranges"] = self.get_range(baremetal_net, 3)
|
||||
|
||||
def set_network(self, net_config, net_name, net_pools=None, seg_type=None):
|
||||
nets_wo_floating = ['public', 'management', 'storage']
|
||||
nets_wo_floating = ['public', 'management', 'storage', 'baremetal']
|
||||
if (seg_type == NEUTRON_SEGMENT['tun'] or
|
||||
seg_type == NEUTRON_SEGMENT['gre']):
|
||||
nets_wo_floating.append('private')
|
||||
|
@ -1347,7 +1367,6 @@ class FuelWebClient(object):
|
|||
i = nets_wo_floating.index(net_name)
|
||||
self.net_settings(net_config, pub_subnets[i], jbond=True)
|
||||
else:
|
||||
|
||||
public_net = self._get_true_net_name('public', net_pools)
|
||||
admin_net = self._get_true_net_name('admin', net_pools)
|
||||
|
||||
|
@ -1380,12 +1399,27 @@ class FuelWebClient(object):
|
|||
if jbond:
|
||||
if net_config['name'] == 'public':
|
||||
net_config['gateway'] = self.environment.d_env.router('public')
|
||||
ip_network = net_name
|
||||
ip_network = net_name
|
||||
elif net_config['name'] == 'baremetal':
|
||||
baremetal_net = self.environment.d_env.get_network(
|
||||
name='ironic').ip_network
|
||||
net_config['gateway'] = str(
|
||||
list(IPNetwork(baremetal_net))[-2])
|
||||
ip_network = baremetal_net
|
||||
else:
|
||||
ip_network = net_name
|
||||
else:
|
||||
net_config['vlan_start'] = None
|
||||
net_config['gateway'] = self.environment.d_env.router(net_name)
|
||||
ip_network = self.environment.d_env.get_network(
|
||||
name=net_name).ip_network
|
||||
if net_config['name'] == 'baremetal':
|
||||
baremetal_net = self.environment.d_env.get_network(
|
||||
name='ironic').ip_network
|
||||
net_config['gateway'] = str(
|
||||
list(IPNetwork(baremetal_net))[-2])
|
||||
ip_network = baremetal_net
|
||||
else:
|
||||
net_config['gateway'] = self.environment.d_env.router(net_name)
|
||||
ip_network = self.environment.d_env.get_network(
|
||||
name=net_name).ip_network
|
||||
|
||||
net_config['cidr'] = str(ip_network)
|
||||
|
||||
|
@ -1407,6 +1441,8 @@ class FuelWebClient(object):
|
|||
return [[str(net[2]), str(net[half - 1])]]
|
||||
elif ip_range == 2:
|
||||
return [[str(net[3]), str(net[half - 1])]]
|
||||
elif ip_range == 3:
|
||||
return [[str(net[half]), str(net[-3])]]
|
||||
|
||||
def get_floating_ranges(self, network_set=''):
|
||||
net_name = 'public{0}'.format(network_set)
|
||||
|
@ -2174,6 +2210,17 @@ class FuelWebClient(object):
|
|||
'password': password,
|
||||
'tenant': tenant}
|
||||
|
||||
@logwrap
|
||||
def get_cluster_additional_components(self, cluster_id):
|
||||
components = {}
|
||||
attributes = self.client.get_cluster_attributes(cluster_id)
|
||||
add_comps = attributes['editable']['additional_components'].items()
|
||||
for comp, opts in add_comps:
|
||||
# exclude metadata
|
||||
if 'metadata' not in comp:
|
||||
components[comp] = opts['value']
|
||||
return components
|
||||
|
||||
@logwrap
|
||||
def spawn_vms_wait(self, cluster_id, timeout=60 * 60, interval=30):
|
||||
logger.info('Spawn VMs of a cluster %s', cluster_id)
|
||||
|
|
|
@ -45,6 +45,7 @@ def import_tests():
|
|||
from tests import test_backup_restore # noqa
|
||||
from tests import test_ceph # noqa
|
||||
from tests import test_environment_action # noqa
|
||||
from tests import test_ironic_base # noqa
|
||||
from tests import test_neutron # noqa
|
||||
from tests import test_neutron_public # noqa
|
||||
from tests import test_neutron_tun # noqa
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
# Copyright 2015 Mirantis, Inc.
|
||||
#
|
||||
# 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.
|
||||
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test.settings import DEPLOYMENT_MODE
|
||||
from fuelweb_test.settings import NEUTRON_SEGMENT
|
||||
from fuelweb_test.tests.base_test_case import SetupEnvironment
|
||||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
|
||||
from proboscis import test
|
||||
|
||||
|
||||
@test(groups=["ironic"])
|
||||
class TestIronicBase(TestBasic):
|
||||
"""TestIronicBase""" # TODO documentation
|
||||
|
||||
@test(depends_on=[SetupEnvironment.prepare_slaves_3],
|
||||
groups=["ironic_base"])
|
||||
@log_snapshot_after_test
|
||||
def ironic_base(
|
||||
self):
|
||||
"""Deploy cluster in HA mode with Ironic:
|
||||
|
||||
Scenario:
|
||||
1. Create cluster
|
||||
2. Add 1 controller node
|
||||
3. Add 1 compute node
|
||||
4. Add 1 ironic node
|
||||
|
||||
Snapshot: test_ironic_base
|
||||
"""
|
||||
|
||||
self.env.revert_snapshot("ready_with_3_slaves")
|
||||
|
||||
cluster_id = self.fuel_web.create_cluster(
|
||||
name=self.__class__.__name__,
|
||||
mode=DEPLOYMENT_MODE,
|
||||
settings={
|
||||
"net_provider": 'neutron',
|
||||
"net_segment_type": NEUTRON_SEGMENT['vlan'],
|
||||
"ironic": True,
|
||||
}
|
||||
)
|
||||
|
||||
self.fuel_web.update_nodes(
|
||||
cluster_id,
|
||||
{
|
||||
'slave-01': ['controller'],
|
||||
'slave-02': ['compute'],
|
||||
'slave-03': ['ironic'],
|
||||
}
|
||||
)
|
||||
|
||||
self.fuel_web.deploy_cluster_wait(cluster_id)
|
||||
|
||||
self.fuel_web.verify_network(cluster_id)
|
||||
self.fuel_web.run_ostf(
|
||||
cluster_id=cluster_id)
|
||||
|
||||
self.env.make_snapshot("ironic_base")
|
Loading…
Reference in New Issue