No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

FusionServer Tools 2.0 uREST User Guide 16

Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Universal Interface

Universal Interface

Function

Provide a universal interface.

For details about the path and usage of Redfish request resources, visit Huawei Server iBMC Redfish API Description.

Format

./urest -H HOST -p PORT -U USERNAME -P PASSWORD --timeout=TIMEOUT request -I URL -T {GET,POST,PATCH,DELETE} -B REQUESTBODYFILE -F FILE

Parameters

Parameter

Description

Value

HOST

Server iBMC IPv4/IPv6 address or domain name. It is a mandatory parameter.

NOTE:

If an IPv6 address is used, the IPv6 address must be included in square brackets, such as [1001::1001].

-

PORT

Port number. The default value is 443. It is an optional parameter.

If the actual port number is not 443, enter the actual port number.

USERNAME

iBMC administrator user name. It is a mandatory parameter.

-

PASSWORD

iBMC administrator password. It is a mandatory parameter.

-

TIMEOUT

Timeout interval for connecting to the iBMC Redfish interface. It is an optional parameter. The default timeout intervals corresponding to different request types are as follows:

  • GET: 30 seconds
  • POST: 300 seconds
  • PATCH: 120 seconds
  • DELETE: 10 seconds

The value ranges from 10 to 1000, and the unit is second.

URL

Request URL. It is a mandatory parameter.

Example:

URL format for querying the Redfish version: /redfish

{GET,POST,PATCH,DELETE}

Request type. It is a mandatory parameter.

The request types are as follows:

  • GET
  • POST
  • PATCH
  • DELETE

REQUESTBODYFILE

Request message body. It is a mandatory parameter when the request type is POST or PATCH. It is an optional parameter when the request type is GET or DELETE.

  • The value is in the format of Directory/File name.
  • The configuration file must be prepared in advance. The file must be a .json file or another file in the same format as a .json file (the file content is contained in {}).
  • To use the file upload function, you need to enter the absolute path of the file to be uploaded.
    • The file types supported by V3 boards are as follows: .hpm, .cer, .pem, .cert, .crt, .pfx, .p12, .xml, .keys, and .pub.
    • The file types supported by V5 boards are as follows: .hpm, .zip, .asc, .cer, .pem, .cert, .crt, .pfx, .p12, .xml, .keys, and .pub.
  • The maximum size of an .hpm file for a V3 board is 46 MB. The maximum size of an .hpm, .zip, or .asc file for a v5 board is 60 MB.
  • The maximum size of a .cer, .pem, .cert, .crt, .xml, or .p12 file is 1 MB. The maximum size of a .pfx or .keys file is 2 MB. The maximum size of a .pub file is 2 KB.

FILE

Path for storing the obtained request result on the local computer. It is an optional parameter.

The value is in the format of Directory/File name.

The file path cannot contain spaces. If the path contains spaces:

  • On Windows, add three double quotation marks (""") before and after the path, for example, -F """D:\\test config\\config.xml""".
  • On Linux, add a double quotation mark (") before and after the path, for example, -F "/home/test config/config.xml".

Usage Guidelines

None

Example

Obtain help information.

[root@localhost bin]# ./urest -H 10.10.10.10 -U ***** -P ***** request -h
usage: urest request [-h] -I URL -T {GET,POST,PATCH,DELETE}
                     [-B REQUESTBODYFILE] [-F FILE]
 
optional arguments:
  -h, --help            show this help message and exit
  -I URL                request URL, starting with /redfish/
  -T {GET,POST,PATCH,DELETE}
                        request type
  -B REQUESTBODYFILE    local file used to save the request body in JSON
                        format or path of the file to be uploaded
  -F FILE               local file used to export the result

Query Redfish version information by using a GET request.

[root@localhost bin]# ./urest -H 10.10.10.10-U ***** -P *****  request -I /redfish -T GET
{

    "v1": "/redfish/v1/"
}

Create a session by using a POST request.

[root@localhost bin]# ./urest -H 10.10.10.10 -U ***** -P *****  request -I /redfish/v1/SessionService/Sessions -T POST -B D:\yangnan\body.json
Location: /redfish/v1/SessionService/Sessions/8417b285bf6eb867
{
   
"@odata.type": "#Session.v1_0_2.Session",
   
"Name": "User Session",
   
"@odata.id": "/redfish/v1/SessionService/Sessions/8417b285bf6eb867",
   
"@odata.context":
"/redfish/v1/$metadata#Session.Session",
   
"Oem": {
       
"Huawei": {
           
"UserValidDays": null,
           
"UserId": 2,
           
"AccountInsecurePromptEnabled": false,
           
"MySession": true,
           
"UserRole": [
               
"Administrator"
            ],
           
"UserIP": "192.168.2.105",
           
"UserAccount": "Administrator",
           
"UserTag": "Redfish",
           
"LoginTime": "2018-05-22T23:48:17+02:00"
        }
    },
   
"Id": "8417b285bf6eb867"
}

Upload a file by using a POST request.

[root@localhost bin]# ./urest -H 10.10.10.10 -U ***** -P ***** request -I /redfish/v1/UpdateService/FirmwareInventory -T POST -B D:\yangnan\PAC900S12-BE_DCV126_PFCV126.hpm
{
    "error": {
        "@Message.ExtendedInfo": [
            {
                "@odata.type": "#MessageRegistry.1.0.0.MessageRegistry",
                "Severity": "Warning",
                "MessageId": "iBMC.0.1.0.Success",
                "RelatedProperties": [],
                "Message": "Successfully Completed Request.",
                "Resolution": "",
                "MessageArgs": []
            }
        ],
        "Message": "A general error has occurred. See ExtendedInfo for more information.",
        "code": "Base.1.0.GeneralError"
    }
}

Delete a user by using a DELETE request.

[root@localhost bin]# ./urest -H 10.10.10.10 -U ***** -P ***** request -I /redfish/v1/AccountService/Accounts/3 -T DELETE
{
    "error": {
        "@Message.ExtendedInfo": [
            {
                "@odata.type": "/redfish/v1/$metadata#MessageRegistry.1.0.0.MessageRegistry",
                "Severity": "OK",
                "MessageId": "Base.1.0.AccountRemoved",
                "RelatedProperties": [],
                "Message": "The account was successfully removed.",
                "Resolution": "No resolution is required.",
                "MessageArgs": []
            }
        ],
        "message": "A general error has occurred. See ExtendedInfo for more information.",
        "code": "Base.1.0.GeneralError"
    }
}

Set a user password by using a PATCH request.

[root@localhost bin]# ./urest -H 10.10.10.10 -U ***** -P *****  request -I /redfish/v1/AccountService/Accounts/5 -T PATCH -B D:\yangnan\body.json
{
    "@odata.type": "#ManagerAccount.v1_0_2.ManagerAccount",
    "UserName": "test5",
    "Locked": false,
    "Name": "User Account",
    "Links": {
        "Role": {
            "@odata.id": "/redfish/v1/AccountService/Roles/Administrator"
        }
    },
    "RoleId": "Administrator",
    "Enabled": true,
    "@odata.id": "/redfish/v1/AccountService/Accounts/5",
    "@odata.context": "/redfish/v1/$metadata#AccountService/Accounts/Members/$entity",
    "Oem": {
        "Huawei": {
            "LoginRule": [],
            "PasswordValidityDays": null,
            "SSHPublicKeyHash": null,
            "LoginInterface": [
                "Web",
                "SNMP",
                "IPMI",
                "SSH",
                "SFTP",
                "Local",
                "Redfish"
            ],
            "AccountInsecurePromptEnabled": true,
            "Actions": {
                "#Account.ImportSSHPublicKey": {
                    "target": "/redfish/v1/AccountService/Accounts/5/Oem/Huawei/Actions/Account.ImportSSHPublicKey",
                    "@Redfish.ActionInfo": "/redfish/v1/AccountService/Accounts/5/ImportSSHPublicKeyActionInfo"
                },
                "#Account.DeleteMutualAuthClientCert": {
                    "target": "/redfish/v1/AccountService/Accounts/5/Oem/Huawei/Actions/Account.DeleteMutualAuthClientCert",
                    "@Redfish.ActionInfo": "/redfish/v1/AccountService/Accounts/5/DeleteMutualAuthClientCertActionInfo"
                },
                "#Account.DeleteSSHPublicKey": {
                    "target": "/redfish/v1/AccountService/Accounts/5/Oem/Huawei/Actions/Account.DeleteSSHPublicKey",
                    "@Redfish.ActionInfo": "/redfish/v1/AccountService/Accounts/5/DeleteSSHPublicKeyActionInfo"
                },
                "#Account.ImportMutualAuthClientCert": {
                    "target": "/redfish/v1/AccountService/Accounts/5/Oem/Huawei/Actions/Account.ImportMutualAuthClientCert",
                    "@Redfish.ActionInfo": "/redfish/v1/AccountService/Accounts/5/ImportMutualAuthClientCertActionInfo"
                }
            },
            "MutualAuthClientCert": null
        }
    },
    "Password": null,
    "Id": "5"
}
Translation
Download
Updated: 2020-02-13

Document ID: EDOC1000176182

Views: 122091

Downloads: 591

Average rating:
This Document Applies to these Products

Related Version

Related Documents

Share
Previous Next