Session Management Tests

Signed-off-by: Vijay <vikantan@in.ibm.com>
Change-Id: I609f6a9c9f65f41082ef2171e819b7e0ad3075e7
diff --git a/redfish/session_service/test_sessions_management.robot b/redfish/session_service/test_sessions_management.robot
index b10a869..5d0c314 100644
--- a/redfish/session_service/test_sessions_management.robot
+++ b/redfish/session_service/test_sessions_management.robot
@@ -69,3 +69,90 @@
     Valid Value  session_properties['Name']  ['User Session']
     Valid Value  session_properties['Id']  ['${session_id}']
     Valid Value  session_properties['UserName']  ['${OPENBMC_USERNAME}']
+
+
+Verify Managers Defaults
+    [Documentation]  Verify managers defaults.
+    [Tags]  Verify_Managers_Defaults
+
+    ${managers}=  Redfish.Get Properties  /redfish/v1/Managers
+    Rprint Vars  managers
+    ${managers_count}=  Get Length  ${managers['Members']}
+
+    Valid Value  managers['@odata.context']  ['/redfish/v1/$metadata#ManagerCollection.ManagerCollection']
+    Valid Value  managers['Name']  ['Manager Collection']
+    Valid Value  managers['@odata.id']  ['/redfish/v1/Managers']
+    Valid Value  managers['Members@odata.count']  [${managers_count}]
+
+    # Members can be one or more, hence checking in the list
+    Valid List  managers['Members']  required_values=[{'@odata.id': '/redfish/v1/Managers/bmc'}]
+
+
+Verify Chassis Defaults
+    [Documentation]  Verify chassis defaults.
+    [Tags]  Verify_Chassis_Defaults
+
+    ${chassis}=  Redfish.Get Properties  /redfish/v1/Chassis
+    Rprint Vars  chassis
+    ${chassis_count}=  Get Length  ${chassis['Members']}
+
+    Valid Value  chassis['@odata.context']  ['/redfish/v1/$metadata#ChassisCollection.ChassisCollection']
+    Valid Value  chassis['Name']  ['Chassis Collection']
+    Valid Value  chassis['@odata.id']  ['/redfish/v1/Chassis']
+    Valid Value  chassis['Members@odata.count']  [${chassis_count}]
+    Valid Value  chassis['Members@odata.count']  [${chassis_count}]
+
+    # Members can be one or more, hence checking in the list
+    Log To Console  ${chassis['Members']}
+    Valid List  chassis['Members']
+    ...  required_values=[{'@odata.id': '/redfish/v1/Chassis/chassis'}]
+
+
+Verify Systems Defaults
+    [Documentation]  Verify systems defaults.
+    [Tags]  Verify_Systems_Defaults
+
+    ${systems}=  Redfish.Get Properties  /redfish/v1/Systems
+    Rprint Vars  systems
+    ${systems_count}=  Get Length  ${systems['Members']}
+
+    Valid Value  systems['@odata.context']
+    ...  ['/redfish/v1/$metadata#ComputerSystemCollection.ComputerSystemCollection']
+    Valid Value  systems['Name']  ['Computer System Collection']
+    Valid Value  systems['@odata.id']  ['/redfish/v1/Systems']
+    Valid Value  systems['Members@odata.count']  [${systems_count}]
+    Valid Value  systems['Members@odata.count']  [${systems_count}]
+    # Members can be one or more, hence checking in the list
+    Valid List  systems['Members']  required_values=[{'@odata.id': '/redfish/v1/Systems/system'}]
+
+
+Verify Session Persistency After BMC Reboot
+    [Documentation]  Verify session persistency after BMC reboot.
+    [Tags]  Verify_Session_Persistency_After_BMC_Reboot
+
+    # Note the current session location
+    ${session_location}=  Redfish.Get Session Location
+
+    Redfish OBMC Reboot (off)  stack_mode=normal
+    Redfish.Login
+
+    # Check for session persistency after BMC reboot
+    # sessions here will have list of all sessions location
+    ${sessions}=  Redfish.Get Attribute  /redfish/v1/SessionService/Sessions  Members
+    ${payload}=  Create Dictionary  @odata.id=${session_location}
+
+    List Should Contain Value  ${sessions}  ${payload}
+
+
+REST Logging Interface Read Should Be A SUCCESS For Authorized Users
+    [Documentation]  REST logging interface read should be a success for authorized users.
+    [Tags]    REST_Logging_Interface_Read_Should_Be_A_SUCCESS_For_Authorized_Users
+
+    ${resp}=  Redfish.Get  /xyz/openbmc_project/logging
+
+    ${resp_output}=  evaluate  json.loads('''${resp.text}''')  json
+    ${log_count}=  Get Length  ${resp_output["data"]}
+
+    # Max 200 error logs are allowed in OpenBmc
+    Run Keyword Unless   ${-1} < ${log_count} < ${201}  Fail
+