| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** | 
|  | 2 | Library           Collections | 
|  | 3 | Library           String | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 4 | Library           RequestsLibrary | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 5 | Library           OperatingSystem | 
| Sandhya Somashekar | 839a0c2 | 2019-01-31 05:05:43 -0600 | [diff] [blame] | 6 | Resource          resource.robot | 
| George Keishing | eaa73b7 | 2018-07-30 09:30:16 -0500 | [diff] [blame] | 7 | Library           disable_warning_urllib.py | 
| Michael Walsh | ad66c95 | 2018-10-04 15:12:47 -0500 | [diff] [blame] | 8 | Library           utils.py | 
| Steven Sombar | b348924 | 2018-12-13 15:59:02 -0600 | [diff] [blame] | 9 | Library           gen_misc.py | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 10 | Library           var_funcs.py | 
| George Keishing | eaa73b7 | 2018-07-30 09:30:16 -0500 | [diff] [blame] | 11 | Resource          rest_response_code.robot | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 12 |  | 
|  | 13 | *** Variables *** | 
| Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 14 | # Assign default value to QUIET for programs which may not define it. | 
|  | 15 | ${QUIET}  ${0} | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 16 |  | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 17 | ${XAUTH_TOKEN}  ${EMPTY} | 
|  | 18 |  | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 19 | *** Keywords *** | 
|  | 20 | OpenBMC Get Request | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 21 | [Documentation]  Do REST GET request and return the result. | 
|  | 22 | # Example result data: | 
|  | 23 | # Response code:200, Content:{ | 
|  | 24 | #   "data": [ | 
|  | 25 | #     "/xyz/openbmc_project/state/host0", | 
|  | 26 | #     "/xyz/openbmc_project/state/chassis0", | 
|  | 27 | #     "/xyz/openbmc_project/state/bmc0" | 
|  | 28 | #   ], | 
|  | 29 | #   "message": "200 OK", | 
|  | 30 | #   "status": "ok" | 
|  | 31 | # } | 
| George Keishing | 41c44cf | 2017-11-15 08:02:59 -0600 | [diff] [blame] | 32 | [Arguments]    ${uri}    ${timeout}=30  ${quiet}=${QUIET}  &{kwargs} | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 33 | # Description of argument(s): | 
|  | 34 | # uri      The URI to establish connection with | 
|  | 35 | #          (e.g. '/xyz/openbmc_project/software/'). | 
|  | 36 | # timeout  Timeout in seconds to establish connection with URI. | 
|  | 37 | # quiet    If enabled, turns off logging to console. | 
|  | 38 | # kwargs   Any additional arguments to be passed directly to the | 
|  | 39 | #          Get Request call. For example, the caller might | 
|  | 40 | #          set kwargs as follows: | 
|  | 41 | #          ${kwargs}=  Create Dictionary  allow_redirect=${True}. | 
| Michael Walsh | f00edee | 2016-12-09 14:10:26 -0600 | [diff] [blame] | 42 |  | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 43 | Initialize OpenBMC  ${timeout}  quiet=${quiet} | 
|  | 44 |  | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 45 | ${base_uri}=    Catenate    SEPARATOR=    ${DBUS_PREFIX}    ${uri} | 
| George Keishing | 4f76cf6 | 2020-12-22 06:42:07 -0600 | [diff] [blame] | 46 | ${headers}=  Create Dictionary  X-Auth-Token=${XAUTH_TOKEN}  Accept=application/json | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 47 | Set To Dictionary  ${kwargs}  headers  ${headers} | 
| George Keishing | 0aaf06f | 2025-07-11 10:58:39 +0530 | [diff] [blame] | 48 | Run Keyword If  '${quiet}' == '${0}'  Log Request  method=Get | 
|  | 49 | ...  base_uri=${base_uri}  args=&{kwargs} | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 50 | ${resp}=  GET On Session  openbmc  ${base_uri}  &{kwargs}  timeout=${timeout}  expected_status=any | 
| George Keishing | 0aaf06f | 2025-07-11 10:58:39 +0530 | [diff] [blame] | 51 | Run Keyword If  '${quiet}' == '${0}'  Log Response  ${resp} | 
| George Keishing | 08540c0 | 2017-07-19 09:42:50 -0500 | [diff] [blame] | 52 | Delete All Sessions | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 53 | RETURN    ${resp} | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 54 |  | 
|  | 55 | OpenBMC Post Request | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 56 | [Documentation]  Do REST POST request and return the result. | 
|  | 57 | # Example result data: | 
|  | 58 | # <Response [200]> | 
| Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 59 | [Arguments]    ${uri}    ${timeout}=10  ${quiet}=${QUIET}  &{kwargs} | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 60 | # Description of argument(s): | 
|  | 61 | # uri      The URI to establish connection with | 
|  | 62 | #          (e.g. '/xyz/openbmc_project/software/'). | 
|  | 63 | # timeout  Timeout in seconds to establish connection with URI. | 
|  | 64 | # quiet    If enabled, turns off logging to console. | 
|  | 65 | # kwargs   Any additional arguments to be passed directly to the | 
|  | 66 | #          Post Request call. For example, the caller might | 
|  | 67 | #          set kwargs as follows: | 
|  | 68 | #          ${kwargs}=  Create Dictionary  allow_redirect=${True}. | 
| Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 69 |  | 
| Michael Walsh | f00edee | 2016-12-09 14:10:26 -0600 | [diff] [blame] | 70 | Initialize OpenBMC    ${timeout}  quiet=${quiet} | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 71 | ${base_uri}=    Catenate    SEPARATOR=    ${DBUS_PREFIX}    ${uri} | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 72 | ${headers}=  Create Dictionary   Content-Type=application/json | 
|  | 73 | ...  X-Auth-Token=${XAUTH_TOKEN} | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 74 | Set To Dictionary  ${kwargs}  headers  ${headers} | 
| George Keishing | 0aaf06f | 2025-07-11 10:58:39 +0530 | [diff] [blame] | 75 | Run Keyword If  '${quiet}' == '${0}'  Log Request  method=Post | 
|  | 76 | ...  base_uri=${base_uri}  args=&{kwargs} | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 77 | ${ret}=  POST On Session  openbmc  ${base_uri}  &{kwargs}  timeout=${timeout} | 
| George Keishing | 0aaf06f | 2025-07-11 10:58:39 +0530 | [diff] [blame] | 78 | Run Keyword If  '${quiet}' == '${0}'  Log Response  ${ret} | 
| George Keishing | 08540c0 | 2017-07-19 09:42:50 -0500 | [diff] [blame] | 79 | Delete All Sessions | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 80 | RETURN    ${ret} | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 81 |  | 
|  | 82 | OpenBMC Put Request | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 83 | [Documentation]  Do REST PUT request on the resource identified by the URI. | 
| Rahul Maheshwari | 79c1294 | 2016-10-17 09:39:17 -0500 | [diff] [blame] | 84 | [Arguments]    ${uri}    ${timeout}=10    &{kwargs} | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 85 | # Description of argument(s): | 
|  | 86 | # uri      The URI to establish connection with | 
|  | 87 | #          (e.g. '/xyz/openbmc_project/software/'). | 
|  | 88 | # timeout  Timeout in seconds to establish connection with URI. | 
|  | 89 | # kwargs   Arguments passed to the REST call. | 
|  | 90 | # kwargs   Any additional arguments to be passed directly to the | 
|  | 91 | #          Put Request call. For example, the caller might | 
|  | 92 | #          set kwargs as follows: | 
|  | 93 | #          ${kwargs}=  Create Dictionary  allow_redirect=${True}. | 
| Michael Walsh | f00edee | 2016-12-09 14:10:26 -0600 | [diff] [blame] | 94 |  | 
|  | 95 | Initialize OpenBMC    ${timeout} | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 96 | ${base_uri}=   Catenate    SEPARATOR=    ${DBUS_PREFIX}    ${uri} | 
|  | 97 | ${headers}=  Create Dictionary   Content-Type=application/json | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 98 | ...  X-Auth-Token=${XAUTH_TOKEN} | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 99 | Log Request  method=Put  base_uri=${base_uri}  args=&{kwargs} | 
|  | 100 | ${resp}=  PUT On Session  openbmc  ${base_uri}  json=${kwargs["data"]}  headers=${headers} | 
|  | 101 | Log Response    ${resp} | 
| George Keishing | 08540c0 | 2017-07-19 09:42:50 -0500 | [diff] [blame] | 102 | Delete All Sessions | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 103 | RETURN    ${resp} | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 104 |  | 
|  | 105 | OpenBMC Delete Request | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 106 | [Documentation]  Do REST request to delete the resource identified by the | 
|  | 107 | ...  URI. | 
| Michael Shepos | cc490b4 | 2020-08-26 12:53:01 -0500 | [diff] [blame] | 108 | [Arguments]    ${uri}    ${timeout}=10   ${quiet}=${QUIET}    &{kwargs} | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 109 | # Description of argument(s): | 
|  | 110 | # uri      The URI to establish connection with | 
|  | 111 | #          (e.g. '/xyz/openbmc_project/software/'). | 
|  | 112 | # timeout  Timeout in seconds to establish connection with URI. | 
| Michael Shepos | cc490b4 | 2020-08-26 12:53:01 -0500 | [diff] [blame] | 113 | # quiet    If enabled, turns off logging to console. | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 114 | # kwargs   Any additional arguments to be passed directly to the | 
|  | 115 | #          Delete Request call. For example, the caller might | 
|  | 116 | #          set kwargs as follows: | 
|  | 117 | #          ${kwargs}=  Create Dictionary  allow_redirect=${True}. | 
| Michael Walsh | f00edee | 2016-12-09 14:10:26 -0600 | [diff] [blame] | 118 |  | 
|  | 119 | Initialize OpenBMC    ${timeout} | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 120 | ${base_uri}=    Catenate    SEPARATOR=    ${DBUS_PREFIX}    ${uri} | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 121 | ${headers}=  Create Dictionary   Content-Type=application/json | 
|  | 122 | ...  X-Auth-Token=${XAUTH_TOKEN} | 
|  | 123 | Set To Dictionary   ${kwargs}  headers   ${headers} | 
| George Keishing | 0aaf06f | 2025-07-11 10:58:39 +0530 | [diff] [blame] | 124 | Run Keyword If  '${quiet}' == '${0}'  Log Request  method=Delete | 
|  | 125 | ...  base_uri=${base_uri}  args=&{kwargs} | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 126 | ${ret}=  DELETE On Session  openbmc  ${base_uri}  &{kwargs}  timeout=${timeout} | 
| George Keishing | 0aaf06f | 2025-07-11 10:58:39 +0530 | [diff] [blame] | 127 | Run Keyword If  '${quiet}' == '${0}'  Log Response    ${ret} | 
| George Keishing | 08540c0 | 2017-07-19 09:42:50 -0500 | [diff] [blame] | 128 | Delete All Sessions | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 129 | RETURN    ${ret} | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 130 |  | 
|  | 131 | Initialize OpenBMC | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 132 | [Documentation]  Do a REST login connection within specified time. | 
| George Keishing | 1cdc6dd | 2017-04-24 15:31:03 -0500 | [diff] [blame] | 133 | [Arguments]  ${timeout}=20  ${quiet}=${1} | 
| George Keishing | 7981f43 | 2023-11-15 23:49:16 +0530 | [diff] [blame] | 134 | ...  ${rest_username}=${OPENBMC_USERNAME} | 
|  | 135 | ...  ${rest_password}=${OPENBMC_PASSWORD} | 
| Michael Walsh | f00edee | 2016-12-09 14:10:26 -0600 | [diff] [blame] | 136 |  | 
| George Keishing | 1cdc6dd | 2017-04-24 15:31:03 -0500 | [diff] [blame] | 137 | # Description of argument(s): | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 138 | # timeout        REST login attempt time out. | 
|  | 139 | # quiet          Suppress console log if set. | 
|  | 140 | # rest_username  The REST username. | 
|  | 141 | # rest_password  The REST password. | 
|  | 142 |  | 
|  | 143 | ${bmcweb_status}=  Run Keyword And Return Status  BMC Web Login Request | 
|  | 144 | ...  ${timeout}  ${rest_username}  ${rest_password} | 
|  | 145 |  | 
|  | 146 | Return From Keyword If  ${bmcweb_status} == ${True} | 
| George Keishing | 1cdc6dd | 2017-04-24 15:31:03 -0500 | [diff] [blame] | 147 |  | 
| George Keishing | 1cdc6dd | 2017-04-24 15:31:03 -0500 | [diff] [blame] | 148 | # This will retry at 20 second interval. | 
|  | 149 | Wait Until Keyword Succeeds  40 sec  20 sec | 
|  | 150 | ...  Post Login Request  ${timeout}  ${quiet} | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 151 | ...  ${rest_username}  ${rest_password} | 
|  | 152 |  | 
|  | 153 |  | 
|  | 154 | BMC Web Login Request | 
|  | 155 | [Documentation]  Do BMC web-based login. | 
| George Keishing | 7981f43 | 2023-11-15 23:49:16 +0530 | [diff] [blame] | 156 | [Arguments]  ${timeout}=20  ${rest_username}=${OPENBMC_USERNAME} | 
|  | 157 | ...  ${rest_password}=${OPENBMC_PASSWORD} | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 158 |  | 
|  | 159 | # Description of argument(s): | 
|  | 160 | # timeout        REST login attempt time out. | 
|  | 161 | # rest_username  The REST username. | 
|  | 162 | # rest_password  The REST password. | 
|  | 163 |  | 
|  | 164 | Create Session  openbmc  ${AUTH_URI}  timeout=${timeout} | 
|  | 165 |  | 
|  | 166 | ${headers}=  Create Dictionary  Content-Type=application/json | 
|  | 167 | @{credentials}=  Create List  ${rest_username}  ${rest_password} | 
|  | 168 | ${data}=  Create Dictionary  data=@{credentials} | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 169 | ${resp}=  POST On Session  openbmc  /login  json=${data}  headers=${headers} | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 170 | Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK} | 
|  | 171 |  | 
|  | 172 | ${processed_token_data}= | 
|  | 173 | ...  Evaluate  re.split(r'[;,]', '${resp.headers["Set-Cookie"]}')  modules=re | 
|  | 174 | ${result}=  Key Value List To Dict  ${processed_token_data}  delim== | 
|  | 175 |  | 
|  | 176 | # Example result data: | 
|  | 177 | # 'XSRF-TOKEN=hQuOyDJFEIbrN4aOg2CT; Secure, | 
| Gunnar Mills | ecad51c | 2025-03-06 11:02:54 -0600 | [diff] [blame] | 178 | # BMCWEB-SESSION=c4wloTiETumSxPI9nLeg; Secure; HttpOnly' | 
| rramyasr-in | 1963a4b | 2025-04-16 04:58:05 -0500 | [diff] [blame] | 179 |  | 
|  | 180 | # To handle latest bmcweb token exceptions. | 
|  | 181 | ${session_token}= | 
|  | 182 | ...  Get Variable Value  ${result['bmcweb-session']}  ${result['session']} | 
|  | 183 | Set Global Variable  ${XAUTH_TOKEN}  ${session_token} | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 184 |  | 
| George Keishing | 1cdc6dd | 2017-04-24 15:31:03 -0500 | [diff] [blame] | 185 |  | 
|  | 186 | Post Login Request | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 187 | [Documentation]  Do REST login request. | 
| George Keishing | 1cdc6dd | 2017-04-24 15:31:03 -0500 | [diff] [blame] | 188 | [Arguments]  ${timeout}=20  ${quiet}=${1} | 
| George Keishing | 7981f43 | 2023-11-15 23:49:16 +0530 | [diff] [blame] | 189 | ...  ${rest_username}=${OPENBMC_USERNAME} | 
|  | 190 | ...  ${rest_password}=${OPENBMC_PASSWORD} | 
| George Keishing | 1cdc6dd | 2017-04-24 15:31:03 -0500 | [diff] [blame] | 191 |  | 
|  | 192 | # Description of argument(s): | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 193 | # timeout        REST login attempt time out. | 
|  | 194 | # quiet          Suppress console log if set. | 
|  | 195 | # rest_username  The REST username. | 
|  | 196 | # rest_password  The REST password. | 
| George Keishing | 1cdc6dd | 2017-04-24 15:31:03 -0500 | [diff] [blame] | 197 |  | 
|  | 198 | Create Session  openbmc  ${AUTH_URI}  timeout=${timeout}  max_retries=3 | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 199 |  | 
| Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 200 | ${headers}=  Create Dictionary  Content-Type=application/json | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 201 | @{credentials}=  Create List  ${rest_username}  ${rest_password} | 
| George Keishing | 695ffe8 | 2022-08-17 22:00:03 -0500 | [diff] [blame] | 202 | ${data}=  Create Dictionary   data=@{credentials} | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 203 | ${status}  ${resp}=  Run Keyword And Ignore Error  POST On Session  openbmc | 
| George Keishing | 695ffe8 | 2022-08-17 22:00:03 -0500 | [diff] [blame] | 204 | ...  /login  json=${data}  headers=${headers} | 
| Michael Walsh | f00edee | 2016-12-09 14:10:26 -0600 | [diff] [blame] | 205 |  | 
|  | 206 | Should Be Equal  ${status}  PASS  msg=${resp} | 
|  | 207 | Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK} | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 208 |  | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 209 |  | 
| George Keishing | e822552 | 2017-03-31 09:21:13 -0500 | [diff] [blame] | 210 | Log Out OpenBMC | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 211 | [Documentation]  Log out of the openbmc REST session. | 
| George Keishing | e822552 | 2017-03-31 09:21:13 -0500 | [diff] [blame] | 212 |  | 
|  | 213 | ${headers}=  Create Dictionary  Content-Type=application/json | 
| Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 214 | ...  X-Auth-Token=${XAUTH_TOKEN} | 
| George Keishing | e822552 | 2017-03-31 09:21:13 -0500 | [diff] [blame] | 215 | ${data}=  Create dictionary  data=@{EMPTY} | 
|  | 216 |  | 
| George Keishing | e16f158 | 2022-12-15 07:32:21 -0600 | [diff] [blame] | 217 | # If there is no active session it will throw the following exception | 
| George Keishing | e822552 | 2017-03-31 09:21:13 -0500 | [diff] [blame] | 218 | # "Non-existing index or alias 'openbmc'" | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 219 | ${resp}=  POST On Session  openbmc | 
| George Keishing | 695ffe8 | 2022-08-17 22:00:03 -0500 | [diff] [blame] | 220 | ...  /logout  json=${data}  headers=${headers} | 
| George Keishing | e822552 | 2017-03-31 09:21:13 -0500 | [diff] [blame] | 221 |  | 
|  | 222 | Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK} | 
|  | 223 | ...  msg=${resp} | 
|  | 224 |  | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 225 |  | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 226 | Log Request | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 227 | [Documentation]  Log the specific REST URI, method name on the console. | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 228 | [Arguments]    &{kwargs} | 
| Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 229 | ${msg}=  Catenate  SEPARATOR=  URI:  ${AUTH_URI}  ${kwargs["base_uri"]} | 
|  | 230 | ...  , method:  ${kwargs["method"]}  , args:  ${kwargs["args"]} | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 231 | Logging    ${msg}    console=True | 
|  | 232 |  | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 233 |  | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 234 | Log Response | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 235 | [Documentation]  Log the response code on the console. | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 236 | [Arguments]    ${resp} | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 237 |  | 
| Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 238 | ${msg}=  Catenate  SEPARATOR=  Response code:  ${resp.status_code} | 
|  | 239 | ...  , Content:  ${resp.content} | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 240 | Logging    ${msg}    console=True | 
|  | 241 |  | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 242 |  | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 243 | Logging | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 244 | [Documentation]  Log the specified message on the console. | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 245 | [Arguments]    ${msg}    ${console}=default False | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 246 | Log  ${msg}  console=True | 
|  | 247 |  | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 248 |  | 
|  | 249 | Read Attribute | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 250 | [Documentation]  Retrieve attribute value from URI and return result. | 
|  | 251 | # Example result data for the attribute 'FieldModeEnabled' in | 
|  | 252 | # "/xyz/openbmc_project/software/attr/" : | 
|  | 253 | # 0 | 
| Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 254 | [Arguments]    ${uri}    ${attr}    ${timeout}=10  ${quiet}=${QUIET} | 
| manasarm | c505e38 | 2018-02-05 14:05:48 +0530 | [diff] [blame] | 255 | ...  ${expected_value}=${EMPTY} | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 256 | # Description of argument(s): | 
|  | 257 | # uri               URI of the object that the attribute lives on | 
|  | 258 | #                   (e.g. '/xyz/openbmc_project/software/'). | 
|  | 259 | # attr              Name of the attribute (e.g. 'FieldModeEnabled'). | 
|  | 260 | # timeout           Timeout for the REST call. | 
|  | 261 | # quiet             If enabled, turns off logging to console. | 
| manasarm | c505e38 | 2018-02-05 14:05:48 +0530 | [diff] [blame] | 262 | # expected_value    If this argument is not empty, the retrieved value | 
|  | 263 | #                   must match this value. | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 264 |  | 
| Steven Sombar | b348924 | 2018-12-13 15:59:02 -0600 | [diff] [blame] | 265 | # Make sure uri ends with slash. | 
|  | 266 | ${uri}=  Add Trailing Slash  ${uri} | 
|  | 267 |  | 
|  | 268 | ${resp}=  OpenBMC Get Request  ${uri}attr/${attr}  timeout=${timeout} | 
| Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 269 | ...  quiet=${quiet} | 
| Michael Walsh | 9cd6193 | 2017-01-17 16:11:02 -0600 | [diff] [blame] | 270 | Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK} | 
| George Keishing | 0aaf06f | 2025-07-11 10:58:39 +0530 | [diff] [blame] | 271 | Run Keyword If  '${expected_value}' != '${EMPTY}' | 
|  | 272 | ...  Should Be Equal As Strings  ${expected_value}  ${resp.json()["data"]} | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 273 | RETURN    ${resp.json()["data"]} | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 274 |  | 
| Charles Paul Hofer | f45e5ee | 2017-10-04 12:15:48 -0500 | [diff] [blame] | 275 |  | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 276 | Write Attribute | 
| Charles Paul Hofer | f45e5ee | 2017-10-04 12:15:48 -0500 | [diff] [blame] | 277 | [Documentation]  Write a D-Bus attribute with REST. | 
|  | 278 | [Arguments]  ${uri}  ${attr}  ${timeout}=10  ${verify}=${FALSE} | 
|  | 279 | ...  ${expected_value}=${EMPTY}  &{kwargs} | 
|  | 280 |  | 
|  | 281 | # Description of argument(s): | 
|  | 282 | # uri               URI of the object that the attribute lives on | 
|  | 283 | #                   (e.g. '/xyz/openbmc_project/software/'). | 
|  | 284 | # attr              Name of the attribute (e.g. 'FieldModeEnabled'). | 
|  | 285 | # timeout           Timeout for the REST call. | 
|  | 286 | # verify            If set to ${TRUE}, the attribute will be read back to | 
|  | 287 | #                   ensure that its value is set to ${verify_attr}. | 
|  | 288 | # expected_value    Only used if verify is set to ${TRUE}. The value that | 
|  | 289 | #                   ${attr} should be set to. This defaults to | 
|  | 290 | #                   ${kwargs['data']. There are cases where the caller | 
|  | 291 | #                   expects some other value in which case this value can | 
|  | 292 | #                   be explicitly specified. | 
|  | 293 | # kwargs            Arguments passed to the REST call. This should always | 
|  | 294 | #                   contain the value to set the property to at the 'data' | 
|  | 295 | #                   key (e.g. data={"data": 1}). | 
|  | 296 |  | 
| George Keishing | df3e65f | 2018-12-18 13:06:56 -0600 | [diff] [blame] | 297 | # Make sure uri ends with slash. | 
|  | 298 | ${uri}=  Add Trailing Slash  ${uri} | 
|  | 299 |  | 
| Charles Paul Hofer | f45e5ee | 2017-10-04 12:15:48 -0500 | [diff] [blame] | 300 | ${base_uri}=  Catenate  SEPARATOR=  ${DBUS_PREFIX}  ${uri} | 
| George Keishing | df3e65f | 2018-12-18 13:06:56 -0600 | [diff] [blame] | 301 | ${resp}=  Openbmc Put Request  ${base_uri}attr/${attr} | 
| Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 302 | ...  timeout=${timeout}  &{kwargs} | 
| Charles Paul Hofer | f45e5ee | 2017-10-04 12:15:48 -0500 | [diff] [blame] | 303 | Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK} | 
|  | 304 |  | 
|  | 305 | # Verify the attribute was set correctly if the caller requested it. | 
|  | 306 | Return From Keyword If  ${verify} == ${FALSE} | 
|  | 307 |  | 
|  | 308 | ${expected_value}=  Set Variable If  '${expected_value}' == '${EMPTY}' | 
| Charles Paul Hofer | 00401e7 | 2017-10-31 11:42:30 -0500 | [diff] [blame] | 309 | ...  ${kwargs['data']['data']}  ${expected_value} | 
| Charles Paul Hofer | f45e5ee | 2017-10-04 12:15:48 -0500 | [diff] [blame] | 310 | ${value}=  Read Attribute  ${uri}  ${attr} | 
|  | 311 | Should Be Equal  ${value}  ${expected_value} | 
|  | 312 |  | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 313 | Read Properties | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 314 | [Documentation]  Read data part of the URI object and return result. | 
|  | 315 | # Example result data: | 
|  | 316 | # [u'/xyz/openbmc_project/software/cf7bf9d5', | 
|  | 317 | #  u'/xyz/openbmc_project/software/5ecb8b2c', | 
|  | 318 | #  u'/xyz/openbmc_project/software/active', | 
|  | 319 | #  u'/xyz/openbmc_project/software/functional'] | 
| George Keishing | 335f536 | 2017-06-30 15:11:20 -0500 | [diff] [blame] | 320 | [Arguments]  ${uri}  ${timeout}=10  ${quiet}=${QUIET} | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 321 | # Description of argument(s): | 
|  | 322 | # uri               URI of the object | 
|  | 323 | #                   (e.g. '/xyz/openbmc_project/software/'). | 
|  | 324 | # timeout           Timeout for the REST call. | 
|  | 325 | # quiet             If enabled, turns off logging to console. | 
|  | 326 |  | 
| George Keishing | 335f536 | 2017-06-30 15:11:20 -0500 | [diff] [blame] | 327 | ${resp}=  OpenBMC Get Request  ${uri}  timeout=${timeout}  quiet=${quiet} | 
|  | 328 | Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK} | 
| Michael Walsh | ad66c95 | 2018-10-04 15:12:47 -0500 | [diff] [blame] | 329 |  | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 330 | RETURN  ${resp.json()["data"]} | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 331 |  | 
|  | 332 | Call Method | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 333 | [Documentation]  Invoke the specific REST service method. | 
| Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 334 | [Arguments]  ${uri}  ${method}  ${timeout}=10  ${quiet}=${QUIET}  &{kwargs} | 
| manasarm | 604b8cd | 2018-01-29 12:14:20 +0530 | [diff] [blame] | 335 | # Description of arguments: | 
|  | 336 | # uri      The URI to establish connection with | 
|  | 337 | #          (e.g. '/xyz/openbmc_project/software/'). | 
|  | 338 | # timeout  Timeout in seconds to establish connection with URI. | 
|  | 339 | # quiet    If enabled, turns off logging to console. | 
|  | 340 | # kwargs   Arguments passed to the REST call. | 
| Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 341 |  | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 342 | ${base_uri}=    Catenate    SEPARATOR=    ${DBUS_PREFIX}    ${uri} | 
| George Keishing | 5c231a8 | 2019-02-05 09:02:04 -0600 | [diff] [blame] | 343 | ${resp}=  OpenBmc Post Request  ${base_uri}action/${method} | 
| Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 344 | ...  timeout=${timeout}  quiet=${quiet}  &{kwargs} | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 345 | RETURN    ${resp} | 
| Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 346 |  | 
| Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 347 |  | 
| Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 348 | Upload Image To BMC | 
| Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 349 | [Documentation]  Upload image to BMC via REST and return status code. | 
|  | 350 | [Arguments]  ${uri}  ${timeout}=10  ${quiet}=${1} | 
| Sushil Singh | c08df05 | 2020-03-30 00:39:22 -0500 | [diff] [blame] | 351 | ...  ${valid_status_codes}=[${HTTP_OK}, ${HTTP_ACCEPTED}]  &{kwargs} | 
| Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 352 |  | 
|  | 353 | # Description of argument(s): | 
| Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 354 | # uri                           URI for uploading image via REST e.g. | 
|  | 355 | #                               "/upload/image". | 
|  | 356 | # timeout                       Time allocated for the REST command to | 
|  | 357 | #                               return status (specified in Robot | 
|  | 358 | #                               Framework Time Format e.g. "3 mins"). | 
|  | 359 | # quiet                         If enabled, turns off logging to console. | 
|  | 360 | # valid_status_codes            A list of status codes that are valid for | 
|  | 361 | #                               the REST post command. This can be | 
|  | 362 | #                               specified as a string the evaluates to a | 
|  | 363 | #                               python object (e.g. [${HTTP_OK}]). | 
|  | 364 | # kwargs                        A dictionary keys/values to be passed | 
|  | 365 | #                               directly to Post Request. | 
| Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 366 |  | 
| George Keishing | badd1fc | 2025-02-05 23:00:05 +0530 | [diff] [blame] | 367 |  | 
|  | 368 | # If /redfish/v1/SessionService/Sessions POST fails, fallback to | 
|  | 369 | # REST /login method. | 
|  | 370 | ${passed}=  Run Keyword And Return Status   Redfish Login | 
| George Keishing | 0aaf06f | 2025-07-11 10:58:39 +0530 | [diff] [blame] | 371 | Run Keyword If  ${passed} != True   Initialize OpenBMC  ${timeout}  quiet=${quiet} | 
| George Keishing | badd1fc | 2025-02-05 23:00:05 +0530 | [diff] [blame] | 372 | ${session_object}=  Set Variable If  ${passed}  redfish  openbmc | 
|  | 373 |  | 
| Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 374 | ${base_uri}=  Catenate  SEPARATOR=  ${DBUS_PREFIX}  ${uri} | 
|  | 375 | ${headers}=  Create Dictionary  Content-Type=application/octet-stream | 
| George Keishing | 4f76cf6 | 2020-12-22 06:42:07 -0600 | [diff] [blame] | 376 | ...  X-Auth-Token=${XAUTH_TOKEN}  Accept=application/json | 
| Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 377 | Set To Dictionary  ${kwargs}  headers  ${headers} | 
| George Keishing | 0aaf06f | 2025-07-11 10:58:39 +0530 | [diff] [blame] | 378 | Run Keyword If  '${quiet}' == '${0}'  Log Request  method=Post | 
|  | 379 | ...  base_uri=${base_uri}  args=&{kwargs} | 
| George Keishing | badd1fc | 2025-02-05 23:00:05 +0530 | [diff] [blame] | 380 | ${ret}=  POST On Session  ${session_object}  ${base_uri}  &{kwargs}  timeout=${timeout} | 
| George Keishing | 0aaf06f | 2025-07-11 10:58:39 +0530 | [diff] [blame] | 381 | Run Keyword If  '${quiet}' == '${0}'  Log Response  ${ret} | 
| Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 382 | Valid Value  ret.status_code  ${valid_status_codes} | 
| George Keishing | 08540c0 | 2017-07-19 09:42:50 -0500 | [diff] [blame] | 383 | Delete All Sessions | 
| Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 384 |  | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 385 | RETURN  ${ret} | 
| Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 386 |  | 
| George Keishing | f4a4397 | 2020-06-29 03:55:38 -0500 | [diff] [blame] | 387 |  | 
|  | 388 | Redfish Login | 
|  | 389 | [Documentation]  Do BMC web-based login. | 
| George Keishing | 7981f43 | 2023-11-15 23:49:16 +0530 | [diff] [blame] | 390 | [Arguments]  ${timeout}=20  ${rest_username}=${OPENBMC_USERNAME} | 
|  | 391 | ...  ${rest_password}=${OPENBMC_PASSWORD}  ${kwargs}=${EMPTY} | 
| George Keishing | f4a4397 | 2020-06-29 03:55:38 -0500 | [diff] [blame] | 392 |  | 
|  | 393 | # Description of argument(s): | 
|  | 394 | # timeout        REST login attempt time out. | 
|  | 395 | # rest_username  The REST username. | 
|  | 396 | # rest_password  The REST password. | 
|  | 397 | # kwargs   Any additional arguments to be passed directly to the | 
|  | 398 | #          Get Request call. For example, the caller might | 
|  | 399 | #          set kwargs as follows: | 
|  | 400 | #          ${kwargs}=  Create Dictionary  allow_redirect=${True}. | 
|  | 401 |  | 
| George Keishing | 566daaf | 2020-07-02 06:18:50 -0500 | [diff] [blame] | 402 | Create Session  redfish  ${AUTH_URI}  timeout=${timeout} | 
| George Keishing | f4a4397 | 2020-06-29 03:55:38 -0500 | [diff] [blame] | 403 | ${headers}=  Create Dictionary  Content-Type=application/json | 
|  | 404 | ${data}=  Set Variable If  '${kwargs}' == '${EMPTY}' | 
|  | 405 | ...    {"UserName":"${rest_username}", "Password":"${rest_password}"} | 
|  | 406 | ...    {"UserName":"${rest_username}", "Password":"${rest_password}", ${kwargs}} | 
|  | 407 |  | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 408 | ${resp}=  POST On Session  redfish  /redfish/v1/SessionService/Sessions | 
| George Keishing | f4a4397 | 2020-06-29 03:55:38 -0500 | [diff] [blame] | 409 | ...  data=${data}  headers=${headers} | 
|  | 410 | Should Be Equal As Strings  ${resp.status_code}  ${HTTP_CREATED} | 
|  | 411 |  | 
|  | 412 | Set Global Variable  ${XAUTH_TOKEN}  ${resp.headers["X-Auth-Token"]} | 
|  | 413 |  | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 414 | RETURN  ${resp.json()} | 
| George Keishing | 566daaf | 2020-07-02 06:18:50 -0500 | [diff] [blame] | 415 |  | 
|  | 416 |  | 
| Sushil Singh | 4ec68ba | 2020-09-11 09:16:43 -0500 | [diff] [blame] | 417 | Redfish Get Request | 
|  | 418 | [Documentation]  Do REST POST request and return the result. | 
|  | 419 | [Arguments]  ${uri}  ${timeout}=10  ${quiet}=${QUIET}  &{kwargs} | 
|  | 420 |  | 
|  | 421 | # Description of argument(s): | 
|  | 422 | # uri      The URI to establish connection with | 
|  | 423 | #          (e.g. '/xyz/openbmc_project/software/'). | 
|  | 424 | # timeout  Timeout in seconds to establish connection with URI. | 
|  | 425 | # quiet    If enabled, turns off logging to console. | 
|  | 426 | # kwargs   Any additional arguments to be passed directly to the | 
|  | 427 | #          Post Request call. For example, the caller might | 
|  | 428 | #          set kwargs as follows: | 
|  | 429 | #          ${kwargs}=  Create Dictionary  allow_redirect=${True}. | 
|  | 430 |  | 
|  | 431 | ${base_uri}=  Catenate  SEPARATOR=  ${DBUS_PREFIX}  ${uri} | 
|  | 432 | ${headers}=  Create Dictionary  Content-Type=application/json  X-Auth-Token=${XAUTH_TOKEN} | 
|  | 433 | Set To Dictionary   ${kwargs}  headers  ${headers} | 
| George Keishing | 0aaf06f | 2025-07-11 10:58:39 +0530 | [diff] [blame] | 434 | Run Keyword If  '${quiet}' == '${0}'  Log Request  method=Post  base_uri=${base_uri}  args=&{kwargs} | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 435 | ${resp}=  GET On Session  redfish  ${base_uri}  &{kwargs}  timeout=${timeout} | 
| George Keishing | 0aaf06f | 2025-07-11 10:58:39 +0530 | [diff] [blame] | 436 | Run Keyword If  '${quiet}' == '${0}'  Log Response  ${resp} | 
| Sushil Singh | 4ec68ba | 2020-09-11 09:16:43 -0500 | [diff] [blame] | 437 |  | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 438 | RETURN  ${resp} | 
| Sushil Singh | 4ec68ba | 2020-09-11 09:16:43 -0500 | [diff] [blame] | 439 |  | 
|  | 440 |  | 
| George Keishing | 566daaf | 2020-07-02 06:18:50 -0500 | [diff] [blame] | 441 | Redfish Post Request | 
|  | 442 | [Documentation]  Do REST POST request and return the result. | 
|  | 443 | [Arguments]  ${uri}  ${timeout}=10  ${quiet}=${QUIET}  &{kwargs} | 
|  | 444 |  | 
|  | 445 | # Description of argument(s): | 
|  | 446 | # uri      The URI to establish connection with | 
|  | 447 | #          (e.g. '/xyz/openbmc_project/software/'). | 
|  | 448 | # timeout  Timeout in seconds to establish connection with URI. | 
|  | 449 | # quiet    If enabled, turns off logging to console. | 
|  | 450 | # kwargs   Any additional arguments to be passed directly to the | 
|  | 451 | #          Post Request call. For example, the caller might | 
|  | 452 | #          set kwargs as follows: | 
|  | 453 | #          ${kwargs}=  Create Dictionary  allow_redirect=${True}. | 
|  | 454 |  | 
|  | 455 | ${base_uri}=  Catenate  SEPARATOR=  ${DBUS_PREFIX}  ${uri} | 
|  | 456 | ${headers}=  Create Dictionary  Content-Type=application/json  X-Auth-Token=${XAUTH_TOKEN} | 
|  | 457 | Set To Dictionary   ${kwargs}  headers  ${headers} | 
| George Keishing | 0aaf06f | 2025-07-11 10:58:39 +0530 | [diff] [blame] | 458 | Run Keyword If  '${quiet}' == '${0}'  Log Request  method=Post  base_uri=${base_uri}  args=&{kwargs} | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 459 | ${resp}=  POST On Session  redfish  ${base_uri}  &{kwargs}  timeout=${timeout}  expected_status=any | 
| George Keishing | 0aaf06f | 2025-07-11 10:58:39 +0530 | [diff] [blame] | 460 | Run Keyword If  '${quiet}' == '${0}'  Log Response  ${resp} | 
| George Keishing | 566daaf | 2020-07-02 06:18:50 -0500 | [diff] [blame] | 461 |  | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 462 | RETURN  ${resp} |