blob: 9dab94227b226aa89c9fb9c7eeb59069f97945ba [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 rayankula5538ed92021-05-19 01:42:21 -050034${xpath_delete_static_ip} //*[@title="Delete IPv4 row"]
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
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -050043${test_ipv4_addr2} 10.7.7.8
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -050044${test_subnet_mask} 255.255.0.0
Anves Kumar rayankulada394342021-01-17 23:51:16 -060045
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -060046# Valid netmask is 4 bytes long and has continuous block of 1s.
47# Maximum valid value in each octet is 255 and least value is 0.
48# Maximum value of octet in netmask is 255.
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -050049${alpha_netmask} ff.ff.ff.ff
50${out_of_range_netmask} 255.256.255.0
51${more_byte_netmask} 255.255.255.0.0
52${lowest_netmask} 128.0.0.0
Anves Kumar rayankulac3a37e42021-06-17 06:56:51 -050053${test_hostname} openbmc
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -060054
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050055*** Test Cases ***
56
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050057Verify Navigation To Network Settings Page
58 [Documentation] Verify navigation to network settings page.
59 [Tags] Verify_Navigation_To_Network_Settings_Page
60
61 Page Should Contain Element ${xpath_network_setting_heading}
62
63
64Verify Existence Of All Sections In Network Settings Page
65 [Documentation] Verify existence of all sections in network settings page.
66 [Tags] Verify_Existence_Of_All_Sections_In_Network_Settings_Page
67
68 Page Should Contain Element ${xpath_interface}
69 Page Should Contain Element ${xpath_system}
70 Page Should Contain Element ${xpath_static_ipv4}
71 Page Should Contain Element ${xpath_static_dns}
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -060072 Page Should Contain Button ${xpath_delete_static_ip}
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050073
74
75Verify Existence Of All Buttons In Network Settings Page
76 [Documentation] Verify existence of all buttons in network settings page.
77 [Tags] Verify_Existence_Of_All_Buttons_In_Network_Settings_Page
78
79 Page Should Contain Element ${xpath_add_static_ip}
80 Page Should Contain Element ${xpath_add_dns_server}
81
82
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050083Verify Network Settings From Server Configuration
84 [Documentation] Verify ability to select "Network Settings" sub-menu option
85 ... of "Server Configuration".
86 [Tags] Verify_Network_Settings_From_Server_Configuration
87
88 Page Should Contain IP address
89
90
91Verify Hostname Text Configuration
92 [Documentation] Verify hostname text is configurable from "network settings"
93 ... sub-menu.
94 [Tags] Verify_Hostname_Text_Configuration
95
Anves Kumar rayankula76c0a8a2020-11-17 03:36:32 -060096 Wait Until Element Is Enabled ${xpath_hostname_input}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050097 Input Text ${xpath_hostname_input} witherspoon1
98 Click Button ${xpath_network_save_settings}
99 Wait Until Page Contains Element ${xpath_setting_success} timeout=10
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500100 Wait Until Keyword Succeeds 15 sec 5 sec Textfield Should Contain ${xpath_hostname_input}
101 ... witherspoon1
102
103
104Verify Default Gateway Editable
105 [Documentation] Verify default gateway text input allowed from "network
106 ... settings".
107 [Tags] Verify_Default_Gateway_Editable
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600108 [Teardown] Click Element ${xpath_refresh_button}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500109
110 Wait Until Page Contains Element ${xpath_default_gateway_input}
111 Input Text ${xpath_default_gateway_input} 10.6.6.7
112
113
114Verify MAC Address Editable
115 [Documentation] Verify MAC address text input allowed from "network
116 ... settings".
117 [Tags] Verify_MAC_Address_Editable
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600118 [Teardown] Click Element ${xpath_refresh_button}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500119
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600120 Wait Until Element Is Enabled ${xpath_mac_address_input}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500121 Input Text ${xpath_mac_address_input} AA:E2:84:14:28:79
122
123
124Verify Static IP Address Editable
125 [Documentation] Verify static IP address is editable.
126 [Tags] Verify_Static_IP_Address_Editable
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600127 [Teardown] Click Element ${xpath_refresh_button}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500128
129 ${exists}= Run Keyword And Return Status Wait Until Page Contains Element ${xpath_static_input_ip0}
130 Run Keyword If '${exists}' == '${False}'
131 ... Click Element ${xpath_add_static_ip}
132
133 Input Text ${xpath_static_input_ip0} ${OPENBMC_HOST}
134
135
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500136Verify System Section In Network Setting page
137 [Documentation] Verify hostname, MAC address and default gateway
Anves Kumar rayankulab172fbe2020-09-09 00:27:21 -0500138 ... under system section of network setting page.
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500139 [Tags] Verify_System_Section
140
Anves Kumar rayankulab172fbe2020-09-09 00:27:21 -0500141 ${host_name}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
Anves Kumar rayankulaba8a48e2020-10-05 06:18:09 -0500142 Textfield Value Should Be ${xpath_hostname_input} ${host_name}
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500143
144 ${mac_address}= Get BMC MAC Address
145 Textfield Value Should Be ${xpath_mac_address_input} ${mac_address}
146
147 ${default_gateway}= Get BMC Default Gateway
148 Textfield Value Should Be ${xpath_default_gateway_input} ${default_gateway}
149
150
Anves Kumar rayankula65e5ed22020-09-17 04:44:44 -0500151Verify Network Interface Details
152 [Documentation] Verify network interface name in network setting page.
153 [Tags] Verify_Network_Interface_Details
154
155 ${active_channel_config}= Get Active Channel Config
156 ${ethernet_interface_redfish}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
157 ${ethernet_interface_gui}= Get Text ${xpath_network_interface}
158 Should Contain ${ethernet_interface_gui} ${ethernet_interface_redfish}
159
160
161Verify Network Static IPv4 Details
162 [Documentation] Verify network static IPv4 details.
163 [Tags] Verify_Network_static_IPv4_Details
164
165 @{network_configurations}= Get Network Configuration
Anves Kumar rayankulad9b4df82021-05-09 09:07:46 -0500166 ${ip_addresses}= Get Static IPv4 Addresses From GUI
Anves Kumar rayankula65e5ed22020-09-17 04:44:44 -0500167 FOR ${network_configuration} IN @{network_configurations}
Anves Kumar rayankulad9b4df82021-05-09 09:07:46 -0500168 List Should Contain Value ${ip_addresses} ${network_configuration["Address"]}
Anves Kumar rayankula65e5ed22020-09-17 04:44:44 -0500169 END
170
171
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500172Configure Invalid Network Addresses And Verify
173 [Documentation] Configure invalid network addresses and verify.
174 [Tags] Configure_Invalid_Network_Addresses_And_Verify
175 [Template] Configure Invalid Network Address And Verify
176
177 # locator invalid_address
178 ${xpath_mac_address_input} A.A.A.A
179 ${xpath_default_gateway_input} a.b.c.d
180 ${xpath_static_input_ip0} a.b.c.d
181 ${xpath_input_netmask_addr0} 255.256.255.0
182
183
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600184Configure And Verify Empty Network Addresses
185 [Documentation] Configure and verify empty network addresses.
186 [Tags] Configure_And_Verify_Empty_Network_Addresses
187 [Template] Configure Invalid Network Address And Verify
188
189 # locator invalid_address expected_error
190 ${xpath_mac_address_input} ${empty} Field required
191 ${xpath_default_gateway_input} ${empty} Field required
192 ${xpath_static_input_ip0} ${empty} Field required
193 ${xpath_input_netmask_addr0} ${empty} Field required
194 ${xpath_hostname_input} ${empty} Field required
195
196
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600197Config And Verify DNS Server Via GUI
198 [Documentation] Configure DNS server and verify.
199 [Tags] Config_And_Verify_DNS_Server_Via_GUI
200 [Setup] DNS Test Setup Execution
201 [Teardown] Run Keywords Delete DNS Server And Verify ${static_name_servers}
202 ... AND DNS Test Teardown Execution
203
204 Add DNS Server And Verify ${static_name_servers}
205
206
207Delete And Verify DNS Server Via GUI
208 [Documentation] Delete DNS server and verify.
209 [Tags] Delete_And_Verify_DNS_Server_Via_GUI
210 [Setup] Run Keywords DNS Test Setup Execution AND
211 ... Add DNS Server And Verify ${static_name_servers}
212 [Teardown] DNS Test Teardown Execution
213
214 Delete DNS Server And Verify ${static_name_servers}
215
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600216Configure And Verify Static IP Address
217 [Documentation] Configure and verify static ip addresses.
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600218 [Tags] Configure_And_Verify_Static_IP_Address
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500219 [Teardown] Delete And Verify Static IP Address On BMC ${test_ipv4_addr}
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600220
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.
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600240 [Tags] Modify_IP_Address_And_Verify
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500241 [Teardown] Delete And Verify Static IP Address On BMC ${test_ipv4_addr2}
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600242
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -0500243 Add Static IP Address And Verify ${test_ipv4_addr} ${test_subnet_mask}
244 Update IP Address And Verify ${test_ipv4_addr} ${test_ipv4_addr2}
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600245
246
247Configure Netmask And Verify
248 [Documentation] Configure and verify netmask.
249 [Tags] Configure_And_Verify_Netmask
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600250 [Template] Add Static IP Address And Verify
251 [Teardown] Run Keywords Click Element ${xpath_refresh_button}
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500252 ... AND Delete And Verify Static IP Address On BMC ${test_ipv4_addr}
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600253
254 # ip_addresses subnet_masks expected_status
255 ${test_ipv4_addr} ${lowest_netmask} Valid format
256 ${test_ipv4_addr} ${more_byte_netmask} Invalid format
257 ${test_ipv4_addr} ${alpha_netmask} Invalid format
258 ${test_ipv4_addr} ${out_of_range_netmask} Invalid format
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600259
Anves Kumar rayankulac3a37e42021-06-17 06:56:51 -0500260
261Configure Hostname And Verify
262 [Documentation] Configure hostname and verify.
263 [Tags] Configure_Hostname_And_Verify
264 [Teardown] Configure And Verify Network Settings
265 ... ${xpath_hostname_input} ${hostname}
266
267 ${hostname}= Get Value ${xpath_hostname_input}
268 Configure And Verify Network Settings ${xpath_hostname_input} ${test_hostname}
269
270
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500271*** Keywords ***
272
273Suite Setup Execution
274 [Documentation] Do test case setup tasks.
275
276 Launch Browser And Login GUI
277 Click Element ${xpath_server_configuration}
278 Click Element ${xpath_select_network_settings}
279 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network-settings
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600280 ${host_name} ${BMC_IP}= Get Host Name IP host=${OPENBMC_HOST}
281 Set Suite Variable ${BMC_IP}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500282
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500283
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500284Configure Invalid Network Address And Verify
285 [Documentation] Configure invalid network address And verify.
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600286 [Arguments] ${locator} ${invalid_address} ${expected_error}=Invalid format
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600287 [Teardown] Click Element ${xpath_refresh_button}
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500288
289 # Description of the argument(s):
290 # locator Xpath to identify an HTML element on a web page.
291 # invalid_address Invalid address to be added.
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600292 # expected_error Expected error optionally provided in testcase
293 # .... (e.g. Invalid format / Field required)
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500294
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600295 Wait Until Element Is Enabled ${locator}
296 Clear Element Text ${locator}
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500297 Input Text ${locator} ${invalid_address}
Anves Kumar rayankula55481152020-10-21 07:51:07 -0500298 Click Element ${xpath_network_save_settings}
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600299 Page Should Contain ${expected_error}
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500300
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600301
302Add DNS Server And Verify
303 [Documentation] Add DNS server on BMC and verify it via BMC CLI.
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600304 [Arguments] ${static_name_servers} ${expected_status}=Valid format
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600305
306 # Description of the argument(s):
307 # static_name_servers A list of static name server IPs to be
308 # configured on the BMC.
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600309 # expected_status Expected status while adding DNS server address
310 # ... (e.g. Invalid format / Field required).
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600311
312 Wait Until Page Contains Element ${xpath_add_dns_server}
313 ${length}= Get Length ${static_name_servers}
314 FOR ${i} IN RANGE ${length}
315 Click Button ${xpath_add_dns_server}
316 Input Text //*[@data-test-id="networkSettings-input-dnsAddress-${i}"]
317 ... ${static_name_servers}[${i}]
318 END
319
320 Click Button ${xpath_network_save_settings}
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600321 Run keyword if '${expected_status}' != 'Valid format'
322 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600323
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600324 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600325 Sleep ${NETWORK_TIMEOUT}s
326 Verify Static Name Server Details On GUI ${static_name_servers}
327 # Check if newly added DNS server is configured on BMC.
328 ${cli_name_servers}= CLI Get Nameservers
329 List Should Contain Sub List ${cli_name_servers} ${static_name_servers}
330
331
332Delete DNS Server And Verify
333 [Documentation] Delete static name servers.
334 [Arguments] ${static_name_servers}
335
336 # Description of the argument(s):
337 # static_name_servers A list of static name server IPs to be
338 # configured on the BMC.
339
340 ${length}= Get Length ${static_name_servers}
341 FOR ${i} IN RANGE ${length}
342 ${status}= Run Keyword And Return Status
343 ... Page Should Contain Element ${xpath_delete_dns_server}
344 Exit For Loop If "${status}" == "False"
345 Wait Until Element Is Enabled ${xpath_delete_dns_server}
346 Click Button ${xpath_delete_dns_server}
347 END
348
349 Click Button ${xpath_network_save_settings}
350 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
351
352 Sleep ${NETWORK_TIMEOUT}s
353 Page Should Not Contain Element ${xpath_input_dns_server}
354 # Check if all name servers deleted on BMC.
355 ${nameservers}= CLI Get Nameservers
356 Should Be Empty ${nameservers}
357
358
359DNS Test Setup Execution
360 [Documentation] Do DNS test setup execution.
361
362 ${original_name_server}= CLI Get Nameservers
363 Set Suite Variable ${original_name_server}
364 Run Keyword If ${original_name_server} != @{EMPTY}
365 ... Delete DNS Server And Verify ${original_name_server}
366
367
368DNS Test Teardown Execution
369 [Documentation] Do DNS test teardown execution.
370
371 Run Keyword If ${original_name_server} != @{EMPTY}
372 ... Add DNS Server And Verify ${original_name_server}
373
374
375Verify Static Name Server Details On GUI
376 [Documentation] Verify static name servers on GUI.
377 [Arguments] ${static_name_servers}
378
379 # Description of the argument(s):
380 # static_name_servers A list of static name server IPs to be
381 # configured on the BMC.
382
383 ${length}= Get Length ${static_name_servers}
384 FOR ${i} IN RANGE ${length}
385 Page Should Contain Element //*[@data-test-id="networkSettings-input-dnsAddress-${i}"]
386 Textfield Value Should Be //*[@data-test-id="networkSettings-input-dnsAddress-${i}"]
387 ... ${static_name_servers}[${i}]
388 END
389
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600390Add Static IP Address And Verify
391 [Documentation] Add static IP on BMC and verify.
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -0500392 [Arguments] ${ip_address} ${subnet_mask} ${expected_status}=Valid format
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600393
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600394 # Description of argument(s):
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -0500395 # ip_address IP address to be added (e.g. 10.7.7.7).
396 # subnet_masks Subnet mask for the IP to be added (e.g. 255.255.0.0).
397 # expected_status Expected status while adding static ipv4 address
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600398 # .... (e.g. Invalid format / Field required).
399
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -0500400 ${available_ip_addresses}= Get Static IPv4 Addresses From GUI
401
402 # New IP address location is GUI is equivalent to the available IP address
403 # in Redfish. i.e. if two IP address are available in GUI then location
404 # on IP address in GUI is also 2.
405 ${location}= Get Length ${available_ip_addresses}
406 Wait Until Element Is Enabled ${xpath_add_static_ip}
407 Click Button ${xpath_add_static_ip}
408
409 Input Text
410 ... //*[@data-test-id="networkSettings-input-staticIpv4-${location}"] ${ip_address}
411 Input Text
412 ... //*[@data-test-id="networkSettings-input-subnetMask-${location}"] ${subnet_mask}
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600413
414 Click Button ${xpath_network_save_settings}
415 Run keyword if '${expected_status}' != 'Valid format'
416 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword
417 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600418 Click Element ${xpath_refresh_button}
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -0500419 Wait Until Page Contains Element ${xpath_static_input_ip0}
420 Validate Network Config On BMC
421 ${ip_addresses}= Get Static IPv4 Addresses From GUI
422 Should Contain ${ip_addresses} ${ip_address}
423
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600424
425Delete And Verify Static IP Address On BMC
426 [Documentation] Delete static IP address and verify
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500427 [Arguments] ${ip_address}
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600428
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500429 # Description of argument(s):
430 # ip_address IP address to be deleted (e.g. "10.7.7.7").
431
432 ${ip_addresses}= Get Static IPv4 Addresses From GUI
433 Should Contain ${ip_addresses} ${ip_address} msg=${ip_address} does not exist on BMC
434
George Keishingb78bca22021-06-29 11:11:19 -0500435 ${delete_ip_buttons}= Get WebElements ${xpath_delete_static_ip}
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500436 FOR ${location} IN RANGE len(${ip_addresses})
437 ${gui_ip}= Get Value //*[@data-test-id="networkSettings-input-staticIpv4-${location}"]
438 Run Keyword If '${gui_ip}' == '${ip_address}' and '${gui_ip}' != '${BMC_IP}'
439 ... Run Keywords Click Element ${delete_ip_buttons}[${location}]
440 ... AND Exit For Loop
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600441 END
442
443 Click Button ${xpath_network_save_settings}
444 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500445 Wait Until Page Contains Element ${xpath_static_input_ip0}
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600446 Validate Network Config On BMC
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500447 ${ip_addresses}= Get Static IPv4 Addresses From GUI
448 Should Not Contain ${ip_addresses} ${ip_address}
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600449
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600450
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600451Update IP Address And Verify
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -0500452 [Documentation] Update and verify static IP address on BMC.
453 [Arguments] ${ip} ${new_ip}
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600454
455 # Description of argument(s):
456 # ip IP address to be replaced (e.g. "10.7.7.7").
457 # new_ip New IP address to be configured.
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600458
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -0500459 ${ip_addresses}= Get Static IPv4 Addresses From GUI
460 Should Contain ${ip_addresses} ${ip} msg=${ip} does not exist on BMC
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600461
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -0500462 FOR ${location} IN RANGE len(${ip_addresses})
463 ${gui_ip}= Get Value //*[@data-test-id="networkSettings-input-staticIpv4-${location}"]
464 Run Keyword If '${gui_ip}' == '${ip}'
465 ... Run Keywords
466 ... Clear Element Text //*[@data-test-id="networkSettings-input-staticIpv4-${location}"]
467 ... AND Input Text
468 ... //*[@data-test-id="networkSettings-input-staticIpv4-${location}"] ${new_ip}
469 ... AND Exit For Loop
470 END
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600471 Click Button ${xpath_network_save_settings}
472 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600473 Click Element ${xpath_refresh_button}
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -0500474 Wait Until Page Contains Element ${xpath_static_input_ip0}
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600475 Validate Network Config On BMC
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -0500476 ${ip_addresses}= Get Static IPv4 Addresses From GUI
477 Should Contain ${ip_addresses} ${new_ip}
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600478
479
Anves Kumar rayankulad9b4df82021-05-09 09:07:46 -0500480Get Static IPv4 Addresses From GUI
481 [Documentation] Get static IPV4 addresses from GUI.
482
483 ${availble_ip_addresses}= Get Network Configuration
484 ${static_ipv4_addresses}= Create List
485
486 FOR ${locator} IN RANGE len(${availble_ip_addresses})
487 ${ip_address}= Get value //*[@data-test-id="networkSettings-input-staticIpv4-${locator}"]
488 Append To List ${static_ipv4_addresses} ${ip_address}
489 END
490
491 [Return] ${static_ipv4_addresses}
Anves Kumar rayankulac3a37e42021-06-17 06:56:51 -0500492
493
494Configure And Verify Network Settings
495 [Documentation] Configure and verify network settings.
496 [Arguments] ${xpath} ${nw_settings}
497
498 # Description of argument(s):
499 # xpath xpath of the network settings.
500 # nw_settings The mac address, hostname etc.
501
502 Wait Until Element Is Enabled ${xpath}
503 Input Text ${xpath} ${nw_settings}
504 Click Button ${xpath_network_save_settings}
505 Wait Until Page Contains Element ${xpath_setting_success} timeout=10
506 Textfield Value Should Be ${xpath} ${nw_settings}
507