dell / iDRAC-Redfish-Scripting

Python and PowerShell scripting for Dell EMC PowerEdge iDRAC REST API with DMTF Redfish
GNU General Public License v2.0
598 stars 276 forks source link

Missing Attributes in iDRAC 8 #256

Closed nsbender closed 1 year ago

nsbender commented 1 year ago

Hi Tex, Im attempting to use

https://IP/redfish/v1/Managers/%s/Attributes

to get some info from a mix of iDRAC 8 and 9 machines, but the APIs appear to be quite different between those two versions. In the python versions of your code, there doesn't appear to be a way to get attributes such as VirtualConsole.1.PluginType from iDRAC.Embedded.1 or ServerPwr.1.PSRedPolicy from System.Embedded.1 in iDRAC 8. Is this yet-to-be added functionality in the modules or does the API for iDRAC 8 just not contain those attributes at any route?

texroemer commented 1 year ago

Hi @nsbender

Dell OEM attribute URIs are not supported on iDRAC 7/8, only iDRAC9. If you run GET on URI "redfish/v1/Managers/iDRAC.Embedded.1" you will not see Oem/Dell/DellAttributes.

To get and set these attributes on iDRAC 7/8 you'll need to leverage iDRAC Server Configuration Profile (SCP) feature.

See example below where i will export all iDRAC and System attributes, modify a few attributes in the SCP file and then import to apply the changes.

C:\Python310>python ExportSystemConfigurationLocalREDFISH.py -ip 192.168.0.120 -u root -p calvin --target IDRAC,System

- Job ID "JID_826158706786" successfully created for ExportSystemConfiguration method

- INFO, "Exporting Server Configuration Profile.", percent complete: 10
- INFO, "Exporting Server Configuration Profile.", percent complete: 10
- INFO, "Exporting Server Configuration Profile.", percent complete: 10
- INFO, "Exporting Server Configuration Profile.", percent complete: 10
- INFO, "Exporting Server Configuration Profile.", percent complete: 10
- INFO, "Exporting Server Configuration Profile.", percent complete: 10
- INFO, "Exporting Server Configuration Profile.", percent complete: 10
- INFO, "Exporting Server Configuration Profile.", percent complete: 10
- INFO, "Exporting Server Configuration Profile.", percent complete: 10

- Export locally job ID JID_826158706786 successfully completed.
- PASS, final detailed job status results for job ID JID_826158706786 -

('@odata.context', '/redfish/v1/$metadata#DellJob.DellJob')
('@odata.id', '/redfish/v1/Managers/iDRAC.Embedded.1/Jobs/JID_826158706786')
('@odata.type', '#DellJob.v1_0_1.DellJob')
('CompletionTime', '2023-04-27T12:18:36')
('Description', 'Job Instance')
('EndTime', None)
('Id', 'JID_826158706786')
('JobState', 'Completed')
('JobType', 'ExportConfiguration')
('Message', 'Successfully exported Server Configuration Profile')
('MessageArgs', [])
('MessageId', 'SYS043')
('Name', 'Export Configuration')
('PercentComplete', 100)
('StartTime', 'TIME_NOW')
('TargetSettingsURI', None)

- Exported attributes also saved in file: 2023-4-27_12943_export.xml

C:\Python310>python ImportSystemConfigurationLocalFilenameREDFISH.py -ip 192.168.0.120 -u root -p calvin --target IDRAC,System --filename 2023-4-27_12943_export.xml

- PASS, JID_826165719276 successfully created for ImportSystemConfiguration method

- INFO, "Analyzing iDRAC, System or Lifecycle Controller configuration for changes to be applied.", percent complete: 10
- PASS, job ID JID_826165719276 successfully marked completed

- Detailed configuration changes and job results for "JID_826165719276"

{'Oem': {'Dell': {'@odata.type': '#DellManager.v1_0_0.ServerConfigurationProfileResults',
                  'DisplayValue': 'Power Supply Redundancy Policy',
                  'ErrCode': '0',
                  'Name': 'ServerPwr.1#PSRedPolicy',
                  'NewValue': 'Input Power Redundant',
                  'OldValue': 'Not Redundant'}},
 'Severity': 'OK'}
{'Oem': {'Dell': {'@odata.type': '#DellManager.v1_0_0.ServerConfigurationProfileResults',
                  'DisplayValue': 'Plugin Type',
                  'ErrCode': '0',
                  'Name': 'VirtualConsole.1#PluginType',
                  'NewValue': 'HTML5',
                  'OldValue': 'Java'}},
 'Severity': 'OK'}
{'Message': 'Successfully imported and applied Server Configuration Profile.',
 'MessageArgs': [],
 'MessageArgs@odata.count': 0,
 'MessageId': 'SYS053'}

- JID_826165719276 completed in: 0:00:16

Thanks Tex

nsbender commented 1 year ago

Excellent thanks for taking the time to reply, this is very helpful!

nsbender commented 1 year ago

I did run into this when running the above script. Any insight on whether this is an iDRAC version issue? The host in question is on 2.83.83.83

PS C:\Users\user\Downloads\iDRAC-Redfish-Scripting-master\Redfish Python> Python .\ExportSystemConfigurationLocalREDFISH.py -ip <IP> -u USERID -p mypass --target IDRAC,SYSTEM
- FAIL, POST command failed to export system configuration, status code 400 returned
- Error details: {'_content': b'{\n  "error": {\n    "code": "Base.1.0.GeneralError",\n    "message": "A general error has occurred. See ExtendedInfo for more information.",\n    "@Message.ExtendedInfo": [\n      {\n        "@odata.type" : "#Message.v1_0_0.Message",\n        "MessageId": "Base.1.0.InternalError",\n        "Message": "failed, No sufficient Privileges for user to perform requested operation."\n    }\n    ]\n  }\n}\n', '_content_consumed': True, '_next': None, 'status_code': 400, 'headers': {'Strict-Transport-Security': 'max-age=63072000', 'OData-Version': '4.0', 'Vary': 'Accept-Encoding', 'Keep-Alive': 'timeout=60, max=199', 'X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'application/json;odata.metadata=minimal;charset=utf-8', 'Server': 'iDRAC/8', 'Date': 'Thu, 27 Apr 2023 19:20:09 GMT', 'Cache-Control': 'no-cache', 'Content-Length': '389', 'Connection': 'Keep-Alive', 'Access-Control-Allow-Origin': '*', 'Accept-Ranges': 'bytes'}, 'raw': <urllib3.response.HTTPResponse object at 0x000001A0C19DB670>, 'url': 'https://<IP>/redfish/v1/Managers/iDRAC.Embedded.1/Actions/Oem/EID_674_Manager.ExportSystemConfiguration', 'encoding': 'utf-8', 'history': [], 'reason': 'Bad Request', 'cookies': <RequestsCookieJar[]>, 'elapsed': datetime.timedelta(microseconds=925460), 'request': <PreparedRequest [POST]>, 'connection': <requests.adapters.HTTPAdapter object at 0x000001A0BF93BC10>}
PS C:\Users\user\Downloads\iDRAC-Redfish-Scripting-master\Redfish Python> Python .\ExportSystemConfigurationLocalREDFISH.py -ip <IP> -u USERID -p mypass --target IDRAC
- FAIL, POST command failed to export system configuration, status code 400 returned
- Error details: {'_content': b'{\n  "error": {\n    "code": "Base.1.0.GeneralError",\n    "message": "A general error has occurred. See ExtendedInfo for more information.",\n    "@Message.ExtendedInfo": [\n      {\n        "@odata.type" : "#Message.v1_0_0.Message",\n        "MessageId": "Base.1.0.InternalError",\n        "Message": "failed, No sufficient Privileges for user to perform requested operation."\n    }\n    ]\n  }\n}\n', '_content_consumed': True, '_next': None, 'status_code': 400, 'headers': {'Strict-Transport-Security': 'max-age=63072000', 'OData-Version': '4.0', 'Vary': 'Accept-Encoding', 'Keep-Alive': 'timeout=60, max=199', 'X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'application/json;odata.metadata=minimal;charset=utf-8', 'Server': 'iDRAC/8', 'Date': 'Thu, 27 Apr 2023 19:20:52 GMT', 'Cache-Control': 'no-cache', 'Content-Length': '389', 'Connection': 'Keep-Alive', 'Access-Control-Allow-Origin': '*', 'Accept-Ranges': 'bytes'}, 'raw': <urllib3.response.HTTPResponse object at 0x0000023CE60BB670>, 'url': 'https://<IP>/redfish/v1/Managers/iDRAC.Embedded.1/Actions/Oem/EID_674_Manager.ExportSystemConfiguration', 'encoding': 'utf-8', 'history': [], 'reason': 'Bad Request', 'cookies': <RequestsCookieJar[]>, 'elapsed': datetime.timedelta(microseconds=904332), 'request': <PreparedRequest [POST]>, 'connection': <requests.adapters.HTTPAdapter object at 0x0000023CE60D3FD0>}
PS C:\Users\user\Downloads\iDRAC-Redfish-Scripting-master\Redfish Python> Python .\ExportSystemConfigurationLocalREDFISH.py -ip <IP> -u USERID -p mypass --target System
- FAIL, POST command failed to export system configuration, status code 400 returned
- Error details: {'_content': b'{\n  "error": {\n    "code": "Base.1.0.GeneralError",\n    "message": "A general error has occurred. See ExtendedInfo for more information.",\n    "@Message.ExtendedInfo": [\n      {\n        "@odata.type" : "#Message.v1_0_0.Message",\n        "MessageId": "Base.1.0.InternalError",\n        "Message": "failed, No sufficient Privileges for user to perform requested operation."\n    }\n    ]\n  }\n}\n', '_content_consumed': True, '_next': None, 'status_code': 400, 'headers': {'Strict-Transport-Security': 'max-age=63072000', 'OData-Version': '4.0', 'Vary': 'Accept-Encoding', 'Keep-Alive': 'timeout=60, max=199', 'X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'application/json;odata.metadata=minimal;charset=utf-8', 'Server': 'iDRAC/8', 'Date': 'Thu, 27 Apr 2023 19:20:58 GMT', 'Cache-Control': 'no-cache', 'Content-Length': '389', 'Connection': 'Keep-Alive', 'Access-Control-Allow-Origin': '*', 'Accept-Ranges': 'bytes'}, 'raw': <urllib3.response.HTTPResponse object at 0x00000282145EB670>, 'url': 'https://<IP>/redfish/v1/Managers/iDRAC.Embedded.1/Actions/Oem/EID_674_Manager.ExportSystemConfiguration', 'encoding': 'utf-8', 'history': [], 'reason': 'Bad Request', 'cookies': <RequestsCookieJar[]>, 'elapsed': datetime.timedelta(microseconds=856135), 'request': <PreparedRequest [POST]>, 'connection': <requests.adapters.HTTPAdapter object at 0x00000282124EBC10>}
texroemer commented 1 year ago

The user you're using does not have admin privileges and you must have admin rights to use SCP feature. This information is also stated in the iDRAC user guide (see image below).

image

Thanks Tex

nsbender commented 1 year ago

Yep, youre right! I should have noticed that from the 400 response. It's working now with another account just fine. Thanks again Tex!