How to update SR635 and SR655 system firmware using the BMC Redfish REST API

How to update SR635 and SR655 system firmware using the BMC Redfish REST API

How to update SR635 and SR655 system firmware using the BMC Redfish REST API

Description

The AMD 1P Redfish Server is based on the AMI MegaRAC® Redfish Technology Package V1.7 (follows DSP0266 1.7.0 Specification and Redfish Schema 2019.1). To add OEM APIs, Redfish uses RESTful interface semantics and JSON resource payloads to perform system management through Web-based protocols.

This article introduces the procedure used to update system firmware using the BMC Redfish REST API.

The following HTTP methods will be used in this article:

  • GET: read request – used to request a specified resource or collection to check data
  • POST: action request – used to initiate operations or create resources

Applicable Systems

SR635, SR655

Prerequisites

  • Redfish clients must be installed on your workstation or laptop.
    • Redfish client
      • Chrome: Postman, Talend API Tester
      • Firefox: RESTClient
  • The workstation or laptop must have direct network access to the BMC on the target server.

Procedures

  1. Download the appropriate firmware package for your machine from the Lenovo support page.
  2. Unzip the files and copy the contents to a specified folder.

How to obtain the installed firmware information

  1. To access the properties in the firmware inventory collection, open Postman, select the GET method and then enter the following requested URL : https://BMCIP/redfish/v1/UpdateService/FirmwareInventory
  2. In the Authorization tab, select Basic Auth from the Type menu , and then enter the BMC credentials . Click Send .
    firmware inventory
    Note: This authorization step is required for each request.
    Response example
    If the previous request is successful, a message body similar to the following will be returned:
    {
    "@odata.context": "/redfish/v1/$metadata#SoftwareInventoryCollection.SoftwareInventoryCollection",
    "@odata.etag": "\"1577837046\"",
    "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory",
    "@odata.type": "#SoftwareInventoryCollection.SoftwareInventoryCollection",
    "Description": "Collection of Firmware Inventory resources available to the UpdateService",
    "Members": [
    {
    "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/LXPMLinuxDriver1"},
    {
    "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/PSU2"},
    {
    "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/LXPMWindowsDriver1"},
    {
    "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/BMC-Primary"},
    {
    "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/BMC-Backup"},
    {
    "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/LXPM"},
    {
    "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/UEFI"},
    {
    "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/PSU1"}
    ],
    "Members@odata.count": 8,
    "Name": "Firmware Inventory Collection"}
  3. From the output of the Members list, find the system firmware endpoint that you want to query – for example, /redfish/v1/UpdateService/FirmwareInventory/UEFI. Enter it into the URL field to get the UEFI information.
{
    "@odata.context": "/redfish/v1/$metadata#UpdateService.UpdateService",
    "@odata.etag": "\"1577837046\"",
    "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/UEFI",
    "@odata.type": "#SoftwareInventory.v1_2_2.SoftwareInventory",
    "Id": "UEFI",
    "Name": "UEFI Firmware",
    "RelatedItem": [
        {
            "@odata.id": "/redfish/v1/Systems/Self"
        },
        {
            "@odata.id": "/redfish/v1/Systems/1"
        }
    ],
    "RelatedItem@odata.count": 2,
    "SoftwareId": "CFE118K",
    "Status": {
        "Health": "OK",
        "State": "Enabled"
    },
    "Updateable": true,
    "Version": "5.10"
}

In the response data shown above, the installed UEFI version is 5.10 and the software ID is CFE118K.

UEFI updates

  1. Select the POST method, and then enter the following requested URL: https://BMCIP/redfish/v1/UpdateService/upload
  2. In the Body tab for the POST action, select form-data , set the KEY name to UpdateFile , and change the KEY type to File .

POSTbody

  1. In the value section, select the firmware image that you want to update.

file

  1. Open a text editor such as Notepad++ to create a parameters.json JSON file with the following content:
{
      "Targets": [
                      "/redfish/v1/Managers/Self"
                  ]
}

parameters

  1. Create another oem_parameters.json JSON file with the following content:
{
      "FlashType":"UEFIUpdate",
      "UploadSelector":"Default"                    
}

oem_parameters

  1. Enter UpdateParameters as a KEY name, change the KEY type to File, and then select the parameters.json file you created in step 4.
  2. Enter OemParameters as another KEY name, change the KEY type to File, and then select the oem_parameters.json file you created in step 5.
  3. Click Send.

UEFI update

  1. If the request is successful, the response code status 202 Accepted will be displayed. The message body will be similar to the following example:

202 accepted

UEFI update status

In the response example above, /redfish/v1/TaskService/Tasks/1989 is the new task that has just been created. You can use the Get method to query the update status with the task ID.

Request URL

https://BMCIP/redfish/v1/TaskService/Task/ID

Response example

query BIOS status

query bios status2

Power actions

  1. Restart the server and perform the firmware inventory again. The BIOS version will have been updated.

You can also use the POST method to perform a system reset.

Request URL

https://BMCIP/redfish/v1/System/Self/Actions/ComputerSystem.Reset

Requested body of the POST action:

{"ResetType":"ForceRestart"}

Response example

If the action was successful, response status 202 will be returned with the following response body:

{
    "@odata.context": "/redfish/v1/$metadata#Task. Task(TaskState,Description,Name,Id)",
    "@odata.id": "/redfish/v1/TaskService/Tasks/1",
    "@odata.type": "#Task.v1_2_0.Task",
    "Description": "Task for Computer Reset",
    "Id": "1",  
    "Name": "Computer Reset",
    "TaskState": "New"
}

BMC updates

  1. Select the POST method, and then enter the following requested URL:

http://BMCIP/redfish/v1/UpdateService/upload

  1. In the Body tab for the POST action, select form-data , set the KEY name to UpdateFile , and change the KEY type to File .

POSTbody

  1. In the value section, select the firmware image that you want to update.

file

  1. Open a source code editor such as Notepad++ to create a parameters.json JSON file with the following content:
{
      "Targets": [
                      "/redfish/v1/Managers/Self"
                  ]
}

parameters

  1. Create another oem_parameters.json JSON file with the following content:
{
      "FlashType":"HPMFwUpdate",
      "UploadSelector":"Default"                     
}

parameters_bmc

  1. Enter UpdateParameters as a KEY name, change the KEY type to File, and then select the parameters.json file you created in step 4.
  2. Enter OemParameters as another KEY name, change the KEY type to File, and then select the oem_parameters.json file you created in step 5.
  3. Click Send.

BMC update

  1. If the request is successful, the response code status 202 Accepted will be displayed. The message body will be similar to the following example:

BMC_task

In the response example above, /redfish/v1/TaskService/Tasks/1991 is the new task that has just been created. You can use the Get method to query the update status with the task ID.

Request URL

https://BMCIP/redfish/v1/TaskService/Task/ID

Response example

BMC_Update status

  1. When the task state is complete and the ThinkSystem System Manager (BMC GUI) is accessible, the BMC version will be updated.

Video

Additional Information

Related Article

Document ID:HT511480
Original Publish Date:11/19/2020
Last Modified Date:03/25/2024