summaryrefslogtreecommitdiffstats
path: root/ansible_collections/dellemc/openmanage/roles
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:22:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:22:15 +0000
commit0202b47f95a87598276869ab7f07f57e8a4c8a87 (patch)
tree21f101dcceb98166b117c40dab3d79d5b2ad8eed /ansible_collections/dellemc/openmanage/roles
parentAdding upstream version 10.0.1+dfsg. (diff)
downloadansible-upstream.tar.xz
ansible-upstream.zip
Adding upstream version 10.1.0+dfsg.upstream/10.1.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/dellemc/openmanage/roles')
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_attributes/molecule/default/converge.yml35
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/prepare.yml4
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_continuous_reset_type_none/converge.yml4
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_disabled_reset_type_none/converge.yml4
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_once_reset_type_none/converge.yml6
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_legacy_job_wait_false/converge.yml6
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/default/converge.yml6
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/default/molecule.yml12
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/backplane/converge.yml16
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/passensor/converge.yml51
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/physicaldisk/converge.yml37
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/powersupply/converge.yml50
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/systemmetrics/converge.yml48
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/mmetrics_assert.yml56
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/passensor_assert.yml39
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/powersupply_assert.yml42
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/tmetrics_assert.yml54
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/default/converge.yml10
-rw-r--r--ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/delete_job/converge.yml6
-rw-r--r--ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/default/converge.yml89
-rw-r--r--ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/default/molecule.yml10
21 files changed, 334 insertions, 251 deletions
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_attributes/molecule/default/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_attributes/molecule/default/converge.yml
index f1ae0f548..d7d393ec1 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_attributes/molecule/default/converge.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_attributes/molecule/default/converge.yml
@@ -13,16 +13,14 @@
validate_certs: false
idrac_attributes:
SSH.1.Timeout: 1800
- ignore_errors: true
ignore_unreachable: true
register: idrac_attributes_error_msg
- name: Asserting after performing operation with wrong hostname
ansible.builtin.assert:
- that:
- - "'Incorrect username or password,
- unreachable iDRAC IP' in '{{ idrac_attributes_out.msg }}' or
- 'Name or service not known' in '{{ idrac_attributes_out.msg }}'"
+ that: >-
+ '"<urlopen error [Errno -2] Name or service not known>" in
+ idrac_attributes_out.msg'
- name: Perform update with wrong username
ansible.builtin.import_role:
@@ -35,7 +33,6 @@
idrac_attributes:
SSH.1.Timeout: 1800
ignore_errors: true
- ignore_unreachable: true
register: idrac_attributes_error_msg
- name: Asserting after performing operation with wrong username
@@ -54,15 +51,12 @@
idrac_attributes:
SSH.1.Timeout: 1800
ignore_errors: true
- ignore_unreachable: true
register: idrac_attributes_error_msg
- name: Asserting after performing operation with wrong password
ansible.builtin.assert:
- that: |-
- ('"HTTP Error 401" in idrac_attributes_out.msg')
- or
- ('"urlopen error timed out" in idrac_attributes_out.msg')
+ that:
+ - '"HTTP Error 401" in idrac_attributes_out.msg'
- name: Perform update with invalid https_port
ansible.builtin.import_role:
@@ -75,16 +69,14 @@
https_port: 9999999
idrac_attributes:
SSH.1.Timeout: 1800
- ignore_errors: true
ignore_unreachable: true
register: idrac_attributes_error_msg
- name: Asserting after performing operation with invalid https_port
ansible.builtin.assert:
- that:
- - ('"Connection refused" in idrac_attributes_out.msg')
- or
- ('"urlopen error timed out" in idrac_attributes_out.msg')
+ that: >-
+ '"<urlopen error [Errno 111] Connection refused>" in
+ idrac_attributes_out.msg'
- name: Perform update with invalid validate_certs
ansible.builtin.import_role:
@@ -118,14 +110,15 @@
validate_certs: true
idrac_attributes:
SSH.1.Timeout: 1800
- ignore_errors: true
ignore_unreachable: true
register: idrac_attributes_error_msg
- name: Asserting after performing operation with wrong ca_path
ansible.builtin.assert:
- that:
- - '"certificate verify failed" in idrac_attributes_out.msg'
+ that: >-
+ '"<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
+ failed: self signed certificate (_ssl.c:1129)>" in
+ idrac_attributes_out.msg'
- name: Perform update with wrong manager_id
ansible.builtin.import_role:
@@ -140,13 +133,12 @@
SSH.1.Timeout: 1800
manager_id: idrac.random.5
ignore_errors: true
- ignore_unreachable: true
register: idrac_attributes_error_msg
- name: Asserting after performing operation with wrong manager_id
ansible.builtin.assert:
that:
- - '"HTTP Error 404" in idrac_attributes_out.msg'
+ - '"HTTP Error 404: Not Found" in idrac_attributes_out.msg'
- name: Perform update with read only attributes
ansible.builtin.import_role:
@@ -161,7 +153,6 @@
SSH.1.MaxSessions: 5
manager_id: "{{ null | default(omit) }}"
ignore_errors: true
- ignore_unreachable: true
register: idrac_attributes_error_msg
- name: Asserting after performing operation with read only attributes
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/prepare.yml b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/prepare.yml
index a91b20b69..bce98ac96 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/prepare.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_bios/molecule/clear_pending_attributes/prepare.yml
@@ -13,6 +13,10 @@
url: "https://{{ idrac_ip }}:{{ idrac_port }}/redfish/v1/Managers\
/iDRAC.Embedded.1/Jobs?$expand=*($levels=1)"
+ - name: Initialize idrac_bios_jobs_items variable
+ ansible.builtin.set_fact:
+ idrac_bios_jobs_items: []
+
- name: Fetch Bios Jobs Data
loop: "{{ idrac_bios_uri_data.json.Members }}"
when: item.JobType == 'BIOSConfiguration' and item.JobState in ['Scheduled', 'Scheduling']
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_continuous_reset_type_none/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_continuous_reset_type_none/converge.yml
index a1e11acdd..dbf9d273b 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_continuous_reset_type_none/converge.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_continuous_reset_type_none/converge.yml
@@ -109,5 +109,7 @@
- name: Asserting TC-115433 in normal mode
ansible.builtin.assert:
- that: idrac_boot_out.msg == "The boot settings job is triggered successfully."
+ that: >-
+ "The boot settings operation is triggered/submitted successfully." in
+ idrac_boot_out.msg
when: not ansible_check_mode
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_disabled_reset_type_none/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_disabled_reset_type_none/converge.yml
index 8c8d2d443..3cd71f208 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_disabled_reset_type_none/converge.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_disabled_reset_type_none/converge.yml
@@ -92,7 +92,9 @@
- name: Asserting TC-115431 in normal mode
ansible.builtin.assert:
- that: idrac_boot_out.msg == "The boot settings job is triggered successfully."
+ that: >-
+ "The boot settings operation is triggered/submitted successfully." in
+ idrac_boot_out.msg
when: not ansible_check_mode and idrac_boot_out.changed
- name: Asserting TC-115431 in idempotence mode
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_once_reset_type_none/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_once_reset_type_none/converge.yml
index 8fc9af6dc..d9aeee409 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_once_reset_type_none/converge.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_enabled_as_once_reset_type_none/converge.yml
@@ -91,6 +91,8 @@
- name: Asserting TC-115432 in normal mode or idempotence mode
ansible.builtin.assert:
- that:
- - 'idrac_boot_out.msg == "The boot settings job is triggered successfully." or "No changes found to be applied."'
+ that: >-
+ 'idrac_boot_out.msg == "The boot settings operation is
+ triggered/submitted successfully." or "No changes found to be
+ applied."'
when: not ansible_check_mode and not idrac_boot_out.changed
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_legacy_job_wait_false/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_legacy_job_wait_false/converge.yml
index 85b84477f..142a0bebb 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_legacy_job_wait_false/converge.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_boot/molecule/boot_source_override_mode_legacy_job_wait_false/converge.yml
@@ -105,6 +105,8 @@
- name: Asserting TC-115429 in normal mode or idempotence mode
ansible.builtin.assert:
- that:
- - 'idrac_boot_out.msg == "The boot settings job is triggered successfully." or "No changes found to be applied."'
+ that: >-
+ 'idrac_boot_out.msg == "The boot settings operation is
+ triggered/submitted successfully." or "No changes found to
+ be applied."'
when: not ansible_check_mode and not idrac_boot_out.changed
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/default/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/default/converge.yml
index 021cec95f..3b394ff6b 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/default/converge.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/default/converge.yml
@@ -165,9 +165,9 @@
- name: Verify task status - Negative - invalid unreachable host
ansible.builtin.assert:
- that:
- - idrac_certificate_out.unreachable
- - '"Unable to communicate with" in idrac_certificate_out.msg'
+ that: >-
+ '"<urlopen error [Errno -2] Name or service not known>" in
+ idrac_certificate_out.msg' and idrac_certificate_out.unreachable
- name: Negative - invalid idrac user
ansible.builtin.import_role:
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/default/molecule.yml b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/default/molecule.yml
index e69de29bb..c6b1e43af 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/default/molecule.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_certificate/molecule/default/molecule.yml
@@ -0,0 +1,12 @@
+---
+scenario:
+ test_sequence:
+ - dependency
+ - cleanup
+ - destroy
+ - syntax
+ - create
+ - prepare
+ - check
+ - converge
+ - destroy
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/backplane/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/backplane/converge.yml
index 9aab189c2..928369a3b 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/backplane/converge.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/backplane/converge.yml
@@ -40,12 +40,6 @@
register: backplane_result_url
no_log: true
- - name: Validate whether PCIeSSDBackPlane information exists
- ansible.builtin.assert:
- that:
- - "{{ backplane_result_url.json.Members | length > 0 }}"
- fail_msg: "PCIeSSDBackPlane information does not exist"
-
- name: Set PCIeSSDBackPlane facts
ansible.builtin.set_fact:
api_response: "{{ backplane_result_url.json.Members | ansible.utils.remove_keys(target=['@odata.context', '@odata.id', '@odata.type']) }}"
@@ -54,9 +48,18 @@
ansible.builtin.include_role:
name: "idrac_gather_facts"
+ - name: Assert backplane data
+ ansible.builtin.assert:
+ that:
+ - "((api_response | length == 0) and (backplane | length == 0))"
+ fail_msg: "The response from the role does not match"
+ success_msg: "The response from the role matches"
+ when: api_response | length == 0
+
- name: Check whether output differs
ansible.builtin.set_fact:
result_diff: "{{ backplane | symmetric_difference(api_response) }}"
+ when: api_response | length > 0
- name: Assert the differences in List
ansible.builtin.assert:
@@ -64,3 +67,4 @@
success_msg: "The response from the role matches"
that:
- "{{ (result_diff | length) == 0 }}"
+ when: api_response | length > 0
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/passensor/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/passensor/converge.yml
index c4d86a62b..0194b2019 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/passensor/converge.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/passensor/converge.yml
@@ -27,13 +27,52 @@
api_system: "/redfish/v1/Systems/System.Embedded.1"
tasks:
+ - name: Fetching Presence and Status Sensor info
+ ansible.builtin.uri:
+ url: "https://{{ hostname }}{{ api_system }}/Oem/
+ Dell/DellPresenceAndStatusSensors"
+ validate_certs: "{{ validate_certs }}"
+ ca_path: "{{ ca_path | default(omit) }}"
+ method: "{{ idrac_gather_facts_uri_method }}"
+ user: "{{ username }}"
+ password: "{{ password }}"
+ headers: "{{ idrac_gather_facts_uri_headers }}"
+ body_format: "{{ idrac_gather_facts_uri_body_format }}"
+ status_code: "{{ idrac_gather_facts_uri_status_code }}"
+ return_content: "{{ idrac_gather_facts_uri_return_content }}"
+ no_log: true
+ register: passensor_result
+
+ - name: Set presence and status sensor facts
+ ansible.builtin.set_fact:
+ api_response: "{{ passensor_result.json.Members |
+ ansible.utils.remove_keys(target=['@odata.context',
+ '@odata.id', '@odata.type', 'Assembly', 'Links']) }}"
+ when: passensor_result.json.Members is defined
+
- name: Gather Facts for the Presence and Status Sensor
ansible.builtin.include_role:
name: "idrac_gather_facts"
- - name: Call assertion
- ansible.builtin.include_tasks: ../../tests/asserts/passensor_assert.yml
- with_items: "{{ presence_and_status_sensor }}"
- loop_control:
- loop_var: passensor_data
- when: presence_and_status_sensor | length > 0
+ - name: Assert Presence and Status Sensor data
+ ansible.builtin.assert:
+ that:
+ - "((api_response | length == 0) and
+ (presence_and_status_sensor | length == 0))"
+ fail_msg: "The response from the role does not match"
+ success_msg: "The response from the role matches"
+ when: api_response | length == 0
+
+ - name: Check whether output differs
+ ansible.builtin.set_fact:
+ result_diff: "{{ presence_and_status_sensor |
+ symmetric_difference(api_response) }}"
+ when: api_response | length > 0
+
+ - name: Assert the differences in List
+ ansible.builtin.assert:
+ fail_msg: "The response from the role does not match"
+ success_msg: "The response from the role matches"
+ that:
+ - "{{ (result_diff | length) == 0 }}"
+ when: api_response | length > 0
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/physicaldisk/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/physicaldisk/converge.yml
index ef2414535..430237de0 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/physicaldisk/converge.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/physicaldisk/converge.yml
@@ -43,7 +43,10 @@
- name: Get all storage controller ids.
ansible.builtin.set_fact:
- storage_ids_list: "{{ idrac_gather_facts_controllers_result.json.Members | map('dict2items') | flatten | map(attribute='value') }}"
+ storage_ids_list:
+ "{{ idrac_gather_facts_controllers_result.json.Members |
+ map('dict2items') | flatten | map(attribute='value') }}"
+ when: idrac_gather_facts_controllers_result.json.Members is defined
- name: Get physical disk information using API.
ansible.builtin.uri:
@@ -52,31 +55,42 @@
loop: "{{ storage_ids_list }}"
no_log: true
register: idrac_gather_facts_disk_result
+ when: storage_ids_list is defined
- name: Count the number of drives in drives_result.results
ansible.builtin.set_fact:
- drives_count: "{{ idrac_gather_facts_disk_result.results | map(attribute='json.drives') | list | length }}"
-
- - name: Validate whether physical disk information exists
- ansible.builtin.assert:
- that:
- - "{{ drives_count | int > 0 }}"
- fail_msg: "Physical Disk information does not exist"
+ drives_count: "{{ idrac_gather_facts_disk_result.results |
+ map(attribute='json.drives') | list | length }}"
+ when: idrac_gather_facts_disk_result.results is defined
- name: Set Physical Disk facts
ansible.builtin.set_fact:
api_response:
- "{{ disk_result.results | selectattr('json', 'defined') | map(attribute='json') | selectattr('Drives', 'defined') |
- map(attribute='Drives') | flatten | ansible.utils.remove_keys(target=['@odata.context', '@odata.id', '@odata.type',
- 'Actions', 'Assembly', 'Links', 'DellDriveSMARTAttributes', 'DellNVMeSMARTAttributes', 'Operations@odata.count']) }}"
+ "{{ idrac_gather_facts_disk_result.results |
+ selectattr('json', 'defined') | map(attribute='json') |
+ selectattr('Drives', 'defined') | map(attribute='Drives') |
+ flatten | ansible.utils.remove_keys(target=['@odata.context',
+ '@odata.id', '@odata.type', 'Actions', 'Assembly', 'Links',
+ 'DellDriveSMARTAttributes', 'DellNVMeSMARTAttributes',
+ 'Operations@odata.count']) }}"
+ when: idrac_gather_facts_disk_result.results is defined
- name: Gather Facts for the Physical Disk component
ansible.builtin.include_role:
name: "idrac_gather_facts"
+ - name: Assert Physical Disk data
+ ansible.builtin.assert:
+ that:
+ - "((drives_count | length == 0) and (physical_disk | length == 0))"
+ fail_msg: "The response from the role does not match"
+ success_msg: "The response from the role matches"
+ when: drives_count | length == 0
+
- name: Check whether output differs
ansible.builtin.set_fact:
result_diff: "{{ physical_disk | symmetric_difference(api_response) }}"
+ when: drives_count | length > 0
- name: Assert the differences in List
ansible.builtin.assert:
@@ -84,3 +98,4 @@
success_msg: "The response from the role matches"
that:
- "{{ (result_diff | length) == 0 }}"
+ when: drives_count | length > 0
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/powersupply/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/powersupply/converge.yml
index 0f648b875..b0e9a2f0b 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/powersupply/converge.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/powersupply/converge.yml
@@ -24,20 +24,54 @@
idrac_gather_facts_uri_return_content: true
diff_data: {}
exclude_keys: []
+ api_chassis: "/redfish/v1/Chassis/System.Embedded.1"
+ power_supply_api: "/PowerSubsystem/PowerSupplies?$expand=*($levels=1)"
tasks:
+ - name: Fetching Power Supply info
+ ansible.builtin.uri:
+ url: "https://{{ hostname }}{{ api_chassis }}{{ power_supply_api }}"
+ validate_certs: "{{ validate_certs }}"
+ ca_path: "{{ ca_path | default(omit) }}"
+ method: "{{ idrac_gather_facts_uri_method }}"
+ user: "{{ username }}"
+ password: "{{ password }}"
+ headers: "{{ idrac_gather_facts_uri_headers }}"
+ body_format: "{{ idrac_gather_facts_uri_body_format }}"
+ status_code: "{{ idrac_gather_facts_uri_status_code }}"
+ return_content: "{{ idrac_gather_facts_uri_return_content }}"
+ register: powersupply_result
+ no_log: true
+
+ - name: Set powersupply facts
+ ansible.builtin.set_fact:
+ api_response:
+ "{{ powersupply_result.json.Members |
+ ansible.utils.remove_keys(target=['@odata.context', '@odata.id',
+ '@odata.type', 'ActiveInputVoltage@Redfish.Deprecated',
+ 'OperationalStatus@odata.count', 'RedTypeOfSet@odata.count']) }}"
+
- name: Gather Facts for the Power Supply component
ansible.builtin.include_role:
name: "idrac_gather_facts"
- - name: Assert power supply dict for length
+ - name: Assert power supply data
ansible.builtin.assert:
that:
- - "{{ power_supply | length > 0 }}"
+ - "((api_response | length == 0) and (power_supply | length == 0))"
+ fail_msg: "The response from the role does not match"
+ success_msg: "The response from the role matches"
+ when: api_response | length == 0
+
+ - name: Check whether output differs
+ ansible.builtin.set_fact:
+ result_diff: "{{ power_supply | symmetric_difference(api_response) }}"
+ when: api_response | length > 0
- - name: Call assertion
- ansible.builtin.include_tasks: ../../tests/asserts/powersupply_assert.yml
- with_items: "{{ power_supply }}"
- loop_control:
- loop_var: powersupply_data
- when: power_supply | length > 0
+ - name: Assert the differences in List
+ ansible.builtin.assert:
+ fail_msg: "The response from the role does not match"
+ success_msg: "The response from the role matches"
+ that:
+ - "{{ (result_diff | length) == 0 }}"
+ when: api_response | length > 0
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/systemmetrics/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/systemmetrics/converge.yml
index 418aa2b78..ea49daa8d 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/systemmetrics/converge.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/molecule/systemmetrics/converge.yml
@@ -30,49 +30,11 @@
ansible.builtin.include_role:
name: "idrac_gather_facts"
- - name: Assert power metrics dict for length
- ansible.builtin.assert:
- that:
- - "{{ power_metrics | length > 0 }}"
-
- - name: Assert thermal metrics dict for length
- ansible.builtin.assert:
- that:
- - "{{ thermal_metrics | length > 0 }}"
-
- - name: Assert memory metrics dict for length
- ansible.builtin.assert:
- that:
- - "{{ memory_metrics | length > 0 }}"
-
- - name: Get Thermal Metrics information.
- ansible.builtin.uri:
- url: "https://{{ hostname }}{{ api_chassis }}/ThermalSubsystem/ThermalMetrics"
- validate_certs: "{{ validate_certs }}"
- method: "{{ idrac_gather_facts_uri_method }}"
- user: "{{ username }}"
- password: "{{ password }}"
- headers: "{{ idrac_gather_facts_uri_headers }}"
- body_format: "{{ idrac_gather_facts_uri_body_format }}"
- status_code: "{{ idrac_gather_facts_uri_status_code }}"
- return_content: "{{ idrac_gather_facts_uri_return_content }}"
- register: response_thermal_metrics
- no_log: true
-
- - name: Set Thermal Metrics facts
- ansible.builtin.set_fact:
- api_thermal_metrics: "{{ response_thermal_metrics.json |
- ansible.utils.remove_keys(target=['@odata.context', '@odata.type', '@odata.id', 'DataSourceUri', 'TemperatureReadingsCelsius@odata.count']) }}"
-
- name: Call assertion for thermal metrics
ansible.builtin.include_tasks: ../../tests/asserts/tmetrics_assert.yml
- name: Call assertion for memory metrics
ansible.builtin.include_tasks: ../../tests/asserts/mmetrics_assert.yml
- with_items: "{{ memory_metrics }}"
- loop_control:
- loop_var: memory_data
- when: memory_metrics | length > 0
- name: Get Power Supply information.
ansible.builtin.uri:
@@ -92,10 +54,18 @@
ansible.builtin.set_fact:
psu_ids: "{{ power_result.json.Members | map(attribute='Id') | list }}"
+ - name: Assert Power Supply Metrics metrics
+ ansible.builtin.assert:
+ that:
+ - "((psu_ids | length == 0) and (power_metrics | length == 0))"
+ fail_msg: "The response from the role does not match"
+ success_msg: "The response from the role matches"
+ when: psu_ids| length == 0
+
- name: Call assertion for Power metrics
ansible.builtin.include_tasks: ../../tests/asserts/psmetrics_assert.yml
with_items: "{{ power_metrics }}"
loop_control:
loop_var: power_data
index_var: index
- when: power_metrics | length > 0
+ when: psu_ids | length > 0
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/mmetrics_assert.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/mmetrics_assert.yml
index 1cc040b73..6964f8d12 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/mmetrics_assert.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/mmetrics_assert.yml
@@ -1,6 +1,6 @@
- name: Get Memory information.
- ansible.builtin.uri:
- url: "https://{{ hostname }}{{ api_system }}/Memory/{{ memory_data.Id }}/MemoryMetrics"
+ ansible.builtin.uri: &api_params
+ url: "https://{{ hostname }}{{ api_system }}/Memory?$expand=*($levels=1)"
validate_certs: "{{ validate_certs }}"
method: "{{ idrac_gather_facts_uri_method }}"
user: "{{ username }}"
@@ -9,30 +9,50 @@
body_format: "{{ idrac_gather_facts_uri_body_format }}"
status_code: "{{ idrac_gather_facts_uri_status_code }}"
return_content: "{{ idrac_gather_facts_uri_return_content }}"
+ register: response_memory
+ no_log: true
+
+- name: Get Memory Metrics ids
+ ansible.builtin.set_fact:
+ memory_metrics_ids: "{{ response_memory.json.Members |
+ selectattr('Metrics', 'defined') | map(attribute='Metrics') | flatten }}"
+ when: response_memory.json.Members is defined
+
+- name: Get Memory Metrics information.
+ ansible.builtin.uri:
+ url: "https://{{ hostname }}{{ item['@odata.id'] }}"
+ <<: *api_params
+ loop: "{{ memory_metrics_ids }}"
register: response_memory_metrics
no_log: true
- name: Set Memory Metrics facts
ansible.builtin.set_fact:
- api_memory_metrics: "{{ response_memory_metrics.json | ansible.utils.remove_keys(target=['@odata.context', '@odata.type', '@odata.id', 'DataSourceUri']) }}"
+ api_memory_metrics: "{{ response_memory_metrics.results |
+ selectattr('json', 'defined') | map(attribute='json') |
+ flatten | ansible.utils.remove_keys(target=['@odata.context',
+ '@odata.type', '@odata.id', 'DataSourceUri']) }}"
+ when: response_memory_metrics.results is defined
-- name: Set the keys diff
- ansible.builtin.set_fact:
- diff_keys: "{{ memory_data.keys() | list | symmetric_difference((api_memory_metrics.keys() | list)) }}"
+- name: Assert memory metrics
+ ansible.builtin.assert:
+ that:
+ - "((api_memory_metrics | length == 0) and
+ (memory_metrics | length == 0))"
+ fail_msg: "The response from the role does not match"
+ success_msg: "The response from the role matches"
+ when: api_memory_metrics| length == 0
-- name: Set a diff of dict
+- name: Check whether output differs
ansible.builtin.set_fact:
- diff_data: "{{ diff_data | combine({item: memory_data[item]}) }}"
- loop: "{{ memory_data.keys() }}"
- when:
- - diff_keys | length == 0
- - memory_data[item] != api_memory_metrics[item]
- - item not in exclude_keys
+ result_diff: "{{ memory_metrics |
+ symmetric_difference(api_memory_metrics) }}"
+ when: api_memory_metrics| length > 0
-- name: Assert the difference in Keys
+- name: Assert the differences in List
ansible.builtin.assert:
+ fail_msg: "The response from the role does not match"
+ success_msg: "The response from the role matches"
that:
- - "{{ (diff_keys | length) == 0 }}"
- - "{{ (diff_data | length) == 0 }}"
- fail_msg: "The response from the role does not match | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"
- success_msg: "The response from the role matches | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"
+ - "{{ (result_diff | length) == 0 }}"
+ when: api_memory_metrics| length > 0
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/passensor_assert.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/passensor_assert.yml
deleted file mode 100644
index 6931c9204..000000000
--- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/passensor_assert.yml
+++ /dev/null
@@ -1,39 +0,0 @@
-- name: Fetching Presence and Status Sensor info
- ansible.builtin.uri:
- url: "https://{{ hostname }}{{ api_system }}/Oem/Dell/DellPresenceAndStatusSensors/{{ passensor_data.Id }}"
- validate_certs: "{{ validate_certs }}"
- ca_path: "{{ ca_path | default(omit) }}"
- method: "{{ idrac_gather_facts_uri_method }}"
- user: "{{ username }}"
- password: "{{ password }}"
- headers: "{{ idrac_gather_facts_uri_headers }}"
- body_format: "{{ idrac_gather_facts_uri_body_format }}"
- status_code: "{{ idrac_gather_facts_uri_status_code }}"
- return_content: "{{ idrac_gather_facts_uri_return_content }}"
- no_log: true
- register: passensor_result
-
-- name: Set presence and status sensor facts
- ansible.builtin.set_fact:
- api_response: "{{ passensor_result.json | ansible.utils.remove_keys(target=['@odata.context', '@odata.id', '@odata.type', 'Assembly', 'Links']) }}"
-
-- name: Set the keys diff
- ansible.builtin.set_fact:
- diff_keys: "{{ passensor_data.keys() | list | symmetric_difference((api_response.keys() | list)) }}"
-
-- name: Set a diff of dict
- ansible.builtin.set_fact:
- diff_data: "{{ diff_data | combine({item: passensor_data[item]}) }}"
- loop: "{{ passensor_data.keys() }}"
- when:
- - diff_keys | length == 0
- - passensor_data[item] != api_response[item]
- - item not in exclude_keys
-
-- name: Assert the difference in Keys
- ansible.builtin.assert:
- that:
- - "{{ (diff_keys | length) == 0 }}"
- - "{{ (diff_data | length) == 0 }}"
- fail_msg: "The response from the role does not match | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"
- success_msg: "The response from the role matches | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/powersupply_assert.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/powersupply_assert.yml
deleted file mode 100644
index ddb77ce04..000000000
--- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/powersupply_assert.yml
+++ /dev/null
@@ -1,42 +0,0 @@
-- name: Fetching Power Supply info
- ansible.builtin.uri:
- url: "https://{{ hostname }}{{ api_chassis }}/PowerSubsystem/PowerSupplies/{{ powersupply_data.Id }}"
- validate_certs: "{{ validate_certs }}"
- ca_path: "{{ ca_path | default(omit) }}"
- method: "{{ idrac_gather_facts_uri_method }}"
- user: "{{ username }}"
- password: "{{ password }}"
- headers: "{{ idrac_gather_facts_uri_headers }}"
- body_format: "{{ idrac_gather_facts_uri_body_format }}"
- status_code: "{{ idrac_gather_facts_uri_status_code }}"
- return_content: "{{ idrac_gather_facts_uri_return_content }}"
- register: powersupply_result
- no_log: true
-
-- name: Set powersupply facts
- ansible.builtin.set_fact:
- api_response:
- "{{ powersupply_result.json | ansible.utils.remove_keys(target=['@odata.context',
- '@odata.id', '@odata.type', 'ActiveInputVoltage@Redfish.Deprecated', 'OperationalStatus@odata.count',
- 'RedTypeOfSet@odata.count']) }}"
-
-- name: Set the keys diff
- ansible.builtin.set_fact:
- diff_keys: "{{ powersupply_data.keys() | list | symmetric_difference((api_response.keys() | list)) }}"
-
-- name: Set a diff of dict
- ansible.builtin.set_fact:
- diff_data: "{{ diff_data | combine({item: powersupply_data[item]}) }}"
- loop: "{{ powersupply_data.keys() }}"
- when:
- - diff_keys | length == 0
- - powersupply_data[item] != api_response[item]
- - item not in exclude_keys
-
-- name: Assert the difference in Keys
- ansible.builtin.assert:
- that:
- - "{{ (diff_keys | length) == 0 }}"
- - "{{ (diff_data | length) == 0 }}"
- fail_msg: "The response from the role does not match | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"
- success_msg: "The response from the role matches | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/tmetrics_assert.yml b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/tmetrics_assert.yml
index 25a8229cf..93f1e3960 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/tmetrics_assert.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/tmetrics_assert.yml
@@ -1,20 +1,46 @@
-- name: Set the keys diff
+---
+- name: Get Thermal Metrics information.
+ ansible.builtin.uri:
+ url:
+ "https://{{ hostname }}{{ api_chassis }}/ThermalSubsystem/ThermalMetrics"
+ validate_certs: "{{ validate_certs }}"
+ method: "{{ idrac_gather_facts_uri_method }}"
+ user: "{{ username }}"
+ password: "{{ password }}"
+ headers: "{{ idrac_gather_facts_uri_headers }}"
+ body_format: "{{ idrac_gather_facts_uri_body_format }}"
+ status_code: "{{ idrac_gather_facts_uri_status_code }}"
+ return_content: "{{ idrac_gather_facts_uri_return_content }}"
+ register: response_thermal_metrics
+ no_log: true
+
+- name: Set Thermal Metrics facts
ansible.builtin.set_fact:
- diff_keys: "{{ thermal_metrics.keys() | list | symmetric_difference((api_thermal_metrics.keys() | list)) }}"
+ api_thermal_metrics: "{{ response_thermal_metrics.json |
+ ansible.utils.remove_keys(target=['@odata.context', '@odata.type',
+ '@odata.id', 'DataSourceUri',
+ 'TemperatureReadingsCelsius@odata.count']) }}"
+ when: response_thermal_metrics is defined
+
+- name: Assert thermal metrics
+ ansible.builtin.assert:
+ that:
+ - "((api_thermal_metrics | length == 0) and
+ (thermal_metrics | length == 0))"
+ fail_msg: "The response from the role does not match"
+ success_msg: "The response from the role matches"
+ when: api_thermal_metrics| length == 0
-- name: Set a diff of dict
+- name: Check whether output differs
ansible.builtin.set_fact:
- diff_data: "{{ diff_data | combine({item: thermal_metrics[item]}) }}"
- loop: "{{ thermal_metrics.keys() }}"
- when:
- - diff_keys | length == 0
- - thermal_metrics[item] != api_thermal_metrics[item]
- - item not in exclude_keys
+ result_diff: "{{ thermal_metrics |
+ symmetric_difference(api_thermal_metrics) }}"
+ when: api_thermal_metrics | length > 0
-- name: Assert the difference in Keys
+- name: Assert the differences in List
ansible.builtin.assert:
+ fail_msg: "The response from the role does not match"
+ success_msg: "The response from the role matches"
that:
- - "{{ (diff_keys | length) == 0 }}"
- - "{{ (diff_data | length) == 0 }}"
- fail_msg: "The response from the role does not match | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"
- success_msg: "The response from the role matches | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"
+ - "{{ (result_diff | length) == 0 }}"
+ when: api_thermal_metrics | length > 0
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/default/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/default/converge.yml
index 2c16c6319..24909882f 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/default/converge.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/default/converge.yml
@@ -8,7 +8,7 @@
idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}"
idrac_user: "{{ lookup('env', 'IDRAC_USER') }}"
idrac_password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
- validate_certs: "{{ lookup('env', 'VALIDATE_CERT') }}"
+ validate_certs: false
scp_components:
- IDRAC
share_name: "/root/"
@@ -26,7 +26,7 @@
hostname: "{{ lookup('env', 'IDRAC_IP') }}"
username: "{{ lookup('env', 'IDRAC_USER') }}"
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
- validate_certs: "{{ lookup('env', 'VALIDATE_CERT') }}"
+ validate_certs: false
job_id: JID_12345678
rescue:
- name: "Verifying invalid job deletion from the job queue"
@@ -44,7 +44,7 @@
username: "{{ lookup('env', 'IDRAC_USER') }}"
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
clear_job_queue: true
- validate_certs: "{{ lookup('env', 'VALIDATE_CERT') }}"
+ validate_certs: false
rescue:
- name: "Verifying job queue clear with an invalid hostname"
@@ -63,7 +63,7 @@
username: "invalidUsername"
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
clear_job_queue: true
- validate_certs: "{{ lookup('env', 'VALIDATE_CERT') }}"
+ validate_certs: false
rescue:
- name: "Verifying job queue clear with an invalid username"
@@ -81,7 +81,7 @@
username: "{{ lookup('env', 'IDRAC_USER') }}"
password: "invalidPassword"
clear_job_queue: true
- validate_certs: "{{ lookup('env', 'VALIDATE_CERT') }}"
+ validate_certs: false
rescue:
- name: "Verifying job queue clear with an invalid password"
diff --git a/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/delete_job/converge.yml b/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/delete_job/converge.yml
index 809dda61f..4c99d6b45 100644
--- a/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/delete_job/converge.yml
+++ b/ansible_collections/dellemc/openmanage/roles/idrac_job_queue/molecule/delete_job/converge.yml
@@ -9,7 +9,7 @@
hostname: "{{ lookup('env', 'IDRAC_IP') }}"
username: "{{ lookup('env', 'IDRAC_USER') }}"
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
- validate_certs: "{{ lookup('env', 'VALIDATE_CERT') }}"
+ validate_certs: false
no_log: true
- name: Creating job which configures iDRAC attributes
@@ -39,7 +39,7 @@
idrac_ip: "{{ lookup('env', 'IDRAC_IP') }}"
idrac_user: "{{ lookup('env', 'IDRAC_USER') }}"
idrac_password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
- validate_certs: "{{ lookup('env', 'VALIDATE_CERT') }}"
+ validate_certs: false
scp_components:
- IDRAC
share_name: "/root/"
@@ -53,7 +53,7 @@
- name: Get Job ID.
ansible.builtin.uri:
url: "https://{{ lookup('env', 'IDRAC_IP') }}/redfish/v1/Managers/iDRAC.Embedded.1/Jobs"
- validate_certs: "{{ lookup('env', 'VALIDATE_CERT') }}"
+ validate_certs: false
method: "GET"
user: "{{ lookup('env', 'IDRAC_USER') }}"
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
diff --git a/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/default/converge.yml b/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/default/converge.yml
index 221fe3bbd..11e682d7b 100644
--- a/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/default/converge.yml
+++ b/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/default/converge.yml
@@ -14,9 +14,9 @@
validate_certs: false
state: present
volume_type: "NonRedundant"
- name: "VD" # noqa: var-naming[no-reserved]
- controller_id: "{{ lookup('env', 'CONTROLLER_ID') }}"
- drives: "{{ lookup('env', 'PHYSICAL_DISK') }}"
+ name: "VD" # noqa: var-naming[no-reserved]
+ controller_id: ""
+ drives: ""
capacity_bytes: 214748364800
optimum_io_size_bytes: 65536
encrypted: false
@@ -27,8 +27,9 @@
- name: Asserting after performing operation.
ansible.builtin.assert:
- that: |-
- redfish_storage_volume_out.msg == "<urlopen error [Errno -2] Name or service not known>"
+ that: >-
+ '"<urlopen error [Errno 111] Connection refused>" in
+ redfish_storage_volume_out.msg'
- name: To check the behaviour of invalid credentials.
ansible.builtin.import_role:
@@ -40,9 +41,9 @@
validate_certs: false
state: present
volume_type: "NonRedundant"
- name: "VD" # noqa: var-naming[no-reserved]
- controller_id: "{{ lookup('env', 'CONTROLLER_ID') }}"
- drives: "{{ lookup('env', 'PHYSICAL_DISK') }}"
+ name: "VD" # noqa: var-naming[no-reserved]
+ controller_id: ""
+ drives: ""
capacity_bytes: 214748364800
optimum_io_size_bytes: 65536
encrypted: false
@@ -55,7 +56,7 @@
that: |-
redfish_storage_volume_out.msg == "HTTP Error 401: Unauthorized"
- - name: To check the behaviour of invalid span count.
+ - name: To check the behaviour of invalid state.
ansible.builtin.import_role:
name: redfish_storage_volume
vars:
@@ -63,11 +64,11 @@
username: "{{ lookup('env', 'IDRAC_USER') }}"
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
validate_certs: false
- state: present
+ state: invalid
volume_type: "SpannedStripesWithParity"
- name: "VD" # noqa: var-naming[no-reserved]
- controller_id: "{{ lookup('env', 'CONTROLLER_ID') }}"
- drives: "{{ lookup('env', 'PHYSICAL_DISK') }}"
+ name: "VD" # noqa: var-naming[no-reserved]
+ controller_id: ""
+ drives: ""
capacity_bytes: 214748364800
optimum_io_size_bytes: 65536
encrypted: false
@@ -77,8 +78,9 @@
- name: Asserting after performing operation for invalid span count.
ansible.builtin.assert:
- that: |-
- redfish_storage_volume_out.msg == "HTTP Error 400: Bad Request"
+ that: >-
+ redfish_storage_volume_out.msg == "value of state must be one of:
+ present, absent, got: invalid"
when: not ansible_check_mode
- name: To check the behaviour of invalid certificate path.
@@ -92,9 +94,9 @@
ca_path: "/tmp/invalid_ca_path.pem"
state: present
volume_type: "SpannedStripesWithParity"
- name: "VD" # noqa: var-naming[no-reserved]
- controller_id: "{{ lookup('env', 'CONTROLLER_ID') }}"
- drives: "{{ lookup('env', 'PHYSICAL_DISK') }}"
+ name: "VD" # noqa: var-naming[no-reserved]
+ controller_id: ""
+ drives: ""
capacity_bytes: 214748364800
optimum_io_size_bytes: 65536
encrypted: false
@@ -105,10 +107,38 @@
- name: Asserting after performing operation for invalid certificate path.
ansible.builtin.assert:
- that: |-
- "certificate verify failed" in redfish_storage_volume_out.msg
+ that: >-
+ "[Errno 2] No such file or directory" in
+ redfish_storage_volume_out.msg
+
+ - name: To check the behaviour of invalid raid type.
+ ansible.builtin.import_role:
+ name: redfish_storage_volume
+ vars:
+ hostname: "{{ lookup('env', 'IDRAC_IP') }}"
+ username: "{{ lookup('env', 'IDRAC_USER') }}"
+ password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
+ validate_certs: false
+ state: present
+ raid_type: "Invalid"
+ name: "VD" # noqa: var-naming[no-reserved]
+ controller_id: ""
+ drives: ""
+ capacity_bytes: 214748364800
+ optimum_io_size_bytes: 65536
+ encrypted: false
+ job_wait: false
+ ignore_errors: true
+ register: redfish_storage_volume_result
- - name: To check the behaviour of invalid volume type.
+ - name: Asserting after performing operation for invalid raid type.
+ ansible.builtin.assert:
+ that: >-
+ "value of raid_type must be one of: RAID0, RAID1, RAID5, RAID6,
+ RAID10, RAID50, RAID60, got: Invalid" in
+ redfish_storage_volume_out.msg
+
+ - name: To check the behaviour of invalid controller_id.
ansible.builtin.import_role:
name: redfish_storage_volume
vars:
@@ -117,19 +147,20 @@
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
validate_certs: false
state: present
- volume_type: "InvalidMirrored"
- name: "VD" # noqa: var-naming[no-reserved]
- controller_id: "{{ lookup('env', 'CONTROLLER_ID') }}"
- drives: "{{ lookup('env', 'PHYSICAL_DISK') }}"
+ raid_type: "RAID0"
+ name: "VD" # noqa: var-naming[no-reserved]
+ controller_id: "invalid"
capacity_bytes: 214748364800
optimum_io_size_bytes: 65536
encrypted: false
job_wait: false
ignore_errors: true
+ ignore_unreachable: true
register: redfish_storage_volume_result
- - name: Asserting after performing operation for invalid volume type.
+ - name: Asserting after performing operation for invalid controller_id.
ansible.builtin.assert:
- that: >
- redfish_storage_volume_out.msg == "value of volume_type must be one of: NonRedundant, Mirrored,
- StripedWithParity, SpannedMirrors, SpannedStripesWithParity, got: InvalidMirrored"
+ that: >-
+ "Specified Controller invalid does not exist in the System." in
+ redfish_storage_volume_out.msg
+ when: redfish_storage_volume_out.failed
diff --git a/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/default/molecule.yml b/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/default/molecule.yml
index e69de29bb..6fe7d44bb 100644
--- a/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/default/molecule.yml
+++ b/ansible_collections/dellemc/openmanage/roles/redfish_storage_volume/molecule/default/molecule.yml
@@ -0,0 +1,10 @@
+---
+scenario:
+ test_sequence:
+ - dependency
+ - destroy
+ - syntax
+ - create
+ - converge
+ - cleanup
+ - destroy