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