blob: 08307772c548995c17111d7efdcea6a0f5dc1fff [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"]
Anves Kumar rayankulabd101342021-05-06 06:36:14 -050017${xpath_static_ipv4} //h2[text()="IPV4"]
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050018${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"]
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -060024${xpath_static_input_ip1} //*[@data-test-id="networkSettings-input-staticIpv4-1"]
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050025${xpath_add_static_ip} //button[contains(text(),"Add static IP")]
26${xpath_setting_success} //*[contains(text(),"Successfully saved network settings.")]
27${xpath_add_dns_server} //button[contains(text(),"Add DNS server")]
Anves Kumar rayankula65e5ed22020-09-17 04:44:44 -050028${xpath_network_interface} //*[@data-test-id="networkSettings-select-interface"]
29${xpath_input_netmask_addr0} //*[@data-test-id="networkSettings-input-subnetMask-0"]
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -060030${xpath_input_netmask_addr1} //*[@data-test-id="networkSettings-input-subnetMask-1"]
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -060031${xpath_delete_static_ip} //*[@title="Delete IPv4 row"]
Anves Kumar rayankula4c884472020-11-24 05:03:45 -060032${xpath_input_dns_server} //*[@data-test-id="networkSettings-input-dnsAddress-0"]
33${xpath_delete_dns_server} //*[@title="Delete DNS row"]
Anves Kumar rayankulada394342021-01-17 23:51:16 -060034${xpath_ip_table} //*[@aria-colcount="3"]
Anves Kumar rayankula4c884472020-11-24 05:03:45 -060035
Anves Kumar rayankula4c884472020-11-24 05:03:45 -060036@{static_name_servers} 10.10.10.10
Anves Kumar rayankula89266292020-12-28 01:29:23 -060037@{null_value} null
38@{empty_dictionary} {}
39@{string_value} aa.bb.cc.dd
40@{special_char_value} @@@.%%.44.11
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050041
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -050042${test_ipv4_addr} 10.7.7.7
43${test_subnet_mask} 255.255.0.0
Anves Kumar rayankulada394342021-01-17 23:51:16 -060044
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -060045# Valid netmask is 4 bytes long and has continuous block of 1s.
46# Maximum valid value in each octet is 255 and least value is 0.
47# Maximum value of octet in netmask is 255.
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -050048${alpha_netmask} ff.ff.ff.ff
49${out_of_range_netmask} 255.256.255.0
50${more_byte_netmask} 255.255.255.0.0
51${lowest_netmask} 128.0.0.0
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -060052
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050053*** Test Cases ***
54
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050055Verify Navigation To Network Settings Page
56 [Documentation] Verify navigation to network settings page.
57 [Tags] Verify_Navigation_To_Network_Settings_Page
58
59 Page Should Contain Element ${xpath_network_setting_heading}
60
61
62Verify Existence Of All Sections In Network Settings Page
63 [Documentation] Verify existence of all sections in network settings page.
64 [Tags] Verify_Existence_Of_All_Sections_In_Network_Settings_Page
65
66 Page Should Contain Element ${xpath_interface}
67 Page Should Contain Element ${xpath_system}
68 Page Should Contain Element ${xpath_static_ipv4}
69 Page Should Contain Element ${xpath_static_dns}
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -060070 Page Should Contain Button ${xpath_delete_static_ip}
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050071
72
73Verify Existence Of All Buttons In Network Settings Page
74 [Documentation] Verify existence of all buttons in network settings page.
75 [Tags] Verify_Existence_Of_All_Buttons_In_Network_Settings_Page
76
77 Page Should Contain Element ${xpath_add_static_ip}
78 Page Should Contain Element ${xpath_add_dns_server}
79
80
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050081Verify Network Settings From Server Configuration
82 [Documentation] Verify ability to select "Network Settings" sub-menu option
83 ... of "Server Configuration".
84 [Tags] Verify_Network_Settings_From_Server_Configuration
85
86 Page Should Contain IP address
87
88
89Verify Hostname Text Configuration
90 [Documentation] Verify hostname text is configurable from "network settings"
91 ... sub-menu.
92 [Tags] Verify_Hostname_Text_Configuration
93
Anves Kumar rayankula76c0a8a2020-11-17 03:36:32 -060094 Wait Until Element Is Enabled ${xpath_hostname_input}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050095 Input Text ${xpath_hostname_input} witherspoon1
96 Click Button ${xpath_network_save_settings}
97 Wait Until Page Contains Element ${xpath_setting_success} timeout=10
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050098 Wait Until Keyword Succeeds 15 sec 5 sec Textfield Should Contain ${xpath_hostname_input}
99 ... witherspoon1
100
101
102Verify Default Gateway Editable
103 [Documentation] Verify default gateway text input allowed from "network
104 ... settings".
105 [Tags] Verify_Default_Gateway_Editable
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600106 [Teardown] Click Element ${xpath_refresh_button}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500107
108 Wait Until Page Contains Element ${xpath_default_gateway_input}
109 Input Text ${xpath_default_gateway_input} 10.6.6.7
110
111
112Verify MAC Address Editable
113 [Documentation] Verify MAC address text input allowed from "network
114 ... settings".
115 [Tags] Verify_MAC_Address_Editable
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600116 [Teardown] Click Element ${xpath_refresh_button}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500117
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600118 Wait Until Element Is Enabled ${xpath_mac_address_input}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500119 Input Text ${xpath_mac_address_input} AA:E2:84:14:28:79
120
121
122Verify Static IP Address Editable
123 [Documentation] Verify static IP address is editable.
124 [Tags] Verify_Static_IP_Address_Editable
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600125 [Teardown] Click Element ${xpath_refresh_button}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500126
127 ${exists}= Run Keyword And Return Status Wait Until Page Contains Element ${xpath_static_input_ip0}
128 Run Keyword If '${exists}' == '${False}'
129 ... Click Element ${xpath_add_static_ip}
130
131 Input Text ${xpath_static_input_ip0} ${OPENBMC_HOST}
132
133
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500134Verify System Section In Network Setting page
135 [Documentation] Verify hostname, MAC address and default gateway
Anves Kumar rayankulab172fbe2020-09-09 00:27:21 -0500136 ... under system section of network setting page.
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500137 [Tags] Verify_System_Section
138
Anves Kumar rayankulab172fbe2020-09-09 00:27:21 -0500139 ${host_name}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
Anves Kumar rayankulaba8a48e2020-10-05 06:18:09 -0500140 Textfield Value Should Be ${xpath_hostname_input} ${host_name}
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500141
142 ${mac_address}= Get BMC MAC Address
143 Textfield Value Should Be ${xpath_mac_address_input} ${mac_address}
144
145 ${default_gateway}= Get BMC Default Gateway
146 Textfield Value Should Be ${xpath_default_gateway_input} ${default_gateway}
147
148
Anves Kumar rayankula65e5ed22020-09-17 04:44:44 -0500149Verify Network Interface Details
150 [Documentation] Verify network interface name in network setting page.
151 [Tags] Verify_Network_Interface_Details
152
153 ${active_channel_config}= Get Active Channel Config
154 ${ethernet_interface_redfish}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
155 ${ethernet_interface_gui}= Get Text ${xpath_network_interface}
156 Should Contain ${ethernet_interface_gui} ${ethernet_interface_redfish}
157
158
159Verify Network Static IPv4 Details
160 [Documentation] Verify network static IPv4 details.
161 [Tags] Verify_Network_static_IPv4_Details
162
163 @{network_configurations}= Get Network Configuration
Anves Kumar rayankulad9b4df82021-05-09 09:07:46 -0500164 ${ip_addresses}= Get Static IPv4 Addresses From GUI
Anves Kumar rayankula65e5ed22020-09-17 04:44:44 -0500165 FOR ${network_configuration} IN @{network_configurations}
Anves Kumar rayankulad9b4df82021-05-09 09:07:46 -0500166 List Should Contain Value ${ip_addresses} ${network_configuration["Address"]}
Anves Kumar rayankula65e5ed22020-09-17 04:44:44 -0500167 END
168
169
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500170Configure Invalid Network Addresses And Verify
171 [Documentation] Configure invalid network addresses and verify.
172 [Tags] Configure_Invalid_Network_Addresses_And_Verify
173 [Template] Configure Invalid Network Address And Verify
174
175 # locator invalid_address
176 ${xpath_mac_address_input} A.A.A.A
177 ${xpath_default_gateway_input} a.b.c.d
178 ${xpath_static_input_ip0} a.b.c.d
179 ${xpath_input_netmask_addr0} 255.256.255.0
180
181
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600182Configure And Verify Empty Network Addresses
183 [Documentation] Configure and verify empty network addresses.
184 [Tags] Configure_And_Verify_Empty_Network_Addresses
185 [Template] Configure Invalid Network Address And Verify
186
187 # locator invalid_address expected_error
188 ${xpath_mac_address_input} ${empty} Field required
189 ${xpath_default_gateway_input} ${empty} Field required
190 ${xpath_static_input_ip0} ${empty} Field required
191 ${xpath_input_netmask_addr0} ${empty} Field required
192 ${xpath_hostname_input} ${empty} Field required
193
194
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600195Config And Verify DNS Server Via GUI
196 [Documentation] Configure DNS server and verify.
197 [Tags] Config_And_Verify_DNS_Server_Via_GUI
198 [Setup] DNS Test Setup Execution
199 [Teardown] Run Keywords Delete DNS Server And Verify ${static_name_servers}
200 ... AND DNS Test Teardown Execution
201
202 Add DNS Server And Verify ${static_name_servers}
203
204
205Delete And Verify DNS Server Via GUI
206 [Documentation] Delete DNS server and verify.
207 [Tags] Delete_And_Verify_DNS_Server_Via_GUI
208 [Setup] Run Keywords DNS Test Setup Execution AND
209 ... Add DNS Server And Verify ${static_name_servers}
210 [Teardown] DNS Test Teardown Execution
211
212 Delete DNS Server And Verify ${static_name_servers}
213
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600214Configure And Verify Static IP Address
215 [Documentation] Configure and verify static ip addresses.
216 [Setup] Test Setup Execution
217 [Tags] Configure_And_Verify_Static_IP_Address
218 [Teardown] Run Keywords Delete And Verify Static IP Address On BMC
219 ... AND Test Teardown Execution
220
221 Add Static IP Address And Verify ${test_ipv4_addr} ${test_subnet_mask}
222
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600223
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600224Configure And Verify Invalid DNS Server
225 [Documentation] Configure invalid DNS server and verify error.
226 [Tags] Configure_And_Verify_Invalid_DNS_Server
227 [Template] Add DNS Server And Verify
228 [Setup] DNS Test Setup Execution
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600229 [Teardown] Run Keywords Click Element ${xpath_refresh_button}
230 ... AND DNS Test Teardown Execution
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600231
232 # invalid_ address expected_status
233 ${string_value} Invalid format
234 ${special_char_value} Invalid format
235 ${empty_dictionary} Field required
236 ${null_value} Invalid format
237
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600238Modify IP Address And Verify
239 [Documentation] Modify IP address and verify.
240 [Setup] Test Setup Execution
241 [Tags] Modify_IP_Address_And_Verify
242 [Teardown] Run Keywords Delete And Verify Static IP Address On BMC
243 ... AND Test Teardown Execution
244
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -0500245 Add Static IP Address And Verify 10.7.7.8 255.255.0.0
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600246 Update IP Address And Verify 10.7.7.8 10.7.7.9 255.255.0.0
247
248
249Configure Netmask And Verify
250 [Documentation] Configure and verify netmask.
251 [Tags] Configure_And_Verify_Netmask
252 [Setup] Test Setup Execution
253 [Template] Add Static IP Address And Verify
254 [Teardown] Run Keywords Click Element ${xpath_refresh_button}
255 ... AND Delete And Verify Static IP Address On BMC
256 ... AND Test Teardown Execution
257
258 # ip_addresses subnet_masks expected_status
259 ${test_ipv4_addr} ${lowest_netmask} Valid format
260 ${test_ipv4_addr} ${more_byte_netmask} Invalid format
261 ${test_ipv4_addr} ${alpha_netmask} Invalid format
262 ${test_ipv4_addr} ${out_of_range_netmask} Invalid format
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600263
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500264*** Keywords ***
265
266Suite Setup Execution
267 [Documentation] Do test case setup tasks.
268
269 Launch Browser And Login GUI
270 Click Element ${xpath_server_configuration}
271 Click Element ${xpath_select_network_settings}
272 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network-settings
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600273 ${host_name} ${BMC_IP}= Get Host Name IP host=${OPENBMC_HOST}
274 Set Suite Variable ${BMC_IP}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500275
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500276
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500277Configure Invalid Network Address And Verify
278 [Documentation] Configure invalid network address And verify.
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600279 [Arguments] ${locator} ${invalid_address} ${expected_error}=Invalid format
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600280 [Teardown] Click Element ${xpath_refresh_button}
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500281
282 # Description of the argument(s):
283 # locator Xpath to identify an HTML element on a web page.
284 # invalid_address Invalid address to be added.
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600285 # expected_error Expected error optionally provided in testcase
286 # .... (e.g. Invalid format / Field required)
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500287
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600288 Wait Until Element Is Enabled ${locator}
289 Clear Element Text ${locator}
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500290 Input Text ${locator} ${invalid_address}
Anves Kumar rayankula55481152020-10-21 07:51:07 -0500291 Click Element ${xpath_network_save_settings}
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600292 Page Should Contain ${expected_error}
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500293
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600294
295Add DNS Server And Verify
296 [Documentation] Add DNS server on BMC and verify it via BMC CLI.
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600297 [Arguments] ${static_name_servers} ${expected_status}=Valid format
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600298
299 # Description of the argument(s):
300 # static_name_servers A list of static name server IPs to be
301 # configured on the BMC.
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600302 # expected_status Expected status while adding DNS server address
303 # ... (e.g. Invalid format / Field required).
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600304
305 Wait Until Page Contains Element ${xpath_add_dns_server}
306 ${length}= Get Length ${static_name_servers}
307 FOR ${i} IN RANGE ${length}
308 Click Button ${xpath_add_dns_server}
309 Input Text //*[@data-test-id="networkSettings-input-dnsAddress-${i}"]
310 ... ${static_name_servers}[${i}]
311 END
312
313 Click Button ${xpath_network_save_settings}
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600314 Run keyword if '${expected_status}' != 'Valid format'
315 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600316
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600317 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600318 Sleep ${NETWORK_TIMEOUT}s
319 Verify Static Name Server Details On GUI ${static_name_servers}
320 # Check if newly added DNS server is configured on BMC.
321 ${cli_name_servers}= CLI Get Nameservers
322 List Should Contain Sub List ${cli_name_servers} ${static_name_servers}
323
324
325Delete DNS Server And Verify
326 [Documentation] Delete static name servers.
327 [Arguments] ${static_name_servers}
328
329 # Description of the argument(s):
330 # static_name_servers A list of static name server IPs to be
331 # configured on the BMC.
332
333 ${length}= Get Length ${static_name_servers}
334 FOR ${i} IN RANGE ${length}
335 ${status}= Run Keyword And Return Status
336 ... Page Should Contain Element ${xpath_delete_dns_server}
337 Exit For Loop If "${status}" == "False"
338 Wait Until Element Is Enabled ${xpath_delete_dns_server}
339 Click Button ${xpath_delete_dns_server}
340 END
341
342 Click Button ${xpath_network_save_settings}
343 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
344
345 Sleep ${NETWORK_TIMEOUT}s
346 Page Should Not Contain Element ${xpath_input_dns_server}
347 # Check if all name servers deleted on BMC.
348 ${nameservers}= CLI Get Nameservers
349 Should Be Empty ${nameservers}
350
351
352DNS Test Setup Execution
353 [Documentation] Do DNS test setup execution.
354
355 ${original_name_server}= CLI Get Nameservers
356 Set Suite Variable ${original_name_server}
357 Run Keyword If ${original_name_server} != @{EMPTY}
358 ... Delete DNS Server And Verify ${original_name_server}
359
360
361DNS Test Teardown Execution
362 [Documentation] Do DNS test teardown execution.
363
364 Run Keyword If ${original_name_server} != @{EMPTY}
365 ... Add DNS Server And Verify ${original_name_server}
366
367
368Verify Static Name Server Details On GUI
369 [Documentation] Verify static name servers on GUI.
370 [Arguments] ${static_name_servers}
371
372 # Description of the argument(s):
373 # static_name_servers A list of static name server IPs to be
374 # configured on the BMC.
375
376 ${length}= Get Length ${static_name_servers}
377 FOR ${i} IN RANGE ${length}
378 Page Should Contain Element //*[@data-test-id="networkSettings-input-dnsAddress-${i}"]
379 Textfield Value Should Be //*[@data-test-id="networkSettings-input-dnsAddress-${i}"]
380 ... ${static_name_servers}[${i}]
381 END
382
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600383Add Static IP Address And Verify
384 [Documentation] Add static IP on BMC and verify.
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -0500385 [Arguments] ${ip_address} ${subnet_mask} ${expected_status}=Valid format
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600386
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600387 # Description of argument(s):
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -0500388 # ip_address IP address to be added (e.g. 10.7.7.7).
389 # subnet_masks Subnet mask for the IP to be added (e.g. 255.255.0.0).
390 # expected_status Expected status while adding static ipv4 address
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600391 # .... (e.g. Invalid format / Field required).
392
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -0500393 ${available_ip_addresses}= Get Static IPv4 Addresses From GUI
394
395 # New IP address location is GUI is equivalent to the available IP address
396 # in Redfish. i.e. if two IP address are available in GUI then location
397 # on IP address in GUI is also 2.
398 ${location}= Get Length ${available_ip_addresses}
399 Wait Until Element Is Enabled ${xpath_add_static_ip}
400 Click Button ${xpath_add_static_ip}
401
402 Input Text
403 ... //*[@data-test-id="networkSettings-input-staticIpv4-${location}"] ${ip_address}
404 Input Text
405 ... //*[@data-test-id="networkSettings-input-subnetMask-${location}"] ${subnet_mask}
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600406
407 Click Button ${xpath_network_save_settings}
408 Run keyword if '${expected_status}' != 'Valid format'
409 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword
410 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600411 Click Element ${xpath_refresh_button}
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -0500412 Wait Until Page Contains Element ${xpath_static_input_ip0}
413 Validate Network Config On BMC
414 ${ip_addresses}= Get Static IPv4 Addresses From GUI
415 Should Contain ${ip_addresses} ${ip_address}
416
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600417
418Delete And Verify Static IP Address On BMC
419 [Documentation] Delete static IP address and verify
420
421 ${all_match_elements}= Get Element Count ${xpath_delete_static_ip}
422 FOR ${element} IN RANGE ${all_match_elements}
423 ${ip_location}= Evaluate ${element} + ${1}
424 Delete Static IPv4 Addresses Except BMC IP ${element}
425 ${status}= Run Keyword And Return Status Page Should Contain Textfield
426 ... //*[@data-test-id="networkSettings-input-staticIpv4-${ip_location}"]
427 Exit For Loop IF "${status}" == "${False}"
428 END
429
430 Click Button ${xpath_network_save_settings}
431 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
432 ${all_match_elements}= Get Element Count ${xpath_delete_static_ip}
433 Should Be Equal ${all_match_elements} ${1}
434 Textfield Value Should Be ${xpath_static_input_ip0} ${BMC_IP}
435 Sleep ${NETWORK_TIMEOUT}s
436 Ping Host ${OPENBMC_HOST}
437 Validate Network Config On BMC
438
439Delete Static IPv4 Addresses Except BMC IP
440 [Documentation] Delete static IP addresses from IPv4 section on GUI except BMC IP.
441 [Arguments] ${element}
442
443 # Description of argument(s):
444 # element IP address location on GUI(e.g. 0 or 1).
445
446 ${ip_location}= Evaluate ${element} + ${1}
447 Wait Until Element Is Enabled //*[@data-test-id="networkSettings-input-staticIpv4-${element}"]
448 ${input_ip}= Get Value //*[@data-test-id="networkSettings-input-staticIpv4-${element}"]
449 Run Keyword If "${BMC_IP}" != "${input_ip}"
450 ... Click Button ${xpath_ip_table}/tbody/tr[${ip_location}]/td[3]/span/button
451
452 # Get delete ip elements.
453 ${delete_ip_elements}= Get Element Count ${xpath_delete_static_ip}
454
George Keishinga53c3412021-04-06 11:09:42 -0500455 # Delete IP Address on BMC if available more than 1.
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600456 Run Keyword If ${delete_ip_elements} != ${1}
457 ... Delete Static IPv4 Addresses Except BMC IP ${element}
458
459Test Setup Execution
460 [Documentation] Get and delete existing IPv4 addresses and netmask if any..
461
462 ${ip_data}= Create List
463 ${netmask_data}= Create List
464
465 # Get all IPv4 addresses and netmask on BMC.
466 ${network_configurations}= Get Network Configuration
467 FOR ${network_configuration} IN @{network_configurations}
468 Continue For Loop If '${BMC_IP}' == '${network_configuration['Address']}'
469 Append To List ${ip_data} ${network_configuration['Address']}
470 Append To List ${netmask_data} ${network_configuration['SubnetMask']}
471 END
472 Set Suite Variable ${ip_data}
473 Set Suite Variable ${netmask_data}
474
George Keishinga53c3412021-04-06 11:09:42 -0500475 # Delete existing static IPv4 addresses and netmask if available.
anvesr77dd83e252021-03-08 22:17:51 -0600476 Run Keyword If ${ip_data} != @{empty} and ${netmask_data} != @{empty}
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600477 ... Delete And Verify Static IP Address On BMC
478
479
480Test Teardown Execution
481 [Documentation] Restore existing IPv4 addresses and netmasks.
482
483 ${ip_length}= Get Length ${ip_data}
484 ${netmask_length}= Get Length ${netmask_data}
485
486 # Restore existing IPv4 addresses and netmasks if any..
anvesr77dd83e252021-03-08 22:17:51 -0600487 Run Keyword If ${ip_length} != ${0} and ${netmask_length} != ${0}
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600488 ... Add Static IP Address And Verify ${ip_data} ${netmask_data}
489
490
491Verify IP And Netmask On BMC Using GUI
492 [Documentation] Verify IP and netmask on GUI.
493 [Arguments] ${ip_addresses} ${subnet_masks}
494
495 # Description of argument(s):
496 # ip_addresses A list of IP address to be added (e.g. ["10.7.7.7"]).
497 # subnet_masks A list of Subnet mask for the IP to be added (e.g. ["255.255.0.0]").
498
499 ${ip_count}= Get Length ${ip_addresses}
500 FOR ${i} IN RANGE ${ip_count}
501 ${input_ip}= Get Value //*[@data-test-id="networkSettings-input-staticIpv4-${i}"]
502 Continue For Loop If '${BMC_IP}' == '${input_ip}'
503 Textfield Value Should Be //*[@data-test-id="networkSettings-input-staticIpv4-${i}"]
504 ... ${ip_addresses}[${i}]
505 Textfield Value Should Be //*[@data-test-id="networkSettings-input-subnetMask-${i}"]
506 ... ${subnet_masks}[${i}]
507 END
508 Validate Network Config On BMC
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600509
510
511Update IP Address And Verify
512 [Documentation] Update static IPv4 address and verify.
513 [Arguments] ${ip} ${new_ip} ${subnet_mask}
514
515 # Description of argument(s):
516 # ip IP address to be replaced (e.g. "10.7.7.7").
517 # new_ip New IP address to be configured.
518 # subnet_mask Netmask value.
519
520 ${get_ip}= Get Value ${xpath_static_input_ip0}
521 Run Keyword If '${ip}'== '${get_ip}'
522 ... Run Keywords Clear Element Text ${xpath_static_input_ip0}
523 ... AND Input Text ${xpath_static_input_ip0} ${new_ip}
524
525 Click Button ${xpath_network_save_settings}
526 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
527 Sleep ${NETWORK_TIMEOUT}s
528 Click Element ${xpath_refresh_button}
529 Verfiy IP On BMC ${new_ip} ${subnet_mask}
530 Validate Network Config On BMC
531
532
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600533Verfiy IP On BMC
534 [Documentation] Verify only one static IPv4 address.
535 [Arguments] ${ip} ${subnet_mask}
536
537 # Description of argument(s):
538 # ip IP address which needs to be verified (e.g. "10.7.7.7").
539 # subnet_mask Netmask value which needs to be verified.(e.g. "255.255.0.0").
540
541 ${get_ip}= Get Value ${xpath_static_input_ip0}
542 ${get_netmask}= Get Value ${xpath_input_netmask_addr0}
543 Should Be Equal ${get_ip} ${ip}
544 Should Be Equal ${get_netmask} ${subnet_mask}
Anves Kumar rayankulad9b4df82021-05-09 09:07:46 -0500545
546
547Get Static IPv4 Addresses From GUI
548 [Documentation] Get static IPV4 addresses from GUI.
549
550 ${availble_ip_addresses}= Get Network Configuration
551 ${static_ipv4_addresses}= Create List
552
553 FOR ${locator} IN RANGE len(${availble_ip_addresses})
554 ${ip_address}= Get value //*[@data-test-id="networkSettings-input-staticIpv4-${locator}"]
555 Append To List ${static_ipv4_addresses} ${ip_address}
556 END
557
558 [Return] ${static_ipv4_addresses}