blob: 74f7f6bee2901c6e57419588ccb01840b0c07b7f [file] [log] [blame]
Anusha Dathatri21ac59f2020-07-14 13:12:58 -05001*** Settings ***
2
3Documentation Test OpenBMC GUI "Network settings" sub-menu of
4... "Server configuration".
5
Rahul Maheshwari41747da2020-11-17 09:09:52 -06006Resource ../../lib/gui_resource.robot
Anves Kumar rayankula65e5ed22020-09-17 04:44:44 -05007Resource ../../../lib/bmc_network_utils.robot
Anusha Dathatri21ac59f2020-07-14 13:12:58 -05008
9Suite Setup Suite Setup Execution
10Suite Teardown Close Browser
11
12*** Variables ***
13
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050014${xpath_network_setting_heading} //h1[text()="Network settings"]
15${xpath_interface} //h2[text()="Interface"]
16${xpath_system} //h2[text()="System"]
17${xpath_static_ipv4} //h2[text()="Static IPv4"]
18${xpath_static_dns} //h2[text()="Static DNS"]
19${xpath_hostname_input} //*[@data-test-id="networkSettings-input-hostname"]
20${xpath_network_save_settings} //button[@data-test-id="networkSettings-button-saveNetworkSettings"]
21${xpath_default_gateway_input} //*[@data-test-id="networkSettings-input-gateway"]
22${xpath_mac_address_input} //*[@data-test-id="networkSettings-input-macAddress"]
23${xpath_static_input_ip0} //*[@data-test-id="networkSettings-input-staticIpv4-0"]
24${xpath_add_static_ip} //button[contains(text(),"Add static IP")]
25${xpath_setting_success} //*[contains(text(),"Successfully saved network settings.")]
26${xpath_add_dns_server} //button[contains(text(),"Add DNS server")]
Anves Kumar rayankula65e5ed22020-09-17 04:44:44 -050027${xpath_network_interface} //*[@data-test-id="networkSettings-select-interface"]
28${xpath_input_netmask_addr0} //*[@data-test-id="networkSettings-input-subnetMask-0"]
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -060029${xpath_delete_static_ip} //*[@title="Delete IPv4 row"]
Anves Kumar rayankula4c884472020-11-24 05:03:45 -060030${xpath_input_dns_server} //*[@data-test-id="networkSettings-input-dnsAddress-0"]
31${xpath_delete_dns_server} //*[@title="Delete DNS row"]
32
Anves Kumar rayankula4c884472020-11-24 05:03:45 -060033@{static_name_servers} 10.10.10.10
Anves Kumar rayankula89266292020-12-28 01:29:23 -060034@{null_value} null
35@{empty_dictionary} {}
36@{string_value} aa.bb.cc.dd
37@{special_char_value} @@@.%%.44.11
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050038
39*** Test Cases ***
40
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050041Verify Navigation To Network Settings Page
42 [Documentation] Verify navigation to network settings page.
43 [Tags] Verify_Navigation_To_Network_Settings_Page
44
45 Page Should Contain Element ${xpath_network_setting_heading}
46
47
48Verify Existence Of All Sections In Network Settings Page
49 [Documentation] Verify existence of all sections in network settings page.
50 [Tags] Verify_Existence_Of_All_Sections_In_Network_Settings_Page
51
52 Page Should Contain Element ${xpath_interface}
53 Page Should Contain Element ${xpath_system}
54 Page Should Contain Element ${xpath_static_ipv4}
55 Page Should Contain Element ${xpath_static_dns}
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -060056 Page Should Contain Button ${xpath_delete_static_ip}
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050057
58
59Verify Existence Of All Buttons In Network Settings Page
60 [Documentation] Verify existence of all buttons in network settings page.
61 [Tags] Verify_Existence_Of_All_Buttons_In_Network_Settings_Page
62
63 Page Should Contain Element ${xpath_add_static_ip}
64 Page Should Contain Element ${xpath_add_dns_server}
65
66
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050067Verify Network Settings From Server Configuration
68 [Documentation] Verify ability to select "Network Settings" sub-menu option
69 ... of "Server Configuration".
70 [Tags] Verify_Network_Settings_From_Server_Configuration
71
72 Page Should Contain IP address
73
74
75Verify Hostname Text Configuration
76 [Documentation] Verify hostname text is configurable from "network settings"
77 ... sub-menu.
78 [Tags] Verify_Hostname_Text_Configuration
79
Anves Kumar rayankula76c0a8a2020-11-17 03:36:32 -060080 Wait Until Element Is Enabled ${xpath_hostname_input}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050081 Input Text ${xpath_hostname_input} witherspoon1
82 Click Button ${xpath_network_save_settings}
83 Wait Until Page Contains Element ${xpath_setting_success} timeout=10
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050084 Wait Until Keyword Succeeds 15 sec 5 sec Textfield Should Contain ${xpath_hostname_input}
85 ... witherspoon1
86
87
88Verify Default Gateway Editable
89 [Documentation] Verify default gateway text input allowed from "network
90 ... settings".
91 [Tags] Verify_Default_Gateway_Editable
Anves Kumar rayankula27603672021-01-21 04:26:08 -060092 [Teardown] Click Element ${xpath_refresh_button}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050093
94 Wait Until Page Contains Element ${xpath_default_gateway_input}
95 Input Text ${xpath_default_gateway_input} 10.6.6.7
96
97
98Verify MAC Address Editable
99 [Documentation] Verify MAC address text input allowed from "network
100 ... settings".
101 [Tags] Verify_MAC_Address_Editable
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600102 [Teardown] Click Element ${xpath_refresh_button}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500103
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600104 Wait Until Element Is Enabled ${xpath_mac_address_input}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500105 Input Text ${xpath_mac_address_input} AA:E2:84:14:28:79
106
107
108Verify Static IP Address Editable
109 [Documentation] Verify static IP address is editable.
110 [Tags] Verify_Static_IP_Address_Editable
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600111 [Teardown] Click Element ${xpath_refresh_button}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500112
113 ${exists}= Run Keyword And Return Status Wait Until Page Contains Element ${xpath_static_input_ip0}
114 Run Keyword If '${exists}' == '${False}'
115 ... Click Element ${xpath_add_static_ip}
116
117 Input Text ${xpath_static_input_ip0} ${OPENBMC_HOST}
118
119
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500120Verify System Section In Network Setting page
121 [Documentation] Verify hostname, MAC address and default gateway
Anves Kumar rayankulab172fbe2020-09-09 00:27:21 -0500122 ... under system section of network setting page.
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500123 [Tags] Verify_System_Section
124
Anves Kumar rayankulab172fbe2020-09-09 00:27:21 -0500125 ${host_name}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
Anves Kumar rayankulaba8a48e2020-10-05 06:18:09 -0500126 Textfield Value Should Be ${xpath_hostname_input} ${host_name}
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500127
128 ${mac_address}= Get BMC MAC Address
129 Textfield Value Should Be ${xpath_mac_address_input} ${mac_address}
130
131 ${default_gateway}= Get BMC Default Gateway
132 Textfield Value Should Be ${xpath_default_gateway_input} ${default_gateway}
133
134
Anves Kumar rayankula65e5ed22020-09-17 04:44:44 -0500135Verify Network Interface Details
136 [Documentation] Verify network interface name in network setting page.
137 [Tags] Verify_Network_Interface_Details
138
139 ${active_channel_config}= Get Active Channel Config
140 ${ethernet_interface_redfish}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
141 ${ethernet_interface_gui}= Get Text ${xpath_network_interface}
142 Should Contain ${ethernet_interface_gui} ${ethernet_interface_redfish}
143
144
145Verify Network Static IPv4 Details
146 [Documentation] Verify network static IPv4 details.
147 [Tags] Verify_Network_static_IPv4_Details
148
149 @{network_configurations}= Get Network Configuration
150 FOR ${network_configuration} IN @{network_configurations}
151 Textfield Value Should Be ${xpath_static_input_ip0} ${network_configuration["Address"]}
152 Textfield Value Should Be ${xpath_input_netmask_addr0} ${network_configuration['SubnetMask']}
153 END
154
155
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500156Configure Invalid Network Addresses And Verify
157 [Documentation] Configure invalid network addresses and verify.
158 [Tags] Configure_Invalid_Network_Addresses_And_Verify
159 [Template] Configure Invalid Network Address And Verify
160
161 # locator invalid_address
162 ${xpath_mac_address_input} A.A.A.A
163 ${xpath_default_gateway_input} a.b.c.d
164 ${xpath_static_input_ip0} a.b.c.d
165 ${xpath_input_netmask_addr0} 255.256.255.0
166
167
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600168Configure And Verify Empty Network Addresses
169 [Documentation] Configure and verify empty network addresses.
170 [Tags] Configure_And_Verify_Empty_Network_Addresses
171 [Template] Configure Invalid Network Address And Verify
172
173 # locator invalid_address expected_error
174 ${xpath_mac_address_input} ${empty} Field required
175 ${xpath_default_gateway_input} ${empty} Field required
176 ${xpath_static_input_ip0} ${empty} Field required
177 ${xpath_input_netmask_addr0} ${empty} Field required
178 ${xpath_hostname_input} ${empty} Field required
179
180
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600181Config And Verify DNS Server Via GUI
182 [Documentation] Configure DNS server and verify.
183 [Tags] Config_And_Verify_DNS_Server_Via_GUI
184 [Setup] DNS Test Setup Execution
185 [Teardown] Run Keywords Delete DNS Server And Verify ${static_name_servers}
186 ... AND DNS Test Teardown Execution
187
188 Add DNS Server And Verify ${static_name_servers}
189
190
191Delete And Verify DNS Server Via GUI
192 [Documentation] Delete DNS server and verify.
193 [Tags] Delete_And_Verify_DNS_Server_Via_GUI
194 [Setup] Run Keywords DNS Test Setup Execution AND
195 ... Add DNS Server And Verify ${static_name_servers}
196 [Teardown] DNS Test Teardown Execution
197
198 Delete DNS Server And Verify ${static_name_servers}
199
200
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600201Configure And Verify Invalid DNS Server
202 [Documentation] Configure invalid DNS server and verify error.
203 [Tags] Configure_And_Verify_Invalid_DNS_Server
204 [Template] Add DNS Server And Verify
205 [Setup] DNS Test Setup Execution
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600206 [Teardown] Run Keywords Click Element ${xpath_refresh_button}
207 ... AND DNS Test Teardown Execution
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600208
209 # invalid_ address expected_status
210 ${string_value} Invalid format
211 ${special_char_value} Invalid format
212 ${empty_dictionary} Field required
213 ${null_value} Invalid format
214
215
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500216*** Keywords ***
217
218Suite Setup Execution
219 [Documentation] Do test case setup tasks.
220
221 Launch Browser And Login GUI
222 Click Element ${xpath_server_configuration}
223 Click Element ${xpath_select_network_settings}
224 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network-settings
225
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500226
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500227Configure Invalid Network Address And Verify
228 [Documentation] Configure invalid network address And verify.
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600229 [Arguments] ${locator} ${invalid_address} ${expected_error}=Invalid format
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600230 [Teardown] Click Element ${xpath_refresh_button}
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500231
232 # Description of the argument(s):
233 # locator Xpath to identify an HTML element on a web page.
234 # invalid_address Invalid address to be added.
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600235 # expected_error Expected error optionally provided in testcase
236 # .... (e.g. Invalid format / Field required)
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500237
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600238 Wait Until Element Is Enabled ${locator}
239 Clear Element Text ${locator}
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500240 Input Text ${locator} ${invalid_address}
Anves Kumar rayankula55481152020-10-21 07:51:07 -0500241 Click Element ${xpath_network_save_settings}
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600242 Page Should Contain ${expected_error}
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500243
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600244
245Add DNS Server And Verify
246 [Documentation] Add DNS server on BMC and verify it via BMC CLI.
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600247 [Arguments] ${static_name_servers} ${expected_status}=Valid format
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600248
249 # Description of the argument(s):
250 # static_name_servers A list of static name server IPs to be
251 # configured on the BMC.
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600252 # expected_status Expected status while adding DNS server address
253 # ... (e.g. Invalid format / Field required).
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600254
255 Wait Until Page Contains Element ${xpath_add_dns_server}
256 ${length}= Get Length ${static_name_servers}
257 FOR ${i} IN RANGE ${length}
258 Click Button ${xpath_add_dns_server}
259 Input Text //*[@data-test-id="networkSettings-input-dnsAddress-${i}"]
260 ... ${static_name_servers}[${i}]
261 END
262
263 Click Button ${xpath_network_save_settings}
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600264 Run keyword if '${expected_status}' != 'Valid format'
265 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600266
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600267 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600268 Sleep ${NETWORK_TIMEOUT}s
269 Verify Static Name Server Details On GUI ${static_name_servers}
270 # Check if newly added DNS server is configured on BMC.
271 ${cli_name_servers}= CLI Get Nameservers
272 List Should Contain Sub List ${cli_name_servers} ${static_name_servers}
273
274
275Delete DNS Server And Verify
276 [Documentation] Delete static name servers.
277 [Arguments] ${static_name_servers}
278
279 # Description of the argument(s):
280 # static_name_servers A list of static name server IPs to be
281 # configured on the BMC.
282
283 ${length}= Get Length ${static_name_servers}
284 FOR ${i} IN RANGE ${length}
285 ${status}= Run Keyword And Return Status
286 ... Page Should Contain Element ${xpath_delete_dns_server}
287 Exit For Loop If "${status}" == "False"
288 Wait Until Element Is Enabled ${xpath_delete_dns_server}
289 Click Button ${xpath_delete_dns_server}
290 END
291
292 Click Button ${xpath_network_save_settings}
293 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
294
295 Sleep ${NETWORK_TIMEOUT}s
296 Page Should Not Contain Element ${xpath_input_dns_server}
297 # Check if all name servers deleted on BMC.
298 ${nameservers}= CLI Get Nameservers
299 Should Be Empty ${nameservers}
300
301
302DNS Test Setup Execution
303 [Documentation] Do DNS test setup execution.
304
305 ${original_name_server}= CLI Get Nameservers
306 Set Suite Variable ${original_name_server}
307 Run Keyword If ${original_name_server} != @{EMPTY}
308 ... Delete DNS Server And Verify ${original_name_server}
309
310
311DNS Test Teardown Execution
312 [Documentation] Do DNS test teardown execution.
313
314 Run Keyword If ${original_name_server} != @{EMPTY}
315 ... Add DNS Server And Verify ${original_name_server}
316
317
318Verify Static Name Server Details On GUI
319 [Documentation] Verify static name servers on GUI.
320 [Arguments] ${static_name_servers}
321
322 # Description of the argument(s):
323 # static_name_servers A list of static name server IPs to be
324 # configured on the BMC.
325
326 ${length}= Get Length ${static_name_servers}
327 FOR ${i} IN RANGE ${length}
328 Page Should Contain Element //*[@data-test-id="networkSettings-input-dnsAddress-${i}"]
329 Textfield Value Should Be //*[@data-test-id="networkSettings-input-dnsAddress-${i}"]
330 ... ${static_name_servers}[${i}]
331 END
332
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600333