Add GetMemoryInventory command to Systems category in redfish facts module (#54125)

* Add GetMemoryInventory command to CATEGORY_COMMANDS_ALL['Systems']

* Add elif command == GetMemoryInventory to Systems category, to use forthcoming get_memory_inventory() function from redfish_utils

* Add get_memory_inventory() function to redfish_utils.py, which does not include any Absent dimms

* Remove trailing whitespace

* Add get_multi_memory_inventory() function to aggregate get_memory_inventory

* Call new function get_multi_memory_inventory()

* Add memory example in docstring

* Fix comment referring to CPUs instead of DIMMs
This commit is contained in:
Xander Madsen 2019-04-04 02:56:23 -04:00 committed by John R Barker
commit 840ceb2777
2 changed files with 72 additions and 4 deletions

View file

@ -74,6 +74,14 @@ EXAMPLES = '''
- debug:
msg: "{{ redfish_facts.cpu.entries.0.Model }}"
- name: Get memory inventory
redfish_facts:
category: Systems
command: GetMemoryInventory
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
- name: Get fan inventory with a timeout of 20 seconds
redfish_facts:
category: Chassis
@ -150,9 +158,10 @@ from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.redfish_utils import RedfishUtils
CATEGORY_COMMANDS_ALL = {
"Systems": ["GetSystemInventory", "GetCpuInventory",
"GetNicInventory", "GetStorageControllerInventory",
"GetDiskInventory", "GetBiosAttributes", "GetBootOrder"],
"Systems": ["GetSystemInventory", "GetPsuInventory", "GetCpuInventory",
"GetMemoryInventory", "GetNicInventory",
"GetStorageControllerInventory", "GetDiskInventory",
"GetBiosAttributes", "GetBootOrder"],
"Chassis": ["GetFanInventory", "GetPsuInventory"],
"Accounts": ["ListUsers"],
"Update": ["GetFirmwareInventory"],
@ -238,6 +247,8 @@ def main():
result["system"] = rf_utils.get_multi_system_inventory()
elif command == "GetCpuInventory":
result["cpu"] = rf_utils.get_multi_cpu_inventory()
elif command == "GetMemoryInventory":
result["memory"] = rf_utils.get_multi_memory_inventory()
elif command == "GetNicInventory":
result["nic"] = rf_utils.get_multi_nic_inventory(category)
elif command == "GetStorageControllerInventory":