Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Connections and authentication module stability tests. |
| 3 | |
| 4 | Resource ../lib/bmc_redfish_resource.robot |
| 5 | Resource ../lib/bmc_network_utils.robot |
| 6 | Resource ../lib/openbmc_ffdc.robot |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 7 | Resource ../lib/resource.robot |
| 8 | Resource ../lib/utils.robot |
| 9 | Resource ../lib/connection_client.robot |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 10 | Library ../lib/bmc_network_utils.py |
| 11 | |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 12 | Library SSHLibrary |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 13 | Library OperatingSystem |
| 14 | Library Collections |
| 15 | |
| 16 | *** Variables *** |
| 17 | |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 18 | ${iterations} 10000 |
| 19 | ${hostname} test_hostname |
| 20 | ${MAX_UNAUTH_PER_IP} ${5} |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 21 | |
| 22 | *** Test Cases *** |
| 23 | |
| 24 | Test Patch Without Auth Token Fails |
| 25 | [Documentation] Send patch method without auth token and verify it throws an error. |
George Keishing | 966a4c5 | 2020-05-13 10:53:58 -0500 | [diff] [blame] | 26 | [Tags] Test_Patch_Without_Auth_Token_Fails |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 27 | |
| 28 | Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} body={'HostName': '${hostname}'} |
| 29 | ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}] |
| 30 | |
| 31 | |
| 32 | Flood Patch Without Auth Token And Check Stability Of BMC |
| 33 | [Documentation] Flood patch method without auth token and check BMC stability. |
| 34 | [Tags] Flood_Patch_Without_Auth_Token_And_Check_Stability_Of_BMC |
| 35 | @{status_list}= Create List |
| 36 | |
| 37 | FOR ${i} IN RANGE ${1} ${iterations} |
| 38 | Log To Console ${i}th iteration |
| 39 | Run Keyword And Ignore Error |
| 40 | ... Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} body={'HostName': '${hostname}'} |
| 41 | |
| 42 | # Every 100th iteration, check BMC allows patch with auth token. |
| 43 | ${status}= Run Keyword If ${i} % 100 == 0 Run Keyword And Return Status |
| 44 | ... Login And Configure Hostname |
| 45 | Run Keyword If ${status} == False Append To List ${status_list} ${status} |
| 46 | END |
| 47 | ${verify_count}= Evaluate ${iterations}/100 |
| 48 | ${fail_count}= Get Length ${status_list} |
| 49 | |
| 50 | Should Be Equal ${fail_count} 0 msg=Patch operation failed ${fail_count} times in ${verify_count} attempts |
| 51 | |
| 52 | |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 53 | Verify Uer Cannot Login After 5 Non-Logged In Sessions |
| 54 | [Documentation] User should not be able to login when there |
| 55 | ... are 5 non-logged in sessions. |
| 56 | [Tags] Verify_User_Cannot_Login_After_5_Non-Logged_In_Sessions |
| 57 | |
| 58 | FOR ${i} IN RANGE ${0} ${MAX_UNAUTH_PER_IP} |
| 59 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 60 | Start Process ssh ${OPENBMC_USERNAME}@${OPENBMC_HOST} shell=True |
| 61 | END |
| 62 | |
| 63 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 64 | ${status}= Run Keyword And Return Status SSHLibrary.Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 65 | |
Anvesh Kumar Rayankula | 85df137 | 2020-04-28 05:01:14 -0500 | [diff] [blame] | 66 | Should Be Equal ${status} ${False} |
| 67 | |
| 68 | |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 69 | Test Post Without Auth Token Fails |
| 70 | [Documentation] Send post method without auth token and verify it throws an error. |
| 71 | [Tags] Test_Post_Without_Auth_Token_Fails |
| 72 | |
| 73 | ${user_info}= Create Dictionary UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} |
| 74 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} |
| 75 | ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}] |
| 76 | |
| 77 | |
| 78 | Flood Post Without Auth Token And Check Stability Of BMC |
| 79 | [Documentation] Flood post method without auth token and check BMC stability. |
| 80 | [Tags] Flood_Post_Without_Auth_Token_And_Check_Stability_Of_BMC |
| 81 | |
| 82 | @{status_list}= Create List |
| 83 | ${user_info}= Create Dictionary UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} |
| 84 | |
| 85 | FOR ${i} IN RANGE ${1} ${iterations} |
| 86 | Log To Console ${i}th iteration |
| 87 | Run Keyword And Ignore Error |
| 88 | ... Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} |
| 89 | |
| 90 | # Every 100th iteration, check BMC allows post with auth token. |
| 91 | ${status}= Run Keyword If ${i} % 100 == 0 Run Keyword And Return Status |
| 92 | ... Login And Create User |
| 93 | Run Keyword If ${status} == False Append To List ${status_list} ${status} |
| 94 | END |
| 95 | ${verify_count}= Evaluate ${iterations}/100 |
| 96 | ${fail_count}= Get Length ${status_list} |
| 97 | |
| 98 | Should Be Equal ${fail_count} 0 msg=Post operation failed ${fail_count} times in ${verify_count} attempts |
| 99 | |
| 100 | |
Prashanth Katti | fa699cf | 2020-04-06 10:13:33 -0500 | [diff] [blame] | 101 | *** Keywords *** |
| 102 | |
| 103 | Login And Configure Hostname |
| 104 | [Documentation] Login and configure hostname |
| 105 | |
| 106 | [Teardown] Redfish.Logout |
| 107 | |
| 108 | Redfish.Login |
| 109 | |
| 110 | Redfish.patch ${REDFISH_NW_PROTOCOL_URI} body={'HostName': '${hostname}'} |
| 111 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 112 | |
Prashanth Katti | 91e5971 | 2020-04-14 08:12:09 -0500 | [diff] [blame] | 113 | |
| 114 | Login And Create User |
| 115 | [Documentation] Login and create user |
| 116 | |
| 117 | [Teardown] Redfish.Logout |
| 118 | |
| 119 | Redfish.Login |
| 120 | |
| 121 | ${user_info}= Create Dictionary UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} |
| 122 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} valid_status_codes=[${HTTP_OK}] |