blob: 4e66c5c45a03aeb74369bb10d4a8daab79f2c640 [file] [log] [blame]
Sushil Singhbb347bb2021-07-09 07:07:39 -05001*** Settings ***
2
3Documentation 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 Keishing4b729492021-11-10 12:51:10 -06006... library infrastructure.
Sushil Singhbb347bb2021-07-09 07:07:39 -05007
8Resource openbmc_ffdc.robot
9Resource bmc_redfish_resource.robot
10Resource rest_response_code.robot
11Library redfish_request.py
12
13*** Keywords ***
14
15Redfish 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
34Redfish 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
50 ${content}= To JSON ${session_resp.content}
51
52 Set To Dictionary ${session_dict} Content ${content}
53
54 Set Global Variable ${active_session_info} ${session_dict}
55 Append To List ${session_dict_list} ${session_dict}
56
57 [Return] ${session_dict}