blob: f8d0e4fc417ab2c0ba6c759f58da6ea134f6996c [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 Keishing4c394012019-02-01 06:03:02 -06007
George Keishing374e6842019-02-20 08:57:18 -06008*** Variables ***
9
10${LOGIN_SESSION_COUNT} ${50}
11
George Keishing4c394012019-02-01 06:03:02 -060012*** Test Cases ***
13
George Keishing5ee33d92019-02-02 12:33:25 -060014Redfish Login With Invalid Credentials
George Keishing4c394012019-02-01 06:03:02 -060015 [Documentation] Login to BMC web using invalid credential.
George Keishing5ee33d92019-02-02 12:33:25 -060016 [Tags] Redfish_Login_With_Invalid_Credentials
George Keishing4c394012019-02-01 06:03:02 -060017 [Template] Login And Verify Redfish Response
18
19 # Expect status Username Password
20 InvalidCredentialsError* ${OPENBMC_USERNAME} deadpassword
21 InvalidCredentialsError* groot ${OPENBMC_PASSWORD}
22 InvalidCredentialsError* ${EMPTY} ${OPENBMC_PASSWORD}
23 InvalidCredentialsError* ${OPENBMC_USERNAME} ${EMPTY}
24 InvalidCredentialsError* ${EMPTY} ${EMPTY}
25
26
George Keishing5ee33d92019-02-02 12:33:25 -060027Redfish Login Using Unsecured HTTP
George Keishinga8116932019-02-05 11:51:47 -060028 [Documentation] Login to BMC web through http unsecured.
George Keishing5ee33d92019-02-02 12:33:25 -060029 [Tags] Redfish_Login_Using_Unsecured_HTTP
George Keishinga8116932019-02-05 11:51:47 -060030
31 Create Session openbmc http://${OPENBMC_HOST}
32 ${data}= Create Dictionary
33 ... UserName=${OPENBMC_USERNAME} Password=${OPENBMC_PASSWORD}
34
35 ${headers}= Create Dictionary Content-Type=application/json
36
37 Run Keyword And Expect Error *Connection refused*
38 ... Post Request openbmc /redfish/v1/SessionService/Sessions
39 ... data=${data} headers=${headers}
40
41
George Keishingb2f07342019-02-09 05:21:45 -060042Redfish Login Using HTTPS Wrong Port 80 Protocol
43 [Documentation] Login to BMC web through wrong protocol port 80.
44 [Tags] Redfish_Login_Using_HTTPS_Wrong_Port_80_Protocol
45
46 Create Session openbmc https://${OPENBMC_HOST}:80
47 ${data}= Create Dictionary
48 ... UserName=${OPENBMC_USERNAME} Password=${OPENBMC_PASSWORD}
49
50 ${headers}= Create Dictionary Content-Type=application/json
51
52 Run Keyword And Expect Error *Connection refused*
53 ... Post Request openbmc /redfish/v1/SessionService/Sessions
54 ... data=${data} headers=${headers}
55
56
George Keishing374e6842019-02-20 08:57:18 -060057Create Multiple Login Sessions And Verify
58 [Documentation] Create 50 login instances and verify.
59 [Tags] Create_Multiple_Login_Sessions_And_Verify
60 [Teardown] Multiple Session Cleanup
61
62 redfish.Login
63 # Example:
64 # {
65 # 'key': 'L0XEsZAXpNdF147jJaOD',
66 # 'location': '/redfish/v1/SessionService/Sessions/qWn2JOJSOs'
67 # }
George Keishing0b9d8ab2019-02-20 14:02:41 -060068 ${saved_session_info}= Get Redfish Session Info
George Keishing374e6842019-02-20 08:57:18 -060069
70 # Sessions book keeping for cleanup once done.
71 ${session_list}= Create List
72 Set Test Variable ${session_list}
73
74 Repeat Keyword ${LOGIN_SESSION_COUNT} times Create New Login Session
75
76 # Update the redfish session object with the first login key and location
77 # and verify if it is still working.
78 redfish.Set Session Key ${saved_session_info["key"]}
79 redfish.Set Session Location ${saved_session_info["location"]}
80 ${resp}= redfish.Get ${saved_session_info["location"]}
81 Should Be Equal As Strings ${resp.status} ${HTTP_OK}
82
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
89 redfish.Login
90 ${saved_session_info}= Get Redfish Session Info
91 redfish.Logout
92
93 # Attempt login with expired session.
94 # By default 60 minutes of inactivity closes the session.
95 redfish.Set Session Key ${saved_session_info["key"]}
96 redfish.Set Session Location ${saved_session_info["location"]}
97
98 ${resp}= redfish.Get ${saved_session_info["location"]}
99 Should Be Equal As Strings ${resp.status} ${HTTP_UNAUTHORIZED}
100
101
George Keishing4c394012019-02-01 06:03:02 -0600102*** Keywords ***
103
104Login And Verify Redfish Response
105 [Documentation] Login and verify redfish response.
106 [Arguments] ${expected_response} ${username} ${password}
107
108 # Description of arguments:
109 # expected_response Expected REST status.
110 # username The username to be used to connect to the server.
111 # password The password to be used to connect to the server.
112
113 ${data}= Create Dictionary username=${username} password=${password}
114 Run Keyword And Expect Error ${expected_response} redfish.Login ${data}
George Keishing374e6842019-02-20 08:57:18 -0600115
116
117Create New Login Session
118 [Documentation] Multiple login session keys.
119
120 redfish.Login
121 ${session_info}= Get Redfish Session Info
122
123 # Append the session location to the list.
124 # ['/redfish/v1/SessionService/Sessions/uDzihgDecs',
125 # '/redfish/v1/SessionService/Sessions/PaHF5brPPd']
126 Append To List ${session_list} ${session_info["location"]}
127
128
129Multiple Session Cleanup
130 [Documentation] Do the teardown for multiple sessions.
131
132 FFDC On Test Case Fail
133
134 :FOR ${item} IN @{session_list}
135 \ redfish.Delete ${item}
136