George Keishing | 4c39401 | 2019-02-01 06:03:02 -0600 | [diff] [blame] | 1 | *** Settings *** |
George Keishing | 8560990 | 2019-02-18 07:24:24 -0600 | [diff] [blame] | 2 | Resource ../../lib/resource.robot |
George Keishing | 4c39401 | 2019-02-01 06:03:02 -0600 | [diff] [blame] | 3 | Resource ../../lib/bmc_redfish_resource.robot |
George Keishing | 3298d5c | 2019-02-12 06:59:25 -0600 | [diff] [blame] | 4 | Resource ../../lib/openbmc_ffdc.robot |
| 5 | |
| 6 | Test Teardown FFDC On Test Case Fail |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame^] | 7 | Test Setup Rprintn |
George Keishing | 4c39401 | 2019-02-01 06:03:02 -0600 | [diff] [blame] | 8 | |
George Keishing | 374e684 | 2019-02-20 08:57:18 -0600 | [diff] [blame] | 9 | *** Variables *** |
| 10 | |
| 11 | ${LOGIN_SESSION_COUNT} ${50} |
| 12 | |
George Keishing | 4c39401 | 2019-02-01 06:03:02 -0600 | [diff] [blame] | 13 | *** Test Cases *** |
| 14 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 15 | Redfish Login With Invalid Credentials |
George Keishing | 4c39401 | 2019-02-01 06:03:02 -0600 | [diff] [blame] | 16 | [Documentation] Login to BMC web using invalid credential. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 17 | [Tags] Redfish_Login_With_Invalid_Credentials |
George Keishing | 4c39401 | 2019-02-01 06:03:02 -0600 | [diff] [blame] | 18 | [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 Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 28 | Redfish Login Using Unsecured HTTP |
George Keishing | a811693 | 2019-02-05 11:51:47 -0600 | [diff] [blame] | 29 | [Documentation] Login to BMC web through http unsecured. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 30 | [Tags] Redfish_Login_Using_Unsecured_HTTP |
George Keishing | a811693 | 2019-02-05 11:51:47 -0600 | [diff] [blame] | 31 | |
| 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 Keishing | b2f0734 | 2019-02-09 05:21:45 -0600 | [diff] [blame] | 43 | Redfish 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 Keishing | 374e684 | 2019-02-20 08:57:18 -0600 | [diff] [blame] | 58 | Create 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 Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame^] | 63 | Redfish.Login |
George Keishing | 374e684 | 2019-02-20 08:57:18 -0600 | [diff] [blame] | 64 | # Example: |
| 65 | # { |
| 66 | # 'key': 'L0XEsZAXpNdF147jJaOD', |
| 67 | # 'location': '/redfish/v1/SessionService/Sessions/qWn2JOJSOs' |
| 68 | # } |
George Keishing | 0b9d8ab | 2019-02-20 14:02:41 -0600 | [diff] [blame] | 69 | ${saved_session_info}= Get Redfish Session Info |
George Keishing | 374e684 | 2019-02-20 08:57:18 -0600 | [diff] [blame] | 70 | |
| 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 Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame^] | 79 | 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 Keishing | 374e684 | 2019-02-20 08:57:18 -0600 | [diff] [blame] | 82 | |
| 83 | |
George Keishing | 0b9d8ab | 2019-02-20 14:02:41 -0600 | [diff] [blame] | 84 | Attempt 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 Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame^] | 89 | Redfish.Login |
George Keishing | 0b9d8ab | 2019-02-20 14:02:41 -0600 | [diff] [blame] | 90 | ${saved_session_info}= Get Redfish Session Info |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame^] | 91 | Redfish.Logout |
George Keishing | 0b9d8ab | 2019-02-20 14:02:41 -0600 | [diff] [blame] | 92 | |
| 93 | # Attempt login with expired session. |
| 94 | # By default 60 minutes of inactivity closes the session. |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame^] | 95 | Redfish.Set Session Key ${saved_session_info["key"]} |
| 96 | Redfish.Set Session Location ${saved_session_info["location"]} |
George Keishing | 0b9d8ab | 2019-02-20 14:02:41 -0600 | [diff] [blame] | 97 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame^] | 98 | Redfish.Get ${saved_session_info["location"]} valid_status_codes=[${HTTP_UNAUTHORIZED}] |
George Keishing | 0b9d8ab | 2019-02-20 14:02:41 -0600 | [diff] [blame] | 99 | |
| 100 | |
George Keishing | 4c39401 | 2019-02-01 06:03:02 -0600 | [diff] [blame] | 101 | *** Keywords *** |
| 102 | |
| 103 | Login 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 Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame^] | 113 | Run Keyword And Expect Error ${expected_response} Redfish.Login ${data} |
George Keishing | 374e684 | 2019-02-20 08:57:18 -0600 | [diff] [blame] | 114 | |
| 115 | |
| 116 | Create New Login Session |
| 117 | [Documentation] Multiple login session keys. |
| 118 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame^] | 119 | Redfish.Login |
George Keishing | 374e684 | 2019-02-20 08:57:18 -0600 | [diff] [blame] | 120 | ${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 | |
| 128 | Multiple 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 Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame^] | 134 | \ Redfish.Delete ${item} |
George Keishing | 374e684 | 2019-02-20 08:57:18 -0600 | [diff] [blame] | 135 | |