New BMC redfish library integration
Changes:
- Use redfish_plus.py when importing Redfish instances.
- Update bmc_redfish.py.
- Update bmc_redfish_utility.py.
- Update object name 'redfish' to 'Redfish'.
- Update test setup and teardown in suites.
- Update response error checking using valid_status_codes.
- Fix test cases required for migration.
Change-Id: Ida154aede649d9a2bbef66d16ccf725f5ea37ed0
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/redfish/service_root/test_service_root.robot b/redfish/service_root/test_service_root.robot
index 23a2ea6..8aef25e 100644
--- a/redfish/service_root/test_service_root.robot
+++ b/redfish/service_root/test_service_root.robot
@@ -1,9 +1,12 @@
*** Settings ***
+
Resource ../../lib/resource.robot
Resource ../../lib/bmc_redfish_resource.robot
Resource ../../lib/openbmc_ffdc.robot
+
Test Teardown FFDC On Test Case Fail
+Test Setup Rprintn
*** Test Cases ***
@@ -11,8 +14,8 @@
[Documentation] Login to BMCweb and then logout.
[Tags] Redfish_Login_And_Logout
- redfish.Login
- redfish.Logout
+ Redfish.Login
+ Redfish.Logout
GET Redfish Hypermedia Without Login
@@ -30,18 +33,17 @@
[Documentation] Login to BMCweb and get /redfish/v1/SessionService.
[Tags] GET_Redfish_SessionService_Resource_With_Login
- redfish.Login
- ${resp}= redfish.Get /redfish/v1/SessionService
- Should Be Equal As Strings ${resp.status} ${HTTP_OK}
- redfish.Logout
+ Redfish.Login
+ ${resp}= Redfish.Get /redfish/v1/SessionService
+ Redfish.Logout
GET Redfish SessionService Without Login
[Documentation] Get /redfish/v1/SessionService without login
[Tags] GET_Redfish_SessionService_Without_Login
- ${resp}= redfish.Get /redfish/v1/SessionService
- Should Be Equal As Strings ${resp.status} ${HTTP_UNAUTHORIZED}
+ ${resp}= Redfish.Get /redfish/v1/SessionService
+ ... valid_status_codes=[${HTTP_UNAUTHORIZED}]
Redfish Login Using Invalid Token
@@ -64,15 +66,17 @@
[Documentation] Delete a session using valid login.
[Tags] Delete_Redfish_Session_Using_Valid_Login
- redfish.Login
+ Redfish.Login
+ Redfish.Login
# Example o/p:
# [{'@odata.id': '/redfish/v1/SessionService/Sessions/bOol3WlCI8'},
# {'@odata.id': '/redfish/v1/SessionService/Sessions/Yu3xFqjZr1'}]
- ${resp_list}= redfish_utils.List Request /redfish/v1/SessionService/Sessions
- redfish.Delete ${resp_list[1]}
+ ${resp_list}= Redfish_Utils.List Request
+ ... /redfish/v1/SessionService/Sessions
+ Redfish.Delete ${resp_list[1]}
- ${resp}= redfish_utils.List Request /redfish/v1/SessionService/Sessions
+ ${resp}= Redfish_Utils.List Request /redfish/v1/SessionService/Sessions
List Should Not Contain Value ${resp} ${resp_list[1]}
@@ -80,11 +84,12 @@
GET And Verify Redfish Response
[Documentation] GET given resource and verfiy response.
- [Arguments] ${expected_response_code} ${resource_path}
+ [Arguments] ${valid_status_codes} ${resource_path}
- # Description of arguments:
- # expected_response_code Expected REST status codes.
- # resource_path Redfish resource URL path.
+ # Description of argument(s):
+ # valid_status_codes A comma-separated list of acceptable
+ # status codes (e.g. 200).
+ # resource_path Redfish resource URL path.
- ${resp}= redfish.Get ${resource_path}
- Should Be Equal As Strings ${resp.status} ${expected_response_code}
+ ${resp}= Redfish.Get ${resource_path}
+ ... valid_status_codes=[${valid_status_codes}]
diff --git a/redfish/service_root/test_service_root_security.robot b/redfish/service_root/test_service_root_security.robot
index f8d0e4f..ac2f482 100644
--- a/redfish/service_root/test_service_root_security.robot
+++ b/redfish/service_root/test_service_root_security.robot
@@ -4,6 +4,7 @@
Resource ../../lib/openbmc_ffdc.robot
Test Teardown FFDC On Test Case Fail
+Test Setup Rprintn
*** Variables ***
@@ -59,7 +60,7 @@
[Tags] Create_Multiple_Login_Sessions_And_Verify
[Teardown] Multiple Session Cleanup
- redfish.Login
+ Redfish.Login
# Example:
# {
# 'key': 'L0XEsZAXpNdF147jJaOD',
@@ -75,10 +76,9 @@
# Update the redfish session object with the first login key and location
# and verify if it is still working.
- redfish.Set Session Key ${saved_session_info["key"]}
- redfish.Set Session Location ${saved_session_info["location"]}
- ${resp}= redfish.Get ${saved_session_info["location"]}
- Should Be Equal As Strings ${resp.status} ${HTTP_OK}
+ Redfish.Set Session Key ${saved_session_info["key"]}
+ Redfish.Set Session Location ${saved_session_info["location"]}
+ Redfish.Get ${saved_session_info["location"]}
Attempt Login With Expired Session
@@ -86,17 +86,16 @@
... use the session.
[Tags] Attempt_Login_With_Expired_Session
- redfish.Login
+ Redfish.Login
${saved_session_info}= Get Redfish Session Info
- redfish.Logout
+ Redfish.Logout
# Attempt login with expired session.
# By default 60 minutes of inactivity closes the session.
- redfish.Set Session Key ${saved_session_info["key"]}
- redfish.Set Session Location ${saved_session_info["location"]}
+ Redfish.Set Session Key ${saved_session_info["key"]}
+ Redfish.Set Session Location ${saved_session_info["location"]}
- ${resp}= redfish.Get ${saved_session_info["location"]}
- Should Be Equal As Strings ${resp.status} ${HTTP_UNAUTHORIZED}
+ Redfish.Get ${saved_session_info["location"]} valid_status_codes=[${HTTP_UNAUTHORIZED}]
*** Keywords ***
@@ -111,13 +110,13 @@
# password The password to be used to connect to the server.
${data}= Create Dictionary username=${username} password=${password}
- Run Keyword And Expect Error ${expected_response} redfish.Login ${data}
+ Run Keyword And Expect Error ${expected_response} Redfish.Login ${data}
Create New Login Session
[Documentation] Multiple login session keys.
- redfish.Login
+ Redfish.Login
${session_info}= Get Redfish Session Info
# Append the session location to the list.
@@ -132,5 +131,5 @@
FFDC On Test Case Fail
:FOR ${item} IN @{session_list}
- \ redfish.Delete ${item}
+ \ Redfish.Delete ${item}