Skip to content

Commit

Permalink
[integration][omevv_firmware]: Minor updates in automation (#789)
Browse files Browse the repository at this point in the history
* Minor fixes

* fixed sonar issues

* Update build_report.yml

---------

Co-authored-by: Shivam Sharma <[email protected]>
Co-authored-by: Sachin Apagundi <[email protected]>
  • Loading branch information
3 people authored Dec 26, 2024
1 parent ab44e36 commit 43ced09
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
testing-type: units
coverage: 'always'
ansible-core-version: 'stable-2.17'
ansible-core-version: 'stable-2.18'
target-python-version: '3.11'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
- name: Fetch pre-requisite details
ansible.builtin.include_tasks: ../_helper.yml

- name: Negative - Update the firmware by passing both svctag and host at once.
- name: Negative - Update the firmware by passing both svctag
and host at once.
dellemc.openmanage.omevv_firmware:
hostname: "{{ hostname }}"
vcenter_uuid: "{{ uuid }}"
Expand All @@ -25,11 +26,13 @@
targets:
- servicetag: "svctag"
host: "host_ip"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_firmware_update
ignore_errors: true

- name: Verify task status - Negative - Update the firmware by passing both svctag and host at once.
- name: Verify task status - Negative - Update the firmware
by passing both svctag and host at once.
ansible.builtin.assert:
that:
- invalid_firmware_update.failed
Expand All @@ -46,23 +49,28 @@
run_now: true
targets:
- cluster: "Invalid_cluster"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_cluster_result
ignore_errors: true

- name: Verify task status - Negative - Update the firmware by passing invalid cluster.
- name: Verify task status - Negative - Update the firmware
by passing invalid cluster.
ansible.builtin.assert:
that:
- invalid_cluster_result.skipped
- not invalid_cluster_result.changed
- 'invalid_cluster_result.msg == "Provided cluster name ''Invalid_cluster'' is not valid."'
- 'invalid_cluster_result.msg ==
"Provided cluster name ''Invalid_cluster'' is not valid."'

- name: Create the expected error message for partial cluster_name
- name: Create the expected error message for
partial cluster_name
set_fact:
expected_msg_for_partial_cluster_name:
"Provided cluster name '{{ cluster_name[:5] }}' is not valid."

- name: Negative - Update the firmware by passing passing partial cluster_name.
- name: Negative - Update the firmware by passing
passing partial cluster_name.
dellemc.openmanage.omevv_firmware:
hostname: "{{ hostname }}"
vcenter_uuid: "{{ uuid }}"
Expand All @@ -71,11 +79,13 @@
run_now: true
targets:
- cluster: "{{ cluster_name[:5] }}"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: partial_cluster_result
ignore_errors: true

- name: Verify task status - Negative - Update the firmware by passing passing partial cluster_name.
- name: Verify task status - Negative - Update the firmware
by passing partial cluster_name.
ansible.builtin.assert:
that:
- partial_cluster_result.skipped
Expand All @@ -91,16 +101,19 @@
run_now: true
targets:
- host: "Invalid_host"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_cluster_result
ignore_errors: true

- name: Verify task status - Negative - Update the firmware by passing invalid host.
- name: Verify task status - Negative - Update the firmware
by passing invalid host.
ansible.builtin.assert:
that:
- invalid_cluster_result.skipped
- not invalid_cluster_result.changed
- 'invalid_cluster_result.msg == "Host ''Invalid_host'' not found under managed hosts."'
- 'invalid_cluster_result.msg ==
"Host ''Invalid_host'' not found under managed hosts."'

- name: Set partial host
set_fact:
Expand All @@ -120,11 +133,13 @@
run_now: true
targets:
- host: "{{ partial_host }}"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_cluster_result
ignore_errors: true

- name: Verify task status - Negative - Update the firmware by passing partial host.
- name: Verify task status - Negative - Update the
firmware by passing partial host.
ansible.builtin.assert:
that:
- invalid_cluster_result.skipped
Expand All @@ -140,16 +155,19 @@
run_now: true
targets:
- servicetag: "Invalidservicetag"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_cluster_result
ignore_errors: true

- name: Verify task status - Negative - Update the firmware by passing non-existent service tag in the cluster.
- name: Verify task status - Negative - Update the firmware by
passing non-existent service tag in the cluster.
ansible.builtin.assert:
that:
- invalid_cluster_result.skipped
- not invalid_cluster_result.changed
- 'invalid_cluster_result.msg == "Host ''Invalidservicetag'' not found under managed hosts."'
- 'invalid_cluster_result.msg ==
"Host ''Invalidservicetag'' not found under managed hosts."'

- name: Set partial host
set_fact:
Expand All @@ -169,18 +187,22 @@
run_now: true
targets:
- servicetag: "{{ partial_servicetag }}"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_cluster_result
ignore_errors: true

- name: Verify task status - Negative - Update the firmware by passing partial servicetag.
- name: Verify task status - Negative - Update the
firmware by passing partial servicetag.
ansible.builtin.assert:
that:
- invalid_cluster_result.skipped
- not invalid_cluster_result.changed
- 'invalid_cluster_result.msg == expected_msg_for_partial_servicetag'
- 'invalid_cluster_result.msg ==
expected_msg_for_partial_servicetag'

- name: Negative - Update the firmware by passing invalid date time.
- name: Negative - Update the firmware by
passing invalid date time.
dellemc.openmanage.omevv_firmware:
hostname: "{{ hostname }}"
vcenter_uuid: "{{ uuid }}"
Expand All @@ -190,11 +212,13 @@
date_time: "invalid_date"
targets:
- cluster: "{{ cluster_name }}"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_cluster_result
ignore_errors: true

- name: Verify task status - Negative - Update the firmware by passing invalid date time.
- name: Verify task status - Negative - Update the
firmware by passing invalid date time.
ansible.builtin.assert:
that:
- invalid_cluster_result.failed
Expand All @@ -208,7 +232,8 @@
run_now: true
targets:
- host: "{{ host_ip_list[0] }}"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_job_wait_timeout_type
ignore_errors: true

Expand All @@ -227,7 +252,8 @@
run_now: true
targets:
- host: "{{ host_ip_list[0] }}"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_job_wait_timeout_value
ignore_errors: true

Expand All @@ -236,7 +262,8 @@
that:
- invalid_job_wait_timeout_value.failed
- not invalid_job_wait_timeout_value.changed
- 'invalid_job_wait_timeout_value.msg == "The value for the ''job_wait_timeout''
- 'invalid_job_wait_timeout_value.msg ==
"The value for the ''job_wait_timeout''
parameter cannot be negative or zero."'

module_defaults:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
run_now: true
targets:
- host: "{{ host_ip_list[0] }}"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_unsupported_argument
ignore_errors: true

Expand All @@ -32,23 +33,27 @@
that:
- invalid_unsupported_argument.failed
- not invalid_unsupported_argument.changed
- 'invalid_unsupported_argument.msg == "Unsupported parameters for
(dellemc.openmanage.omevv_firmware) module: unsupported_argument.
Supported parameters include: ca_path, check_vSAN_health, date_time,
- 'invalid_unsupported_argument.msg ==
"Unsupported parameters for
(dellemc.openmanage.omevv_firmware) module:
unsupported_argument. Supported parameters include:
ca_path, check_vSAN_health, date_time,
delete_job_queue, drs_check, enter_maintenance_mode_options,
enter_maintenance_mode_timeout, evacuate_VMs, exit_maintenance_mode,
hostname, job_description, job_name, job_wait, job_wait_timeout,
maintenance_mode_count_check, port, reboot_options, reset_idrac,
run_now, targets, timeout, validate_certs, vcenter_password,
vcenter_username, vcenter_uuid."'
enter_maintenance_mode_timeout, evacuate_VMs,
exit_maintenance_mode, hostname, job_description,
job_name, job_wait, job_wait_timeout,
maintenance_mode_count_check, port, reboot_options,
reset_idrac, run_now, targets, timeout, validate_certs,
vcenter_password, vcenter_username, vcenter_uuid."'

- name: Negative - unreachable host
dellemc.openmanage.omevv_firmware:
hostname: 999.999.999.999
run_now: true
targets:
- host: "{{ host_ip_list[0] }}"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_unreachable
ignore_unreachable: true

Expand All @@ -69,7 +74,8 @@
run_now: true
targets:
- host: "{{ host_ip_list[0] }}"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_port
ignore_errors: true

Expand All @@ -87,7 +93,8 @@
run_now: true
targets:
- host: "{{ host_ip_list[0] }}"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_username
ignore_errors: true

Expand All @@ -107,7 +114,8 @@
run_now: true
targets:
- host: "{{ host_ip_list[0] }}"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_password
ignore_errors: true

Expand All @@ -127,7 +135,8 @@
run_now: true
targets:
- host: "{{ host_ip_list[0] }}"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_validate_certs
ignore_errors: true

Expand All @@ -149,7 +158,8 @@
run_now: true
targets:
- host: "{{ host_ip_list[0] }}"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_ca_path
ignore_errors: true

Expand All @@ -166,7 +176,8 @@
run_now: true
targets:
- host: "{{ host_ip_list[0] }}"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_timeout_type
ignore_errors: true

Expand All @@ -185,7 +196,8 @@
run_now: true
targets:
- host: "{{ host_ip_list[0] }}"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_timeout_value
ignore_errors: true

Expand All @@ -203,7 +215,8 @@
run_now: true
targets:
- host: "{{ host_ip_list[0] }}"
firmware_components: "DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
firmware_components:
"DCIM:INSTALLED#802__Diagnostics.Embedded.1:LC.Embedded.1"
register: invalid_uuid
ignore_errors: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
SHARE_PATH = "https://downloads.dell.com//catalog/catalog.xml.gz"
PROFILE_NAME = "Dell Default Catalog"
DESCRIPTION = "Latest Firmware From Dell"
VSAN = "vSAN Catalog"


class TestFirmwareRepositoryProfile(FakeAnsibleModule):
Expand Down Expand Up @@ -699,7 +700,6 @@ def test_output_modify_response(self, mocker, omevv_default_args, omevv_connecti
"description": DESCRIPTION,
"status": "Failed"
}
diff = {'profileName': 'Dell Default'}
mocker.patch(MODULE_UTILS_PATH +
GET_PROFILE_BY_ID, return_value=obj)
mocker.patch(MODULE_UTILS_PATH +
Expand Down Expand Up @@ -776,7 +776,7 @@ def test_check_mode_support(self, mocker, omevv_default_args, omevv_connection_f
"value": [
{
"Id": 10022,
"Name": "vSAN Catalog",
"Name": VSAN,
"Description": "null",
"DateModified": "2024-12-10 15:14:45.061",
"Owner": "admin",
Expand All @@ -799,7 +799,7 @@ def test_check_mode_support(self, mocker, omevv_default_args, omevv_connection_f
{
"id": 1086,
"owner": "UMP",
"profileName": "vSAN Catalog",
"profileName": VSAN,
"profileType": "Firmware",
"protocolType": "Not Applicable",
"sharePath": "//shared/dell/omc/cifs/idrac/RepositoryStore",
Expand Down Expand Up @@ -841,7 +841,7 @@ def test_remove_keys(self, mocker, omevv_default_args, omevv_connection_firmware
"BaselineDescription": "null",
"BaselineVersion": "null",
"RefreshedVersion": "null",
"Name": "vSAN Catalog",
"Name": VSAN,
"Version": 1.00
}
]
Expand Down

0 comments on commit 43ced09

Please sign in to comment.