blob: a8e216ad739e5245003a853c38a57bfdb5d96aef [file] [log] [blame]
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -05001*** Settings ***
2
meghagn12345f942dae2021-08-27 02:53:00 -05003Documentation Test OpenBMC GUI "Policies" sub-menu of "Security and Access" menu.
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -05004
5Resource ../../lib/gui_resource.robot
meghagn56eba262021-09-16 07:05:52 -05006Resource ../lib/ipmi_client.robot
meghagn2052fdd2021-12-07 02:42:31 -06007Resource ../lib/protocol_setting_utils.robot
8Resource ../lib/common_utils.robot
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -05009Suite Setup Launch Browser And Login GUI
10Suite Teardown Close Browser
11Test Setup Test Setup Execution
12
13
14*** Variables ***
rramyasr-in34960622022-08-11 11:35:04 -050015
16${xpath_policies_heading} //h1[text()="Policies"]
17${xpath_bmc_ssh_toggle} //*[@data-test-id='policies-toggle-bmcShell']
18... /following-sibling::label
19${xpath_network_ipmi_toggle} //*[@data-test-id='polices-toggle-networkIpmi']
20... /following-sibling::label
21${xpath_host_tpm_toggle} //input[@id='host-tpm-policy']
22${xpath_virtual_tpm_toggle} //*[@data-test-id='policies-toggle-vtpm']
23${xpath_rtad_toggle} //*[@data-test-id='policies-toggle-rtad']
24${xpath_usb_firmware_update_policy_toggle} //*[@data-test-id='policies-toggle-usbFirmwareUpdatePolicy']
25${xpath_secure_version_lockin_toggle} //*[@data-test-id='policies-toggle-svle']
26${xpath_host_usb_enablement_toggle} //*[@data-test-id='policies-toggle-hostUsb']
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050027
28*** Test Cases ***
29
Rahul Maheshwari142642d2021-08-24 00:00:15 -050030Verify Navigation To Policies Page
meghagn12345f942dae2021-08-27 02:53:00 -050031 [Documentation] Verify navigation to policies page.
Rahul Maheshwari142642d2021-08-24 00:00:15 -050032 [Tags] Verify_Navigation_To_Policies_Page
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050033
Rahul Maheshwari142642d2021-08-24 00:00:15 -050034 Page Should Contain Element ${xpath_policies_heading}
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050035
36
Rahul Maheshwari142642d2021-08-24 00:00:15 -050037Verify Existence Of All Sections In Policies Page
38 [Documentation] Verify existence of all sections in policies page.
39 [Tags] Verify_Existence_Of_All_Sections_In_Policies_Page
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050040
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050041 Page Should Contain BMC shell (via SSH)
42 Page Should Contain Network IPMI (out-of-band IPMI)
rramyasr-in03f42372022-06-16 11:51:11 -050043 Page Should Contain Host TPM
44 Page Should Contain VirtualTPM
45 Page Should Contain RTAD
46 Page Should Contain USB firmware update policy
47 Page Should Contain Secure version lock-in
48 Page Should Contain Host USB enablement
meghagn2052fdd2021-12-07 02:42:31 -060049
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050050
Rahul Maheshwari142642d2021-08-24 00:00:15 -050051Verify Existence Of All Buttons In Policies Page
52 [Documentation] Verify existence of All Buttons in policies page.
53 [Tags] Verify_Existence_Of_All_Buttons_In_Policies_Page
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050054
55 Page Should Contain Element ${xpath_bmc_ssh_toggle}
56 Page Should Contain Element ${xpath_network_ipmi_toggle}
rramyasr-in34960622022-08-11 11:35:04 -050057 Page Should Contain Element ${xpath_host_tpm_toggle}
58 Page Should Contain Element ${xpath_virtual_tpm_toggle}
59 Page Should Contain Element ${xpath_rtad_toggle}
60 Page Should Contain Element ${xpath_usb_firmware_update_policy_toggle}
61 Page Should Contain Element ${xpath_secure_version_lockin_toggle}
62 Page Should Contain Element ${xpath_host_usb_enablement_toggle}
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -050063
64
meghagn12345f942dae2021-08-27 02:53:00 -050065Enable SSH Via GUI And Verify
meghagn2052fdd2021-12-07 02:42:31 -060066 [Documentation] Login to GUI Policies page,enable SSH toggle and
67 ... verify that SSH to BMC starts working after enabling SSH.
meghagn12345f942dae2021-08-27 02:53:00 -050068 [Tags] Enable_SSH_Via_GUI_And_Verify
meghagn12345f942dae2021-08-27 02:53:00 -050069
meghagn2052fdd2021-12-07 02:42:31 -060070 Set Policy Via GUI SSH Enabled
meghagn12345f942dae2021-08-27 02:53:00 -050071 Wait Until Keyword Succeeds 10 sec 5 sec Open Connection And Login
72
73
meghagn07db9622021-09-13 07:22:28 -050074Disable SSH Via GUI And Verify
meghagn2052fdd2021-12-07 02:42:31 -060075 [Documentation] Login to GUI Policies page,disable SSH and
76 ... verify that SSH to BMC stops working after disabling SSH.
meghagn07db9622021-09-13 07:22:28 -050077 [Tags] Disable_SSH_Via_GUI_And_Verify
meghagn2052fdd2021-12-07 02:42:31 -060078 [Teardown] Run Keywords Enable SSH Protocol ${True} AND
79 ... Wait Until Keyword Succeeds 30 sec 10 sec Open Connection And Login
meghagn07db9622021-09-13 07:22:28 -050080
meghagn2052fdd2021-12-07 02:42:31 -060081 Set Policy Via GUI SSH Disabled
meghagn07db9622021-09-13 07:22:28 -050082
83 ${status}= Run Keyword And Return Status
84 ... Open Connection And Login
85
86 Should Be Equal As Strings ${status} False
87 ... msg=SSH login still working after disabling SSH.
88
89
meghagn56eba262021-09-16 07:05:52 -050090Disable IPMI Via GUI And Verify
meghagn2052fdd2021-12-07 02:42:31 -060091 [Documentation] Login to GUI Policies page,disable IPMI and
George Keishingde7e0452022-02-01 07:04:41 -060092 ... verify that IPMI command does not work after disabling IPMI.
meghagn56eba262021-09-16 07:05:52 -050093 [Tags] Disable_IPMI_Via_GUI_And_Verify
meghagn56eba262021-09-16 07:05:52 -050094
meghagn2052fdd2021-12-07 02:42:31 -060095 Set Policy Via GUI IPMI Disabled
meghagn56eba262021-09-16 07:05:52 -050096
97 ${status}= Run Keyword And Return Status
98 ... Wait Until Keyword Succeeds 10 sec 5 sec Run IPMI Standard Command sel info
99
100 Should Be Equal As Strings ${status} False
101 ... msg=IPMI command is working after disabling IPMI.
102
103
meghagnb5c88b02021-09-14 00:32:27 -0500104Enable IPMI Via GUI And Verify
meghagn2052fdd2021-12-07 02:42:31 -0600105 [Documentation] Login to GUI Policies page,enable IPMI and
106 ... verify that IPMI command works after enabling IPMI.
meghagnb5c88b02021-09-14 00:32:27 -0500107 [Tags] Enable_IPMI_Via_GUI_And_Verify
meghagnb5c88b02021-09-14 00:32:27 -0500108
meghagn2052fdd2021-12-07 02:42:31 -0600109 Set Policy Via GUI IPMI Enabled
meghagnb5c88b02021-09-14 00:32:27 -0500110 Wait Until Keyword Succeeds 10 sec 5 sec Run IPMI Standard Command sel info
111
112
meghagn2052fdd2021-12-07 02:42:31 -0600113Enable SSH Via GUI And Verify Persistency On BMC Reboot
114 [Documentation] Login to GUI Policies page,enable SSH and
115 ... verify persistency of SSH connection on BMC reboot.
116 [Tags] Enable_SSH_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
117
118 Set Policy Via GUI SSH Enabled
119
120 Reboot BMC via GUI
121
122 Wait Until Keyword Succeeds 5 min 30 sec Open Connection And Login
123
124
125Enable IPMI Via GUI And Verify Persistency On BMC Reboot
126 [Documentation] Login to GUI Policies page,enable IPMI and
127 ... verify persistency of IPMI command work on BMC reboot.
128 [Tags] Enable_IPMI_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
129
130 Set Policy Via GUI IPMI Enabled
131
132 Reboot BMC via GUI
133
134 Wait Until Keyword Succeeds 2 min 30 sec Run IPMI Standard Command sel info
135
136
meghagn3fb3d1b2022-01-28 01:27:59 -0600137Disable SSH Via GUI And Verify Persistency On BMC Reboot
138 [Documentation] Login to GUI Policies page,disable SSH and
139 ... verify that SSH to BMC stops working after disabling SSH on BMC reboot.
140 [Tags] Disable_SSH_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
141 [Teardown] Run Keywords Wait Until Keyword Succeeds 2 min 15 sec Enable SSH Protocol ${True}
142 ... AND Wait Until Keyword Succeeds 2 min 15 sec Open Connection And Login
143
144 Set Policy Via GUI SSH Disabled
145
146 Reboot BMC via GUI
147
148 ${status}= Run Keyword And Return Status
149 ... Wait Until Keyword Succeeds 10 sec 5 sec Open Connection And Login
150
151 Should Be Equal As Strings ${status} False
152 ... msg=SSH login still working after disabling SSH.
153
154
155Disable IPMI Via GUI And Verify Persistency On BMC Reboot
156 [Documentation] Login to GUI Policies page,disable IPMI and
George Keishing86d85f42022-08-18 23:02:22 -0500157 ... verify persistency of IPMI command does not work on BMC reboot.
meghagn3fb3d1b2022-01-28 01:27:59 -0600158 [Tags] Disable_IPMI_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
159 [Teardown] Run Keywords Wait Until Keyword Succeeds 2 min 15 sec Enable IPMI Protocol ${True}
160 ... AND Wait Until Keyword Succeeds 2 min 15 sec Run IPMI Standard Command sel info
161
162 Set Policy Via GUI IPMI Disabled
163
164 Reboot BMC via GUI
165
166 ${status}= Run Keyword And Return Status
167 ... Wait Until Keyword Succeeds 10 sec 5 sec Run IPMI Standard Command sel info
168
169 Should Be Equal As Strings ${status} False
170 ... msg=IPMI command is working after disabling IPMI.
171
172
Ashwini Chandrappafdfd7e32021-08-02 07:59:11 -0500173*** Keywords ***
174
175Test Setup Execution
176 [Documentation] Do test case setup tasks.
meghagn2052fdd2021-12-07 02:42:31 -0600177
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500178 Click Element ${xpath_secuity_and_accesss_menu}
179 Click Element ${xpath_policies_sub_menu}
180 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain policies
meghagn12345f942dae2021-08-27 02:53:00 -0500181
182
meghagn2052fdd2021-12-07 02:42:31 -0600183Set Policy Via GUI
184
185 [Documentation] Login to GUI Policies page and set policy.
186 [Arguments] ${policy} ${state}
187
188 # Description of argument(s):
189 # policy policy to be set(e.g. SSH, IPMI).
190 # state state to be set(e.g. Enable, Disable).
191
192 ${opposite_state_gui} ${opposite_state_redfish}= Run Keyword If
193 ... '${state}' == 'Enabled' Set Variable Disabled ${False}
194 ... ELSE IF '${state}' == 'Disabled' Set Variable Enabled ${True}
195
196 # Setting policy to an opposite value via Redfish.
197 Run Keyword If '${policy}' == 'SSH'
198 ... Enable SSH Protocol ${opposite_state_redfish}
199 ... ELSE IF '${policy}' == 'IPMI'
200 ... Enable IPMI Protocol ${opposite_state_redfish}
201
202 ${policy_toggle_button}= Run Keyword If '${policy}' == 'SSH'
203 ... Set variable ${xpath_bmc_ssh_toggle}
204 ... ELSE IF '${policy}' == 'IPMI'
205 ... Set variable ${xpath_network_ipmi_toggle}
206
207 Wait Until Keyword Succeeds 1 min 30 sec
208 ... Refresh GUI And Verify Element Value ${policy_toggle_button} ${opposite_state_gui}
209 Click Element ${policy_toggle_button}
210
211 # Wait for GUI to reflect policy status.
212 Wait Until Keyword Succeeds 1 min 30 sec
213 ... Refresh GUI And Verify Element Value ${policy_toggle_button} ${state}