Robotframework request package upgrade changes
Current working package version
robotframework-requests 0.7.2
To Test:
pip3 install robotframework-requests -U
or
# Once this commit is merged.
pip3 install -r requirements.txt
Version latest:
robotframework-requests 0.9.3
Refer Documentation:
https://marketsquare.github.io/robotframework-requests/doc/RequestsLibrary.html
What is not changed:
- The test cases under directory tests/ is not modified and is
deprecated but you can continue using it with older package
and configuration using
git clone -b v3.0-stable https://github.com/openbmc/openbmc-test-automation
Tested:
Upstream HW_CI test list, firmware code update and few other
test suite like ipmi, certificate, dumps, ffdc and redfish
test suites.
Note: I have not tested end to end, so it is likely there could be
grey areas where it could fail but should be minor w.r.t
response data format.
Resolves: openbmc/openbmc-test-automation#2105
Change-Id: Ie03b25ff88948bcccb09e9d82f8da86e28c92697
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/redfish/dmtf_tools/test_redfishtool_certificate.robot b/redfish/dmtf_tools/test_redfishtool_certificate.robot
index 5c84b62..63d0280 100644
--- a/redfish/dmtf_tools/test_redfishtool_certificate.robot
+++ b/redfish/dmtf_tools/test_redfishtool_certificate.robot
@@ -6,6 +6,7 @@
Library OperatingSystem
Library String
Library Collections
+Library JSONLibrary
Resource ../../lib/resource.robot
Resource ../../lib/bmc_redfish_resource.robot
@@ -284,8 +285,8 @@
[Documentation] Delete all CA certificate via Redfish.
${cmd_output}= Redfishtool Get /redfish/v1/Managers/bmc/Truststore/Certificates
- ${json_object}= To JSON ${cmd_output}
- ${cert_list}= Set Variable ${json_object["Members"]}
+ ${cmd_output}= Convert String to JSON ${cmd_output}
+ ${cert_list}= Set Variable ${cmd_output["Members"]}
FOR ${cert} IN @{cert_list}
Redfishtool Delete ${cert["@odata.id"]} ${root_cmd_args}
END
@@ -333,14 +334,13 @@
... X-Auth-Token=${XAUTH_TOKEN}
Set To Dictionary ${kwargs} headers ${headers}
- ${ret}= Post Request openbmc ${uri} &{kwargs}
- ${content_json}= To JSON ${ret.content}
- ${cert_id}= Set Variable If '${ret.status_code}' == '${HTTP_OK}' ${content_json["Id"]} -1
+ ${resp}= POST On Session openbmc ${uri} &{kwargs}
+ ${cert_id}= Set Variable If '${resp.status_code}' == '${HTTP_OK}' ${resp.json()["Id"]} -1
Run Keyword If '${status}' == 'ok'
- ... Should Be Equal As Strings ${ret.status_code} ${HTTP_OK}
+ ... Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
... ELSE IF '${status}' == 'error'
- ... Should Be Equal As Strings ${ret.status_code} ${HTTP_INTERNAL_SERVER_ERROR}
+ ... Should Be Equal As Strings ${resp.status_code} ${HTTP_INTERNAL_SERVER_ERROR}
Delete All Sessions
@@ -409,9 +409,10 @@
${rc} ${cmd_output}= Run and Return RC and Output ${cmd_args} GET ${uri}
Run Keyword If ${rc} != 0 Is HTTP error Expected ${cmd_output} ${expected_error}
- ${json_object}= To JSON ${cmd_output}
- [Return] ${json_object["CertificateString"]}
+ ${cmd_output}= Convert String to JSON ${cmd_output}
+
+ [Return] ${cmd_output["CertificateString"]}
Suite Setup Execution
diff --git a/redfish/dmtf_tools/test_redfishtool_local_user.robot b/redfish/dmtf_tools/test_redfishtool_local_user.robot
index a27d339..5b0ca54 100644
--- a/redfish/dmtf_tools/test_redfishtool_local_user.robot
+++ b/redfish/dmtf_tools/test_redfishtool_local_user.robot
@@ -249,24 +249,6 @@
[return] ${status}
-Redfishtool GetAttribute
- [Documentation] Execute redfishtool for GET operation.
- [Arguments] ${uri} ${Attribute} ${cmd_args}=${root_cmd_args} ${expected_error}=""
-
- # Description of argument(s):
- # uri URI for GET operation (e.g. /redfish/v1/AccountService/Accounts/).
- # Attribute The specific attribute to be retrieved with the URI.
- # cmd_args Commandline arguments.
- # expected_error Expected error optionally provided in testcase (e.g. 401 /
- # authentication error, etc. ).
-
- ${rc} ${cmd_output}= Run and Return RC and Output ${cmd_args} GET ${uri}
- Run Keyword If ${rc} != 0 Is HTTP error Expected ${cmd_output} ${expected_error}
- ${json_object}= To JSON ${cmd_output}
-
- [Return] ${json_object["${Attribute}"]}
-
-
Suite Setup Execution
[Documentation] Do suite setup execution.
diff --git a/redfish/service_root/test_service_root.robot b/redfish/service_root/test_service_root.robot
index 5c378c5..f5c03ce 100644
--- a/redfish/service_root/test_service_root.robot
+++ b/redfish/service_root/test_service_root.robot
@@ -64,8 +64,9 @@
${headers}= Create Dictionary Content-Type=application/json
... X-Auth-Token=deadbeef
- ${resp}= Get Request
+ ${resp}= GET On Session
... openbmc /redfish/v1/SessionService/Sessions headers=${headers}
+ ... expected_status=${HTTP_UNAUTHORIZED}
Should Be Equal As Strings ${resp.status_code} ${HTTP_UNAUTHORIZED}
@@ -106,15 +107,14 @@
Create Session openbmc https://${OPENBMC_HOST}
${headers}= Create Dictionary Content-Type=application/json
- ${data}= Create Dictionary UserName=${OPENBMC_USERNAME} Password=${OPENBMC_PASSWORD}
+ ${data}= Set Variable {"UserName":"${OPENBMC_USERNAME}", "Password":"${OPENBMC_PASSWORD}"}
- ${resp}= Post Request openbmc /redfish/v1/SessionService/Sessions data=${data} headers=${headers}
+ ${resp}= POST On Session openbmc /redfish/v1/SessionService/Sessions data=${data} headers=${headers}
Should Be Equal As Strings ${resp.status_code} ${HTTP_CREATED}
- ${content}= To JSON ${resp.content}
${headers}= Create Dictionary Content-Type=application/json
... X-Auth-Token=${resp.headers["X-Auth-Token"]}
- ${resp}= Delete Request openbmc ${REDFISH_SESSION}${/}${content["Id"]} headers=${headers}
+ ${resp}= DELETE On Session openbmc ${REDFISH_SESSION}${/}${resp.json()["Id"]} headers=${headers}
Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
diff --git a/redfish/service_root/test_service_root_security.robot b/redfish/service_root/test_service_root_security.robot
index c0a8d89..0686d6f 100644
--- a/redfish/service_root/test_service_root_security.robot
+++ b/redfish/service_root/test_service_root_security.robot
@@ -46,7 +46,7 @@
${headers}= Create Dictionary Content-Type=application/json
Run Keyword And Expect Error *Connection refused*
- ... Post Request openbmc /redfish/v1/SessionService/Sessions
+ ... POST On Session openbmc /redfish/v1/SessionService/Sessions
... data=${data} headers=${headers}
@@ -61,7 +61,7 @@
${headers}= Create Dictionary Content-Type=application/json
Run Keyword And Expect Error *Connection refused*
- ... Post Request openbmc /redfish/v1/SessionService/Sessions
+ ... POST On Session openbmc /redfish/v1/SessionService/Sessions
... data=${data} headers=${headers}
diff --git a/redfish/systems/eventlog/test_association.robot b/redfish/systems/eventlog/test_association.robot
index 3dc8d79..093aff0 100755
--- a/redfish/systems/eventlog/test_association.robot
+++ b/redfish/systems/eventlog/test_association.robot
@@ -45,10 +45,9 @@
Create Test Error With Callout
${elog_entry}= Get Elog URL List
${resp}= OpenBMC Get Request ${elog_entry[0]}
- ${jsondata}= To JSON ${resp.content}
List Should Contain Value
- ... ${jsondata["data"]["AdditionalData"]} CALLOUT_DEVICE_PATH_TEST=${target_device_path}
- List Should Contain Value ${jsondata["data"]["AdditionalData"]} DEV_ADDR=0x0DEADEAD
+ ... ${resp.json()["data"]["AdditionalData"]} CALLOUT_DEVICE_PATH_TEST=${target_device_path}
+ List Should Contain Value ${resp.json()["data"]["AdditionalData"]} DEV_ADDR=0x0DEADEAD
Create Test Error Callout And Verify Associations
@@ -67,11 +66,10 @@
Create Test Error With Callout
${elog_entry}= Get Elog URL List
${resp}= OpenBMC Get Request ${elog_entry[0]}
- ${jsondata}= To JSON ${resp.content}
- List Should Contain Value ${jsondata["data"]["Associations"][0]} callout
- List Should Contain Value ${jsondata["data"]["Associations"][0]} fault
+ List Should Contain Value ${resp.json()["data"]["Associations"][0]} callout
+ List Should Contain Value ${resp.json()["data"]["Associations"][0]} fault
List Should Contain Value
- ... ${jsondata["data"]["Associations"][0]}
+ ... ${resp.json()["data"]["Associations"][0]}
... /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
@@ -200,8 +198,7 @@
Create Test Error With Callout
${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
${resp}= OpenBMC Get Request ${elog_entry[0]}
- ${jsondata}= To JSON ${resp.content}
- Should Contain ${jsondata["data"]["Associations"][0]} callout
+ Should Contain ${resp.json()["data"]["Associations"][0]} callout
# Set the error log field "Resolved".
# By doing so, the callout object should get deleted automatically.
@@ -260,12 +257,11 @@
[Documentation] Verify test error log entries.
${elog_entry}= Get Elog URL List
${resp}= OpenBMC Get Request ${elog_entry[0]}
- ${json}= To JSON ${resp.content}
- Should Be Equal ${json["data"]["Message"]}
+ Should Be Equal ${resp.json()["data"]["Message"]}
... example.xyz.openbmc_project.Example.Elog.TestCallout
- Should Be Equal ${json["data"]["Severity"]}
+ Should Be Equal ${resp.json()["data"]["Severity"]}
... xyz.openbmc_project.Logging.Entry.Level.Error
${content}= Read Attribute ${elog_entry[0]}/callout endpoints
diff --git a/redfish/systems/eventlog/test_esel.robot b/redfish/systems/eventlog/test_esel.robot
index 4a2c85e..7381f6e 100644
--- a/redfish/systems/eventlog/test_esel.robot
+++ b/redfish/systems/eventlog/test_esel.robot
@@ -104,7 +104,6 @@
${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
${resp}= OpenBMC Get Request ${elog_entry[0]}
Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
- ${jsondata}= To JSON ${resp.content}
# "/xyz/openbmc_project/logging/entry/1": {
# "Timestamp": 1487743771812,
# "AdditionalData": [],
@@ -112,7 +111,7 @@
# "Id": 1,
# "Severity": "xyz.openbmc_project.Logging.Entry.Level.Emergency"
# }
- Should Not Be Empty ${jsondata["data"]["AdditionalData"]}
+ Should Not Be Empty ${resp.json()["data"]["AdditionalData"]}
Test Wrong Reservation_ID