1fa699cfaSPrashanth Katti*** Settings *** 2fa699cfaSPrashanth KattiDocumentation Connections and authentication module stability tests. 3fa699cfaSPrashanth Katti 4fa699cfaSPrashanth KattiResource ../lib/bmc_redfish_resource.robot 5fa699cfaSPrashanth KattiResource ../lib/bmc_network_utils.robot 6fa699cfaSPrashanth KattiResource ../lib/openbmc_ffdc.robot 785df137fSAnvesh Kumar RayankulaResource ../lib/resource.robot 885df137fSAnvesh Kumar RayankulaResource ../lib/utils.robot 985df137fSAnvesh Kumar RayankulaResource ../lib/connection_client.robot 10b844a873Sshrsuman123Resource ../gui/lib/gui_resource.robot 11fa699cfaSPrashanth KattiLibrary ../lib/bmc_network_utils.py 12fa699cfaSPrashanth Katti 1385df137fSAnvesh Kumar RayankulaLibrary SSHLibrary 14fa699cfaSPrashanth KattiLibrary Collections 15ee26d5ecSPrashanth KattiLibrary XvfbRobot 16ee26d5ecSPrashanth KattiLibrary OperatingSystem 1747d1e8e6SGeorge KeishingLibrary SeleniumLibrary 120 120 18ee26d5ecSPrashanth KattiLibrary Telnet 30 Seconds 19ee26d5ecSPrashanth KattiLibrary Screenshot 20ee26d5ecSPrashanth Katti 21a8ca296bSshrsuman123 22a8ca296bSshrsuman123Suite Setup Redfish.Logout 23a8ca296bSshrsuman123 24ee26d5ecSPrashanth KattiVariables ../gui/data/gui_variables.py 2587dc442cSGeorge Keishing 26*6fb70d98SMatt FischerTest Tags BMC_Connections 27fa699cfaSPrashanth Katti 28fa699cfaSPrashanth Katti*** Variables *** 29fa699cfaSPrashanth Katti 30fa699cfaSPrashanth Katti${iterations} 10000 313cddd032SAnvesh Kumar Rayankula${loop_iteration} ${1000} 3223afcc57SGeorge Keishing${hostname} testhostname 3385df137fSAnvesh Kumar Rayankula${MAX_UNAUTH_PER_IP} ${5} 3446bd8c24SMatt Fischer${bmc_url} https://${OPENBMC_HOST}:${HTTPS_PORT} 35ee26d5ecSPrashanth Katti 36fa699cfaSPrashanth Katti 37fa699cfaSPrashanth Katti*** Test Cases *** 38fa699cfaSPrashanth Katti 39fa699cfaSPrashanth KattiTest Patch Without Auth Token Fails 40fa699cfaSPrashanth Katti [Documentation] Send patch method without auth token and verify it throws an error. 41966a4c5cSGeorge Keishing [Tags] Test_Patch_Without_Auth_Token_Fails 42fa699cfaSPrashanth Katti 43816d3cecSAnves Kumar rayankula ${active_channel_config}= Get Active Channel Config 44816d3cecSAnves Kumar rayankula ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 45816d3cecSAnves Kumar rayankula 46816d3cecSAnves Kumar rayankula Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body={'HostName': '${hostname}'} 47fa699cfaSPrashanth Katti ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}] 48fa699cfaSPrashanth Katti 49fa699cfaSPrashanth Katti 50fa699cfaSPrashanth KattiFlood Patch Without Auth Token And Check Stability Of BMC 51fa699cfaSPrashanth Katti [Documentation] Flood patch method without auth token and check BMC stability. 52fa699cfaSPrashanth Katti [Tags] Flood_Patch_Without_Auth_Token_And_Check_Stability_Of_BMC 5323afcc57SGeorge Keishing 5423afcc57SGeorge Keishing @{fail_list}= Create List 55fa699cfaSPrashanth Katti 56816d3cecSAnves Kumar rayankula ${active_channel_config}= Get Active Channel Config 57816d3cecSAnves Kumar rayankula ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 58816d3cecSAnves Kumar rayankula 5923afcc57SGeorge Keishing FOR ${iter} IN RANGE ${1} ${iterations} + 1 6023afcc57SGeorge Keishing Log To Console ${iter}th iteration Patch Request without valid session token 6123afcc57SGeorge Keishing # Expected valid fail status response code. 6223afcc57SGeorge Keishing Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body={'HostName': '${hostname}'} 6323afcc57SGeorge Keishing ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}] 64fa699cfaSPrashanth Katti 65fa699cfaSPrashanth Katti # Every 100th iteration, check BMC allows patch with auth token. 6623afcc57SGeorge Keishing ${status}= Run Keyword If ${iter} % 100 == 0 Run Keyword And Return Status 6723afcc57SGeorge Keishing ... Login And Configure Hostname ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 6823afcc57SGeorge Keishing Run Keyword If ${status} == False Append To List ${fail_list} ${iter} 69fa699cfaSPrashanth Katti END 70fa699cfaSPrashanth Katti ${verify_count}= Evaluate ${iterations}/100 7123afcc57SGeorge Keishing ${fail_count}= Get Length ${fail_list} 72fa699cfaSPrashanth Katti 7323afcc57SGeorge Keishing Should Be Equal As Integers ${fail_count} ${0} 7423afcc57SGeorge Keishing ... msg=Patch operation failed ${fail_count} times in ${verify_count} attempts; fails at iterations ${fail_list} 75fa699cfaSPrashanth Katti 76fa699cfaSPrashanth Katti 774fb89c1eSGeorge KeishingVerify User Cannot Login After 5 Non-Logged In Sessions 7885df137fSAnvesh Kumar Rayankula [Documentation] User should not be able to login when there 7985df137fSAnvesh Kumar Rayankula ... are 5 non-logged in sessions. 8085df137fSAnvesh Kumar Rayankula [Tags] Verify_User_Cannot_Login_After_5_Non-Logged_In_Sessions 8105a29c85SGene Ratzlaff [Setup] Confirm Ability to Connect Then Close All Connections 8205a29c85SGene Ratzlaff [Teardown] Run Keywords Process.Terminate All Processes AND 8305a29c85SGene Ratzlaff ... SSHLibrary.Close All Connections AND FFDC On Test Case Fail 8485df137fSAnvesh Kumar Rayankula 8523afcc57SGeorge Keishing FOR ${iter} IN RANGE ${0} ${MAX_UNAUTH_PER_IP} 8685df137fSAnvesh Kumar Rayankula SSHLibrary.Open Connection ${OPENBMC_HOST} 8785df137fSAnvesh Kumar Rayankula Start Process ssh ${OPENBMC_USERNAME}@${OPENBMC_HOST} shell=True 8885df137fSAnvesh Kumar Rayankula END 8985df137fSAnvesh Kumar Rayankula 9085df137fSAnvesh Kumar Rayankula SSHLibrary.Open Connection ${OPENBMC_HOST} 9185df137fSAnvesh Kumar Rayankula ${status}= Run Keyword And Return Status SSHLibrary.Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} 9291e59717SPrashanth Katti 9385df137fSAnvesh Kumar Rayankula Should Be Equal ${status} ${False} 9485df137fSAnvesh Kumar Rayankula 9585df137fSAnvesh Kumar Rayankula 9691e59717SPrashanth KattiTest Post Without Auth Token Fails 9791e59717SPrashanth Katti [Documentation] Send post method without auth token and verify it throws an error. 9891e59717SPrashanth Katti [Tags] Test_Post_Without_Auth_Token_Fails 9991e59717SPrashanth Katti 1003cddd032SAnvesh Kumar Rayankula ${user_info}= Create Dictionary 1013cddd032SAnvesh Kumar Rayankula ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} 10291e59717SPrashanth Katti Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} 10391e59717SPrashanth Katti ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}] 10491e59717SPrashanth Katti 10591e59717SPrashanth Katti 10691e59717SPrashanth KattiFlood Post Without Auth Token And Check Stability Of BMC 10791e59717SPrashanth Katti [Documentation] Flood post method without auth token and check BMC stability. 10891e59717SPrashanth Katti [Tags] Flood_Post_Without_Auth_Token_And_Check_Stability_Of_BMC 10991e59717SPrashanth Katti 11023afcc57SGeorge Keishing @{fail_list}= Create List 11123afcc57SGeorge Keishing 1123cddd032SAnvesh Kumar Rayankula ${user_info}= Create Dictionary 1133cddd032SAnvesh Kumar Rayankula ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} 11491e59717SPrashanth Katti 11523afcc57SGeorge Keishing FOR ${iter} IN RANGE ${1} ${iterations} + 1 11623afcc57SGeorge Keishing Log To Console ${iter}th iteration Post Request without valid session token 11723afcc57SGeorge Keishing # Expected valid fail status response code. 11823afcc57SGeorge Keishing Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} 11923afcc57SGeorge Keishing ... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}] 12091e59717SPrashanth Katti 12191e59717SPrashanth Katti # Every 100th iteration, check BMC allows post with auth token. 12223afcc57SGeorge Keishing ${status}= Run Keyword If ${iter} % 100 == 0 Run Keyword And Return Status 12391e59717SPrashanth Katti ... Login And Create User 12423afcc57SGeorge Keishing Run Keyword If ${status} == False Append To List ${fail_list} ${iter} 12591e59717SPrashanth Katti END 12691e59717SPrashanth Katti ${verify_count}= Evaluate ${iterations}/100 12723afcc57SGeorge Keishing ${fail_count}= Get Length ${fail_list} 12891e59717SPrashanth Katti 12923afcc57SGeorge Keishing Should Be Equal As Integers ${fail_count} ${0} 13023afcc57SGeorge Keishing ... msg=Post operation failed ${fail_count} times in ${verify_count} attempts; fails at iterations ${fail_list} 1313cddd032SAnvesh Kumar Rayankula 1323cddd032SAnvesh Kumar Rayankula 1333cddd032SAnvesh Kumar RayankulaMake Large Number Of Wrong SSH Login Attempts And Check Stability 1343cddd032SAnvesh Kumar Rayankula [Documentation] Check BMC stability with large number of SSH wrong login requests. 1353cddd032SAnvesh Kumar Rayankula [Tags] Make_Large_Number_Of_Wrong_SSH_Login_Attempts_And_Check_Stability 1363cddd032SAnvesh Kumar Rayankula [Setup] Set Account Lockout Threshold 1373cddd032SAnvesh Kumar Rayankula [Teardown] FFDC On Test Case Fail 1383cddd032SAnvesh Kumar Rayankula 1393cddd032SAnvesh Kumar Rayankula SSHLibrary.Open Connection ${OPENBMC_HOST} 1403cddd032SAnvesh Kumar Rayankula @{ssh_status_list}= Create List 141fde32cfaSGene Ratzlaff FOR ${iter} IN RANGE ${1} ${loop_iteration} + 1 14223afcc57SGeorge Keishing Log To Console ${iter}th iteration 14323afcc57SGeorge Keishing ${invalid_password}= Catenate ${OPENBMC_PASSWORD}${iter} 1443cddd032SAnvesh Kumar Rayankula Run Keyword and Ignore Error 1453cddd032SAnvesh Kumar Rayankula ... Open Connection And Log In ${OPENBMC_USERNAME} ${invalid_password} 1463cddd032SAnvesh Kumar Rayankula 1473cddd032SAnvesh Kumar Rayankula # Every 100th iteration Login with correct credentials 14823afcc57SGeorge Keishing ${status}= Run keyword If ${iter} % ${100} == ${0} Run Keyword And Return Status 1493cddd032SAnvesh Kumar Rayankula ... Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} 1503cddd032SAnvesh Kumar Rayankula Run Keyword If ${status} == ${False} Append To List ${ssh_status_list} ${status} 1513cddd032SAnvesh Kumar Rayankula SSHLibrary.Close Connection 1523cddd032SAnvesh Kumar Rayankula END 1533cddd032SAnvesh Kumar Rayankula 1543cddd032SAnvesh Kumar Rayankula ${valid_login_count}= Evaluate ${iterations}/100 1553cddd032SAnvesh Kumar Rayankula ${fail_count}= Get Length ${ssh_status_list} 1563cddd032SAnvesh Kumar Rayankula Should Be Equal ${fail_count} ${0} 1573cddd032SAnvesh Kumar Rayankula ... msg= Login Failed ${fail_count} times in ${valid_login_count} attempts. 15891e59717SPrashanth Katti 15991e59717SPrashanth Katti 160ee26d5ecSPrashanth KattiTest Stability On Large Number Of Wrong Login Attempts To GUI 161ee26d5ecSPrashanth Katti [Documentation] Test stability on large number of wrong login attempts to GUI. 162ee26d5ecSPrashanth Katti [Tags] Test_Stability_On_Large_Number_Of_Wrong_Login_Attempts_To_GUI 163ee26d5ecSPrashanth Katti 164ee26d5ecSPrashanth Katti @{status_list}= Create List 165ee26d5ecSPrashanth Katti 166ee26d5ecSPrashanth Katti # Open headless browser. 167ee26d5ecSPrashanth Katti Start Virtual Display 168ee26d5ecSPrashanth Katti ${browser_ID}= Open Browser ${bmc_url} alias=browser1 169ee26d5ecSPrashanth Katti Set Window Size 1920 1080 170ee26d5ecSPrashanth Katti 171ee26d5ecSPrashanth Katti Go To ${bmc_url} 172ee26d5ecSPrashanth Katti 17323afcc57SGeorge Keishing FOR ${iter} IN RANGE ${1} ${iterations} + 1 17423afcc57SGeorge Keishing Log To Console ${iter}th login 175fef9aa92SGeorge Keishing Run Keyword And Ignore Error Login to GUI With Incorrect Credentials 176ee26d5ecSPrashanth Katti 177ee26d5ecSPrashanth Katti # Every 100th iteration, check BMC GUI is responsive. 17823afcc57SGeorge Keishing ${status}= Run Keyword If ${iter} % 100 == 0 Run Keyword And Return Status 179ee26d5ecSPrashanth Katti ... Open Browser ${bmc_url} 180ee26d5ecSPrashanth Katti Append To List ${status_list} ${status} 18147d1e8e6SGeorge Keishing Run Keyword If '${status}' == 'True' 18247d1e8e6SGeorge Keishing ... Run Keywords Close Browser AND Switch Browser browser1 183ee26d5ecSPrashanth Katti END 184ee26d5ecSPrashanth Katti 185ee26d5ecSPrashanth Katti ${fail_count}= Count Values In List ${status_list} False 186ee26d5ecSPrashanth Katti Run Keyword If ${fail_count} > ${0} FAIL Could not open BMC GUI ${fail_count} times 187ee26d5ecSPrashanth Katti 188ae743b89SMegha G N 189b844a873Sshrsuman123Test BMC GUI Stability On Continuous Refresh Of GUI Home Page 190b844a873Sshrsuman123 [Documentation] Login to BMC GUI and keep refreshing home page and verify stability 191b844a873Sshrsuman123 ... by login at times in another browser. 192b844a873Sshrsuman123 [Tags] Test_BMC_GUI_Stability_On_Continuous_Refresh_Of_GUI_Home_Page 193b844a873Sshrsuman123 [Teardown] Close All Browsers 194b844a873Sshrsuman123 195b844a873Sshrsuman123 @{failed_list}= Create List 196b844a873Sshrsuman123 197b844a873Sshrsuman123 # Open headless browser. 198b844a873Sshrsuman123 Start Virtual Display 199b844a873Sshrsuman123 ${browser_ID}= Open Browser ${bmc_url} alias=browser1 200b844a873Sshrsuman123 Set Window Size 1920 1080 201b844a873Sshrsuman123 Login GUI 202b844a873Sshrsuman123 203b844a873Sshrsuman123 FOR ${iter} IN RANGE ${iterations} 204b844a873Sshrsuman123 Log To Console ${iter}th Refresh of home page 205b844a873Sshrsuman123 206b844a873Sshrsuman123 Refresh GUI 207b844a873Sshrsuman123 Continue For Loop If ${iter}%100 != 0 208b844a873Sshrsuman123 209b844a873Sshrsuman123 # Every 100th iteration, check BMC GUI is responsive. 210b844a873Sshrsuman123 ${status}= Run Keyword And Return Status 211b844a873Sshrsuman123 ... Run Keywords Launch Browser And Login GUI AND Logout GUI 212b844a873Sshrsuman123 Run Keyword If '${status}' == 'False' Append To List ${failed_list} ${iter} 213b844a873Sshrsuman123 ... ELSE IF '${status}' == 'True' 214b844a873Sshrsuman123 ... Run Keywords Close Browser AND Switch Browser browser1 215b844a873Sshrsuman123 END 216b844a873Sshrsuman123 Log ${failed_list} 217b844a873Sshrsuman123 ${fail_count}= Get Length ${failed_list} 218b844a873Sshrsuman123 Run Keyword If ${fail_count} > ${0} FAIL Could not open BMC GUI ${fail_count} times 219ee26d5ecSPrashanth Katti 220ae743b89SMegha G N 2212b8bfcaaSshrsuman123Test BMCweb Stability On Continuous Redfish Login Attempts With Invalid Credentials 2222b8bfcaaSshrsuman123 [Documentation] Make invalid credentials Redfish login attempts continuously and 2232b8bfcaaSshrsuman123 ... verify bmcweb stability by login to Redfish with valid credentials. 2242b8bfcaaSshrsuman123 [Tags] Test_BMCweb_Stability_On_Continuous_Redfish_Login_Attempts_With_Invalid_Credentials 2252b8bfcaaSshrsuman123 2262b8bfcaaSshrsuman123 Invalid Credentials Redfish Login Attempts 2272b8bfcaaSshrsuman123 228ae743b89SMegha G N 2292b8bfcaaSshrsuman123Test User Delete Operation Without Session Token And Expect Failure 2302b8bfcaaSshrsuman123 [Documentation] Try to delete an object without valid session token and verifies it throws 2312b8bfcaaSshrsuman123 ... an unauthorised error. 2322b8bfcaaSshrsuman123 [Tags] Test_User_Delete_Operation_Without_Session_Token_And_Expect_Failure 2332b8bfcaaSshrsuman123 [Setup] Redfish.Logout 2342b8bfcaaSshrsuman123 2352b8bfcaaSshrsuman123 Redfish.Delete /redfish/v1/AccountService/Accounts/test_user 2362b8bfcaaSshrsuman123 ... valid_status_codes=[${HTTP_UNAUTHORIZED}] 2372b8bfcaaSshrsuman123 2382b8bfcaaSshrsuman123 2392b8bfcaaSshrsuman123Test Bmcweb Stability On Continuous Redfish Delete Operation Request Without Session Token 2402b8bfcaaSshrsuman123 [Documentation] Send delete object request without valid session token continuously and 2412b8bfcaaSshrsuman123 ... verify bmcweb stability by sending delete request with valid session token. 2422b8bfcaaSshrsuman123 [Tags] Test_Bmcweb_Stability_On_Continuous_Redfish_Delete_Operation_Request_Without_Session_Token 2432b8bfcaaSshrsuman123 2442b8bfcaaSshrsuman123 @{failed_iter_list}= Create List 2452b8bfcaaSshrsuman123 2462b8bfcaaSshrsuman123 FOR ${iter} IN RANGE ${iterations} 2472b8bfcaaSshrsuman123 Log To Console ${iter}th Redfish Delete Object Request without valid session token 2482b8bfcaaSshrsuman123 2492b8bfcaaSshrsuman123 Run Keyword And Ignore Error 2502b8bfcaaSshrsuman123 ... Redfish.Delete /redfish/v1/AccountService/Accounts/test_user 2512b8bfcaaSshrsuman123 Continue For Loop If ${iter}%100 != 0 2522b8bfcaaSshrsuman123 2532b8bfcaaSshrsuman123 # Every 100th iteration, check delete operation with valid session token. 2542b8bfcaaSshrsuman123 ${status}= Run Keyword And Return Status 2552b8bfcaaSshrsuman123 ... Login And Delete User 2562b8bfcaaSshrsuman123 Run Keyword If '${status}' == 'False' Append To List ${failed_iter_list} ${iter} 2572b8bfcaaSshrsuman123 END 2582b8bfcaaSshrsuman123 Log ${failed_iter_list} 2592b8bfcaaSshrsuman123 ${fail_count}= Get Length ${failed_iter_list} 2602b8bfcaaSshrsuman123 Run Keyword If ${fail_count} > ${0} FAIL Could not do Redfish delete operation ${fail_count} times 2612b8bfcaaSshrsuman123 262ae743b89SMegha G N 263ae743b89SMegha G NVerify Flood Put Method Without Auth Token 264ae743b89SMegha G N [Documentation] Flood put method without auth token and check BMC stability. 265ae743b89SMegha G N [Tags] Verify_Flood_Put_Method_Without_Auth_Token 266ae743b89SMegha G N [Teardown] Delete All BMC Partition File 267ae743b89SMegha G N 268ae743b89SMegha G N @{status_list}= Create List 269ae743b89SMegha G N 270ae743b89SMegha G N FOR ${iter} IN RANGE ${1} ${iterations} 271ae743b89SMegha G N Log To Console ${iter}th iteration 272ae743b89SMegha G N Run Keyword And Ignore Error 273ae743b89SMegha G N ... Redfish.Put ${LED_LAMP_TEST_ASSERTED_URI}attr/Asserted body={"data":1} 274ae743b89SMegha G N # Every 100th iteration, check BMC allows put with auth token. 275ae743b89SMegha G N ${status}= Run Keyword If ${iter} % 100 == 0 276ae743b89SMegha G N ... Run Keyword And Return Status 277ae743b89SMegha G N ... Login And Upload Partition File To BMC 278ae743b89SMegha G N Run Keyword If ${status} == ${False} 279ae743b89SMegha G N ... Append To List ${status_list} ${status} 280ae743b89SMegha G N END 281ae743b89SMegha G N 282ae743b89SMegha G N # Note the count for every 100 iterations. 283ae743b89SMegha G N ${verify_count}= Evaluate ${iterations}/100 284ae743b89SMegha G N ${fail_count}= Get Length ${status_list} 285ae743b89SMegha G N 286ae743b89SMegha G N Should Be Equal ${fail_count} ${0} 287ae743b89SMegha G N ... msg=Put operation failed ${fail_count} times in ${verify_count} attempts. 288ae743b89SMegha G N 289ae743b89SMegha G N 290fa699cfaSPrashanth Katti*** Keywords *** 291fa699cfaSPrashanth Katti 292fa699cfaSPrashanth KattiLogin And Configure Hostname 293fa699cfaSPrashanth Katti [Documentation] Login and configure hostname 29423afcc57SGeorge Keishing [Arguments] ${ethernet_interface_uri} 295fa699cfaSPrashanth Katti [Teardown] Redfish.Logout 296fa699cfaSPrashanth Katti 29723afcc57SGeorge Keishing # Description of argument(s): 29823afcc57SGeorge Keishing # ethernet_interface_uri Network interface URI path. 29923afcc57SGeorge Keishing 300fa699cfaSPrashanth Katti Redfish.Login 301fa699cfaSPrashanth Katti 30223afcc57SGeorge Keishing Redfish.Patch ${ethernet_interface_uri} body={'HostName': '${hostname}'} 303fa699cfaSPrashanth Katti ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 304fa699cfaSPrashanth Katti 30591e59717SPrashanth Katti 30691e59717SPrashanth KattiLogin And Create User 30791e59717SPrashanth Katti [Documentation] Login and create user 3082b8bfcaaSshrsuman123 [Teardown] Run Keywords Redfish.Delete /redfish/v1/AccountService/Accounts/test_user 3092b8bfcaaSshrsuman123 ... AND Redfish.Logout 3102b8bfcaaSshrsuman123 3112b8bfcaaSshrsuman123 Redfish.Login 3122b8bfcaaSshrsuman123 3132b8bfcaaSshrsuman123 ${user_info}= Create Dictionary 314ae743b89SMegha G N ... UserName=test_user Password=TestPwd123 RoleId=ReadOnly Enabled=${True} 3152b8bfcaaSshrsuman123 Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} 3162b8bfcaaSshrsuman123 ... valid_status_codes=[${HTTP_OK}, ${HTTP_CREATED}] 3172b8bfcaaSshrsuman123 318ae743b89SMegha G N 3192b8bfcaaSshrsuman123Login And Delete User 3202b8bfcaaSshrsuman123 [Documentation] Login create and delete user 32191e59717SPrashanth Katti [Teardown] Redfish.Logout 32291e59717SPrashanth Katti 32391e59717SPrashanth Katti Redfish.Login 32491e59717SPrashanth Katti 3253cddd032SAnvesh Kumar Rayankula ${user_info}= Create Dictionary 326ae743b89SMegha G N ... UserName=test_user Password=TestPwd123 RoleId=ReadOnly Enabled=${True} 3273cddd032SAnvesh Kumar Rayankula Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{user_info} 3282b8bfcaaSshrsuman123 ... valid_status_codes=[${HTTP_OK}, ${HTTP_CREATED}] 3292b8bfcaaSshrsuman123 Redfish.Delete /redfish/v1/AccountService/Accounts/test_user 3303cddd032SAnvesh Kumar Rayankula 331ae743b89SMegha G N 3323cddd032SAnvesh Kumar RayankulaSet Account Lockout Threshold 3333cddd032SAnvesh Kumar Rayankula [Documentation] Set user account lockout threshold. 3343cddd032SAnvesh Kumar Rayankula [Teardown] Redfish.Logout 3353cddd032SAnvesh Kumar Rayankula 3363cddd032SAnvesh Kumar Rayankula Redfish.Login 3373cddd032SAnvesh Kumar Rayankula Redfish.Patch /redfish/v1/AccountService body=[('AccountLockoutThreshold', 0)] 338ee26d5ecSPrashanth Katti 339ee26d5ecSPrashanth Katti 340ee26d5ecSPrashanth KattiLogin to GUI With Incorrect Credentials 3410aeb54f9SGeorge Keishing [Documentation] Attempt to login to GUI as root, providing incorrect password argument. 342ee26d5ecSPrashanth Katti 343d1ae7fa3Srramyasr-in Input Text ${xpath_login_username_input} root 344d1ae7fa3Srramyasr-in Input Password ${xpath_login_password_input} incorrect_password 345ee26d5ecSPrashanth Katti Click Button ${xpath_login_button} 3462b8bfcaaSshrsuman123 347ae743b89SMegha G N 3482b8bfcaaSshrsuman123Invalid Credentials Redfish Login Attempts 3492b8bfcaaSshrsuman123 [Documentation] Continuous invalid credentials login attempts to Redfish and 3502b8bfcaaSshrsuman123 ... login to Redfish with valid credentials at times and get failed login attempts. 3512b8bfcaaSshrsuman123 [Arguments] ${login_username}=${OPENBMC_USERNAME} ${login_password}=${OPENBMC_PASSWORD} 3522b8bfcaaSshrsuman123 3532b8bfcaaSshrsuman123 # Description of argument(s): 3542b8bfcaaSshrsuman123 # login_username username for login user. 3552b8bfcaaSshrsuman123 # login_password password for login user. 3562b8bfcaaSshrsuman123 3572b8bfcaaSshrsuman123 @{failed_iter_list}= Create List 3582b8bfcaaSshrsuman123 3592b8bfcaaSshrsuman123 FOR ${iter} IN RANGE ${iterations} 3602b8bfcaaSshrsuman123 Log To Console ${iter}th Redfish login with invalid credentials 3612b8bfcaaSshrsuman123 Run Keyword And Ignore Error Redfish.Login ${login_username} incorrect_password 3622b8bfcaaSshrsuman123 Continue For Loop If ${iter}%100 != 0 3632b8bfcaaSshrsuman123 3642b8bfcaaSshrsuman123 # Every 100th iteration, check Redfish is responsive. 3652b8bfcaaSshrsuman123 ${status}= Run Keyword And Return Status 3662b8bfcaaSshrsuman123 ... Redfish.Login ${login_username} ${login_password} 3672b8bfcaaSshrsuman123 Run Keyword If '${status}' == 'False' Append To List ${failed_iter_list} ${iter} 3682b8bfcaaSshrsuman123 Redfish.Logout 3692b8bfcaaSshrsuman123 END 3702b8bfcaaSshrsuman123 Log ${failed_iter_list} 3712b8bfcaaSshrsuman123 ${fail_count}= Get Length ${failed_iter_list} 3722b8bfcaaSshrsuman123 Run Keyword If ${fail_count} > ${0} FAIL Could not Login to Redfish ${fail_count} times 37305a29c85SGene Ratzlaff 37405a29c85SGene Ratzlaff 37505a29c85SGene RatzlaffConfirm Ability to Connect Then Close All Connections 37605a29c85SGene Ratzlaff [Documentation] Confirm that SSH login works, otherwise, skip this test. 37705a29c85SGene Ratzlaff ... If login succeeds, close all SSH connections to BMC to prepare for test. 37805a29c85SGene Ratzlaff 37905a29c85SGene Ratzlaff SSHLibrary.Close All Connections 38005a29c85SGene Ratzlaff SSHLibrary.Open Connection ${OPENBMC_HOST} 38105a29c85SGene Ratzlaff ${status}= Run Keyword And Return Status 38205a29c85SGene Ratzlaff ... SSHLibrary.Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} 38305a29c85SGene Ratzlaff Skip If ${status} == ${False} msg= SSH Login failed: test will be skipped 38405a29c85SGene Ratzlaff SSHLibrary.Close All Connections 385ae743b89SMegha G N 386ae743b89SMegha G N 387ae743b89SMegha G NLogin And Upload Partition File To BMC 388ae743b89SMegha G N [Documentation] Upload partition file to BMC. 389ae743b89SMegha G N 390ae743b89SMegha G N Create Partition File 391ae743b89SMegha G N Initialize OpenBMC 392ae743b89SMegha G N 393ae743b89SMegha G N # Get the content of the file and upload to BMC. 394ae743b89SMegha G N ${image_data}= OperatingSystem.Get Binary File 100-file 395ae743b89SMegha G N ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN} Content-Type=application/octet-stream 396ae743b89SMegha G N 397ae743b89SMegha G N ${kwargs}= Create Dictionary data=${image_data} 398ae743b89SMegha G N Set To Dictionary ${kwargs} headers ${headers} 3990af9eb04SMegha G N ${resp}= PUT On Session openbmc ${OEM_HOST_CONFIG_URI}/100-file &{kwargs} timeout=10 400ae743b89SMegha G N Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} 401ae743b89SMegha G N Delete Local Partition File 402ae743b89SMegha G N 403ae743b89SMegha G N 404ae743b89SMegha G NDelete Local Partition File 405ae743b89SMegha G N [Documentation] Delete local partition file. 406ae743b89SMegha G N 407ae743b89SMegha G N ${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist 100-file 408ae743b89SMegha G N Run Keyword If 'True' == '${file_exist}' Remove File 100-file 409ae743b89SMegha G N 410ae743b89SMegha G N 411ae743b89SMegha G NCreate Partition File 412ae743b89SMegha G N [Documentation] Create Partition file. 413ae743b89SMegha G N 414ae743b89SMegha G N Delete Local Partition File 415ae743b89SMegha G N 416ae743b89SMegha G N @{words}= Split String 100-file - 417ae743b89SMegha G N Run dd if=/dev/zero of=100-file bs=${words}[-0] count=1 418ae743b89SMegha G N OperatingSystem.File Should Exist 100-file 419ae743b89SMegha G N 420ae743b89SMegha G N 421ae743b89SMegha G NDelete All BMC Partition File 422ae743b89SMegha G N [Documentation] Delete multiple partition file on BMC via Redfish. 423ae743b89SMegha G N 424ae743b89SMegha G N Initialize OpenBMC 425ae743b89SMegha G N ${data}= Create Dictionary 426ae743b89SMegha G N ${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN} 427ae743b89SMegha G N Set To Dictionary ${data} headers ${headers} 428ae743b89SMegha G N 4290af9eb04SMegha G N ${resp}= POST On Session openbmc ${OEM_HOST_CONFIG_ACTIONS_URI}.DeleteAll &{data} 430ae743b89SMegha G N Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} 431ae743b89SMegha G N 432ae743b89SMegha G N Delete All Sessions 433