1*** Settings *** 2 3Documentation Test OpenBMC GUI "Policies" sub-menu of "Security and Access" menu. 4 5Resource ../../lib/gui_resource.robot 6Resource ../lib/ipmi_client.robot 7Resource ../lib/protocol_setting_utils.robot 8Resource ../lib/common_utils.robot 9Suite Setup Run Keywords Launch Browser And Login GUI AND Redfish.Login 10Suite Teardown Close Browser 11Test Setup Test Setup Execution 12 13Force Tags Policies_Sub_Menu 14 15*** Variables *** 16 17 18${xpath_policies_heading} //h1[text()="Policies"] 19${xpath_bmc_ssh_toggle} //*[@data-test-id='policies-toggle-bmcShell'] 20... /following-sibling::label 21${xpath_network_ipmi_toggle} //*[@data-test-id='polices-toggle-networkIpmi'] 22... /following-sibling::label 23${xpath_host_tpm_toggle} //input[@id='host-tpm-policy'] 24${xpath_virtual_tpm_toggle} //*[@data-test-id='policies-toggle-vtpm'] 25${xpath_rtad_toggle} //*[@data-test-id='policies-toggle-rtad'] 26${xpath_usb_firmware_update_policy_toggle} //*[@data-test-id='policies-toggle-usbFirmwareUpdatePolicy'] 27${xpath_secure_version_lockin_toggle} //*[@data-test-id='policies-toggle-svle'] 28${xpath_host_usb_enablement_toggle} //*[@data-test-id='policies-toggle-hostUsb'] 29 30 31*** Test Cases *** 32 33Verify Navigation To Policies Page 34 [Documentation] Verify navigation to policies page. 35 [Tags] Verify_Navigation_To_Policies_Page 36 37 Page Should Contain Element ${xpath_policies_heading} 38 39 40Verify Existence Of All Sections In Policies Page 41 [Documentation] Verify existence of all sections in policies page. 42 [Tags] Verify_Existence_Of_All_Sections_In_Policies_Page 43 44 Page Should Contain BMC shell (via SSH) 45 Page Should Contain Network IPMI (out-of-band IPMI) 46 Page Should Contain Host TPM 47 Page Should Contain VirtualTPM 48 Page Should Contain RTAD 49 Page Should Contain USB firmware update policy 50 Page Should Contain Secure version lock-in 51 Page Should Contain Host USB enablement 52 53 54Verify Existence Of All Buttons In Policies Page 55 [Documentation] Verify existence of All Buttons in policies page. 56 [Tags] Verify_Existence_Of_All_Buttons_In_Policies_Page 57 58 Page Should Contain Element ${xpath_bmc_ssh_toggle} 59 Page Should Contain Element ${xpath_network_ipmi_toggle} 60 Page Should Contain Element ${xpath_host_tpm_toggle} 61 Page Should Contain Element ${xpath_virtual_tpm_toggle} 62 Page Should Contain Element ${xpath_rtad_toggle} 63 Page Should Contain Element ${xpath_usb_firmware_update_policy_toggle} 64 Page Should Contain Element ${xpath_secure_version_lockin_toggle} 65 Page Should Contain Element ${xpath_host_usb_enablement_toggle} 66 67 68Enable SSH Via GUI And Verify 69 [Documentation] Login to GUI Policies page,enable SSH toggle and 70 ... verify that SSH to BMC starts working after enabling SSH. 71 [Tags] Enable_SSH_Via_GUI_And_Verify 72 73 Set Policy Via GUI SSH Enabled 74 Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} Open Connection And Login 75 76 77Disable SSH Via GUI And Verify 78 [Documentation] Login to GUI Policies page,disable SSH and 79 ... verify that SSH to BMC stops working after disabling SSH. 80 [Tags] Disable_SSH_Via_GUI_And_Verify 81 [Teardown] Run Keywords Enable SSH Protocol ${True} AND 82 ... Wait Until Keyword Succeeds 30 sec 15 sec Open Connection And Login 83 84 Set Policy Via GUI SSH Disabled 85 86 ${status}= Run Keyword And Return Status 87 ... Open Connection And Login 88 89 Should Be Equal As Strings ${status} False 90 ... msg=SSH login still working after disabling SSH. 91 92 93Disable IPMI Via GUI And Verify 94 [Documentation] Login to GUI Policies page,disable IPMI and 95 ... verify that IPMI command does not work after disabling IPMI. 96 [Tags] Disable_IPMI_Via_GUI_And_Verify 97 98 Set Policy Via GUI IPMI Disabled 99 100 ${status}= Run Keyword And Return Status 101 ... Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} 102 ... Run IPMI Standard Command sel info 103 104 Should Be Equal As Strings ${status} False 105 ... msg=IPMI command is working after disabling IPMI. 106 107 108Enable IPMI Via GUI And Verify 109 [Documentation] Login to GUI Policies page,enable IPMI and 110 ... verify that IPMI command works after enabling IPMI. 111 [Tags] Enable_IPMI_Via_GUI_And_Verify 112 113 Set Policy Via GUI IPMI Enabled 114 Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} 115 ... Run IPMI Standard Command sel info 116 117 118Enable SSH Via GUI And Verify Persistency On BMC Reboot 119 [Documentation] Login to GUI Policies page,enable SSH and 120 ... verify persistency of SSH connection on BMC reboot. 121 [Tags] Enable_SSH_Via_GUI_And_Verify_Persistency_On_BMC_Reboot 122 123 Set Policy Via GUI SSH Enabled 124 125 Reboot BMC via GUI 126 127 Wait Until Keyword Succeeds 5 min 30 sec Open Connection And Login 128 129 130Enable IPMI Via GUI And Verify Persistency On BMC Reboot 131 [Documentation] Login to GUI Policies page,enable IPMI and 132 ... verify persistency of IPMI command work on BMC reboot. 133 [Tags] Enable_IPMI_Via_GUI_And_Verify_Persistency_On_BMC_Reboot 134 135 Set Policy Via GUI IPMI Enabled 136 137 Reboot BMC via GUI 138 139 Wait Until Keyword Succeeds 2 min 30 sec Run IPMI Standard Command sel info 140 141 142Disable SSH Via GUI And Verify Persistency On BMC Reboot 143 [Documentation] Login to GUI Policies page,disable SSH and 144 ... verify that SSH to BMC stops working after disabling SSH on BMC reboot. 145 [Tags] Disable_SSH_Via_GUI_And_Verify_Persistency_On_BMC_Reboot 146 [Teardown] Run Keywords Wait Until Keyword Succeeds 2 min 15 sec Enable SSH Protocol ${True} 147 ... AND Wait Until Keyword Succeeds 2 min 15 sec Open Connection And Login 148 149 Set Policy Via GUI SSH Disabled 150 151 Reboot BMC via GUI 152 153 ${status}= Run Keyword And Return Status 154 ... Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} Open Connection And Login 155 156 Should Be Equal As Strings ${status} False 157 ... msg=SSH login still working after disabling SSH. 158 159 160Disable IPMI Via GUI And Verify Persistency On BMC Reboot 161 [Documentation] Login to GUI Policies page,disable IPMI and 162 ... verify persistency of IPMI command does not work on BMC reboot. 163 [Tags] Disable_IPMI_Via_GUI_And_Verify_Persistency_On_BMC_Reboot 164 [Teardown] Run Keywords Wait Until Keyword Succeeds 2 min 15 sec Enable IPMI Protocol ${True} 165 ... AND Wait Until Keyword Succeeds 2 min 15 sec Run IPMI Standard Command sel info 166 167 Set Policy Via GUI IPMI Disabled 168 169 Reboot BMC via GUI 170 171 ${status}= Run Keyword And Return Status 172 ... Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} 173 ... Run IPMI Standard Command sel info 174 175 Should Be Equal As Strings ${status} False 176 ... msg=IPMI command is working after disabling IPMI. 177 178 179Configure SSH And IPMI Settings Via GUI And Verify 180 [Documentation] Login to GUI Policies page,set SSH and IPMI toggle and 181 ... verify SSH & IPMI after the settings. 182 [Tags] Configure_SSH_And_IPMI_Settings_Via_GUI_And_Verify 183 [Setup] Fetch IPMI And SSH Settings 184 [Template] Set SSH And IPMI State Via GUI 185 [Teardown] Set SSH And IPMI State Via GUI ${initial_ssh_setting} ${initial_ipmi_setting} 186 187 # ssh_state ipmi_state 188 Enabled Enabled 189 Disabled Disabled 190 Enabled Disabled 191 Disabled Enabled 192 193 194Configure SSH And IPMI Settings Via GUI And Verify Its Persistency 195 [Documentation] Login to GUI Policies page,set SSH and IPMI toggle and 196 ... verify SSH & IPMI settings after BMC reboot. 197 [Tags] Configure_SSH_And_IPMI_Settings_Via_GUI_And_Verify_Its_Persistency 198 [Setup] Fetch IPMI And SSH Settings 199 [Template] Set SSH And IPMI State Via GUI 200 [Teardown] Set SSH And IPMI State Via GUI ${initial_ssh_setting} ${initial_ipmi_setting} 201 202 # ssh_state ipmi_state persistency_check 203 Enabled Enabled True 204 Disabled Disabled True 205 Enabled Disabled True 206 Disabled Enabled True 207 208 209*** Keywords *** 210 211Test Setup Execution 212 [Documentation] Do test case setup tasks. 213 214 Wait Until Keyword Succeeds 30 sec 15 sec Click Element ${xpath_secuity_and_accesss_menu} 215 Click Element ${xpath_policies_sub_menu} 216 Wait Until Keyword Succeeds 30 sec 15 sec Location Should Contain policies 217 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=1min 218 219Set Policy Via GUI 220 221 [Documentation] Login to GUI Policies page and set policy. 222 [Arguments] ${policy} ${state} 223 224 # Description of argument(s): 225 # policy policy to be set(e.g. SSH, IPMI). 226 # state state to be set(e.g. Enable, Disable). 227 228 ${opposite_state_gui} ${opposite_state_redfish}= Run Keyword If 229 ... '${state}' == 'Enabled' Set Variable Disabled ${False} 230 ... ELSE IF '${state}' == 'Disabled' Set Variable Enabled ${True} 231 232 # Setting policy to an opposite value via Redfish. 233 Run Keyword If '${policy}' == 'SSH' 234 ... Enable SSH Protocol ${opposite_state_redfish} 235 ... ELSE IF '${policy}' == 'IPMI' 236 ... Enable IPMI Protocol ${opposite_state_redfish} 237 238 ${policy_toggle_button}= Run Keyword If '${policy}' == 'SSH' 239 ... Set variable ${xpath_bmc_ssh_toggle} 240 ... ELSE IF '${policy}' == 'IPMI' 241 ... Set variable ${xpath_network_ipmi_toggle} 242 243 Wait Until Keyword Succeeds 1 min 30 sec 244 ... Refresh GUI And Verify Element Value ${policy_toggle_button} ${opposite_state_gui} 245 Click Element ${policy_toggle_button} 246 247 # Wait for GUI to reflect policy status. 248 Wait Until Keyword Succeeds 1 min 30 sec 249 ... Refresh GUI And Verify Element Value ${policy_toggle_button} ${state} 250 251 252Verify Policy State 253 [Documentation] Verify if the current SSH and IPMI setting matches with 254 ... given values. 255 256 # Verify SSH state value. 257 ${status}= Run Keyword And Return Status 258 ... Open Connection And Login 259 260 Run Keyword If '${status}' == 'True' 261 ... Element Text Should Be ${xpath_bmc_ssh_toggle} Enabled 262 ... ELSE IF '${status}' == 'False' 263 ... Element Text Should Be ${xpath_bmc_ssh_toggle} Disabled 264 265 # Verify IPMI state value. 266 ${status}= Run Keyword And Return Status 267 ... Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} 268 ... Run IPMI Standard Command sel info 269 270 Run Keyword If '${status}' == 'True' 271 ... Element Text Should Be ${xpath_network_ipmi_toggle} Enabled 272 ... ELSE IF '${status}' == 'False' 273 ... Element Text Should Be ${xpath_network_ipmi_toggle} Disabled 274 275 276Set SSH And IPMI State Via GUI 277 [Documentation] Set SSH and IPMI states via GUI. 278 [Arguments] ${ssh_state} ${ipmi_state} ${persistency_check}=${False} 279 280 # Description of argument(s): 281 # ssh_state State of SSH to be set (e.g. Enabled, Disabled). 282 # ipmi_state State of IPMI to be set (e.g. Enabled, Disabled). 283 284 ${current_ssh_state}= Get Text ${xpath_bmc_ssh_toggle} 285 286 Run Keyword If '${ssh_state}' == '${current_ssh_state}' 287 # When SSH state is already set to given value, click SSH toggle 288 # button twice to reset SSH value back to its original value. 289 ... Run Keywords Click Element ${xpath_bmc_ssh_toggle} 290 ... AND Click Element ${xpath_bmc_ssh_toggle} 291 ... ELSE IF '${ssh_state}' != '${current_ssh_state}' 292 ... Click Element ${xpath_bmc_ssh_toggle} 293 294 ${current_ipmi_state}= Get Text ${xpath_network_ipmi_toggle} 295 296 Run Keyword If '${ipmi_state}' == '${current_ipmi_state}' 297 # When IPMI state is already set to given value, click IPMI toggle 298 # button twice to reset IPMI value back to its original value. 299 ... Run Keywords Click Element ${xpath_network_ipmi_toggle} 300 ... AND Click Element ${xpath_network_ipmi_toggle} 301 ... ELSE IF '${ipmi_state}' != '${current_ipmi_state}' 302 ... Click Element ${xpath_network_ipmi_toggle} 303 304 Run Keyword If ${persistency_check} == ${True} 305 ... Run Keywords Reboot BMC via GUI AND Test Setup Execution 306 307 Wait Until Keyword Succeeds 30 sec 15 sec Verify Policy State 308 309 310Fetch IPMI And SSH Settings 311 [Documentation] Note down the initial states of SSH and IPMI. 312 313 Test Setup Execution 314 ${initial_ssh_setting}= Get Text ${xpath_bmc_ssh_toggle} 315 Set Suite Variable ${initial_ssh_setting} 316 ${initial_ipmi_setting}= Get Text ${xpath_network_ipmi_toggle} 317 Set Suite Variable ${initial_ipmi_setting} 318