blob: acffb720bfab7933256e2a93f39ed7b89ecb6340 [file] [log] [blame]
Anusha Dathatri21ac59f2020-07-14 13:12:58 -05001*** Settings ***
2
Rahul Maheshwari142642d2021-08-24 00:00:15 -05003Documentation Test OpenBMC GUI "Network" sub-menu of "Settings".
Anusha Dathatri21ac59f2020-07-14 13:12:58 -05004
Rahul Maheshwari41747da2020-11-17 09:09:52 -06005Resource ../../lib/gui_resource.robot
Anves Kumar rayankula65e5ed22020-09-17 04:44:44 -05006Resource ../../../lib/bmc_network_utils.robot
Anusha Dathatri21ac59f2020-07-14 13:12:58 -05007
8Suite Setup Suite Setup Execution
9Suite Teardown Close Browser
10
11*** Variables ***
12
Rahul Maheshwari142642d2021-08-24 00:00:15 -050013${xpath_network_heading} //h1[text()="Network"]
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050014${xpath_interface} //h2[text()="Interface"]
15${xpath_system} //h2[text()="System"]
Anves Kumar rayankulabd101342021-05-06 06:36:14 -050016${xpath_static_ipv4} //h2[text()="IPV4"]
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050017${xpath_static_dns} //h2[text()="Static DNS"]
Rahul Maheshwari142642d2021-08-24 00:00:15 -050018${xpath_hostname_input} //*[@data-test-id="network-input-hostname"]
19${xpath_network_save_settings} //button[@data-test-id="network-button-saveNetworkSettings"]
20${xpath_default_gateway_input} //*[@data-test-id="network-input-gateway"]
21${xpath_mac_address_input} //*[@data-test-id="network-input-macAddress"]
22${xpath_static_input_ip0} //*[@data-test-id="network-input-staticIpv4-0"]
23${xpath_static_input_ip1} //*[@data-test-id="network-input-staticIpv4-1"]
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050024${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")]
Rahul Maheshwari142642d2021-08-24 00:00:15 -050027${xpath_network_interface} //*[@data-test-id="network-select-interface"]
28${xpath_input_netmask_addr0} //*[@data-test-id="network-input-subnetMask-0"]
29${xpath_input_netmask_addr1} //*[@data-test-id="network-input-subnetMask-1"]
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -060030${xpath_delete_static_ip} //*[@title="Delete IPv4 row"]
Rahul Maheshwari142642d2021-08-24 00:00:15 -050031${xpath_input_dns_server} //*[@data-test-id="network-input-dnsAddress-0"]
Anves Kumar rayankula4c884472020-11-24 05:03:45 -060032${xpath_delete_dns_server} //*[@title="Delete DNS row"]
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -050033${xpath_delete_static_ip} //*[@title="Delete IPv4 row"]
Anves Kumar rayankula4c884472020-11-24 05:03:45 -060034
Anves Kumar rayankula4c884472020-11-24 05:03:45 -060035@{static_name_servers} 10.10.10.10
Anves Kumar rayankula89266292020-12-28 01:29:23 -060036@{null_value} null
37@{empty_dictionary} {}
38@{string_value} aa.bb.cc.dd
39@{special_char_value} @@@.%%.44.11
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050040
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -050041${test_ipv4_addr} 10.7.7.7
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -050042${test_ipv4_addr2} 10.7.7.8
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -050043${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 rayankulac3a37e42021-06-17 06:56:51 -050052${test_hostname} openbmc
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -060053
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050054*** Test Cases ***
55
Rahul Maheshwari142642d2021-08-24 00:00:15 -050056Verify Navigation To Network Page
57 [Documentation] Verify navigation to network page.
58 [Tags] Verify_Navigation_To_Network_Page
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050059
Rahul Maheshwari142642d2021-08-24 00:00:15 -050060 Page Should Contain Element ${xpath_network_heading}
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050061
62
Rahul Maheshwari142642d2021-08-24 00:00:15 -050063Verify Existence Of All Sections In Network Page
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050064 [Documentation] Verify existence of all sections in network settings page.
Rahul Maheshwari142642d2021-08-24 00:00:15 -050065 [Tags] Verify_Existence_Of_All_Sections_In_Network_Page
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050066
67 Page Should Contain Element ${xpath_interface}
68 Page Should Contain Element ${xpath_system}
69 Page Should Contain Element ${xpath_static_ipv4}
70 Page Should Contain Element ${xpath_static_dns}
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -060071 Page Should Contain Button ${xpath_delete_static_ip}
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050072
73
Rahul Maheshwari142642d2021-08-24 00:00:15 -050074Verify Existence Of All Buttons In Network Page
75 [Documentation] Verify existence of all buttons in network page.
76 [Tags] Verify_Existence_Of_All_Buttons_In_Network_Page
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050077
78 Page Should Contain Element ${xpath_add_static_ip}
79 Page Should Contain Element ${xpath_add_dns_server}
80
81
Rahul Maheshwari142642d2021-08-24 00:00:15 -050082Verify Network From Server Configuration
83 [Documentation] Verify ability to select "Network" sub-menu option
84 ... of "Settings".
85 [Tags] Verify_Network_From_Server_Configuration
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050086
87 Page Should Contain IP address
88
89
90Verify Hostname Text Configuration
91 [Documentation] Verify hostname text is configurable from "network settings"
92 ... sub-menu.
93 [Tags] Verify_Hostname_Text_Configuration
94
Anves Kumar rayankula76c0a8a2020-11-17 03:36:32 -060095 Wait Until Element Is Enabled ${xpath_hostname_input}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050096 Input Text ${xpath_hostname_input} witherspoon1
97 Click Button ${xpath_network_save_settings}
98 Wait Until Page Contains Element ${xpath_setting_success} timeout=10
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050099 Wait Until Keyword Succeeds 15 sec 5 sec Textfield Should Contain ${xpath_hostname_input}
100 ... witherspoon1
101
102
103Verify Default Gateway Editable
104 [Documentation] Verify default gateway text input allowed from "network
105 ... settings".
106 [Tags] Verify_Default_Gateway_Editable
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600107 [Teardown] Click Element ${xpath_refresh_button}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500108
109 Wait Until Page Contains Element ${xpath_default_gateway_input}
110 Input Text ${xpath_default_gateway_input} 10.6.6.7
111
112
113Verify MAC Address Editable
114 [Documentation] Verify MAC address text input allowed from "network
115 ... settings".
116 [Tags] Verify_MAC_Address_Editable
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600117 [Teardown] Click Element ${xpath_refresh_button}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500118
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600119 Wait Until Element Is Enabled ${xpath_mac_address_input}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500120 Input Text ${xpath_mac_address_input} AA:E2:84:14:28:79
121
122
123Verify Static IP Address Editable
124 [Documentation] Verify static IP address is editable.
125 [Tags] Verify_Static_IP_Address_Editable
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600126 [Teardown] Click Element ${xpath_refresh_button}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500127
128 ${exists}= Run Keyword And Return Status Wait Until Page Contains Element ${xpath_static_input_ip0}
129 Run Keyword If '${exists}' == '${False}'
130 ... Click Element ${xpath_add_static_ip}
131
132 Input Text ${xpath_static_input_ip0} ${OPENBMC_HOST}
133
134
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500135Verify System Section In Network Setting page
136 [Documentation] Verify hostname, MAC address and default gateway
Anves Kumar rayankulab172fbe2020-09-09 00:27:21 -0500137 ... under system section of network setting page.
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500138 [Tags] Verify_System_Section
139
Anves Kumar rayankulab172fbe2020-09-09 00:27:21 -0500140 ${host_name}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
Anves Kumar rayankulaba8a48e2020-10-05 06:18:09 -0500141 Textfield Value Should Be ${xpath_hostname_input} ${host_name}
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500142
143 ${mac_address}= Get BMC MAC Address
144 Textfield Value Should Be ${xpath_mac_address_input} ${mac_address}
145
146 ${default_gateway}= Get BMC Default Gateway
147 Textfield Value Should Be ${xpath_default_gateway_input} ${default_gateway}
148
149
Anves Kumar rayankula65e5ed22020-09-17 04:44:44 -0500150Verify Network Interface Details
151 [Documentation] Verify network interface name in network setting page.
152 [Tags] Verify_Network_Interface_Details
153
154 ${active_channel_config}= Get Active Channel Config
155 ${ethernet_interface_redfish}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
156 ${ethernet_interface_gui}= Get Text ${xpath_network_interface}
157 Should Contain ${ethernet_interface_gui} ${ethernet_interface_redfish}
158
159
160Verify Network Static IPv4 Details
161 [Documentation] Verify network static IPv4 details.
162 [Tags] Verify_Network_static_IPv4_Details
163
164 @{network_configurations}= Get Network Configuration
Anves Kumar rayankulad9b4df82021-05-09 09:07:46 -0500165 ${ip_addresses}= Get Static IPv4 Addresses From GUI
Anves Kumar rayankula65e5ed22020-09-17 04:44:44 -0500166 FOR ${network_configuration} IN @{network_configurations}
Anves Kumar rayankulad9b4df82021-05-09 09:07:46 -0500167 List Should Contain Value ${ip_addresses} ${network_configuration["Address"]}
Anves Kumar rayankula65e5ed22020-09-17 04:44:44 -0500168 END
169
170
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500171Configure Invalid Network Addresses And Verify
172 [Documentation] Configure invalid network addresses and verify.
173 [Tags] Configure_Invalid_Network_Addresses_And_Verify
174 [Template] Configure Invalid Network Address And Verify
175
176 # locator invalid_address
177 ${xpath_mac_address_input} A.A.A.A
178 ${xpath_default_gateway_input} a.b.c.d
179 ${xpath_static_input_ip0} a.b.c.d
180 ${xpath_input_netmask_addr0} 255.256.255.0
181
182
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600183Configure And Verify Empty Network Addresses
184 [Documentation] Configure and verify empty network addresses.
185 [Tags] Configure_And_Verify_Empty_Network_Addresses
186 [Template] Configure Invalid Network Address And Verify
187
188 # locator invalid_address expected_error
189 ${xpath_mac_address_input} ${empty} Field required
190 ${xpath_default_gateway_input} ${empty} Field required
191 ${xpath_static_input_ip0} ${empty} Field required
192 ${xpath_input_netmask_addr0} ${empty} Field required
193 ${xpath_hostname_input} ${empty} Field required
194
195
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600196Config And Verify DNS Server Via GUI
197 [Documentation] Configure DNS server and verify.
198 [Tags] Config_And_Verify_DNS_Server_Via_GUI
199 [Setup] DNS Test Setup Execution
200 [Teardown] Run Keywords Delete DNS Server And Verify ${static_name_servers}
201 ... AND DNS Test Teardown Execution
202
203 Add DNS Server And Verify ${static_name_servers}
204
205
206Delete And Verify DNS Server Via GUI
207 [Documentation] Delete DNS server and verify.
208 [Tags] Delete_And_Verify_DNS_Server_Via_GUI
209 [Setup] Run Keywords DNS Test Setup Execution AND
210 ... Add DNS Server And Verify ${static_name_servers}
211 [Teardown] DNS Test Teardown Execution
212
213 Delete DNS Server And Verify ${static_name_servers}
214
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600215Configure And Verify Static IP Address
216 [Documentation] Configure and verify static ip addresses.
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600217 [Tags] Configure_And_Verify_Static_IP_Address
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500218 [Teardown] Delete And Verify Static IP Address On BMC ${test_ipv4_addr}
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600219
220 Add Static IP Address And Verify ${test_ipv4_addr} ${test_subnet_mask}
221
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600222
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600223Configure And Verify Invalid DNS Server
224 [Documentation] Configure invalid DNS server and verify error.
225 [Tags] Configure_And_Verify_Invalid_DNS_Server
226 [Template] Add DNS Server And Verify
227 [Setup] DNS Test Setup Execution
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600228 [Teardown] Run Keywords Click Element ${xpath_refresh_button}
229 ... AND DNS Test Teardown Execution
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600230
231 # invalid_ address expected_status
232 ${string_value} Invalid format
233 ${special_char_value} Invalid format
234 ${empty_dictionary} Field required
235 ${null_value} Invalid format
236
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600237Modify IP Address And Verify
238 [Documentation] Modify IP address and verify.
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600239 [Tags] Modify_IP_Address_And_Verify
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500240 [Teardown] Delete And Verify Static IP Address On BMC ${test_ipv4_addr2}
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600241
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -0500242 Add Static IP Address And Verify ${test_ipv4_addr} ${test_subnet_mask}
243 Update IP Address And Verify ${test_ipv4_addr} ${test_ipv4_addr2}
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600244
245
246Configure Netmask And Verify
247 [Documentation] Configure and verify netmask.
248 [Tags] Configure_And_Verify_Netmask
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600249 [Template] Add Static IP Address And Verify
250 [Teardown] Run Keywords Click Element ${xpath_refresh_button}
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500251 ... AND Delete And Verify Static IP Address On BMC ${test_ipv4_addr}
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600252
253 # ip_addresses subnet_masks expected_status
254 ${test_ipv4_addr} ${lowest_netmask} Valid format
255 ${test_ipv4_addr} ${more_byte_netmask} Invalid format
256 ${test_ipv4_addr} ${alpha_netmask} Invalid format
257 ${test_ipv4_addr} ${out_of_range_netmask} Invalid format
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600258
Anves Kumar rayankulac3a37e42021-06-17 06:56:51 -0500259
260Configure Hostname And Verify
261 [Documentation] Configure hostname and verify.
262 [Tags] Configure_Hostname_And_Verify
263 [Teardown] Configure And Verify Network Settings
264 ... ${xpath_hostname_input} ${hostname}
265
266 ${hostname}= Get Value ${xpath_hostname_input}
267 Configure And Verify Network Settings ${xpath_hostname_input} ${test_hostname}
268
269
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500270*** Keywords ***
271
272Suite Setup Execution
273 [Documentation] Do test case setup tasks.
274
275 Launch Browser And Login GUI
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500276 Click Element ${xpath_settings_menu}
277 Click Element ${xpath_network_sub_menu}
278 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600279 ${host_name} ${BMC_IP}= Get Host Name IP host=${OPENBMC_HOST}
280 Set Suite Variable ${BMC_IP}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500281
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500282
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500283Configure Invalid Network Address And Verify
284 [Documentation] Configure invalid network address And verify.
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600285 [Arguments] ${locator} ${invalid_address} ${expected_error}=Invalid format
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600286 [Teardown] Click Element ${xpath_refresh_button}
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500287
288 # Description of the argument(s):
289 # locator Xpath to identify an HTML element on a web page.
290 # invalid_address Invalid address to be added.
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600291 # expected_error Expected error optionally provided in testcase
292 # .... (e.g. Invalid format / Field required)
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500293
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600294 Wait Until Element Is Enabled ${locator}
295 Clear Element Text ${locator}
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500296 Input Text ${locator} ${invalid_address}
Anves Kumar rayankula55481152020-10-21 07:51:07 -0500297 Click Element ${xpath_network_save_settings}
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600298 Page Should Contain ${expected_error}
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500299
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600300
301Add DNS Server And Verify
302 [Documentation] Add DNS server on BMC and verify it via BMC CLI.
Anves Kumar rayankula27603672021-01-21 04:26:08 -0600303 [Arguments] ${static_name_servers} ${expected_status}=Valid format
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600304
305 # Description of the argument(s):
306 # static_name_servers A list of static name server IPs to be
307 # configured on the BMC.
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600308 # expected_status Expected status while adding DNS server address
309 # ... (e.g. Invalid format / Field required).
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600310
311 Wait Until Page Contains Element ${xpath_add_dns_server}
312 ${length}= Get Length ${static_name_servers}
313 FOR ${i} IN RANGE ${length}
314 Click Button ${xpath_add_dns_server}
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500315 Input Text //*[@data-test-id="network-input-dnsAddress-${i}"]
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600316 ... ${static_name_servers}[${i}]
317 END
318
319 Click Button ${xpath_network_save_settings}
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600320 Run keyword if '${expected_status}' != 'Valid format'
321 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600322
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600323 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600324 Sleep ${NETWORK_TIMEOUT}s
325 Verify Static Name Server Details On GUI ${static_name_servers}
326 # Check if newly added DNS server is configured on BMC.
327 ${cli_name_servers}= CLI Get Nameservers
328 List Should Contain Sub List ${cli_name_servers} ${static_name_servers}
329
330
331Delete DNS Server And Verify
332 [Documentation] Delete static name servers.
333 [Arguments] ${static_name_servers}
334
335 # Description of the argument(s):
336 # static_name_servers A list of static name server IPs to be
337 # configured on the BMC.
338
339 ${length}= Get Length ${static_name_servers}
340 FOR ${i} IN RANGE ${length}
341 ${status}= Run Keyword And Return Status
342 ... Page Should Contain Element ${xpath_delete_dns_server}
343 Exit For Loop If "${status}" == "False"
344 Wait Until Element Is Enabled ${xpath_delete_dns_server}
345 Click Button ${xpath_delete_dns_server}
346 END
347
348 Click Button ${xpath_network_save_settings}
349 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
350
351 Sleep ${NETWORK_TIMEOUT}s
352 Page Should Not Contain Element ${xpath_input_dns_server}
353 # Check if all name servers deleted on BMC.
354 ${nameservers}= CLI Get Nameservers
355 Should Be Empty ${nameservers}
356
357
358DNS Test Setup Execution
359 [Documentation] Do DNS test setup execution.
360
361 ${original_name_server}= CLI Get Nameservers
362 Set Suite Variable ${original_name_server}
363 Run Keyword If ${original_name_server} != @{EMPTY}
364 ... Delete DNS Server And Verify ${original_name_server}
365
366
367DNS Test Teardown Execution
368 [Documentation] Do DNS test teardown execution.
369
370 Run Keyword If ${original_name_server} != @{EMPTY}
371 ... Add DNS Server And Verify ${original_name_server}
372
373
374Verify Static Name Server Details On GUI
375 [Documentation] Verify static name servers on GUI.
376 [Arguments] ${static_name_servers}
377
378 # Description of the argument(s):
379 # static_name_servers A list of static name server IPs to be
380 # configured on the BMC.
381
382 ${length}= Get Length ${static_name_servers}
383 FOR ${i} IN RANGE ${length}
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500384 Page Should Contain Element //*[@data-test-id="network-input-dnsAddress-${i}"]
385 Textfield Value Should Be //*[@data-test-id="network-input-dnsAddress-${i}"]
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600386 ... ${static_name_servers}[${i}]
387 END
388
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600389Add Static IP Address And Verify
390 [Documentation] Add static IP on BMC and verify.
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -0500391 [Arguments] ${ip_address} ${subnet_mask} ${expected_status}=Valid format
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600392
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600393 # Description of argument(s):
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -0500394 # ip_address IP address to be added (e.g. 10.7.7.7).
395 # subnet_masks Subnet mask for the IP to be added (e.g. 255.255.0.0).
396 # expected_status Expected status while adding static ipv4 address
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600397 # .... (e.g. Invalid format / Field required).
398
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -0500399 ${available_ip_addresses}= Get Static IPv4 Addresses From GUI
400
401 # New IP address location is GUI is equivalent to the available IP address
402 # in Redfish. i.e. if two IP address are available in GUI then location
403 # on IP address in GUI is also 2.
404 ${location}= Get Length ${available_ip_addresses}
405 Wait Until Element Is Enabled ${xpath_add_static_ip}
406 Click Button ${xpath_add_static_ip}
407
408 Input Text
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500409 ... //*[@data-test-id="network-input-staticIpv4-${location}"] ${ip_address}
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -0500410 Input Text
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500411 ... //*[@data-test-id="network-input-subnetMask-${location}"] ${subnet_mask}
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600412
413 Click Button ${xpath_network_save_settings}
414 Run keyword if '${expected_status}' != 'Valid format'
415 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword
416 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600417 Click Element ${xpath_refresh_button}
Anves Kumar rayankulab2f73772021-05-11 04:58:25 -0500418 Wait Until Page Contains Element ${xpath_static_input_ip0}
419 Validate Network Config On BMC
420 ${ip_addresses}= Get Static IPv4 Addresses From GUI
421 Should Contain ${ip_addresses} ${ip_address}
422
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600423
424Delete And Verify Static IP Address On BMC
425 [Documentation] Delete static IP address and verify
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500426 [Arguments] ${ip_address}
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600427
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500428 # Description of argument(s):
429 # ip_address IP address to be deleted (e.g. "10.7.7.7").
430
431 ${ip_addresses}= Get Static IPv4 Addresses From GUI
432 Should Contain ${ip_addresses} ${ip_address} msg=${ip_address} does not exist on BMC
433
George Keishingb78bca22021-06-29 11:11:19 -0500434 ${delete_ip_buttons}= Get WebElements ${xpath_delete_static_ip}
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500435 FOR ${location} IN RANGE len(${ip_addresses})
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500436 ${gui_ip}= Get Value //*[@data-test-id="networ-input-staticIpv4-${location}"]
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500437 Run Keyword If '${gui_ip}' == '${ip_address}' and '${gui_ip}' != '${BMC_IP}'
438 ... Run Keywords Click Element ${delete_ip_buttons}[${location}]
439 ... AND Exit For Loop
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600440 END
441
442 Click Button ${xpath_network_save_settings}
443 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500444 Wait Until Page Contains Element ${xpath_static_input_ip0}
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600445 Validate Network Config On BMC
Anves Kumar rayankula5538ed92021-05-19 01:42:21 -0500446 ${ip_addresses}= Get Static IPv4 Addresses From GUI
447 Should Not Contain ${ip_addresses} ${ip_address}
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600448
Anves Kumar rayankulada394342021-01-17 23:51:16 -0600449
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600450Update IP Address And Verify
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -0500451 [Documentation] Update and verify static IP address on BMC.
452 [Arguments] ${ip} ${new_ip}
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600453
454 # Description of argument(s):
455 # ip IP address to be replaced (e.g. "10.7.7.7").
456 # new_ip New IP address to be configured.
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600457
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -0500458 ${ip_addresses}= Get Static IPv4 Addresses From GUI
459 Should Contain ${ip_addresses} ${ip} msg=${ip} does not exist on BMC
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600460
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -0500461 FOR ${location} IN RANGE len(${ip_addresses})
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500462 ${gui_ip}= Get Value //*[@data-test-id="network-input-staticIpv4-${location}"]
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -0500463 Run Keyword If '${gui_ip}' == '${ip}'
464 ... Run Keywords
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500465 ... Clear Element Text //*[@data-test-id="network-input-staticIpv4-${location}"]
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -0500466 ... AND Input Text
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500467 ... //*[@data-test-id="network-input-staticIpv4-${location}"] ${new_ip}
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -0500468 ... AND Exit For Loop
469 END
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600470 Click Button ${xpath_network_save_settings}
471 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600472 Click Element ${xpath_refresh_button}
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -0500473 Wait Until Page Contains Element ${xpath_static_input_ip0}
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600474 Validate Network Config On BMC
Anves Kumar rayankula14a8c982021-05-25 07:31:53 -0500475 ${ip_addresses}= Get Static IPv4 Addresses From GUI
476 Should Contain ${ip_addresses} ${new_ip}
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -0600477
478
Anves Kumar rayankulad9b4df82021-05-09 09:07:46 -0500479Get Static IPv4 Addresses From GUI
480 [Documentation] Get static IPV4 addresses from GUI.
481
482 ${availble_ip_addresses}= Get Network Configuration
483 ${static_ipv4_addresses}= Create List
484
485 FOR ${locator} IN RANGE len(${availble_ip_addresses})
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500486 ${ip_address}= Get value //*[@data-test-id="network-input-staticIpv4-${locator}"]
Anves Kumar rayankulad9b4df82021-05-09 09:07:46 -0500487 Append To List ${static_ipv4_addresses} ${ip_address}
488 END
489
490 [Return] ${static_ipv4_addresses}
Anves Kumar rayankulac3a37e42021-06-17 06:56:51 -0500491
492
493Configure And Verify Network Settings
494 [Documentation] Configure and verify network settings.
495 [Arguments] ${xpath} ${nw_settings}
496
497 # Description of argument(s):
498 # xpath xpath of the network settings.
499 # nw_settings The mac address, hostname etc.
500
501 Wait Until Element Is Enabled ${xpath}
502 Input Text ${xpath} ${nw_settings}
503 Click Button ${xpath_network_save_settings}
504 Wait Until Page Contains Element ${xpath_setting_success} timeout=10
505 Textfield Value Should Be ${xpath} ${nw_settings}
506