Authenticate to Redfish, then log out and attempt to use the session

Changes:
   - Test to login using expired session key and location

Change-Id: I3e281594eafe8af176d023475e95bd54abd3d1c5
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/redfish/service_root/test_service_root_security.robot b/redfish/service_root/test_service_root_security.robot
index cab493d..f8d0e4f 100644
--- a/redfish/service_root/test_service_root_security.robot
+++ b/redfish/service_root/test_service_root_security.robot
@@ -65,7 +65,7 @@
     #      'key': 'L0XEsZAXpNdF147jJaOD',
     #      'location': '/redfish/v1/SessionService/Sessions/qWn2JOJSOs'
     #    }
-    ${saved_session_info}=   Get Redfish Session Info
+    ${saved_session_info}=  Get Redfish Session Info
 
     # Sessions book keeping for cleanup once done.
     ${session_list}=  Create List
@@ -81,6 +81,24 @@
     Should Be Equal As Strings  ${resp.status}  ${HTTP_OK}
 
 
+Attempt Login With Expired Session
+    [Documentation]  Authenticate to redfish, then log out and attempt to
+    ...   use the session.
+    [Tags]  Attempt_Login_With_Expired_Session
+
+    redfish.Login
+    ${saved_session_info}=  Get Redfish Session Info
+    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"]}
+
+    ${resp}=  redfish.Get  ${saved_session_info["location"]}
+    Should Be Equal As Strings  ${resp.status}  ${HTTP_UNAUTHORIZED}
+
+
 *** Keywords ***
 
 Login And Verify Redfish Response