blob: 0b111078b64acd07ac495839373cfe9931bd2536 [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
33
34@{static_name_servers} 10.10.10.10
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050035
36*** Test Cases ***
37
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050038Verify Navigation To Network Settings Page
39 [Documentation] Verify navigation to network settings page.
40 [Tags] Verify_Navigation_To_Network_Settings_Page
41
42 Page Should Contain Element ${xpath_network_setting_heading}
43
44
45Verify Existence Of All Sections In Network Settings Page
46 [Documentation] Verify existence of all sections in network settings page.
47 [Tags] Verify_Existence_Of_All_Sections_In_Network_Settings_Page
48
49 Page Should Contain Element ${xpath_interface}
50 Page Should Contain Element ${xpath_system}
51 Page Should Contain Element ${xpath_static_ipv4}
52 Page Should Contain Element ${xpath_static_dns}
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -060053 Page Should Contain Button ${xpath_delete_static_ip}
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050054
55
56Verify Existence Of All Buttons In Network Settings Page
57 [Documentation] Verify existence of all buttons in network settings page.
58 [Tags] Verify_Existence_Of_All_Buttons_In_Network_Settings_Page
59
60 Page Should Contain Element ${xpath_add_static_ip}
61 Page Should Contain Element ${xpath_add_dns_server}
62
63
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050064Verify Network Settings From Server Configuration
65 [Documentation] Verify ability to select "Network Settings" sub-menu option
66 ... of "Server Configuration".
67 [Tags] Verify_Network_Settings_From_Server_Configuration
68
69 Page Should Contain IP address
70
71
72Verify Hostname Text Configuration
73 [Documentation] Verify hostname text is configurable from "network settings"
74 ... sub-menu.
75 [Tags] Verify_Hostname_Text_Configuration
76
Anves Kumar rayankula76c0a8a2020-11-17 03:36:32 -060077 Wait Until Element Is Enabled ${xpath_hostname_input}
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050078 Input Text ${xpath_hostname_input} witherspoon1
79 Click Button ${xpath_network_save_settings}
80 Wait Until Page Contains Element ${xpath_setting_success} timeout=10
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050081 Wait Until Keyword Succeeds 15 sec 5 sec Textfield Should Contain ${xpath_hostname_input}
82 ... witherspoon1
83
84
85Verify Default Gateway Editable
86 [Documentation] Verify default gateway text input allowed from "network
87 ... settings".
88 [Tags] Verify_Default_Gateway_Editable
89
90 Wait Until Page Contains Element ${xpath_default_gateway_input}
91 Input Text ${xpath_default_gateway_input} 10.6.6.7
92
93
94Verify MAC Address Editable
95 [Documentation] Verify MAC address text input allowed from "network
96 ... settings".
97 [Tags] Verify_MAC_Address_Editable
98
99 Wait Until Page Contains Element ${xpath_mac_address_input}
100 Input Text ${xpath_mac_address_input} AA:E2:84:14:28:79
101
102
103Verify Static IP Address Editable
104 [Documentation] Verify static IP address is editable.
105 [Tags] Verify_Static_IP_Address_Editable
106
107 ${exists}= Run Keyword And Return Status Wait Until Page Contains Element ${xpath_static_input_ip0}
108 Run Keyword If '${exists}' == '${False}'
109 ... Click Element ${xpath_add_static_ip}
110
111 Input Text ${xpath_static_input_ip0} ${OPENBMC_HOST}
112
113
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500114Verify System Section In Network Setting page
115 [Documentation] Verify hostname, MAC address and default gateway
Anves Kumar rayankulab172fbe2020-09-09 00:27:21 -0500116 ... under system section of network setting page.
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500117 [Tags] Verify_System_Section
118
Anves Kumar rayankulab172fbe2020-09-09 00:27:21 -0500119 ${host_name}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
Anves Kumar rayankulaba8a48e2020-10-05 06:18:09 -0500120 Textfield Value Should Be ${xpath_hostname_input} ${host_name}
Anves Kumar rayankula475811b2020-08-31 06:22:11 -0500121
122 ${mac_address}= Get BMC MAC Address
123 Textfield Value Should Be ${xpath_mac_address_input} ${mac_address}
124
125 ${default_gateway}= Get BMC Default Gateway
126 Textfield Value Should Be ${xpath_default_gateway_input} ${default_gateway}
127
128
Anves Kumar rayankula65e5ed22020-09-17 04:44:44 -0500129Verify Network Interface Details
130 [Documentation] Verify network interface name in network setting page.
131 [Tags] Verify_Network_Interface_Details
132
133 ${active_channel_config}= Get Active Channel Config
134 ${ethernet_interface_redfish}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
135 ${ethernet_interface_gui}= Get Text ${xpath_network_interface}
136 Should Contain ${ethernet_interface_gui} ${ethernet_interface_redfish}
137
138
139Verify Network Static IPv4 Details
140 [Documentation] Verify network static IPv4 details.
141 [Tags] Verify_Network_static_IPv4_Details
142
143 @{network_configurations}= Get Network Configuration
144 FOR ${network_configuration} IN @{network_configurations}
145 Textfield Value Should Be ${xpath_static_input_ip0} ${network_configuration["Address"]}
146 Textfield Value Should Be ${xpath_input_netmask_addr0} ${network_configuration['SubnetMask']}
147 END
148
149
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500150Configure Invalid Network Addresses And Verify
151 [Documentation] Configure invalid network addresses and verify.
152 [Tags] Configure_Invalid_Network_Addresses_And_Verify
153 [Template] Configure Invalid Network Address And Verify
154
155 # locator invalid_address
156 ${xpath_mac_address_input} A.A.A.A
157 ${xpath_default_gateway_input} a.b.c.d
158 ${xpath_static_input_ip0} a.b.c.d
159 ${xpath_input_netmask_addr0} 255.256.255.0
160
161
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600162Configure And Verify Empty Network Addresses
163 [Documentation] Configure and verify empty network addresses.
164 [Tags] Configure_And_Verify_Empty_Network_Addresses
165 [Template] Configure Invalid Network Address And Verify
166
167 # locator invalid_address expected_error
168 ${xpath_mac_address_input} ${empty} Field required
169 ${xpath_default_gateway_input} ${empty} Field required
170 ${xpath_static_input_ip0} ${empty} Field required
171 ${xpath_input_netmask_addr0} ${empty} Field required
172 ${xpath_hostname_input} ${empty} Field required
173
174
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600175Config And Verify DNS Server Via GUI
176 [Documentation] Configure DNS server and verify.
177 [Tags] Config_And_Verify_DNS_Server_Via_GUI
178 [Setup] DNS Test Setup Execution
179 [Teardown] Run Keywords Delete DNS Server And Verify ${static_name_servers}
180 ... AND DNS Test Teardown Execution
181
182 Add DNS Server And Verify ${static_name_servers}
183
184
185Delete And Verify DNS Server Via GUI
186 [Documentation] Delete DNS server and verify.
187 [Tags] Delete_And_Verify_DNS_Server_Via_GUI
188 [Setup] Run Keywords DNS Test Setup Execution AND
189 ... Add DNS Server And Verify ${static_name_servers}
190 [Teardown] DNS Test Teardown Execution
191
192 Delete DNS Server And Verify ${static_name_servers}
193
194
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500195*** Keywords ***
196
197Suite Setup Execution
198 [Documentation] Do test case setup tasks.
199
200 Launch Browser And Login GUI
201 Click Element ${xpath_server_configuration}
202 Click Element ${xpath_select_network_settings}
203 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network-settings
204
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500205
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500206Configure Invalid Network Address And Verify
207 [Documentation] Configure invalid network address And verify.
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600208 [Arguments] ${locator} ${invalid_address} ${expected_error}=Invalid format
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500209
210 # Description of the argument(s):
211 # locator Xpath to identify an HTML element on a web page.
212 # invalid_address Invalid address to be added.
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600213 # expected_error Expected error optionally provided in testcase
214 # .... (e.g. Invalid format / Field required)
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500215
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600216 Wait Until Element Is Enabled ${locator}
217 Clear Element Text ${locator}
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500218 Input Text ${locator} ${invalid_address}
Anves Kumar rayankula55481152020-10-21 07:51:07 -0500219 Click Element ${xpath_network_save_settings}
Anves Kumar rayankula43d8fe82020-12-08 21:21:38 -0600220 Page Should Contain ${expected_error}
Anves Kumar rayankula550eba92020-09-21 23:36:44 -0500221
Anves Kumar rayankula4c884472020-11-24 05:03:45 -0600222
223Add DNS Server And Verify
224 [Documentation] Add DNS server on BMC and verify it via BMC CLI.
225 [Arguments] ${static_name_servers}
226
227 # Description of the argument(s):
228 # static_name_servers A list of static name server IPs to be
229 # configured on the BMC.
230
231 Wait Until Page Contains Element ${xpath_add_dns_server}
232 ${length}= Get Length ${static_name_servers}
233 FOR ${i} IN RANGE ${length}
234 Click Button ${xpath_add_dns_server}
235 Input Text //*[@data-test-id="networkSettings-input-dnsAddress-${i}"]
236 ... ${static_name_servers}[${i}]
237 END
238
239 Click Button ${xpath_network_save_settings}
240 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
241
242 Sleep ${NETWORK_TIMEOUT}s
243 Verify Static Name Server Details On GUI ${static_name_servers}
244 # Check if newly added DNS server is configured on BMC.
245 ${cli_name_servers}= CLI Get Nameservers
246 List Should Contain Sub List ${cli_name_servers} ${static_name_servers}
247
248
249Delete DNS Server And Verify
250 [Documentation] Delete static name servers.
251 [Arguments] ${static_name_servers}
252
253 # Description of the argument(s):
254 # static_name_servers A list of static name server IPs to be
255 # configured on the BMC.
256
257 ${length}= Get Length ${static_name_servers}
258 FOR ${i} IN RANGE ${length}
259 ${status}= Run Keyword And Return Status
260 ... Page Should Contain Element ${xpath_delete_dns_server}
261 Exit For Loop If "${status}" == "False"
262 Wait Until Element Is Enabled ${xpath_delete_dns_server}
263 Click Button ${xpath_delete_dns_server}
264 END
265
266 Click Button ${xpath_network_save_settings}
267 Wait Until Page Contains Element ${xpath_setting_success} timeout=15
268
269 Sleep ${NETWORK_TIMEOUT}s
270 Page Should Not Contain Element ${xpath_input_dns_server}
271 # Check if all name servers deleted on BMC.
272 ${nameservers}= CLI Get Nameservers
273 Should Be Empty ${nameservers}
274
275
276DNS Test Setup Execution
277 [Documentation] Do DNS test setup execution.
278
279 ${original_name_server}= CLI Get Nameservers
280 Set Suite Variable ${original_name_server}
281 Run Keyword If ${original_name_server} != @{EMPTY}
282 ... Delete DNS Server And Verify ${original_name_server}
283
284
285DNS Test Teardown Execution
286 [Documentation] Do DNS test teardown execution.
287
288 Run Keyword If ${original_name_server} != @{EMPTY}
289 ... Add DNS Server And Verify ${original_name_server}
290
291
292Verify Static Name Server Details On GUI
293 [Documentation] Verify static name servers on GUI.
294 [Arguments] ${static_name_servers}
295
296 # Description of the argument(s):
297 # static_name_servers A list of static name server IPs to be
298 # configured on the BMC.
299
300 ${length}= Get Length ${static_name_servers}
301 FOR ${i} IN RANGE ${length}
302 Page Should Contain Element //*[@data-test-id="networkSettings-input-dnsAddress-${i}"]
303 Textfield Value Should Be //*[@data-test-id="networkSettings-input-dnsAddress-${i}"]
304 ... ${static_name_servers}[${i}]
305 END
306