blob: ac2f482b2f7aa848ea8f994c62f6a0c3de44e368 [file] [log] [blame]
George Keishing4c394012019-02-01 06:03:02 -06001*** Settings ***
George Keishing85609902019-02-18 07:24:24 -06002Resource ../../lib/resource.robot
George Keishing4c394012019-02-01 06:03:02 -06003Resource ../../lib/bmc_redfish_resource.robot
George Keishing3298d5c2019-02-12 06:59:25 -06004Resource ../../lib/openbmc_ffdc.robot
5
6Test Teardown FFDC On Test Case Fail
George Keishing97c93942019-03-04 12:45:07 -06007Test Setup Rprintn
George Keishing4c394012019-02-01 06:03:02 -06008
George Keishing374e6842019-02-20 08:57:18 -06009*** Variables ***
10
11${LOGIN_SESSION_COUNT} ${50}
12
George Keishing4c394012019-02-01 06:03:02 -060013*** Test Cases ***
14
George Keishing5ee33d92019-02-02 12:33:25 -060015Redfish Login With Invalid Credentials
George Keishing4c394012019-02-01 06:03:02 -060016 [Documentation] Login to BMC web using invalid credential.
George Keishing5ee33d92019-02-02 12:33:25 -060017 [Tags] Redfish_Login_With_Invalid_Credentials
George Keishing4c394012019-02-01 06:03:02 -060018 [Template] Login And Verify Redfish Response
19
20 # Expect status Username Password
21 InvalidCredentialsError* ${OPENBMC_USERNAME} deadpassword
22 InvalidCredentialsError* groot ${OPENBMC_PASSWORD}
23 InvalidCredentialsError* ${EMPTY} ${OPENBMC_PASSWORD}
24 InvalidCredentialsError* ${OPENBMC_USERNAME} ${EMPTY}
25 InvalidCredentialsError* ${EMPTY} ${EMPTY}
26
27
George Keishing5ee33d92019-02-02 12:33:25 -060028Redfish Login Using Unsecured HTTP
George Keishinga8116932019-02-05 11:51:47 -060029 [Documentation] Login to BMC web through http unsecured.
George Keishing5ee33d92019-02-02 12:33:25 -060030 [Tags] Redfish_Login_Using_Unsecured_HTTP
George Keishinga8116932019-02-05 11:51:47 -060031
32 Create Session openbmc http://${OPENBMC_HOST}
33 ${data}= Create Dictionary
34 ... UserName=${OPENBMC_USERNAME} Password=${OPENBMC_PASSWORD}
35
36 ${headers}= Create Dictionary Content-Type=application/json
37
38 Run Keyword And Expect Error *Connection refused*
39 ... Post Request openbmc /redfish/v1/SessionService/Sessions
40 ... data=${data} headers=${headers}
41
42
George Keishingb2f07342019-02-09 05:21:45 -060043Redfish Login Using HTTPS Wrong Port 80 Protocol
44 [Documentation] Login to BMC web through wrong protocol port 80.
45 [Tags] Redfish_Login_Using_HTTPS_Wrong_Port_80_Protocol
46
47 Create Session openbmc https://${OPENBMC_HOST}:80
48 ${data}= Create Dictionary
49 ... UserName=${OPENBMC_USERNAME} Password=${OPENBMC_PASSWORD}
50
51 ${headers}= Create Dictionary Content-Type=application/json
52
53 Run Keyword And Expect Error *Connection refused*
54 ... Post Request openbmc /redfish/v1/SessionService/Sessions
55 ... data=${data} headers=${headers}
56
57
George Keishing374e6842019-02-20 08:57:18 -060058Create Multiple Login Sessions And Verify
59 [Documentation] Create 50 login instances and verify.
60 [Tags] Create_Multiple_Login_Sessions_And_Verify
61 [Teardown] Multiple Session Cleanup
62
George Keishing97c93942019-03-04 12:45:07 -060063 Redfish.Login
George Keishing374e6842019-02-20 08:57:18 -060064 # Example:
65 # {
66 # 'key': 'L0XEsZAXpNdF147jJaOD',
67 # 'location': '/redfish/v1/SessionService/Sessions/qWn2JOJSOs'
68 # }
George Keishing0b9d8ab2019-02-20 14:02:41 -060069 ${saved_session_info}= Get Redfish Session Info
George Keishing374e6842019-02-20 08:57:18 -060070
71 # Sessions book keeping for cleanup once done.
72 ${session_list}= Create List
73 Set Test Variable ${session_list}
74
75 Repeat Keyword ${LOGIN_SESSION_COUNT} times Create New Login Session
76
77 # Update the redfish session object with the first login key and location
78 # and verify if it is still working.
George Keishing97c93942019-03-04 12:45:07 -060079 Redfish.Set Session Key ${saved_session_info["key"]}
80 Redfish.Set Session Location ${saved_session_info["location"]}
81 Redfish.Get ${saved_session_info["location"]}
George Keishing374e6842019-02-20 08:57:18 -060082
83
George Keishing0b9d8ab2019-02-20 14:02:41 -060084Attempt Login With Expired Session
85 [Documentation] Authenticate to redfish, then log out and attempt to
86 ... use the session.
87 [Tags] Attempt_Login_With_Expired_Session
88
George Keishing97c93942019-03-04 12:45:07 -060089 Redfish.Login
George Keishing0b9d8ab2019-02-20 14:02:41 -060090 ${saved_session_info}= Get Redfish Session Info
George Keishing97c93942019-03-04 12:45:07 -060091 Redfish.Logout
George Keishing0b9d8ab2019-02-20 14:02:41 -060092
93 # Attempt login with expired session.
94 # By default 60 minutes of inactivity closes the session.
George Keishing97c93942019-03-04 12:45:07 -060095 Redfish.Set Session Key ${saved_session_info["key"]}
96 Redfish.Set Session Location ${saved_session_info["location"]}
George Keishing0b9d8ab2019-02-20 14:02:41 -060097
George Keishing97c93942019-03-04 12:45:07 -060098 Redfish.Get ${saved_session_info["location"]} valid_status_codes=[${HTTP_UNAUTHORIZED}]
George Keishing0b9d8ab2019-02-20 14:02:41 -060099
100
George Keishing4c394012019-02-01 06:03:02 -0600101*** Keywords ***
102
103Login And Verify Redfish Response
104 [Documentation] Login and verify redfish response.
105 [Arguments] ${expected_response} ${username} ${password}
106
107 # Description of arguments:
108 # expected_response Expected REST status.
109 # username The username to be used to connect to the server.
110 # password The password to be used to connect to the server.
111
112 ${data}= Create Dictionary username=${username} password=${password}
George Keishing97c93942019-03-04 12:45:07 -0600113 Run Keyword And Expect Error ${expected_response} Redfish.Login ${data}
George Keishing374e6842019-02-20 08:57:18 -0600114
115
116Create New Login Session
117 [Documentation] Multiple login session keys.
118
George Keishing97c93942019-03-04 12:45:07 -0600119 Redfish.Login
George Keishing374e6842019-02-20 08:57:18 -0600120 ${session_info}= Get Redfish Session Info
121
122 # Append the session location to the list.
123 # ['/redfish/v1/SessionService/Sessions/uDzihgDecs',
124 # '/redfish/v1/SessionService/Sessions/PaHF5brPPd']
125 Append To List ${session_list} ${session_info["location"]}
126
127
128Multiple Session Cleanup
129 [Documentation] Do the teardown for multiple sessions.
130
131 FFDC On Test Case Fail
132
133 :FOR ${item} IN @{session_list}
George Keishing97c93942019-03-04 12:45:07 -0600134 \ Redfish.Delete ${item}
George Keishing374e6842019-02-20 08:57:18 -0600135