Add standalone tests using direct HTTP links

Adds two tests that uses direct HTTP link instead of glance:
  * pxe_ipmitool + wholedisk on HTTP server
  * agent_ipmitool + wholedisk on HTTP server

Change-Id: I8f1a5b0ecb3d53ffdefd7018c1b9700210572ffc
This commit is contained in:
Vasyl Saienko 2017-02-23 13:06:56 -05:00
parent d66737ced6
commit f46b9fa3a6
4 changed files with 81 additions and 6 deletions

View File

@ -34,6 +34,10 @@ baremetal_group = cfg.OptGroup(name='baremetal',
'live_migration, pause, rescue, resize, ' 'live_migration, pause, rescue, resize, '
'shelve, snapshot, and suspend') 'shelve, snapshot, and suspend')
baremetal_features_group = cfg.OptGroup(
name='baremetal_feature_enabled',
title="Enabled Baremetal Service Features")
BaremetalGroup = [ BaremetalGroup = [
cfg.StrOpt('catalog_type', cfg.StrOpt('catalog_type',
default='baremetal', default='baremetal',
@ -86,6 +90,11 @@ BaremetalGroup = [
help="Whether the Ironic/Neutron tenant isolation is enabled"), help="Whether the Ironic/Neutron tenant isolation is enabled"),
cfg.StrOpt('whole_disk_image_ref', cfg.StrOpt('whole_disk_image_ref',
help="UUID of the wholedisk image to use in the tests."), help="UUID of the wholedisk image to use in the tests."),
cfg.StrOpt('whole_disk_image_url',
help="An http link to the wholedisk image to use in the "
"tests."),
cfg.StrOpt('whole_disk_image_checksum',
help="An MD5 checksum of the image."),
cfg.StrOpt('partition_image_ref', cfg.StrOpt('partition_image_ref',
help="UUID of the partitioned image to use in the tests."), help="UUID of the partitioned image to use in the tests."),
cfg.ListOpt('enabled_drivers', cfg.ListOpt('enabled_drivers',
@ -99,3 +108,9 @@ BaremetalGroup = [
help="Ironic adjusted disk size to use in the standalone tests " help="Ironic adjusted disk size to use in the standalone tests "
"as instance_info/root_gb value."), "as instance_info/root_gb value."),
] ]
BaremetalFeaturesGroup = [
cfg.BoolOpt('ipxe_enabled',
default=True,
help="Defines if IPXE is enabled"),
]

View File

@ -21,6 +21,12 @@ from tempest.test_discover import plugins
from ironic_tempest_plugin import config as project_config from ironic_tempest_plugin import config as project_config
_opts = [
(project_config.baremetal_group, project_config.BaremetalGroup),
(project_config.baremetal_features_group,
project_config.BaremetalFeaturesGroup)
]
class IronicTempestPlugin(plugins.TempestPlugin): class IronicTempestPlugin(plugins.TempestPlugin):
def load_tests(self): def load_tests(self):
@ -33,9 +39,8 @@ class IronicTempestPlugin(plugins.TempestPlugin):
def register_opts(self, conf): def register_opts(self, conf):
conf.register_opt(project_config.service_option, conf.register_opt(project_config.service_option,
group='service_available') group='service_available')
config.register_opt_group(conf, project_config.baremetal_group, for group, option in _opts:
project_config.BaremetalGroup) config.register_opt_group(conf, group, option)
def get_opt_lists(self): def get_opt_lists(self):
return [(project_config.baremetal_group.name, return [(group.name, option) for group, option in _opts]
project_config.BaremetalGroup)]

View File

@ -206,7 +206,7 @@ class BaremetalStandaloneManager(bm.BaremetalScenarioTest,
return nodes[0] return nodes[0]
@classmethod @classmethod
def boot_node(cls, driver, image_ref): def boot_node(cls, driver, image_ref, image_checksum=None):
"""Boot ironic node. """Boot ironic node.
The following actions are executed: The following actions are executed:
@ -220,6 +220,8 @@ class BaremetalStandaloneManager(bm.BaremetalScenarioTest,
:param driver: Node driver to use. :param driver: Node driver to use.
:param image_ref: Reference to user image to boot node with. :param image_ref: Reference to user image to boot node with.
:param image_checksum: md5sum of image specified in image_ref.
Needed only when direct HTTP link is provided.
:returns: Ironic node. :returns: Ironic node.
""" """
node = cls.get_and_reserve_node() node = cls.get_and_reserve_node()
@ -230,6 +232,10 @@ class BaremetalStandaloneManager(bm.BaremetalScenarioTest,
patch = [{'path': '/instance_info/image_source', patch = [{'path': '/instance_info/image_source',
'op': 'add', 'op': 'add',
'value': image_ref}] 'value': image_ref}]
if image_checksum is not None:
patch.append({'path': '/instance_info/image_checksum',
'op': 'add',
'value': image_checksum})
patch.append({'path': '/instance_info/root_gb', patch.append({'path': '/instance_info/root_gb',
'op': 'add', 'op': 'add',
'value': CONF.baremetal.adjusted_root_disk_size_gb}) 'value': CONF.baremetal.adjusted_root_disk_size_gb})
@ -280,6 +286,9 @@ class BaremetalStandaloneScenarioTest(BaremetalStandaloneManager):
# Boolean value specify if image is wholedisk or not. # Boolean value specify if image is wholedisk or not.
wholedisk_image = None wholedisk_image = None
# Image checksum, required when image is stored on HTTP server.
image_checksum = None
mandatory_attr = ['driver', 'image_ref', 'wholedisk_image'] mandatory_attr = ['driver', 'image_ref', 'wholedisk_image']
node = None node = None
@ -310,7 +319,11 @@ class BaremetalStandaloneScenarioTest(BaremetalStandaloneManager):
if getattr(cls, v) is None: if getattr(cls, v) is None:
raise lib_exc.InvalidConfiguration( raise lib_exc.InvalidConfiguration(
"Mandatory attribute %s not set." % v) "Mandatory attribute %s not set." % v)
cls.node = cls.boot_node(cls.driver, cls.image_ref) image_checksum = None
if not uuidutils.is_uuid_like(cls.image_ref):
image_checksum = cls.image_checksum
cls.node = cls.boot_node(cls.driver, cls.image_ref,
image_checksum=image_checksum)
cls.node_ip = cls.add_floatingip_to_node(cls.node['uuid']) cls.node_ip = cls.add_floatingip_to_node(cls.node['uuid'])
@classmethod @classmethod

View File

@ -34,6 +34,27 @@ class BaremetalAgentIpmitoolWholedisk(bsm.BaremetalStandaloneScenarioTest):
self.ping_ip_address(self.node_ip, should_succeed=True) self.ping_ip_address(self.node_ip, should_succeed=True)
class BaremetalAgentIpmitoolWholediskHttpLink(
bsm.BaremetalStandaloneScenarioTest):
driver = 'agent_ipmitool'
image_ref = CONF.baremetal.whole_disk_image_url
image_checksum = CONF.baremetal.whole_disk_image_checksum
wholedisk_image = True
@classmethod
def skip_checks(cls):
super(BaremetalAgentIpmitoolWholediskHttpLink, cls).skip_checks()
if not CONF.baremetal_feature_enabled.ipxe_enabled:
skip_msg = ("HTTP server is not available when ipxe is disabled.")
raise cls.skipException(skip_msg)
@test.idempotent_id('d926c683-1a32-44df-afd0-e60134346fd0')
@test.services('network')
def test_ip_access_to_server(self):
self.ping_ip_address(self.node_ip, should_succeed=True)
class BaremetalAgentIpmitoolPartitioned(bsm.BaremetalStandaloneScenarioTest): class BaremetalAgentIpmitoolPartitioned(bsm.BaremetalStandaloneScenarioTest):
driver = 'agent_ipmitool' driver = 'agent_ipmitool'
@ -58,6 +79,27 @@ class BaremetalPxeIpmitoolWholedisk(bsm.BaremetalStandaloneScenarioTest):
self.ping_ip_address(self.node_ip, should_succeed=True) self.ping_ip_address(self.node_ip, should_succeed=True)
class BaremetalPxeIpmitoolWholediskHttpLink(
bsm.BaremetalStandaloneScenarioTest):
driver = 'pxe_ipmitool'
image_ref = CONF.baremetal.whole_disk_image_url
image_checksum = CONF.baremetal.whole_disk_image_checksum
wholedisk_image = True
@classmethod
def skip_checks(cls):
super(BaremetalPxeIpmitoolWholediskHttpLink, cls).skip_checks()
if not CONF.baremetal_feature_enabled.ipxe_enabled:
skip_msg = ("HTTP server is not available when ipxe is disabled.")
raise cls.skipException(skip_msg)
@test.idempotent_id('71ccf06f-6765-40fd-8252-1b1bfa423b9b')
@test.services('network')
def test_ip_access_to_server(self):
self.ping_ip_address(self.node_ip, should_succeed=True)
class BaremetalPxeIpmitoolPartitioned(bsm.BaremetalStandaloneScenarioTest): class BaremetalPxeIpmitoolPartitioned(bsm.BaremetalStandaloneScenarioTest):
driver = 'pxe_ipmitool' driver = 'pxe_ipmitool'