Sushil Singh | bb347bb | 2021-07-09 07:07:39 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Redfish request library which provide keywords for creating session, |
| 4 | ... sending POST, PUT, DELETE, PATCH, GET etc. request using redfish_request.py |
| 5 | ... library file. It also contain other keywords which uses redfish_request.py |
George Keishing | 4b72949 | 2021-11-10 12:51:10 -0600 | [diff] [blame] | 6 | ... library infrastructure. |
Sushil Singh | bb347bb | 2021-07-09 07:07:39 -0500 | [diff] [blame] | 7 | |
| 8 | Resource openbmc_ffdc.robot |
| 9 | Resource bmc_redfish_resource.robot |
| 10 | Resource rest_response_code.robot |
| 11 | Library redfish_request.py |
| 12 | |
| 13 | *** Keywords *** |
| 14 | |
| 15 | Redfish Generic Login Request |
| 16 | [Documentation] Do Redfish login request. |
| 17 | [Arguments] ${user_name} ${password} |
| 18 | |
| 19 | # Description of argument(s): |
| 20 | # user_name User name of BMC. |
| 21 | # password Password of BMC. |
| 22 | |
| 23 | ${client_id}= Create Dictionary ClientID=None |
| 24 | ${oem_data}= Create Dictionary OpenBMC=${client_id} |
| 25 | ${data}= Create Dictionary UserName=${user_name} Password=${password} Oem=${oem_data} |
| 26 | |
| 27 | Set Test Variable ${uri} /redfish/v1/SessionService/Sessions |
| 28 | ${resp}= Request_Login headers=None url=${uri} credential=${data} |
| 29 | Should Be Equal As Strings ${resp.status_code} ${HTTP_CREATED} |
| 30 | |
| 31 | [Return] ${resp} |
| 32 | |
| 33 | |
| 34 | Redfish Generic Session Request |
| 35 | [Documentation] Do Redfish login request and store the session details. |
| 36 | [Arguments] ${user_name} ${password} |
| 37 | |
| 38 | # Description of argument(s): |
| 39 | # user_name User name of BMC. |
| 40 | # password Password of BMC. |
| 41 | |
| 42 | ${session_dict}= Create Dictionary |
| 43 | ${session_resp}= Redfish Generic Login Request ${user_name} ${password} |
| 44 | |
| 45 | ${auth_token}= Create Dictionary X-Auth-Token ${session_resp.headers['X-Auth-Token']} |
| 46 | |
| 47 | Set To Dictionary ${session_dict} headers ${auth_token} |
| 48 | Set To Dictionary ${session_dict} Location ${session_resp.headers['Location']} |
| 49 | |
Sushil Singh | bb347bb | 2021-07-09 07:07:39 -0500 | [diff] [blame] | 50 | |
George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 51 | Set To Dictionary ${session_dict} Content ${session_resp.content} |
Sushil Singh | bb347bb | 2021-07-09 07:07:39 -0500 | [diff] [blame] | 52 | |
| 53 | Set Global Variable ${active_session_info} ${session_dict} |
| 54 | Append To List ${session_dict_list} ${session_dict} |
| 55 | |
| 56 | [Return] ${session_dict} |