Repository: ansible-collections/community.general

Issue:
[redfish_info / redfish_utils] Retrieve Id property for NIC devices 
Hello

##### SUMMARY
When we use :
```
  community.general.redfish_info:
    category: Systems
    command: GetNicInventory
```
Data returned contains description of NIC but no ID.
ID is available for command GetDiskInventory for example and i think, should be present for every devices returned by GetXXXInventory commands.

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
redfish_utils

##### ANSIBLE VERSION
```ansible 2.10.1
  config file = /home/pyfontan/.ansible.cfg
  configured module search path = ['/home/pyfontan/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/pyfontan/virtualenv/ansible/lib/python3.8/site-packages/ansible
  executable location = /home/pyfontan/virtualenv/ansible/bin/ansible
  python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]
```

##### STEPS TO REPRODUCE
Just a look at data returned from:
```
  community.general.redfish_info:
    category: Systems
    command: GetNicInventory
```

##### EXPECTED RESULTS
Expected result is to have an 'Id' property to refer for later use.
For example, on a DELL Server, i would like to call a playbook with a device description like "Embedded NIC 1 Port 1 Partition 1" and be able to work on device which is really called "NIC.Embedded.1-1-1". This is not possible without the ID.

I made a simple modification here:
https://github.com/pyfontan/community.general/commit/cba77b709a9a5a3f7994c5dc83daed652b533e99

Thank you.


Discussion:
Files identified in the description:
* [`plugins/module_utils/redfish_utils.py`](https://github.com/ansible-collections/community.general/blob/master/plugins/module_utils/redfish_utils.py)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @billdodd @mraineri @tomasg2012
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
> I made a simple modification here:
> [pyfontan@cba77b7](https://github.com/pyfontan/community.general/commit/cba77b709a9a5a3f7994c5dc83daed652b533e99)

Thanks for reporting this! That change looks fine. Please feel free to submit it as a Pull Request.



Resolving patch:
diff --git a/plugins/module_utils/redfish_utils.py b/plugins/module_utils/redfish_utils.py
--- a/plugins/module_utils/redfish_utils.py
+++ b/plugins/module_utils/redfish_utils.py
@@ -469,7 +469,7 @@ def get_storage_controller_inventory(self, systems_uri):
         controller_results = []
         # Get these entries, but does not fail if not found
         properties = ['CacheSummary', 'FirmwareVersion', 'Identifiers',
-                      'Location', 'Manufacturer', 'Model', 'Name',
+                      'Location', 'Manufacturer', 'Model', 'Name', 'Id',
                       'PartNumber', 'SerialNumber', 'SpeedGbps', 'Status']
         key = "StorageControllers"
 
@@ -1700,7 +1700,7 @@ def get_chassis_inventory(self):
         chassis_results = []
 
         # Get these entries, but does not fail if not found
-        properties = ['ChassisType', 'PartNumber', 'AssetTag',
+        properties = ['Name', 'Id', 'ChassisType', 'PartNumber', 'AssetTag',
                       'Manufacturer', 'IndicatorLED', 'SerialNumber', 'Model']
 
         # Go through list
@@ -1724,7 +1724,7 @@ def get_fan_inventory(self):
         fan_results = []
         key = "Thermal"
         # Get these entries, but does not fail if not found
-        properties = ['FanName', 'Reading', 'ReadingUnits', 'Status']
+        properties = ['Name', 'FanName', 'Reading', 'ReadingUnits', 'Status']
 
         # Go through list
         for chassis_uri in self.chassis_uris:
@@ -1836,8 +1836,8 @@ def get_cpu_inventory(self, systems_uri):
         cpu_results = []
         key = "Processors"
         # Get these entries, but does not fail if not found
-        properties = ['Id', 'Manufacturer', 'Model', 'MaxSpeedMHz', 'TotalCores',
-                      'TotalThreads', 'Status']
+        properties = ['Id', 'Name', 'Manufacturer', 'Model', 'MaxSpeedMHz',
+                      'TotalCores', 'TotalThreads', 'Status']
 
         # Search for 'key' entry and extract URI from it
         response = self.get_request(self.root_uri + systems_uri)
@@ -1886,7 +1886,7 @@ def get_memory_inventory(self, systems_uri):
         memory_results = []
         key = "Memory"
         # Get these entries, but does not fail if not found
-        properties = ['SerialNumber', 'MemoryDeviceType', 'PartNumber',
+        properties = ['Id', 'SerialNumber', 'MemoryDeviceType', 'PartNumber',
                       'MemoryLocation', 'RankCount', 'CapacityMiB', 'OperatingMemoryModes', 'Status', 'Manufacturer', 'Name']
 
         # Search for 'key' entry and extract URI from it
@@ -1943,7 +1943,7 @@ def get_nic_inventory(self, resource_uri):
         nic_results = []
         key = "EthernetInterfaces"
         # Get these entries, but does not fail if not found
-        properties = ['Description', 'FQDN', 'IPv4Addresses', 'IPv6Addresses',
+        properties = ['Name', 'Id', 'Description', 'FQDN', 'IPv4Addresses', 'IPv6Addresses',
                       'NameServers', 'MACAddress', 'PermanentMACAddress',
                       'SpeedMbps', 'MTUSize', 'AutoNeg', 'Status']
 
@@ -2368,7 +2368,7 @@ def get_system_inventory(self, systems_uri):
         properties = ['Status', 'HostName', 'PowerState', 'Model', 'Manufacturer',
                       'PartNumber', 'SystemType', 'AssetTag', 'ServiceTag',
                       'SerialNumber', 'SKU', 'BiosVersion', 'MemorySummary',
-                      'ProcessorSummary', 'TrustedModules']
+                      'ProcessorSummary', 'TrustedModules', 'Name', 'Id']
 
         response = self.get_request(self.root_uri + systems_uri)
         if response['ret'] is False:


Test patch: