141747da7SRahul Maheshwari*** Settings *** 241747da7SRahul MaheshwariDocumentation This is a resource file containing user-defined keywords for new Vue based OpenBMC GUI. 341747da7SRahul Maheshwari 441747da7SRahul MaheshwariLibrary XvfbRobot 541747da7SRahul MaheshwariLibrary SeleniumLibrary 641747da7SRahul MaheshwariLibrary SSHLibrary 30 Seconds 741747da7SRahul MaheshwariResource ../../lib/state_manager.robot 841747da7SRahul MaheshwariVariables ../data/gui_variables.py 941747da7SRahul Maheshwari 1041747da7SRahul Maheshwari 1141747da7SRahul Maheshwari*** Variables *** 12*fba7a399SSridevi Ramesh${OPENBMC_GUI_URL} https://${OPENBMC_HOST}:${HTTPS_PORT} 13978f91d6Sshahmo32${xpath_power_page} //*[@data-test-id='appHeader-container-power'] 14978f91d6Sshahmo32${xpath_power_shutdown} //*[@data-test-id='serverPowerOperations-button-shutDown'] 15978f91d6Sshahmo32${xpath_power_power_on} //*[@data-test-id='serverPowerOperations-button-powerOn'] 16978f91d6Sshahmo32${xpath_power_reboot} //*[@data-test-id='serverPowerOperations-button-reboot'] 17978f91d6Sshahmo32${xpath_confirm} //button[contains(text(),'Confirm')] 1841747da7SRahul Maheshwari 194d4ef99fSGeorge Keishing# Default GUI browser and mode is set to "Firefox" and "headless" 2041747da7SRahul Maheshwari# respectively here. 2141747da7SRahul Maheshwari${GUI_BROWSER} ff 2241747da7SRahul Maheshwari${GUI_MODE} headless 2341747da7SRahul Maheshwari 2441747da7SRahul Maheshwari 2541747da7SRahul Maheshwari*** Keywords *** 2641747da7SRahul Maheshwari 2741747da7SRahul MaheshwariOpen Browser With URL 2841747da7SRahul Maheshwari [Documentation] Open browser with specified URL and returns browser id. 2941747da7SRahul Maheshwari [Arguments] ${URL} ${browser}=ff ${mode}=${GUI_MODE} 3041747da7SRahul Maheshwari 3141747da7SRahul Maheshwari # Description of argument(s): 3241747da7SRahul Maheshwari # URL Openbmc GUI URL to be open 3341747da7SRahul Maheshwari # (e.g. https://openbmc-test.mybluemix.net/#/login). 3441747da7SRahul Maheshwari # browser Browser used to open above URL 3541747da7SRahul Maheshwari # (e.g. gc for google chrome, ff for firefox). 3641747da7SRahul Maheshwari # mode Browser opening mode(e.g. headless, header). 3741747da7SRahul Maheshwari 3841747da7SRahul Maheshwari ${browser_ID}= Run Keyword If '${mode}' == 'headless' 3941747da7SRahul Maheshwari ... Launch Headless Browser ${URL} ${browser} 4041747da7SRahul Maheshwari ... ELSE Open Browser ${URL} ${browser} 4141747da7SRahul Maheshwari 42409df05dSGeorge Keishing RETURN ${browser_ID} 4341747da7SRahul Maheshwari 4441747da7SRahul Maheshwari 4541747da7SRahul MaheshwariLaunch Header Browser 4641747da7SRahul Maheshwari [Documentation] Open the browser with the URL and 4741747da7SRahul Maheshwari ... login on windows platform. 4841747da7SRahul Maheshwari [Arguments] ${browser_type}=${GUI_BROWSER} 4941747da7SRahul Maheshwari 5041747da7SRahul Maheshwari # Description of argument(s): 5141747da7SRahul Maheshwari # browser_type Type of browser (e.g. "firefox", "chrome", etc.). 5241747da7SRahul Maheshwari 53*fba7a399SSridevi Ramesh ${BROWSER_ID}= Open Browser ${OPENBMC_GUI_URL} ${browser_type} 5441747da7SRahul Maheshwari Maximize Browser Window 5541747da7SRahul Maheshwari Set Global Variable ${BROWSER_ID} 5641747da7SRahul Maheshwari 5741747da7SRahul Maheshwari 5841747da7SRahul MaheshwariLaunch Headless Browser 5941747da7SRahul Maheshwari [Documentation] Launch headless browser. 60*fba7a399SSridevi Ramesh [Arguments] ${URL}=${OPENBMC_GUI_URL} ${browser}=${GUI_BROWSER} 6141747da7SRahul Maheshwari 6241747da7SRahul Maheshwari # Description of argument(s): 6341747da7SRahul Maheshwari # URL Openbmc GUI URL to be open 6441747da7SRahul Maheshwari # (e.g. https://openbmc-test.mybluemix.net/#/login). 6541747da7SRahul Maheshwari # browser Browser to open given URL in headless way 6641747da7SRahul Maheshwari # (e.g. gc for google chrome, ff for firefox). 6741747da7SRahul Maheshwari 6841747da7SRahul Maheshwari Start Virtual Display 69761f5d96Syuvanvarshitha ${browser_ID}= Open Browser ${URL} ${browser} 7041747da7SRahul Maheshwari Set Window Size 1920 1080 7141747da7SRahul Maheshwari 72409df05dSGeorge Keishing RETURN ${browser_ID} 7341747da7SRahul Maheshwari 7441747da7SRahul Maheshwari 7541747da7SRahul MaheshwariLaunch Browser And Login GUI 76b874c315Srramyasr-in [Documentation] Launch browser and login to OpenBMC GUI, retry 2 attempts 77b874c315Srramyasr-in ... in 1 minute time. 78b874c315Srramyasr-in 794f16a513Srramyasr-in Wait Until Keyword Succeeds 195 sec 65 sec Retry Browser Login Attempts 80b874c315Srramyasr-in 81b874c315Srramyasr-in 82b874c315Srramyasr-inRetry Browser Login Attempts 8341747da7SRahul Maheshwari [Documentation] Launch browser and login to OpenBMC GUI. 8441747da7SRahul Maheshwari 85*fba7a399SSridevi Ramesh Open Browser With URL ${OPENBMC_GUI_URL} 8641747da7SRahul Maheshwari Login GUI ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} 8741747da7SRahul Maheshwari 8841747da7SRahul Maheshwari 8941747da7SRahul MaheshwariLogin GUI 9041747da7SRahul Maheshwari [Documentation] Login to OpenBMC GUI. 9141747da7SRahul Maheshwari [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD} 9241747da7SRahul Maheshwari 9341747da7SRahul Maheshwari # Description of argument(s): 9441747da7SRahul Maheshwari # username The username to be used for login. 9541747da7SRahul Maheshwari # password The password to be used for login. 9641747da7SRahul Maheshwari 97*fba7a399SSridevi Ramesh Go To ${OPENBMC_GUI_URL} 98d1ae7fa3Srramyasr-in Wait Until Element Is Enabled ${xpath_login_username_input} 99d1ae7fa3Srramyasr-in Input Text ${xpath_login_username_input} ${username} 100d1ae7fa3Srramyasr-in Input Password ${xpath_login_password_input} ${password} 101978f91d6Sshahmo32 Wait Until Element Is Enabled ${xpath_login_button} 10241747da7SRahul Maheshwari Click Element ${xpath_login_button} 1037ae30a48SRahul Maheshwari Wait Until Page Contains Overview timeout=60s 104319f27ecSrramyasr-in Wait Until Element Is Not Visible 105319f27ecSrramyasr-in ... ${xpath_page_loading_progress_bar} timeout=120s 10641747da7SRahul Maheshwari 1077ef2c448Ssarandev3Launch Browser And Login GUI With Given User 1087ef2c448Ssarandev3 [Documentation] Launch browser and login eBMC with specified user 1097ef2c448Ssarandev3 ... credentials through GUI. 1107ef2c448Ssarandev3 [Arguments] ${user_name} ${user_password} 1117ef2c448Ssarandev3 1127ef2c448Ssarandev3 # Description of argument(s): 1137ef2c448Ssarandev3 # user_name User name to login to eBMC. 1147ef2c448Ssarandev3 # user_password User password to login to eBMC. 1157ef2c448Ssarandev3 116*fba7a399SSridevi Ramesh Open Browser With URL ${OPENBMC_GUI_URL} 1177ef2c448Ssarandev3 LOGIN GUI ${user_name} ${user_password} 1187ef2c448Ssarandev3 11941747da7SRahul MaheshwariLogout GUI 12041747da7SRahul Maheshwari [Documentation] Logout of OpenBMC GUI. 12141747da7SRahul Maheshwari 122a9d9341cSshrsuman123 Click Element ${xpath_root_button_menu} 12341747da7SRahul Maheshwari Click Element ${xpath_logout_button} 12441747da7SRahul Maheshwari Wait Until Page Contains Element ${xpath_login_button} 12541747da7SRahul Maheshwari 12641747da7SRahul Maheshwari 12741747da7SRahul MaheshwariGenerate Test Error Log 12841747da7SRahul Maheshwari [Documentation] Generate test error log. 12941747da7SRahul Maheshwari 130ae6a3c23Srramyasr-in BMC Execute Command ${CMD_UNRECOVERABLE_ERROR} 13154edcbcfSAnusha Dathatri 13254edcbcfSAnusha Dathatri 13354edcbcfSAnusha DathatriSet Timezone In Profile Settings Page 13454edcbcfSAnusha Dathatri [Documentation] Set the given timezone in profile settings page. 13554edcbcfSAnusha Dathatri [Arguments] ${timezone}=Default 13654edcbcfSAnusha Dathatri 13754edcbcfSAnusha Dathatri # Description of argument(s): 13854edcbcfSAnusha Dathatri # timezone Timezone to select (eg. Default or Browser_offset). 13954edcbcfSAnusha Dathatri 14054edcbcfSAnusha Dathatri Wait Until Page Contains Element ${xpath_root_button_menu} 14154edcbcfSAnusha Dathatri Click Element ${xpath_root_button_menu} 14254edcbcfSAnusha Dathatri Click Element ${xpath_profile_settings} 14354edcbcfSAnusha Dathatri Click Element At Coordinates ${xpath_default_UTC} 0 0 14454edcbcfSAnusha Dathatri Click Element ${xpath_profile_save_button} 14590c6a81cSAshwini Chandrappa 14690c6a81cSAshwini Chandrappa 14790c6a81cSAshwini ChandrappaRefresh GUI 14890c6a81cSAshwini Chandrappa [Documentation] Refresh GUI via refresh button in header. 14990c6a81cSAshwini Chandrappa 15090c6a81cSAshwini Chandrappa Click Element ${xpath_refresh_button} 15190c6a81cSAshwini Chandrappa # Added delay for page to load fully after refresh. 15290c6a81cSAshwini Chandrappa Sleep 5s 153f942dae4Smeghagn12345 154f942dae4Smeghagn12345 155f942dae4Smeghagn12345Refresh GUI And Verify Element Value 156f942dae4Smeghagn12345 [Documentation] Refresh GUI using refresh button and verify that given element contains expected value. 157f942dae4Smeghagn12345 [Arguments] ${element} ${expected_value} 158f942dae4Smeghagn12345 159f942dae4Smeghagn12345 # Description of argument(s): 160f942dae4Smeghagn12345 # element Element whose value need to be checked. 161f942dae4Smeghagn12345 # expected_value Expected value of for the given element. 162f942dae4Smeghagn12345 163f942dae4Smeghagn12345 # Refresh GUI. 164f942dae4Smeghagn12345 165f942dae4Smeghagn12345 Click Element ${xpath_refresh_button} 166f942dae4Smeghagn12345 167f942dae4Smeghagn12345 # Check element value and verify that it contains expected value. 168f942dae4Smeghagn12345 ${element_value}= Get Text ${element} 169f942dae4Smeghagn12345 Log ${element_value} 170f942dae4Smeghagn12345 Should Contain ${element_value} ${expected_value} 171f942dae4Smeghagn12345 1722052fdddSmeghagn 1732052fdddSmeghagnReboot BMC via GUI 1742052fdddSmeghagn [Documentation] Reboot BMC via GUI. 1752052fdddSmeghagn 1762052fdddSmeghagn Click Element ${xpath_operations_menu} 1772052fdddSmeghagn Click Element ${xpath_reboot_bmc_sub_menu} 1782052fdddSmeghagn Click Button ${xpath_reboot_bmc_button} 179b9ae25afSMegha G N Wait Until Keyword Succeeds 30 sec 10 sec Click Button ${xpath_confirm_bmc_reboot} 1802052fdddSmeghagn Wait Until Keyword Succeeds 2 min 10 sec Is BMC Unpingable 1812052fdddSmeghagn Wait For Host To Ping ${OPENBMC_HOST} 1 min 1822a31e512SMegha G N 1832a31e512SMegha G N 1842a31e512SMegha G NAdd DNS Servers And Verify 1852a31e512SMegha G N [Documentation] Login to GUI Network page,add DNS server on BMC 1862a31e512SMegha G N ... and verify it via BMC CLI. 1872a31e512SMegha G N [Arguments] ${dns_server} ${expected_status}=Valid format 1882a31e512SMegha G N 1892a31e512SMegha G N # Description of the argument(s): 1902a31e512SMegha G N # dns_server A list of static name server IPs to be 1912a31e512SMegha G N # configured on the BMC. 1922a31e512SMegha G N # expected_status Expected status while adding DNS server address 1932a31e512SMegha G N # (e.g. Invalid format / Field required). 1942a31e512SMegha G N 1952a31e512SMegha G N Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15sec 1962a31e512SMegha G N 1972a31e512SMegha G N Click Button ${xpath_add_dns_ip_address_button} 1982a31e512SMegha G N Input Text ${xpath_input_static_dns} ${dns_server} 1992a31e512SMegha G N Click Button ${xpath_add_button} 2002a31e512SMegha G N Run keyword if '${expected_status}' != 'Valid format' 2012a31e512SMegha G N ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword 2022a31e512SMegha G N 2032a31e512SMegha G N Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=10sec 2042a31e512SMegha G N Wait Until Page Contains ${dns_server} timeout=40sec 2052a31e512SMegha G N 2062a31e512SMegha G N # Check if newly added DNS server is configured on BMC. 2072a31e512SMegha G N ${cli_name_servers}= CLI Get Nameservers 2082a31e512SMegha G N ${cmd_status}= Run Keyword And Return Status 2092a31e512SMegha G N ... List Should Contain Sub List ${cli_name_servers} ${dns_server} 210b9e3c716SMegha G N Run Keyword If '${expected_status}' == '${HTTP_OK}' 211b9e3c716SMegha G N ... Should Be True ${cmd_status} == ${True} 212b9e3c716SMegha G N ... ELSE Should Not Be True ${cmd_status} 213978f91d6Sshahmo32 214978f91d6Sshahmo32 215978f91d6Sshahmo32Navigate To Server Power Page 216978f91d6Sshahmo32 [Documentation] Navigate To Server Power Page. 217978f91d6Sshahmo32 218978f91d6Sshahmo32 Click Element ${xpath_power_page} 219978f91d6Sshahmo32 Wait Until Element Is Not Visible ${xpath_progress_bar} timeout=30 220978f91d6Sshahmo32 221978f91d6Sshahmo32 222978f91d6Sshahmo32Power Off Server 223978f91d6Sshahmo32 [Documentation] Powering off server. 224978f91d6Sshahmo32 225978f91d6Sshahmo32 Navigate To Server Power Page 226978f91d6Sshahmo32 ${present}= Run Keyword And Return Status 227978f91d6Sshahmo32 ... Element Should Be Visible ${xpath_power_shutdown} 228978f91d6Sshahmo32 IF ${present} 229978f91d6Sshahmo32 Click Element ${xpath_power_shutdown} 230978f91d6Sshahmo32 Click Button ${xpath_confirm} 231978f91d6Sshahmo32 Wait Until Element Is Visible ${xpath_power_poweron} timeout=60 232978f91d6Sshahmo32 ELSE 233978f91d6Sshahmo32 Log To console Server is already powered Off. 234978f91d6Sshahmo32 END 235978f91d6Sshahmo32 236978f91d6Sshahmo32 237978f91d6Sshahmo32Power On Server 238978f91d6Sshahmo32 [Documentation] Powering on server. 239978f91d6Sshahmo32 240978f91d6Sshahmo32 Navigate To Server Power Page 241978f91d6Sshahmo32 ${present}= Run Keyword And Return Status 242978f91d6Sshahmo32 ... Element Should Be Visible ${xpath_power_power_on} 243978f91d6Sshahmo32 IF (${present}) 244978f91d6Sshahmo32 Click Element ${xpath_power_power_on} 245978f91d6Sshahmo32 Wait Until Element Is Visible ${xpath_power_shutdown} timeout=60 246978f91d6Sshahmo32 ELSE 247978f91d6Sshahmo32 Log To console Server is already powered On. 248978f91d6Sshahmo32 END 249978f91d6Sshahmo32 250978f91d6Sshahmo32 251978f91d6Sshahmo32Reboot Server 252978f91d6Sshahmo32 [Documentation] Rebooting the server. 253978f91d6Sshahmo32 254978f91d6Sshahmo32 Navigate To Server Power Page 255978f91d6Sshahmo32 ${present}= Run Keyword And Return Status 256978f91d6Sshahmo32 ... Element Should Be Visible ${xpath_power_reboot} 257978f91d6Sshahmo32 IF ${present} 258978f91d6Sshahmo32 Click Element ${xpath_power_reboot} 259978f91d6Sshahmo32 Wait Until Element Is Visible ${xpath_confirm} timeout=30 260978f91d6Sshahmo32 Click Button ${xpath_confirm} 261978f91d6Sshahmo32 Wait Until Element Is Visible ${xpath_power_reboot} timeout=60 262978f91d6Sshahmo32 ELSE 263978f91d6Sshahmo32 Log To console Server is already powered Off, can't reboot. 264978f91d6Sshahmo32 END 265