Fujitsu iRMC Redfish Examples

I got an escalation from our second level support that a customer would like to get MAC address information on a server via Redfish. This can be done with the FirmwareInventory endpoint. I can show the example, but I think it would be good to show some other examples for basic tasks as well so that you can use Fujitsu iRMC Redfish APIs with your scripts/applications.

Fujitsu iRMC Redfish API Examples

  • Check the server power status
  • $ curl -s -k -u admin:admin -H"Content-type: application/json" -X GET https://irmc_address/redfish/v1/Systems/0/ |jq -r '.PowerState'
    On 
    
  • Power on the server
  • $ curl -k -u admin:admin -H"Content-type: application/json" -X POST https://irmc_address/redfish/v1/Systems/0/Actions/Oem/FTSComputerSystem.Reset --data-binary $'{"FTSResetType":"PowerOn"}'
    
  • Power off the server
  • $ curl -k -u admin:admin -H"Content-type: application/json" -X POST https://irmc_address/redfish/v1/Systems/0/Actions/Oem/FTSComputerSystem.Reset --data-binary $'{"FTSResetType":"PowerOff"}'
    
  • Reset the server
  • $ curl -k -u admin:admin -H"Content-type: application/json" -X POST https://irmc_address/redfish/v1/Systems/0/Actions/Oem/FTSComputerSystem.Reset --data-binary $'{"FTSResetType":"ImmediateReset"}'
    
  • Reset iRMC
  • $ curl -k -u admin:admin -H"Content-type: application/json" -X POST https://irmc_address/redfish/v1/Managers/iRMC/Actions/Manager.Reset
    
  • Check BIOS and iRMC Firmware version
  • $  curl -s -k -u admin:admin -H"Content-type: application/json" -X GET https://irmc_address/redfish/v1/Systems/0/Oem/ts_fujitsu/FirmwareInventory |jq '{SystemBIOS, BMCFirmware, SDRRVersion}'
    {
      "SystemBIOS": "V5.0.0.12 R1.18.0 for D3383-A1x",
      "BMCFirmware": "1.25P",
      "SDRRVersion": "3.38"
    }
    
  • Get the server model name and serial number
  • $ curl -s -k -u admin:admin -H"Content-type: application/json" -X GET https://irmc_address/redfish/v1/Systems/0/ |jq '{Model, SerialNumber}'
    {
      "Model": "PRIMERGY RX2530 M4",
      "SerialNumber": "MABQ000000"
    }
    
  • Update BIOS
  • $ curl -k -u admin:admin –H "Content-type: multiplart/form-data" –H "Accept: application/json" -X POST -F "data=@RX2530M4_R1180.UPC" https://irmc_address/redfish/v1/Systems/0/Bios/Actions/Oem/FTSBios.BiosUpdate
    
  • Update iRMC Firmware
  • $ curl -k -u admin:admin –H "Content-type: multiplart/form-data" –H "Accept: application/json" -X POST -F "data=@RX2530M4_125Psdr0338.bin" https://irmc_address/redfish/v1/Managers/iRMC/Actions/Oem/FTSManager.FWUpdate
    
  • Generate and download iRMC System Report
  • When you have a hardware problem and Fujitsu support asks for a system report, you can use the following API to download the report, and send it to Fujitsu support.
    $ curl -k -u admin:admin –H "Accept: application/json" -X POST https://irmc_address/redfish/v1/Systems/0/Actions/Oem/FTSComputerSystem.SystemReportGenerate
    $ curl -k -u admin:admin –H "Accept: application/json" -H "Content-Type: application/octet-stream" -X POST https://irmc_address/redfish/v1/Systems/0/Actions/Oem/FTSComputerSystem.SystemReportDownload --output iRMCSystemReport.xml
    
  • List MAC addresses on the server
  • $ curl -s -k -u admin:admin -H"Content-type: application/json" -X GET https://irmc_ip_address/redfish/v1/Systems/0/Oem/ts_fujitsu/FirmwareInventory/NIC |jq '.Ports[] | {SlotId, PortId, ManufacturerMacAddress}'
    {
      "SlotId": 0,
      "PortId": 0,
      "ManufacturerMacAddress": "90:1b:0e:ad:11:6f"
    }
    {
      "SlotId": 0,
      "PortId": 1,
      "ManufacturerMacAddress": "90:1b:0e:ad:11:70"
    }
    {
      "SlotId": 11,
      "PortId": 0,
      "ManufacturerMacAddress": "3c:fd:fe:a1:6e:c4"
    }
    {
      "SlotId": 11,
      "PortId": 1,
      "ManufacturerMacAddress": "3c:fd:fe:a1:6e:c5"
    }
    

Reference

14 comments:

sjb76 said...

Hi Masa, great examples, but one we're having problems with (RX2530 M4) is applying iRMC and BIOS config from an input file. We exported the current config (no SSL) to a .pre file from the Web GUI, edited the hostname, then tried to pass the file back using a call to ImportConfiguration, which responds with:

The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers

Headers set to:
Content: application/atom+xml (also tried pure xml, but it said content not acceptable)
Accept: application/json

Can you give an example of the command to upload a modified file in this way?

Cheers,
Simon

Masa Murayama said...

Hello sjb76,

Once you modify your iRMC configuration file (.pre), you can use the ImportConfiguration endpoint as you mentioned.

Here is a curl example to upload the pre file to iRMC using Redfish (rx2530m4-irmc.pre is the iRMC configuration XML file name).

$ curl -k -u admin:admin -H "Content-type: multipart/form-data" -H "Accept: application/json" -X POST -F "data=@rx2530m4-irmc.pre" -i https://irmc_ip_address/redfish/v1/Managers/iRMC/Actions/Oem/FTSManager.ImportConfiguration

You will see the task number in the response header, so you can check the result in Task. In this example, it is set to task# 7.

$ curl -k -u admin:admin -H "Accpet: application/json" -X GET https://irmc_ip_address/redfish/v1/TaskService/Tasks/7

Hope this helps.

Thanks,
Masa

Unknown said...

Hello,

I've been trying to use Redfish with Powershell Invoke-RestMethod, but it has been a nightmare to get this working.

I still couldn't figure out how to do the Update BIOS/iRMC.
Not in Python and not even on Postman...

Any tips?

Unknown said...

Fujitsu's documentation is really really poor on this..
Found iDRAC github, and there you have way more examples for this.
https://github.com/dell/iDRAC-Redfish-Scripting
Code is almost the same, you just have to edit minor things.
Finally got the update bios to work with powershell.
Now i'm just missing the User Account manipulation, like edit passwords and stuff like that..

Masa Murayama said...

Hi iAM EXIO,

Thank you for your feedback. I will forward your comment to the appropriate group in Fujitsu to update the documents. I cannot guarantee they will do that, but I will try.
In the meantime, I may add more iRMC Redfish examples using PowerShell and Python to my blog when I have spare time.

One tips for you. If you use Google Chrome, you can copy/export your operations in iRMC GUI to PowerShell or curl scripts. You just need to enable the developer mode (hit F12), and do a right-click on your operation in the Network tab, and do "Copy" -> "Copy as PowerShell" or "Copy as cURL". When you manipulate user accounts in iRMC GUI with the developer tool, you can see what PowerShell will look like for the operation.

Unknown said...

Hello Masa,

Thanks for your answer, and for being here for us in general!

I followed your tip, and it helps a lot, I never knew something like that was available on chrome.
But i found that iRMC S4 still uses the old URLs when doing the web requests, whereas iRMC S5 uses redfish by default. So I'll be using S5 to get the commands.
(same redfish command works the same way for both versions).

User account manipulation is now working!

Thanks,

EXIO

Claus said...

Hello Masa,

I'm looking for configuring "BootSourceOverrideTarget" on iRMC S5 for PRIMERGY RX2540 M5 servers to be able to set the server to boot from PXE on next boot.

Using the iRMC console the setting can be achieved via "Power - Boot Options - Next boot only".

"BootSourceOverrideTarget" is defined in https://www.dmtf.org/sites/default/files/standards/documents/DSP2046_2017.0a.pdf and is usable on HPE servers / iLO.

Do you have a curl command for setting the next boot to PXE using curl / RedFish?

Thank you very much in advance!

Claus

Claus said...

I get "ETag is required". What is the reason?

$ curl -k -u user:pw -H "Content-type: application/json" -X PATCH https://irmc/redfish/v1/Systems/0/ -d '{"Boot":{"BootSourceOverrideTarget": "Pxe"}}'
{
"error":{
"@Message.ExtendedInfo":[
{
"@odata.type":"#Message.1_0_0.Message",
"MessageId":"Fujitsu.1.0.PreconditionRequired",
"Message":"ETag is required",
"Severity":"Critical",
"Resolution":"Change the request and resubmit it."
}
],
"code":"Fujitsu.1.0.PreconditionRequired",
"message":"ETag is required"
}
}


Thank you!

Masa Murayama said...

Sorry Claus for my late response. This would be too late, but I posted a new entry on my blog that explains how to change the boot device via Redfish.

https://mmurayama.blogspot.com/2020/07/fujitsu-primergy-change-for-boot-device.html

Hope this helps.

João Quaresma said...

Hi guys,
For those who are looking for upgrade the iRMC firmware via Powershell with Redfish, just leave the following lines so you can save some time:

$IrmcRepoPath = "D:\fwfolder\"
$BinFileName = "filename.BIN"
$IrmcFileFullPath = $IrmcRepoPath + $BinFileName
$header = @{
"Accept" = "application/json"
"Accept-Charset" = "UTF-8"
}
$CODEPAGE = "iso-8859-1"
$fileBin = [System.IO.File]::ReadAllBytes($IrmcFileFullPath)
$enc = [System.Text.Encoding]::GetEncoding($CODEPAGE)
$fileEnc = $enc.GetString($fileBin)
$boundary = [System.Guid]::NewGuid().ToString()
$LF = "`r`n"
$bodyLines = (
"--$boundary",
"Content-Disposition: form-data; name=`"data`"; filename=`"$BinFileName`"",
"Content-Type: application/octet-stream$LF",
$fileEnc,
"--$boundary--$LF"
) -join $LF

$uri = "https://" + $IrmcIpAddress + "/redfish/v1/Managers/iRMC/Actions/Oem/FTSManager.FWUpdate"
$req_response = Invoke-WebRequest -Uri $uri -Credential $credential -Method Post -ContentType "multipart/form-data; boundary=`"$boundary`"" -Headers $header -Body $bodyLines

Take the chance to thank Masa for all the great info he's posting.


sucram said...

HI,

when I try Power off the server
?
1
$ curl -k -u admin:admin -H"Content-type: application/json" -X POST https://192.168.0.11/redfish/v1/Systems/0/Actions/Oem/FTSComputerSystem.Reset --data-binary $"{"FTSResetType":"PowerOff"}"


what do I wrong? I use Windos 10 and started the coman in a Dos Comannd Box
{
"error":{
"@Message.ExtendedInfo":[
{
"@odata.type":"#Message.1_0_0.Message",
"MessageId":"Base.1.5.ActionParameterMissing",
"Message":"The action FTSComputerSystem.Reset requires the parameter FTSResetType to be present in the request body.",
"Severity":"Critical",
"Resolution":"Supply the action with the required parameter in the request body when the request is resubmitted."
}
],
"code":"Base.1.5.ActionParameterMissing",
"message":"The action FTSComputerSystem.Reset requires the parameter FTSResetType to be present in the request body."
}
}

Kind regards
Marcus

João Quaresma said...

Hi Sucram,
Did you try already with -d '{"FTSResetType":"PowerOff"}'
Try it in postman, is the best way to try to figure out what is the way to go.

Sk3y said...

Yes i try it. But same error appears.

brunet said...

Please be careful about usage of ' and ".
I don`t have issues with following syntax on linux:

curl -s -k -u admin:admin -H "Accept: application/json" -H "Content-type: application/json" -d '{"FTSResetType": "PowerOff"}' -k -i -X POST https://{{IP}}/redfish/v1/Systems/0/Actions/Oem/FTSComputerSystem.Reset

Good Bye, Folks!

As you may have heard, Fujitsu has completely discontinued Data Center Products and Solutions business in North America on April 1st, 2021. ...