Allow to pass default interface values to tempest
In case any of those are set in ironic, test that resets interfaces
might fail.
Closes-issue: https://mirantis.jira.com/browse/PRODX-9563
Change-Id: I6f07e25644a92ccac169f84f7c79696d21b58e76
(cherry picked from commit 675c7c0109c8d83f1d8de9b3d28b0e93dd900595)
(cherry picked from commit 2b3bba75492cd93c2140b8e78c4d8fb405486693)
(cherry picked from commit dcb729692f0fd8a804506ba358c9fa2f5c680e3f)
diff --git a/ironic_tempest_plugin/config.py b/ironic_tempest_plugin/config.py
index 5a71b84..8213b61 100644
--- a/ironic_tempest_plugin/config.py
+++ b/ironic_tempest_plugin/config.py
@@ -20,6 +20,10 @@
from tempest import config # noqa
+_DEFAULT_IFACE_HELP = ('Default {0} interface to be used for nodes that '
+ 'do not have {0}_interface field set.')
+
+
# NOTE(TheJulia): The following options are loaded into a tempest
# plugin configuration option via plugin.py.
ironic_service_option = cfg.BoolOpt('ironic',
@@ -203,8 +207,30 @@
cfg.ListOpt('enabled_power_interfaces',
default=['fake', 'ipmitool'],
help="List of Ironic enabled power interfaces."),
+ cfg.StrOpt('default_bios_interface',
+ help=_DEFAULT_IFACE_HELP.format('bios')),
+ cfg.StrOpt('default_boot_interface',
+ help=_DEFAULT_IFACE_HELP.format('boot')),
+ cfg.StrOpt('default_console_interface',
+ help=_DEFAULT_IFACE_HELP.format('console')),
+ cfg.StrOpt('default_deploy_interface',
+ help=_DEFAULT_IFACE_HELP.format('deploy')),
+ cfg.StrOpt('default_inspect_interface',
+ help=_DEFAULT_IFACE_HELP.format('inspect')),
+ cfg.StrOpt('default_management_interface',
+ help=_DEFAULT_IFACE_HELP.format('management')),
+ cfg.StrOpt('default_network_interface',
+ help=_DEFAULT_IFACE_HELP.format('network')),
+ cfg.StrOpt('default_power_interface',
+ help=_DEFAULT_IFACE_HELP.format('power')),
+ cfg.StrOpt('default_raid_interface',
+ help=_DEFAULT_IFACE_HELP.format('raid')),
cfg.StrOpt('default_rescue_interface',
- help="Ironic default rescue interface."),
+ help=_DEFAULT_IFACE_HELP.format('rescue')),
+ cfg.StrOpt('default_storage_interface',
+ help=_DEFAULT_IFACE_HELP.format('storage')),
+ cfg.StrOpt('default_vendor_interface',
+ help=_DEFAULT_IFACE_HELP.format('vendor')),
cfg.StrOpt('firmware_image_url',
help="Image URL of firmware image file supported by "
"update_firmware clean step."),
diff --git a/ironic_tempest_plugin/tests/api/admin/test_nodes.py b/ironic_tempest_plugin/tests/api/admin/test_nodes.py
index d6d1833..61dfb9e 100644
--- a/ironic_tempest_plugin/tests/api/admin/test_nodes.py
+++ b/ironic_tempest_plugin/tests/api/admin/test_nodes.py
@@ -649,7 +649,10 @@
[{'path': '/%s' % field,
'op': 'remove'}])
_, node = self.client.show_node(self.node['uuid'])
- self.assertEqual('fake', node[field])
+ default_iface_option = getattr(
+ CONF.baremetal, 'default_%s_interface' % iface)
+ expected_value = default_iface_option or 'fake'
+ self.assertEqual(expected_value, node[field])
class TestResetInterfaces(TestHardwareInterfaces):