Added new cases for Redfish session service
Testcases added:
- Set Session Timeout And Verify Session deleted After Timeout.
Set session timeout and create a new session, wait for the configured
timeout value and verify the created session deleted in redfish/v1/Session/Sessions
URI.
- Verify Session Login And Logout for Newly created User.
Create a new session for newly created user and verify we can able
to access the redfish URI's via that created session and logut of that session.
Modified cases:
- Added a new keyword to get Default session timeout value and
configured default timeout value on Teardown.
Tested : Run robot redfish/serive_root/test_session_management.robot
Signed-off-by: Nagarjun B <nagarjunb@ami.com>
Change-Id: Iaca7026fbf72227e5b025b7b9d0c46862edc196a
diff --git a/redfish/service_root/test_sessions_management.robot b/redfish/service_root/test_sessions_management.robot
index 93d7a93..60a7514 100644
--- a/redfish/service_root/test_sessions_management.robot
+++ b/redfish/service_root/test_sessions_management.robot
@@ -40,7 +40,7 @@
[Documentation] Set Session Timeout And Verify Response Code.
[Tags] Set_Session_Timeout_And_Verify_Response_Code
[Template] Set Session Timeout And Verify
- [Teardown] Set Session Timeout And Verify ${3600} ${HTTP_OK}
+ [Teardown] Set Session Timeout And Verify ${Default_Timeout_Value} ${HTTP_OK}
# The minimum & maximum allowed values for session timeout are 30
# seconds and 86400 seconds respectively as per the session service
@@ -55,6 +55,32 @@
${86500} ${HTTP_BAD_REQUEST}
+Set Session Timeout And Verify Session After Timeout
+ [Documentation] Set timeout for session service and verify session is deleted after timeout.
+ [Tags] Set_Session_Timeout_And_Verify_Session_After_Timeout
+ [Teardown] Set Session Timeout And Verify ${Default_Timeout_Value} ${HTTP_OK}
+ [Template] Set Session Timeout And Verify Session Deleted After Timeout
+
+ #timeout Value
+ ${30}
+ ${300}
+
+
+Verify Session Login And Logout For Newly Created User
+ [Documentation] Verify able to login and logout using the session created for new user.
+ [Tags] Verify_Session_Login_And_Logout_For_Newly_Created_User
+ [Teardown] Redfish.Login
+
+ # Logout already created redfish session.
+ Redfish.Logout
+ Redfish.Login ${ADMIN}[0] ${ADMIN}[1]
+ ${systems}= Redfish.Get Properties /redfish/v1/Systems
+ Rprint Vars systems
+ Redfish.Logout
+ ${systems}= Redfish.Get /redfish/v1/Systems
+ ... valid_status_codes=[${HTTP_UNAUTHORIZED}]
+
+
Verify SessionService Defaults
[Documentation] Verify SessionService default property values.
[Tags] Verify_SessionService_Defaults
@@ -67,7 +93,7 @@
Valid Value session_service['Id'] ['SessionService']
Valid Value session_service['Name'] ['Session Service']
Valid Value session_service['ServiceEnabled'] [True]
- Valid Value session_service['SessionTimeout'] [3600]
+ Valid Value session_service['SessionTimeout'] [${Default_Timeout_Value}]
Valid Value session_service['Sessions']['@odata.id'] ['/redfish/v1/SessionService/Sessions']
@@ -191,6 +217,7 @@
# value The value to patch session timeout.
# valid_status_code Expected response code, default is ${HTTP_OK}.
+ Redfish.Login
${data}= Create Dictionary SessionTimeout=${value}
Redfish.Patch ${REDFISH_BASE_URI}SessionService
... body=&{data}
@@ -203,15 +230,58 @@
... Valid Value session_timeout [${value}]
+Create Session And Check Session Timeout
+ [Documentation] Create session and check session timeout.
+ [Arguments] ${value}
+
+ # Description of argument(s):
+ # value timeout value in integer to be configured.
+
+ ${resp}= Redfish.Post /redfish/v1/SessionService/Sessions
+ ... body={'UserName':'${OPENBMC_USERNAME}', 'Password': '${OPENBMC_PASSWORD}'}
+ ... valid_status_codes=[${HTTP_CREATED}]
+ ${session_id}= Set Variable ${resp.dict['@odata.id']}
+ Sleep ${value}s
+
+ Redfish.Get ${REDFISH_SESSION} valid_status_codes=[${HTTP_UNAUTHORIZED}]
+ # Since sessions will deleted so logging again.
+ Redfish.login
+ ${session_list}= Redfish.Get Members List /redfish/v1/SessionService/Sessions
+
+ List Should Not Contain Value ${session_list} ${session_id}
+
+
+Set Session Timeout And Verify Session Deleted After Timeout
+ [Documentation] Set timeout for session service and verify session is deleted after timeout.
+ [Arguments] ${timeout_value}
+
+ # Description of argument(s):
+ # timeout_value timeout value in integer to be configured.
+
+ ${data}= Create Dictionary SessionTimeout=${timeout_value}
+ ${resp_patch}= Redfish.Patch /redfish/v1/SessionService
+ ... body=&{data} valid_status_codes=[${HTTP_OK}]
+ Create Session And Check Session Timeout ${timeout_value}
+
+
+Get Default Timeout Value
+ [Documentation] Get default session timeout value and set as a suite variable.
+
+ ${Default_Timeout_Value}= Redfish.Get Attribute /redfish/v1/SessionService SessionTimeout
+ Set Suite Variable ${Default_Timeout_Value}
+
+
Suite Setup Execution
[Documentation] Suite Setup Execution.
Redfish.Login
Create Users With Different Roles users=${USERS} force=${True}
+ Get Default Timeout Value
Suite Teardown Execution
[Documentation] Suite teardown execution.
Delete BMC Users Via Redfish users=${USERS}
+ Run Keyword And Ignore Error Delete All Redfish Sessions
Redfish.Logout