Merge "Add more deploy tests for idrac, redfish, ipmi"
diff --git a/ironic_tempest_plugin/tests/scenario/baremetal_standalone_manager.py b/ironic_tempest_plugin/tests/scenario/baremetal_standalone_manager.py
index da7db4c..e4d8717 100644
--- a/ironic_tempest_plugin/tests/scenario/baremetal_standalone_manager.py
+++ b/ironic_tempest_plugin/tests/scenario/baremetal_standalone_manager.py
@@ -125,6 +125,16 @@
return body
@classmethod
+ def _disassociate_instance_with_node(cls, node_id):
+ """Disassociate instance_uuid from attached node.
+
+ :param node_id: Name or UUID of the node.
+ """
+ cls.update_node(node_id, [{'op': 'replace',
+ 'path': '/instance_uuid',
+ 'value': None}])
+
+ @classmethod
def get_node_vifs(cls, node_id):
"""Return a list of VIFs for a given node.
@@ -233,6 +243,28 @@
return nodes[0]
@classmethod
+ def unreserve_node(cls, node):
+ """Unreserves node by disassociating instance_uuid attached to node.
+
+ :param node: Ironic node to disassociate instance_uuid from.
+ """
+
+ def _try_to_disassociate_instance():
+ _, node_prop = cls.baremetal_client.show_node(node['uuid'])
+ if node_prop['instance_uuid']:
+ try:
+ cls._disassociate_instance_with_node(node['uuid'])
+ except lib_exc.Conflict:
+ return False
+ return True
+ if (not test_utils.call_until_true(
+ _try_to_disassociate_instance,
+ duration=CONF.baremetal.association_timeout, sleep_for=1)):
+ msg = ('Timed out waiting to disassociate instance from '
+ 'ironic node uuid %s' % node['instance_uuid'])
+ raise lib_exc.TimeoutException(msg)
+
+ @classmethod
def boot_node(cls, image_ref=None, image_checksum=None,
boot_option=None):
"""Boot ironic node.
@@ -600,6 +632,7 @@
except lib_exc.NotFound:
pass
cls.terminate_node(cls.node['uuid'])
+ cls.unreserve_node(cls.node)
base.reset_baremetal_api_microversion()
super(BaremetalStandaloneManager, cls).resource_cleanup()
diff --git a/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_inspection_basic.py b/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_inspection_basic.py
new file mode 100644
index 0000000..d6e2af1
--- /dev/null
+++ b/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_inspection_basic.py
@@ -0,0 +1,67 @@
+# Copyright (c) 2022 Dell Inc. or its subsidiaries.
+#
+# 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 tempest.lib import decorators
+
+from ironic_tempest_plugin.tests.scenario import \
+ baremetal_standalone_manager as bsm
+
+
+class BaremetalIdracInspect(bsm.BaremetalStandaloneScenarioTest):
+
+ driver = 'idrac'
+ mandatory_attr = ['driver', 'inspect_interface']
+ # The test cases clean up at the end by detaching the VIF.
+ # Support for VIFs was introduced by version 1.28
+ # (# v1.28: Add vifs subcontroller to node).
+ api_microversion = '1.28'
+ delete_node = False
+
+ def _verify_node_inspection_data(self):
+ _, node = self.baremetal_client.show_node(self.node['uuid'])
+
+ self.assertEqual(node['properties']['cpu_arch'], 'x86_64')
+ self.assertGreater(int(node['properties']['memory_mb']), 0)
+ self.assertGreater(int(node['properties']['cpus']), 0)
+ self.assertGreater(int(node['properties']['local_gb']), 0)
+
+ @decorators.idempotent_id('47ea4487-4720-43e8-a024-53ae82f8c264')
+ def test_baremetal_inspect(self):
+ """This test case follows this set of operations:
+
+ * Sets nodes to manageable state
+ * Inspects nodes
+ * Verifies inspection data
+ * Sets node to available state
+ """
+ self.baremetal_client.set_node_provision_state(self.node['uuid'],
+ 'manage')
+ self.baremetal_client.set_node_provision_state(self.node['uuid'],
+ 'inspect')
+
+ self.wait_provisioning_state(self.node['uuid'], 'manageable')
+
+ self._verify_node_inspection_data()
+
+ self.baremetal_client.set_node_provision_state(self.node['uuid'],
+ 'provide')
+ self.wait_provisioning_state(self.node['uuid'], 'available')
+
+
+class BaremetalIdracRedfishInspect(BaremetalIdracInspect):
+ inspect_interface = 'idrac-redfish'
+
+
+class BaremetalIdracWSManInspect(BaremetalIdracInspect):
+ inspect_interface = 'idrac-wsman'