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 | 4c39401 | 2019-02-01 06:03:02 -0600 | [diff] [blame] | 7 | |
George Keishing | 374e684 | 2019-02-20 08:57:18 -0600 | [diff] [blame] | 8 | *** Variables *** |
| 9 | |
| 10 | ${LOGIN_SESSION_COUNT} ${50} |
| 11 | |
George Keishing | 4c39401 | 2019-02-01 06:03:02 -0600 | [diff] [blame] | 12 | *** Test Cases *** |
| 13 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 14 | Redfish Login With Invalid Credentials |
George Keishing | 4c39401 | 2019-02-01 06:03:02 -0600 | [diff] [blame] | 15 | [Documentation] Login to BMC web using invalid credential. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 16 | [Tags] Redfish_Login_With_Invalid_Credentials |
George Keishing | 4c39401 | 2019-02-01 06:03:02 -0600 | [diff] [blame] | 17 | [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 Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 27 | Redfish Login Using Unsecured HTTP |
George Keishing | a811693 | 2019-02-05 11:51:47 -0600 | [diff] [blame] | 28 | [Documentation] Login to BMC web through http unsecured. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 29 | [Tags] Redfish_Login_Using_Unsecured_HTTP |
George Keishing | a811693 | 2019-02-05 11:51:47 -0600 | [diff] [blame] | 30 | |
| 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 Keishing | b2f0734 | 2019-02-09 05:21:45 -0600 | [diff] [blame] | 42 | Redfish 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 Keishing | 374e684 | 2019-02-20 08:57:18 -0600 | [diff] [blame] | 57 | Create 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 Keishing | 0b9d8ab | 2019-02-20 14:02:41 -0600 | [diff] [blame] | 68 | ${saved_session_info}= Get Redfish Session Info |
George Keishing | 374e684 | 2019-02-20 08:57:18 -0600 | [diff] [blame] | 69 | |
| 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 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 | |
| 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 Keishing | 4c39401 | 2019-02-01 06:03:02 -0600 | [diff] [blame] | 102 | *** Keywords *** |
| 103 | |
| 104 | Login 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 Keishing | 374e684 | 2019-02-20 08:57:18 -0600 | [diff] [blame] | 115 | |
| 116 | |
| 117 | Create 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 | |
| 129 | Multiple 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 | |