Added Ironic test to check nodes are available/active
Added Ironic test to check nodes are available/active.
All other states are not expected. The full list of
states with description, see here:
https://docs.openstack.org/ironic/latest/contributor/states.html
Change-Id: I23c97ceb615b0fc1a7629445677d1f3ae3ecd889
Realated: PROD-30572
(cherry picked from commit 2f7a2a1c4468e8c209b6ac450c079969e227b49e)
diff --git a/test_set/cvp-sanity/tests/test_ironic_services.py b/test_set/cvp-sanity/tests/test_ironic_services.py
new file mode 100644
index 0000000..f2d3c90
--- /dev/null
+++ b/test_set/cvp-sanity/tests/test_ironic_services.py
@@ -0,0 +1,20 @@
+import pytest
+
+
+@pytest.mark.full
+@pytest.mark.usefixtures('check_ironic')
+@pytest.mark.usefixtures('check_openstack')
+def test_ironic_nodes_are_available_or_active(local_salt_client):
+ """
+ Make sure that ironic nodes are available or active - check that all
+ nodes have 'active' or 'available' state in output of
+ `openstack baremetal node list` on 'keystone:server' nodes.
+ The other states are not expected. See full states description:
+ https://docs.openstack.org/ironic/latest/contributor/states.html
+ """
+ result = local_salt_client.cmd_any(
+ tgt='keystone:server',
+ param='. /root/keystonercv3; openstack baremetal node list | '
+ 'grep -v "\-------\|UUID\|active\|available"')
+ assert result == '', (
+ "Some Ironic nodes are in wrong state:\n{}".format(result))