Giter Club home page Giter Club logo

idrac-redfish-scripting's Introduction

iDRAC-Redfish-Scripting

Python and PowerShell scripting for Dell EMC PowerEdge iDRAC REST API with DMTF Redfish.

Sample scripts written in Python and PowerShell that illustrate using the integrated Dell Remote Access Controller (iDRAC) REST API with Redfish to manage Dell EMC PowerEdge servers.

Powershell cmdlets can also be installed from Powershell gallery using Install-Module. Recommended to install IdracRedfishSupport module which will import all iDRAC cmdlets.

For Python, you can leverage either individual python scripts or install iDRAC Python Redfish module. This module is an interactive session with an iDRAC which allows you to perform multiple workflows like firwmare updates or configuration changes to BIOS, NIC or Storage. You can install this module by running "pip3 install IdracRedfishSupport".

NOTE: When installing IdracRedfishSupport module using pip3, this will also install all standalone python scripts from the GitHub Python directory.

When executing any script or cmdlet, if your username or password has special characters or passing in domain name along with username, make sure to surround the argument value with double quotes.

Examples:

"testdomain.i\aduser", "testdomain.i/aduser", "[email protected]"

Redfish Overview

There are various Out-of-Band (OOB) systems management standards available in the industry today. However, there is no single standard that can be easily used within emerging programming standards, can be readily implemented within embedded systems, and can meet the demands of today’s evolving IT solution models. New IT solutions models have placed new demands on systems management solutions to support expanded scale, higher security, and multi-vendor openness, while also aligning with modern DevOps tools and processes. Recognizing these needs, Dell EMC and other IT solutions leaders within the Distributed Management Task Force (DMTF) undertook the creation of a new management interface standard. After a multi-year effort, the new standard, Redfish v1.0, was announced in July, 2015.

Redfish’s key benefits include:

  • Increased simplicity and usability
  • Encrypted connections and generally heightened security
  • A programmatic interface that can easily be controlled through scripts
  • Based on widely-used standards for web APIs and data formats

Redfish has been designed to support the full range of server architectures from monolithic servers to converged infrastructure and hyper-scale architecture. The Redfish data model, which defines the structure and format of data representing server status, inventory and available operational functions, is vendor-neutral. Administrators can then create management automation scripts that can manage any Redfish compliant server. This is crucial for the efficient operation of a heterogonous server fleet.

Using Redfish also has significant security benefits: unlike legacy management protocols, Redfish utilizes HTTPS encryption for secure and reliable communication. All Redfish network traffic, including event notifications, can be sent encrypted across the network.

Redfish provides a highly organized and easily accessible method to interact with a server using scripting tools. The web interface employed by Redfish is supported by many programming languages, and its tree-like structure makes information easier to locate. Data returned from a Redfish query can be turned into a searchable dictionary consisting of key-value-pairs. By looking at the values in the dictionary, it is easy to locate settings and current status of a Redfish managed system. These settings can then be updated and actions issued to one or multiple systems.

iDRAC with Lifecycle Controller Overview

The Integrated Dell Remote Access Controller (iDRAC) is designed to enhance the productivity of server administrators and improve the overall availability of PowerEdge servers. iDRAC alerts administrators to server problems, enabling remote server management, and reducing the need for an administrator to physically visit the server. iDRAC with Lifecycle Controller allows administrators to deploy, update, monitor and manage Dell servers from any location without the use of agents in a one-to-one or one-to-many method. This out-of-band management allows configuration changes and firmware updates to be managed from Dell EMC, appropriate third-party consoles, and custom scripting directly to iDRAC with Lifecycle Controller using supported industry-standard API’s. To support the Redfish standard, the iDRAC with Lifecycle Controller includes support for the iDRAC REST API in addition to support for the IPMI, SNMP, and WS-Man standard APIs. The iDRAC REST API builds upon the Redfish standard to provide a RESTful interface for Dell EMC value-add operations including:

  • Information on all iDRAC with Lifecycle Controller out-of-band services—web server, SNMP, virtual media, SSH, Telnet, IPMI, and KVM
  • Expanded storage subsystem reporting covering controllers, enclosures, and drives
  • For the PowerEdge FX2 modular server, detailed chassis information covering power supplies, temperatures, and fans
  • With the iDRAC Service Module (iSM) installed under the server OS, the API provides detailed inventory and status reporting for host network interfaces including such details as IP address, subnet mask, and gateway for the Host OS.

Learning more about iDRAC and Redfish

For complete information concerning iDRAC with Lifecycle Controller, see the documents at http://www.dell.com/idracmanuals .

See iDRAC whitepapers below for more information about overview of Redfish support, detailed workflow examples or commonly asked questions:

For details on the DMTF Redfish standard, visit https://www.dmtf.org/standards/redfish

Simulating iDRAC Redfish Environment Using Redfish Mockup Server

Redfish mockup server is an effective method to simulate Redfish iDRAC environment without using a physical server or iDRAC. Leveraging Redfish mockup server can solve the following issues:

  • Do not have access to a physical server or iDRAC.
  • Do have access to a server and you must test Redfish PATCH or POST calls without being destructive.
  • Train many team members on Redfish without the necessity of physical servers or iDRAC.
  • Do not have iDRAC user privileges to make Redfish calls.

See whitepaper below for more details about how to use this simulation:

iDRAC REST API with Redfish Scripting Library

This GitHub library contains example Python and PowerShell scripts that illustrate the usage of the iDRAC REST API with Redfish to perform many different workflows which include:

BIOS operations

  • Get / Set BIOS attributes
  • Get / Set BIOS boot order, boot source state
  • Set next one-time boot device
  • Set BIOS to default settings

iDRAC operations

  • Change an iDRAC user password
  • Set iDRAC to default settings
  • Get iDRAC Lifecycle Controller logs
  • Get / Set iDRAC, Lifecycle Controller, and System Attributes

Firmware operations

  • Get server firmware inventory
  • Perform a single server device firmware update

Server operations

  • Export / Import Server Configuration Profile (SCP)
  • Preview SCP Import
  • Get / Set server power state
  • Get server storage inventory

Storage operations

  • Create virtual disk
  • Reset controller
  • Set / Rekey / Remove controller encryption
  • Assign / Unassign DHS / GHS

Prerequisites

  • PowerEdge 12G/13G/14G/15G servers
  • Minimum iDRAC 7/8 FW 2.40.40.40, iDRAC9 FW 3.00.00.00
  • Python 3.x
  • PowerShell 5.0 or later

Support

Please note this code is provided as-is and currently not supported by Dell.

Report problems or provide feedback

If you run into any problems or would like to provide feedback, please open an issue here https://github.com/dell/idrac-Redfish-Scripting/issues

idrac-redfish-scripting's People

Contributors

binarysta avatar blazarmilkywayflybee avatar daviesow avatar deagon avatar gelma avatar grantcurell avatar jeaubin avatar larsks avatar mrcalderon avatar nhimf avatar onivla avatar parmentelat avatar paruburoi avatar rounak-adhikary avatar shadealabsamsft avatar slariviere avatar snecklifter avatar texroemer avatar the-bush avatar wslab3d avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

idrac-redfish-scripting's Issues

How to map virtual media?

I only find this url "/redfish/v1/Managers//VirtualMedia", how to map/unmap a virtual media though redfish?

Error code 5 ("not supported") when trying to use Set-ExportImportServerConfigurationProfileREDFISH

Hello,

I've downloaded the most recent version of scripts, and I'm trying to access iDRAC from Powershell. I'm trying to use Set-ExportImportServerConfigurationProfileREDFISH, however I keep getting an error.

I've tried both the regular and iDRAC8 only module, with the same result.

Please help! :)

Set-ExportImportServerConfigurationProfileREDFISH -idrac_ip 10.77.250.8 -idrac_username root -idrac_password calvin -Method import -network_share_IPAddress 10.77.1.5 -ShareType CIFS -ShareName Redfish -cifs_Username user -cifs_Password pass -Target RAID -FileName export_ps.xml

Output:

  • WARNING, Parameter details for import operation

Name Value


ShareParameters {Password, ShareName, IPAddress, UserName...}

ShareParameters details:

Password pass
ShareName Redfish
IPAddress 10.77.1.5
UserName user
FileName export_ps.xml
ShareType CIFS
Target RAID
Invoke-WebRequest : { "error": { "code": "5", "message": { "lang": "en-us", "value": "not supported: " } } }
At C:\apps\iDRAC-Redfish-Scripting-master\Redfish PowerShell\Set-ExportImportServerConfigurationProfileREDFISH_iDRAC8_o
nly\Set-ExportImportServerConfigurationProfileREDFISH_iDRAC8_only.psm1:175 char:12

  • $result1 = Invoke-WebRequest -Uri $u -Credential $credential -Method Post -Body ...
  •   + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
     eption
      + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
    

Exception calling "Match" with "2" argument(s): "Value cannot be null.
Parameter name: input"
At C:\apps\iDRAC-Redfish-Scripting-master\Redfish PowerShell\Set-ExportImportServerConfigurationProfileREDFISH_iDRAC8_o
nly\Set-ExportImportServerConfigurationProfileREDFISH_iDRAC8_only.psm1:177 char:1

  • $job_id_search=[regex]::Match($raw_content_output, "JID_.+?r").captures.groups[0 ...
  •   + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : ArgumentNullException
    
    

You cannot call a method on a null-valued expression.
At C:\apps\iDRAC-Redfish-Scripting-master\Redfish PowerShell\Set-ExportImportServerConfigurationProfileREDFISH_iDRAC8_o
nly\Set-ExportImportServerConfigurationProfileREDFISH_iDRAC8_only.psm1:178 char:1

  • $job_id=$job_id_search.Replace("\r","")
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    
    

Exception calling "Format" with "2" argument(s): "Value cannot be null.
Parameter name: args"
At C:\apps\iDRAC-Redfish-Scripting-master\Redfish PowerShell\Set-ExportImportServerConfigurationProfileREDFISH_iDRAC8_o
nly\Set-ExportImportServerConfigurationProfileREDFISH_iDRAC8_only.psm1:189 char:5

  • [String]::Format("- FAIL, statuscode {0} returned",$result1.StatusCode)
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : ArgumentNullException

PowerShell Help does not work

After the modules have been placed in a module folder I found that the help was not working as it should in Powershell. When I run get-help Set-IdracUserPasswordREDFISH for example I do not get the synopsis, and description that was defined. The same issue exists for the examples when the -example switch is used with the command.

To resolve this issue i had to relocate the author, version, and copyright info. Once the modules were updated the help and example details in Powershell displayed as expected.

404 response code for python api

url = 'https://%s/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset' % idrac_ip

payload = {'ResetType': 'ForceOff'}
headers = {'content-type': 'application/json'}
response = requests.post(url, data=json.dumps(payload), headers=headers, verify=False, auth=(idrac_username,idrac_password))
statusCode = response.status_code
print statusCode
404
quit()

I am trying to reboot the host using this however, everytime I am getting 404 response.
idrac is reachable normally from browser using same IP and access details.

Please help.

How can i get size of all disks

right now, getting only:
HealthRollUp: OK
State: Enabled
Health: OK
Model : xxxxxxxxxx
Name: Physical Disk 0:1:3
Manufacturer: HGST

How can I check a size?

GetIdracLcSystemAttributesREDFISH.py does not work

The urls all give error 404. The Bios Get Attributes sample works, proof env ir up, but cannot get the iDRAC, System, nor LC to work. Error 404 - attributes element apparently does not exist.
This is against iDRAC 2.50.50.50
Will check back here in hope of a correction.
What am I doing? need to setup server to pxe boot, need to enable ipmi, ... But if the simple calls to get attribute info do not work, I need another path.

IDRAC 14gen switchconnection ID

Whilst IDRAC 14Gen web interface can view the switchconnection ID for a network adapter. I am unable to find within the Redfish API an ability to view the switchconnection ID for a network adapter.
Is this possible within redfish.

Export Config Local&Network

Hy Texas,

why did you make to different versions?

Set-ExportImportServerConfigurationProfileNetworkShareREDFISH
Set-ExportServerConfigurationProfileLocalREDFISH

I realy like to get the ExportUse options also in the Local Version as I need this more often while testing stuff.

  • ExportUse (Supported values: Default, Clone and Replace) OPTIONAL for export only. If not passed in, value will be "Default" used.

I did change it for testing, but of course it will be better we can use it out of the box.

$ExportUse = "Clone"

$share_info=@{"ExportFormat"=$ExportFormat;"ExportUse"=$ExportUse;"ShareParameters"=@{"Target"=$Target}}

Thx

Set-IdracLcSystemAttributesREDFISH invalid url?

I don't believe these urls exist. I'm getting this error:
"Unable to complete the operation because the resource Attributes entered in not found."

"https://$idrac_ip/redfish/v1/Managers/iDRAC.Embedded.1/Attributes"
"https://$idrac_ip/redfish/v1/Managers/LifecycleController.Embedded.1/Attributes"
"https://$idrac_ip/redfish/v1/Managers/System.Embedded.1/Attributes"

Additionally browsing with Postman I don't see "Attributes"

Problem to upload files Idrac7/8

Hi,

I was testing the new Idrac7/8 (2.60.60.60) firmware with support to UpdateService with the client that I developed, but it was not working, after some research I saw that in Idrac 7/8 the server doesn't understand post requests with the boundary in quotes

ex:
content-type: multipart/form-data; boundary="--------------------------906062808661884025570449"

Requests library in python doesn't use quotes for boundary so it works fine when running the scripts that you made, but .NET HttpClient which is the library that I'm using to make request, put quotes in the boundary, so the server don't understand the request and throw me an 400 error.

I was able to find a workaround for this and get it to work with Idrac7/8, but since Idrac9 support this kind of request and the RFC says that is valid https://tools.ietf.org/html/rfc2046#section-5.1.1, it would be nice to have this in Idrac7/8, that may avoid some compatibility problems in the future.

GracefulRestart performs a hard reset

Tested against multiple Dell R730, iDRAC 8 firmware version 2.60.60.60.

Running the following performs a hard reset which is also confirmed in the Lifecycle logs:
Set-PowerControlREDFISH -idrac_ip $ip -idrac_username $user -idrac_password $pwd -power_request_value GracefulRestart

Running the following correctly performs a Graceful Shutdown which is also confirmed in the Lifecycle logs:
Set-PowerControlREDFISH -idrac_ip $ip -idrac_username $user -idrac_password $pwd -power_request_value GracefulShutdown

Failure to create configureation job

I have no errors up until the 'create_bios_config_job' and the error is
No pending data present to create a Configuration job.
The data from the call before to set the config does not match current settings, so there is a change:

[{u'Index': 0, u'Enabled': True, u'Id': u'BIOS.Setup.1-1#UefiBootSeq#NIC.PxeDevice.1-1#81e55d13a36bc065ca3bf9bf8d699391', u'Name': u'NIC.PxeDevice.1-1'},
{u'Index': 1, u'Enabled': True, u'Id': u'BIOS.Setup.1-1#UefiBootSeq#RAID.Integrated.1-1#87261b9978c1e72f4eee4644670cb0a6', u'Name': u'RAID.Integrated.1-1'}]

No matter if I swap the indexes - same error. Server has 2.50.50.50 iDRAC.
create_bios_configjob is unchanged from your code.
set_bios_boot_source is unchanged but passess with resp 200

Anxious to fix. Be awesome

How to get fru info

how to get fru infos through redfish api? or any node related to fru info? such as power?

SSL Issue

Will i have to enable any SSL Features or something?
I can't connect to my new R630 via Redfish.

I was using ExportSystemConfigurationLocalREDFISH.py with python2,7 and python3.6.
Both return SSL Handshake errors

Python3

python3 ExportSystemConfigurationLocalREDFISH.py -ip 192.168.0.120 -u root -p calvin -t ALL
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 436, in wrap_socket
    cnx.do_handshake()
  File "/usr/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1716, in do_handshake
    self._raise_ssl_error(self._ssl, result)
  File "/usr/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1449, in _raise_ssl_error
    raise SysCallError(-1, "Unexpected EOF")
OpenSSL.SSL.SysCallError: (-1, 'Unexpected EOF')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/usr/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 345, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 844, in _validate_conn
    conn.connect()
  File "/usr/lib/python3.6/site-packages/requests/packages/urllib3/connection.py", line 326, in connect
    ssl_context=context)
  File "/usr/lib/python3.6/site-packages/requests/packages/urllib3/util/ssl_.py", line 324, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.6/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 443, in wrap_socket
    raise ssl.SSLError('bad handshake: %r' % e)
ssl.SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/usr/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py", line 630, in urlopen
    raise SSLError(e)
requests.packages.urllib3.exceptions.SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "ExportSystemConfigurationLocalREDFISH.py", line 44, in <module>
    response = requests.post(url, data=json.dumps(payload), headers=headers, verify=False, auth=(idrac_username,idrac_password))
  File "/usr/lib/python3.6/site-packages/requests/api.py", line 110, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/adapters.py", line 497, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",)

Python2

python ExportSystemConfigurationLocalREDFISH.py -ip 192.168.0.120 -u root -p calvin -t ALL
Traceback (most recent call last):
  File "ExportSystemConfigurationLocalREDFISH.py", line 44, in <module>
    response = requests.post(url, data=json.dumps(payload), headers=headers, verify=False, auth=(idrac_username,idrac_password))
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 506, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='192.168.0.120', port=443): Max retries exceeded with url: /redfish/v1/Managers/iDRAC.Embedded.1/Actions/Oem/EID_674_Manager.ExportSystemConfiguration (Caused by SSLError(SSLError("bad handshake: SysCallError(-1, 'Unexpected EOF')",),))

License View

Is there any API to view the IDRAC license

example command:

racadm license view

Changing BIOS setting for LogicalProc to Enabled

I tried to use the BiosSetAttributeREDFISH.py script to change the "LogicalProc" setting to "Enabled" (enabling SMT). Everything reported as working, the update job got scheduled and the system rebooted. After it came up BiosGetAttributesREDFISH.py reported LogicalProc as Enabled. But the total number of processors reported by nproc had not changed.

Even when I enter the BIOS and look at LogicalProc, it is set to enabled.
And if I then exit from the BIOS, it doesn't think anything has changed and doesn't do a reboot, and nproc still shows that LogicalProc is not being recognized.

I had to enter the BIOS, make some other needless change, which caused it to go thru reboot. That did then manage to really change LogicalProc as reflected by nproc.

This was on a Dell r7425.

how to get host dhcp ip from iDRAC?

Hi Guru,

supposing I have Dell PE host and let it boot up such as from Linux or VMWare vSphere iso, it will have a dhcp ip,

may from iDRAC (is there a powershell way?) I can know this ip? thanks

too many requirements

So we configure atleast 50 iDRACs per day on an average from our team. We have a team size of around 80. The Get-ImportServerConfigurationProfilePreviewREDFISH requires that all of these guys should have access to a network share or should know the credentials. We should be able to give any path, preferably local path.
what we are trying to do is this.

  1. configure one idrac
  2. import and save the configuration of that on our local machine
  3. push it to all the others
    or
    give target idrac ip, give source idrac ip then the settings should get copied.

Create and Delete iDRAC Users

Hy Texas,

is it possible to extend the Set-IdracUserPasswordREDFISH.psm1 to the functionality of
CreateIdracUserPasswordREDFISH.py

I got the code from JSON and brought it to Powershell ;)

$JsonBody = @{"Enabled"= $True ; 'UserName'= $idrac_newusername; 'Password'= $idrac_new_password; 'RoleId'= "Administrator"; 'Description'= "Admin"} | ConvertTo-Json -Compress

But I also like to delete a user not only to disable it as you did in the Python.

$JsonBody = @{"Enabled"= $False ; 'RoleId'= "None"; 'Description'= ""; 'UserName'= "" ; 'Password'= "" } | ConvertTo-Json -Compress

This does the Trick but it throws an ugly Error in the end, even if it succeeds in deleting Username and Password.

[{"Message":"The specified value is not allowed to be configured if the user name \nor password is
blank.","

any advice how to make it right.

PowerSupply and Temperature overview

Feature Request:
It would be great to have an overview of the overall and specific sensor data with redfish and PowerShell.
Like power consumption, temperature, all sensor data, and overall health.

DeviceFirmwareSimpleUpdateREDFISH.py assumes Windows

DeviceFirmwareSimpleUpdateREDFISH.py should use os.path.join to create ImagePath, not inserting a backslash. On a unix system, this produces an invalid path.

That is,
ImagePath = ImageLocation + "\\" + filename

should be:
ImagePath = os.path.join(ImageLocation, filename)

to work on both platforms.

DeviceFirmwareUpdateREDFISH.py compatibility issue

We want to upgrade idrac version to 2.60.60.60 on our 400 plus hosts, So that we tried executing the script for the same (DeviceFirmwareUpdateREDFISH.py ).

We use idrac version 2.50.50.50.

It give us message: WARNING, current server iDRAC version does not support Redfish firmware features. Refer to Dell online Redfish documentation for information on which iDRAC version supports firmware features.

We want to know whether is there any way available for upgrading the idrac version using this script or any other ways available.

Create new user in idrac with redfish API

Hello,

After some analysis I found the way for configuring new user in IDRAC.

import requests
import json
url = 'https://host-rsc/redfish/v1/Managers/iDRAC.Embedded.1/Accounts/3'
plUserName = {'UserName': 'testuser'}
plPass = {'Password': 'calvin'}
plRoleId = {'RoleId': 'Administrator'}
p1Enabled = {'Enabled':True}
headers = {'content-type': 'application/json'}
for payload in plUserName,plPass,plRoleId, p1Enabled:
response = requests.patch(url, data=json.dumps(payload), headers=headers,verify=False, auth=('root','pass'))
print(response.text)

With this script I can be able to change the username, password, enabled, role.

But now I need to change the LAN, Serial port, Serial over lan values. Please suggest how to find the payload for the same.

I don't find any for the same.

{"@odata.context":"/redfish/v1/$metadata#ManagerAccount.ManagerAccount","@odata.id":"/redfish/v1/Managers/iDRAC.Embedded.1/Accounts/3","@odata.type":"#ManagerAccount.v1_0_2.ManagerAccount","Description":"User Account","Enabled":false,"Id":"3","Links":{"Role":{"@odata.id":"/redfish/v1/Managers/iDRAC.Embedded.1/Roles/Administrator"}},"Locked":false,"Name":"User Account","Password":null,"RoleId":"Administrator","UserName":"testuser"}

Thanks.

Is it possible to fetch all events without looping?

I see if you fetch: /redfish/v1/Managers/iDRAC.Embedded.1/Logs/Lclog, it will only return a subset of the results with:

@odata.nextLink": "/redfish/v1/Managers/iDRAC.Embedded.1/Logs/Lclog?$skip=50

Is it possible to have it return all of the results in one go or do I have to keep making multiple requests ?

Issue with Firmware Update

While trying to update firmware using DUP via https://downloads.dell.com/FOLDER04610507M/2/BIOS_79GKV_LN_1.2.11_01.BIN for Dell PowerEdge R740, I encountered the following error message -

root@debian:~/testing# python DeviceFirmwareUpdateREDFISH.py -i 10.99.54.23 -u root -p calvin -f BIOS_79GKV_LN_1.2.11_01.BIN

- WARNING, downloading DUP payload to iDRAC

Traceback (most recent call last):
  File "update.py", line 222, in <module>
    download_image_payload()
  File "update.py", line 60, in download_image_payload
    req = requests.get('https://%s/redfish/v1/UpdateService/FirmwareInventory/' % (idrac_ip), auth=(idrac_username, idrac_password), verify=False)
  File "/usr/lib/python2.7/dist-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 487, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='-i', port=443): Max retries exceeded with url: /redfish/v1/UpdateService/FirmwareInventory/ (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7efc8f637e50>: Failed to establish a new connection: [Errno -2] Name or service not known',))

Looks to me HTTPS certificate issue. Any idea how to fix it?

Paths don't exist?

I'm trying to use some of these scripts, but a lot of the redfish paths don't appear to exist on any of my iDRACs (v2.50.50, redfish v1.0.2)?

"failed: Request URI: /redfish/v1/UpdateService is invalid"

Redfish script to upgrade BIOS, Controller and Idrac

I am using Idrac 7, 8 and 9 on R730xd and need to upgrade BIOS, controllers, and Idrac in bulk of servers. It would be great if we have Redfish or non-redfish based Python script to upgrade them.
Or just script to upload iso/ exe which we usually do to upgrade them.

Suggestion to remove ForceOff from cmdlets

IMHO the following cmdlets should remove the additional step to perform a power "ForceOff"

Invoke-CheckConsistencyVirtualDiskREDFISH
Invoke-CreateVirtualDiskREDFISH
Invoke-DeleteVirtualDiskREDFISH
Invoke-InitializeVirtualDiskREDFISH
Invoke-SecureEraseDeviceREDFISH
Invoke-SetExternalEnclosureAssetTagREDFISH
Set-BiosBootOrderBootSourceStateREDFISH
Set-BiosDefaultSettingsREDFISH
Set-MultipleBIOSAttributesREDFISH
Set-NetworkPropertiesREDFISH
Set-NextOneTimeBootDeviceREDFISH
Set-OneBIOSAttributeREDFISH
Set-UpdateOneDeviceREDFISH

The user should control that action as they see fit using the wonder Set-PowerControlREDFISH cmdlet you created.

Thank you!

Memory and Update Redfish

Hi,
I am consuming the redfish api on a dell gen 13.
My server is currently at redfish v1.0.2
I want to access individual DIMM information using /systems/systems.Embedded.1/Memory. Right now, I can just see the Memory Summary in /systems/systems.Embedded.1/. I am guessing the 1.0.2 dosent support /Memory path.

So my question is ->

  1. Is there a resource which I could find which tells me what all paths are supported in what version.

  2. I am also willing to upgrade redfish to 1.6 which is the standard DMTF specifies. So how do I upgrade the redfish version on my dell without touching any other firmware or software on the server.

Fiber Channel

I like to see all FC Adapters and the coresponding Slots as we need to disable it when installing our Systems. Is there a way to get this info with Redfish.

In the Schema I see Endpoint resource - EndpointProtocol: string: FC

But how to find it :)

Network Slot Virtualization Mode

Which Redfish API can give the following information

racadm get NIC.DeviceLevelConfig.5
Security Alert: Certificate is invalid - unable to get local issuer certificate
Continuing execution. Use -S option for racadm to stop execution on certificate-related errors.
[Key=NIC.Slot.2-1-1#DeviceLevelConfig]
#INTEL_AdapterPBA=J0000-000
#NParEP=Disabled
#NumberVFSupported=128
#PartitionStateInterpretation=Fixed
#RDMASupport=Unavailable
#SRIOVSupport=Available
#VFAllocBasis=Device
#VFAllocMult=16
VirtualizationMode=SRIOV

Connection Error

I have used ChangeIdracUserPasswordREDFISH.py for creating the script for reset the password in idRac for root user.

We can be able to change the password for first time, But in consecutive attempts it always failing with error.

Getting different errors in different platform , In windows getting error as follows:

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='esxcldrest003-rsc', port=443): Max retries exceeded with url: /redfish/v1/Managers/iDRAC.Embedded.1/Accounts/2 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x00000260BACB9400>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond',))

Attached the full log.
Windows_Error_log.txt

Problem with redfish/v1/Systems/System.Embedded.1/Bios

Hi,

We have C6320s with iDRAC firmware version 2.41.40.40 (Build 07). I'm attempting to test Redfish scripting, and started by trying the BiosGetAttributesREDFISH.py script. I get the following error when running this script,

{u'error': {u'message': {u'lang': u'en-us', u'value': u'failed: Request URI: /redfish/v1/Systems/System.Embedded.1/Bios is invalid'}, u'code': u'1'}}
Traceback (most recent call last):
File "./BiosGetAttributesREDFISH.py", line 65, in
get_bios_attributes()
File "./BiosGetAttributesREDFISH.py", line 53, in get_bios_attributes
for i in data[u'Attributes'].items():
KeyError: u'Attributes'

When I visit the corresponding URL in a browser I see the following,

{
"error": {
"code": "1",
"message": {
"lang": "en-us",
"value": "failed: Request URI: /redfish/v1/Systems/System.Embedded.1/Bios is invalid"
}
}
}

Any insight into the error would be appreciated, we would really like to transition to Redfish for managing our systems.

Api returning error 500

Hi, we are implementing an .NET client to consume Dell Redfish api, it works fine for most functions but returns an error 500 when we try to upload an firmware to Idrac,

We are running the tests on a R740, the Idrac version is 3.21.23.22

here's the code I'm using to upload the file:

`

    private async Task<Uri> UploadFile(string path)
    {
        using (var request = new HttpRequestMessage(HttpMethod.Post, baseUri + FIRMWARE_INVENTORY))
        using (var content = new MultipartFormDataContent(Guid.NewGuid().ToString()))
        using (var fileContent = new StreamContent(File.Open(path, FileMode.Open)))
        {
            string etag = await GetHeaderValue("ETag", baseUri + FIRMWARE_INVENTORY);
            fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/octet-stream");
            request.Headers.Authorization = HttpUtil.GetCredentialHeader(server.User, server.Password);
            request.Headers.TryAddWithoutValidation("If-Match", etag);
            fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
            {
                Name = "file",
                FileName = Path.GetFileName(path).ToLower()
            };
            content.Add(fileContent);
            request.Content = content;
            using (HttpResponseMessage response = await client.SendAsync(request))
            {
                if (!response.IsSuccessStatusCode)
                {
                    throw new HttpRequestException("Falha no upload do arquivo: " + response.ReasonPhrase);
                }
                return response.Headers.Location;
            }
        }
    }

`

Missing Data From Redfish

Can you please help me to fetch the following information from Redfish API

1)System Setup / iDRAC Settings / Power Configuration / Redundancy Policy
2)System Setup / iDRAC Settings / Power Configuration / Enable Hot Spare
3)System Setup / iDRAC Settings / Network / Enable IPMI Over Lan
4)System Setup / iDRAC Settings / Network / Common Settings / Static DNS Domain Name

Are these Values set at the boot time ?

run ImportSystemConfigurationLocalREDFISH.py get html code 503

hi:
I imitate ImportSystemConfigurationLocalREDFISH.py and send a request to v1/Managers/iDRAC.Embedded.1/Actions/Oem/EID_674_Manager.ImportSystemConfiguration, bug got a html code 503, what the problem means? how to solve it?
help me, thanks a lot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.