Split Tempest tests between ipmi and redfish

- Renamed the classes from the ironic_standalone scenario
- Added logic to choose redfish as driver when possible

Change-Id: If81a39dd8bee657bba8c5cee0fead900c6e8f56c
diff --git a/doc/source/usage.rst b/doc/source/usage.rst
index ecb7218..6fb682c 100644
--- a/doc/source/usage.rst
+++ b/doc/source/usage.rst
@@ -40,18 +40,19 @@
     all bare metal tests
 ``ironic_tempest_plugin.tests.api``
     only API tests using fake hardware, without other OpenStack services (these
-    tests are run by jobs starting with ``tempest-dsvm-ironic-functional``)
+    tests are run by jobs starting with ``ironic-tempest-functional-python3``)
 ``ironic_tempest_plugin.tests.scenario``
     all integration tests, excluding the API tests with fake hardware (these
     tests are run by most of the jobs)
 ``ironic_standalone``
     standalone bare metal tests that do not use the Compute service
-    (these tests are run by the job ``ironic-dsvm-standalone``)
+    (these tests are run by the jobs ``ironic-standalone`` and
+    ``ironic-standalone-redfish``)
 ``InspectorBasicTest``
     basic introspection tests (these tests are run by most of the jobs with
     ``ironic-inspector`` in their name)
 ``InspectorDiscoveryTest``
     introspection auto-discovery tests (these tests are run by the job
-    ``ironic-inspector-tempest-dsvm-discovery`` and require additional set up)
+    ``ironic-inspector-tempest-discovery`` and require additional set up)
 
 .. _Tempest documentation: https://docs.openstack.org/tempest/latest/run.html
diff --git a/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_adoption.py b/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_adoption.py
index 63e5f5a..ba56917 100644
--- a/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_adoption.py
+++ b/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_adoption.py
@@ -25,10 +25,13 @@
 CONF = config.CONF
 
 
-class BaremetalAdoptionIpmiWholedisk(
+class BaremetalAdoptionDriverWholedisk(
         bsm.BaremetalStandaloneScenarioTest):
 
-    driver = 'ipmi'
+    if 'redfish' in CONF.baremetal.enabled_hardware_types:
+        driver = 'redfish'
+    else:
+        driver = 'ipmi'
     image_ref = CONF.baremetal.whole_disk_image_ref
     wholedisk_image = True
     deploy_interface = 'iscsi'
@@ -37,7 +40,10 @@
 
     @classmethod
     def skip_checks(cls):
-        super(BaremetalAdoptionIpmiWholedisk, cls).skip_checks()
+        super(BaremetalAdoptionDriverWholedisk, cls).skip_checks()
+        if cls.driver == 'ipmi':
+            skip_msg = ("Adoption feature is covered by redfish driver")
+            raise cls.skipException(skip_msg)
         if not CONF.baremetal_feature_enabled.adoption:
             skip_msg = ("Adoption feature is not enabled")
             raise cls.skipException(skip_msg)
@@ -50,10 +56,10 @@
                 'instance_info': cls.node['instance_info'],
                 'driver': cls.node['driver'],
                 'properties': cls.node['properties']}
-        if set(body['driver_info'].get('ipmi_password')) == {'*'}:
+        if set(body['driver_info'].get('redfish_password')) == {'*'}:
             # A hack to enable devstack testing without showing secrets
             # secrets. Use the hardcoded devstack value.
-            body['driver_info']['ipmi_password'] = 'password'
+            body['driver_info']['redfish_password'] = 'password'
         # configdrive is hidden and anyway should be supplied on rebuild
         body['instance_info'].pop('configdrive', None)
         for key, value in cls.node.items():
diff --git a/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_basic_ops.py b/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_basic_ops.py
index ea6f62d..afc1cb7 100644
--- a/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_basic_ops.py
+++ b/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_basic_ops.py
@@ -113,68 +113,112 @@
         self.boot_and_verify_node()
 
 
-class BaremetalIpmiIscsiWholedisk(bsm.BaremetalStandaloneScenarioTest):
+class BaremetalDriverIscsiWholedisk(bsm.BaremetalStandaloneScenarioTest):
 
     api_microversion = '1.31'  # to set the deploy_interface
-    driver = 'ipmi'
+    if 'redfish' in CONF.baremetal.enabled_hardware_types:
+        driver = 'redfish'
+    else:
+        driver = 'ipmi'
+
     deploy_interface = 'iscsi'
     image_ref = CONF.baremetal.whole_disk_image_ref
     wholedisk_image = True
 
+    @classmethod
+    def skip_checks(cls):
+        super(BaremetalDriverIscsiWholedisk, cls).skip_checks()
+        if cls.driver == 'redfish':
+            skip_msg = ("Test covered when using ipmi")
+            raise cls.skipException(skip_msg)
+
     @decorators.idempotent_id('f25b71df-2150-45d7-a780-7f5b07124808')
     @utils.services('image', 'network')
     def test_ip_access_to_server(self):
         self.boot_and_verify_node()
 
 
-class BaremetalIpmiDirectWholedisk(bsm.BaremetalStandaloneScenarioTest):
+class BaremetalDriverDirectWholedisk(bsm.BaremetalStandaloneScenarioTest):
 
     api_microversion = '1.31'  # to set the deploy_interface
-    driver = 'ipmi'
+    if 'redfish' in CONF.baremetal.enabled_hardware_types:
+        driver = 'redfish'
+    else:
+        driver = 'ipmi'
     deploy_interface = 'direct'
     image_ref = CONF.baremetal.whole_disk_image_ref
     wholedisk_image = True
 
+    @classmethod
+    def skip_checks(cls):
+        super(BaremetalDriverDirectWholedisk, cls).skip_checks()
+        if cls.driver == 'ipmi':
+            skip_msg = ("Test covered when using redfish")
+            raise cls.skipException(skip_msg)
+
     @decorators.idempotent_id('c2db24e7-07dc-4a20-8f93-d4efae2bfd4e')
     @utils.services('image', 'network')
     def test_ip_access_to_server(self):
         self.boot_and_verify_node()
 
 
-class BaremetalIpmiIscsiPartitioned(bsm.BaremetalStandaloneScenarioTest):
+class BaremetalDriverIscsiPartitioned(bsm.BaremetalStandaloneScenarioTest):
 
     api_microversion = '1.31'  # to set the deploy_interface
-    driver = 'ipmi'
+    if 'redfish' in CONF.baremetal.enabled_hardware_types:
+        driver = 'redfish'
+    else:
+        driver = 'ipmi'
     deploy_interface = 'iscsi'
     image_ref = CONF.baremetal.partition_image_ref
     wholedisk_image = False
     boot_option = 'netboot' if CONF.baremetal.partition_netboot else 'local'
 
+    @classmethod
+    def skip_checks(cls):
+        super(BaremetalDriverIscsiPartitioned, cls).skip_checks()
+        if cls.driver == 'ipmi':
+            skip_msg = ("Test covered when using redfish")
+            raise cls.skipException(skip_msg)
+
     @decorators.idempotent_id('7d0b205e-edbc-4e2d-9f6d-95cd74eefecb')
     @utils.services('image', 'network')
     def test_ip_access_to_server(self):
         self.boot_and_verify_node()
 
 
-class BaremetalIpmiDirectPartitioned(bsm.BaremetalStandaloneScenarioTest):
+class BaremetalDriverDirectPartitioned(bsm.BaremetalStandaloneScenarioTest):
 
     api_microversion = '1.31'  # to set the deploy_interface
-    driver = 'ipmi'
+    if 'redfish' in CONF.baremetal.enabled_hardware_types:
+        driver = 'redfish'
+    else:
+        driver = 'ipmi'
     deploy_interface = 'direct'
     image_ref = CONF.baremetal.partition_image_ref
     wholedisk_image = False
     boot_option = 'netboot' if CONF.baremetal.partition_netboot else 'local'
 
+    @classmethod
+    def skip_checks(cls):
+        super(BaremetalDriverDirectPartitioned, cls).skip_checks()
+        if cls.driver == 'redfish':
+            skip_msg = ("Test covered when using ipmi")
+            raise cls.skipException(skip_msg)
+
     @decorators.idempotent_id('7b4b2dcd-2bbb-44f5-991f-0964300af6b7')
     @utils.services('image', 'network')
     def test_ip_access_to_server(self):
         self.boot_and_verify_node()
 
 
-class BaremetalIpmiAnsibleWholedisk(bsm.BaremetalStandaloneScenarioTest):
+class BaremetalDriverAnsibleWholedisk(bsm.BaremetalStandaloneScenarioTest):
 
     api_microversion = '1.31'  # to set the deploy_interface
-    driver = 'ipmi'
+    if 'redfish' in CONF.baremetal.enabled_hardware_types:
+        driver = 'redfish'
+    else:
+        driver = 'ipmi'
     deploy_interface = 'ansible'
     image_ref = CONF.baremetal.whole_disk_image_ref
     wholedisk_image = True
diff --git a/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_cleaning.py b/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_cleaning.py
index 10b6663..c068fbe 100644
--- a/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_cleaning.py
+++ b/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_cleaning.py
@@ -79,7 +79,10 @@
 
 class SoftwareRaidIscsi(bsm.BaremetalStandaloneScenarioTest):
 
-    driver = 'ipmi'
+    if 'redfish' in CONF.baremetal.enabled_hardware_types:
+        driver = 'redfish'
+    else:
+        driver = 'ipmi'
     image_ref = CONF.baremetal.whole_disk_image_ref
     wholedisk_image = True
     deploy_interface = 'iscsi'
@@ -101,6 +104,8 @@
     @classmethod
     def skip_checks(cls):
         super(SoftwareRaidIscsi, cls).skip_checks()
+        if cls.driver == 'ipmi':
+            raise cls.skipException("Testing with redfish driver")
         if not CONF.baremetal_feature_enabled.software_raid:
             raise cls.skipException("Software RAID feature is not enabled")
 
@@ -121,7 +126,10 @@
 
 class SoftwareRaidDirect(bsm.BaremetalStandaloneScenarioTest):
 
-    driver = 'ipmi'
+    if 'redfish' in CONF.baremetal.enabled_hardware_types:
+        driver = 'redfish'
+    else:
+        driver = 'ipmi'
     image_ref = CONF.baremetal.whole_disk_image_ref
     wholedisk_image = True
     deploy_interface = 'direct'
@@ -144,6 +152,8 @@
     @classmethod
     def skip_checks(cls):
         super(SoftwareRaidDirect, cls).skip_checks()
+        if cls.driver == 'redfish':
+            raise cls.skipException("Testing with ipmi driver")
         if not CONF.baremetal_feature_enabled.software_raid:
             raise cls.skipException("Software RAID feature is not enabled")