blob: 45916edd0d59c6c4da69a62caf13e36c5a5e13eb [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
92
93 Wait Until Page Contains Element ${xpath_default_gateway_input}
94 Input Text ${xpath_default_gateway_input} 10.6.6.7
95
96
97Verify MAC Address Editable
98 [Documentation] Verify MAC address text input allowed from "network
99 ... settings".
100 [Tags] Verify_MAC_Address_Editable
101
102 Wait Until Page Contains Element ${xpath_mac_address_input}
103 Input Text ${xpath_mac_address_input} AA:E2:84:14:28:79
104
105
106Verify Static IP Address Editable
107 [Documentation] Verify static IP address is editable.
108 [Tags] Verify_Static_IP_Address_Editable
109
110 ${exists}= Run Keyword And Return Status Wait Until Page Contains Element ${xpath_static_input_ip0}
111 Run Keyword If '${exists}' == '${False}'
112 ... Click Element ${xpath_add_static_ip}
113
114 Input Text ${xpath_static_input_ip0} ${OPENBMC_HOST}
115
116
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500117Verify System Section In Network Setting page
118 [Documentation] Verify hostname, MAC address and default gateway
Anves Kumar rayankulab172fbe2020-09-09 00:27:21 -0500119 ... under system section of network setting page.
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500120 [Tags] Verify_System_Section
121
Anves Kumar rayankulab172fbe2020-09-09 00:27:21 -0500122 ${host_name}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
Anves Kumar rayankulaba8a48e2020-10-05 06:18:09 -0500123 Textfield Value Should Be ${xpath_hostname_input} ${host_name}
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500124
125 ${mac_address}= Get BMC MAC Address
126 Textfield Value Should Be ${xpath_mac_address_input} ${mac_address}
127
128 ${default_gateway}= Get BMC Default Gateway
129 Textfield Value Should Be ${xpath_default_gateway_input} ${default_gateway}
130
131
Anves Kumar rayankula65e5ed22020-09-17 04:44:44 -0500132Verify Network Interface Details
133 [Documentation] Verify network interface name in network setting page.
134 [Tags] Verify_Network_Interface_Details
135
136 ${active_channel_config}= Get Active Channel Config
137 ${ethernet_interface_redfish}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
138 ${ethernet_interface_gui}= Get Text ${xpath_network_interface}
139 Should Contain ${ethernet_interface_gui} ${ethernet_interface_redfish}
140
141
142Verify Network Static IPv4 Details
143 [Documentation] Verify network static IPv4 details.
144 [Tags] Verify_Network_static_IPv4_Details
145
146 @{network_configurations}= Get Network Configuration
147 FOR ${network_configuration} IN @{network_configurations}
148 Textfield Value Should Be ${xpath_static_input_ip0} ${network_configuration["Address"]}
149 Textfield Value Should Be ${xpath_input_netmask_addr0} ${network_configuration['SubnetMask']}
150 END
151
152
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500153Configure Invalid Network Addresses And Verify
154 [Documentation] Configure invalid network addresses and verify.
155 [Tags] Configure_Invalid_Network_Addresses_And_Verify
156 [Template] Configure Invalid Network Address And Verify
157
158 # locator invalid_address
159 ${xpath_mac_address_input} A.A.A.A
160 ${xpath_default_gateway_input} a.b.c.d
161 ${xpath_static_input_ip0} a.b.c.d
162 ${xpath_input_netmask_addr0} 255.256.255.0
163
164
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600165Configure And Verify Empty Network Addresses
166 [Documentation] Configure and verify empty network addresses.
167 [Tags] Configure_And_Verify_Empty_Network_Addresses
168 [Template] Configure Invalid Network Address And Verify
169
170 # locator invalid_address expected_error
171 ${xpath_mac_address_input} ${empty} Field required
172 ${xpath_default_gateway_input} ${empty} Field required
173 ${xpath_static_input_ip0} ${empty} Field required
174 ${xpath_input_netmask_addr0} ${empty} Field required
175 ${xpath_hostname_input} ${empty} Field required
176
177
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600178Config And Verify DNS Server Via GUI
179 [Documentation] Configure DNS server and verify.
180 [Tags] Config_And_Verify_DNS_Server_Via_GUI
181 [Setup] DNS Test Setup Execution
182 [Teardown] Run Keywords Delete DNS Server And Verify ${static_name_servers}
183 ... AND DNS Test Teardown Execution
184
185 Add DNS Server And Verify ${static_name_servers}
186
187
188Delete And Verify DNS Server Via GUI
189 [Documentation] Delete DNS server and verify.
190 [Tags] Delete_And_Verify_DNS_Server_Via_GUI
191 [Setup] Run Keywords DNS Test Setup Execution AND
192 ... Add DNS Server And Verify ${static_name_servers}
193 [Teardown] DNS Test Teardown Execution
194
195 Delete DNS Server And Verify ${static_name_servers}
196
197
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600198Configure And Verify Invalid DNS Server
199 [Documentation] Configure invalid DNS server and verify error.
200 [Tags] Configure_And_Verify_Invalid_DNS_Server
201 [Template] Add DNS Server And Verify
202 [Setup] DNS Test Setup Execution
203 [Teardown] DNS Test Teardown Execution
204
205 # invalid_ address expected_status
206 ${string_value} Invalid format
207 ${special_char_value} Invalid format
208 ${empty_dictionary} Field required
209 ${null_value} Invalid format
210
211
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500212*** Keywords ***
213
214Suite Setup Execution
215 [Documentation] Do test case setup tasks.
216
217 Launch Browser And Login GUI
218 Click Element ${xpath_server_configuration}
219 Click Element ${xpath_select_network_settings}
220 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network-settings
221
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500222
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500223Configure Invalid Network Address And Verify
224 [Documentation] Configure invalid network address And verify.
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600225 [Arguments] ${locator} ${invalid_address} ${expected_error}=Invalid format
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500226
227 # Description of the argument(s):
228 # locator Xpath to identify an HTML element on a web page.
229 # invalid_address Invalid address to be added.
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600230 # expected_error Expected error optionally provided in testcase
231 # .... (e.g. Invalid format / Field required)
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500232
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600233 Wait Until Element Is Enabled ${locator}
234 Clear Element Text ${locator}
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500235 Input Text ${locator} ${invalid_address}
Anves Kumar rayankula55481152020-10-21 07:51:07 -0500236 Click Element ${xpath_network_save_settings}
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600237 Page Should Contain ${expected_error}
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500238
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600239
240Add DNS Server And Verify
241 [Documentation] Add DNS server on BMC and verify it via BMC CLI.
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600242 [Arguments] ${static_name_servers} ${expected_status}= Valid format
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600243
244 # Description of the argument(s):
245 # static_name_servers A list of static name server IPs to be
246 # configured on the BMC.
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600247 # expected_status Expected status while adding DNS server address
248 # ... (e.g. Invalid format / Field required).
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600249
250 Wait Until Page Contains Element ${xpath_add_dns_server}
251 ${length}= Get Length ${static_name_servers}
252 FOR ${i} IN RANGE ${length}
253 Click Button ${xpath_add_dns_server}
254 Input Text //*[@data-test-id="networkSettings-input-dnsAddress-${i}"]
255 ... ${static_name_servers}[${i}]
256 END
257
258 Click Button ${xpath_network_save_settings}
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600259 Run keyword if '${expected_status}' != 'Valid format'
260 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600261
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600262 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600263 Sleep ${NETWORK_TIMEOUT}s
264 Verify Static Name Server Details On GUI ${static_name_servers}
265 # Check if newly added DNS server is configured on BMC.
266 ${cli_name_servers}= CLI Get Nameservers
267 List Should Contain Sub List ${cli_name_servers} ${static_name_servers}
268
269
270Delete DNS Server And Verify
271 [Documentation] Delete static name servers.
272 [Arguments] ${static_name_servers}
273
274 # Description of the argument(s):
275 # static_name_servers A list of static name server IPs to be
276 # configured on the BMC.
277
278 ${length}= Get Length ${static_name_servers}
279 FOR ${i} IN RANGE ${length}
280 ${status}= Run Keyword And Return Status
281 ... Page Should Contain Element ${xpath_delete_dns_server}
282 Exit For Loop If "${status}" == "False"
283 Wait Until Element Is Enabled ${xpath_delete_dns_server}
284 Click Button ${xpath_delete_dns_server}
285 END
286
287 Click Button ${xpath_network_save_settings}
288 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
289
290 Sleep ${NETWORK_TIMEOUT}s
291 Page Should Not Contain Element ${xpath_input_dns_server}
292 # Check if all name servers deleted on BMC.
293 ${nameservers}= CLI Get Nameservers
294 Should Be Empty ${nameservers}
295
296
297DNS Test Setup Execution
298 [Documentation] Do DNS test setup execution.
299
300 ${original_name_server}= CLI Get Nameservers
301 Set Suite Variable ${original_name_server}
302 Run Keyword If ${original_name_server} != @{EMPTY}
303 ... Delete DNS Server And Verify ${original_name_server}
304
305
306DNS Test Teardown Execution
307 [Documentation] Do DNS test teardown execution.
308
309 Run Keyword If ${original_name_server} != @{EMPTY}
310 ... Add DNS Server And Verify ${original_name_server}
311
312
313Verify Static Name Server Details On GUI
314 [Documentation] Verify static name servers on GUI.
315 [Arguments] ${static_name_servers}
316
317 # Description of the argument(s):
318 # static_name_servers A list of static name server IPs to be
319 # configured on the BMC.
320
321 ${length}= Get Length ${static_name_servers}
322 FOR ${i} IN RANGE ${length}
323 Page Should Contain Element //*[@data-test-id="networkSettings-input-dnsAddress-${i}"]
324 Textfield Value Should Be //*[@data-test-id="networkSettings-input-dnsAddress-${i}"]
325 ... ${static_name_servers}[${i}]
326 END
327
Anves Kumar rayankula89266292020-12-28 01:29:23 -0600328