blob: aee7f3d86d02f31ab1914eb2b6b0cb29555579ab [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
meghagn1bd39282021-12-19 23:56:42 -060011
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050012*** Variables ***
13
meghagn1bd39282021-12-19 23:56:42 -060014${xpath_network_heading} //h1[text()="Network"]
15${xpath_interface_settings} //h2[text()="Interface settings"]
16${xpath_network_settings} //h2[text()="Network settings"]
17${xpath_static_ipv4} //h2[text()="IPv4"]
18${xpath_static_dns} //h2[text()="Static DNS"]
19${xpath_domain_name_toggle} //*[@data-test-id="networkSettings-switch-useDomainName"]
20${xpath_dns_servers_toggle} //*[@data-test-id="networkSettings-switch-useDns"]
21${xpath_ntp_servers_toggle} //*[@data-test-id="networkSettings-switch-useNtp"]
22${xpath_add_static_ipv4_address_button} //button[contains(text(),"Add static IPv4 address")]
23${xpath_add_dns_ip_address_button} //button[contains(text(),"Add IP address")]
meghagncca733c2021-12-20 04:34:55 -060024${xpath_hostname} //*[@title="Edit hostname"]
25${xpath_hostname_input} //*[@id="hostname"]
26${xpath_input_ip_address} //*[@id="ipAddress"]
27${xpath_input_gateway} //*[@id="gateway"]
28${xpath_input_subnetmask} //*[@id="subnetMask"]
29${xpath_input_static_dns} //*[@id="staticDns"]
30${xpath_cancel_button} //button[contains(text(),'Cancel')]
meghagn2007beb2022-01-11 08:23:13 -060031${xpath_delete_dns_server} //*[@title="Delete DNS address"]
meghagn2007beb2022-01-11 08:23:13 -060032
33${dns_server} 10.10.10.10
meghagn122340d2022-02-01 04:57:37 -060034${test_ipv4_addr} 10.7.7.7
35${test_subnet_mask} 255.255.0.0
36${alpha_netmask} ff.ff.ff.ff
37${out_of_range_netmask} 255.256.255.0
38${more_byte_netmask} 255.255.255.0.0
39${lowest_netmask} 128.0.0.0
40${test_gateway} 10.7.7.1
meghagn97f7eb42022-03-02 02:59:35 -060041${test_hostname} openbmc
Anves Kumar rayankula4c884472020-11-24 05:03:45 -060042
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -060043
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050044*** Test Cases ***
45
Rahul Maheshwari142642d2021-08-24 00:00:15 -050046Verify Navigation To Network Page
meghagn1bd39282021-12-19 23:56:42 -060047 [Documentation] Login to GUI and navigate to the settings sub-menu network page.
Rahul Maheshwari142642d2021-08-24 00:00:15 -050048 [Tags] Verify_Navigation_To_Network_Page
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050049
Rahul Maheshwari142642d2021-08-24 00:00:15 -050050 Page Should Contain Element ${xpath_network_heading}
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050051
52
Rahul Maheshwari142642d2021-08-24 00:00:15 -050053Verify Existence Of All Sections In Network Page
meghagn1bd39282021-12-19 23:56:42 -060054 [Documentation] Login to GUI and navigate to the settings sub-menu network page
55 ... and confirm the page contains sections that should be accessible.
Rahul Maheshwari142642d2021-08-24 00:00:15 -050056 [Tags] Verify_Existence_Of_All_Sections_In_Network_Page
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050057
meghagn1bd39282021-12-19 23:56:42 -060058 Wait Until Page Contains Element ${xpath_network_settings} timeout=1min
59 Page Should Contain Element ${xpath_interface_settings}
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050060 Page Should Contain Element ${xpath_static_ipv4}
61 Page Should Contain Element ${xpath_static_dns}
62
63
Rahul Maheshwari142642d2021-08-24 00:00:15 -050064Verify Existence Of All Buttons In Network Page
meghagn1bd39282021-12-19 23:56:42 -060065 [Documentation] Login to GUI and navigate to the settings sub-menu network page
66 ... and confirm the page contains basic features button that should be accessible.
Rahul Maheshwari142642d2021-08-24 00:00:15 -050067 [Tags] Verify_Existence_Of_All_Buttons_In_Network_Page
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050068
meghagn1bd39282021-12-19 23:56:42 -060069 Page Should Contain Button ${xpath_add_static_ipv4_address_button}
70 Page Should Contain Button ${xpath_add_dns_ip_address_button}
71 Page Should Contain Button ${xpath_domain_name_toggle}
72 Page Should Contain Button ${xpath_dns_servers_toggle}
73 Page Should Contain Button ${xpath_ntp_servers_toggle}
Anves Kumar rayankulac3a37e42021-06-17 06:56:51 -050074
75
meghagncca733c2021-12-20 04:34:55 -060076Verify Existence Of All Fields In Hostname
77 [Documentation] Login to GUI and navigate to the settings sub-menu network page
78 ... and confirm hostname contains all the fields.
79 [Tags] Verify_Existence_Of_All_Fields_In_Hostname
80 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND
81 ... Wait Until Keyword Succeeds 10 sec 5 sec
82 ... Refresh GUI And Verify Element Value ${xpath_network_heading} Network
83
84 Click Element ${xpath_hostname}
85 Wait Until Page Contains Edit hostname timeout=1min
86 Page Should Contain Textfield ${xpath_hostname_input}
87 Page Should Contain Button ${xpath_cancel_button}
88 Page Should Contain Button ${xpath_add_button}
89
90
91Verify Existence Of All Fields In Static IP Address
92 [Documentation] Login to GUI and navigate to the settings sub-menu network page
93 ... and confirm section static IPv4 contains all the fields.
94 [Tags] Verify_Existence_Of_All_Fields_In_Static_IP_Address
95 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND
96 ... Wait Until Keyword Succeeds 10 sec 5 sec
97 ... Refresh GUI And Verify Element Value ${xpath_network_heading} Network
98
99 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_add_static_ipv4_address_button}
100 Wait Until Page Contains Add static IPv4 address timeout=15s
101 Page Should Contain Textfield ${xpath_input_ip_address}
102 Page Should Contain Textfield ${xpath_input_gateway}
103 Page Should Contain Textfield ${xpath_input_subnetmask}
104 Page Should Contain Button ${xpath_cancel_button}
105 Page Should Contain Button ${xpath_add_button}
106
107
108Verify Existence Of All Fields In Static DNS
109 [Documentation] Login to GUI and navigate to the settings sub-menu network page
110 ... and confirm section static DNS contains all the fields.
111 [Tags] Verify_Existence_Of_All_Fields_In_Static_DNS
112 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND
113 ... Wait Until Keyword Succeeds 10 sec 5 sec
114 ... Refresh GUI And Verify Element Value ${xpath_network_heading} Network
115
116 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_add_dns_ip_address_button}
117 Wait Until Page Contains Add IP address timeout=11s
118 Page Should Contain Textfield ${xpath_input_static_dns}
119 Page Should Contain Button ${xpath_cancel_button}
120 Page Should Contain Button ${xpath_add_button}
121
122
meghagn2007beb2022-01-11 08:23:13 -0600123Configure And Verify DNS Server Via GUI
124 [Documentation] Login to GUI Network page, add DNS server IP
125 ... and verify that the page reflects server IP.
126 [Tags] Configure_And_Verify_DNS_Server_Via_GUI
127 [Teardown] Delete DNS Servers And Verify
128
129 Add DNS Servers And Verify ${dns_server}
130
131
meghagn122340d2022-02-01 04:57:37 -0600132Configure Static IPv4 Netmask Via GUI And Verify
133 [Documentation] Login to GUI Network page, configure static IPv4 netmask and verify.
134 [Tags] Configure_Static_IPv4_Netmask_Via_GUI_And_Verify
135 [Template] Add Static IP Address And Verify
136
137 # ip_addresses subnet_masks gateway expected_status
138 ${test_ipv4_addr} ${lowest_netmask} ${test_gateway} Success
139 ${test_ipv4_addr} ${more_byte_netmask} ${test_gateway} Invalid format
140 ${test_ipv4_addr} ${alpha_netmask} ${test_gateway} Invalid format
141 ${test_ipv4_addr} ${out_of_range_netmask} ${test_gateway} Invalid format
142 ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} Success
143
144
meghagn97f7eb42022-03-02 02:59:35 -0600145Configure Hostname Via GUI And Verify
146 [Documentation] Login to GUI Network page, configure hostname and verify.
147 [Tags] Configure_Hostname_Via_GUI_And_Verify
148 [Teardown] Configure And Verify Network Settings Via GUI
149 ... ${xpath_hostname} ${xpath_hostname_input} ${hostname}
150
151 ${hostname}= Get BMC Hostname
152 Configure And Verify Network Settings Via GUI ${xpath_hostname}
153 ... ${xpath_hostname_input} ${test_hostname}
154
155 ${bmc_hostname}= Get BMC Hostname
156 Should Be Equal As Strings ${bmc_hostname} ${test_hostname}
157
158
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500159*** Keywords ***
160
161Suite Setup Execution
meghagn1bd39282021-12-19 23:56:42 -0600162 [Documentation] Do suite setup tasks.
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500163
164 Launch Browser And Login GUI
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500165 Click Element ${xpath_settings_menu}
166 Click Element ${xpath_network_sub_menu}
167 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network
meghagn2007beb2022-01-11 08:23:13 -0600168
169
170Add DNS Servers And Verify
171 [Documentation] Login to GUI Network page,add DNS server on BMC
172 ... and verify it via BMC CLI.
173 [Arguments] ${dns_server} ${expected_status}=Valid format
174
175 # Description of the argument(s):
176 # dns_server A list of static name server IPs to be
177 # configured on the BMC.
178 # expected_status Expected status while adding DNS server address
179 # ... (e.g. Invalid format / Field required).
180
181 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15sec
182
183 Click Button ${xpath_add_dns_ip_address_button}
184 Input Text ${xpath_input_static_dns} ${dns_server}
meghagn97f7eb42022-03-02 02:59:35 -0600185 Click Button ${xpath_add_button}
meghagn2007beb2022-01-11 08:23:13 -0600186 Run keyword if '${expected_status}' != 'Valid format'
187 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword
188
189 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=10sec
190 Wait Until Page Contains ${dns_server} timeout=40sec
191
192 # Check if newly added DNS server is configured on BMC.
193 ${cli_name_servers}= CLI Get Nameservers
194 ${cmd_status}= Run Keyword And Return Status
195 ... List Should Contain Sub List ${cli_name_servers} ${dns_server}
196
197
198Delete DNS Servers And Verify
199 [Documentation] Login to GUI Network page,delete static name servers
George Keishingc91aadd2022-02-23 09:30:48 -0600200 ... and verify that page does not reflect static name servers.
meghagn2007beb2022-01-11 08:23:13 -0600201
202 Page Should Contain Element ${xpath_delete_dns_server}
203 Wait Until Element Is Enabled ${xpath_delete_dns_server}
204 Click Button ${xpath_delete_dns_server}
205 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15
206 # Check if all name servers deleted on BMC.
207 ${nameservers}= CLI Get Nameservers
208 Should Be Empty ${nameservers}
meghagn122340d2022-02-01 04:57:37 -0600209
210
211Add Static IP Address And Verify
212 [Documentation] Add static IP address, subnet mask and
213 ... gateway via GUI and verify.
214 [Arguments] ${ip_address} ${subnet_mask} ${gateway_address} ${expected_status}=error
215
216 # Description of argument(s):
217 # ip_address IP address to be added (e.g. 10.7.7.7).
218 # subnet_mask Subnet mask for the IP to be added (e.g. 255.255.0.0).
219 # gateway_address Gateway address for the IP to be added (e.g. 10.7.7.1).
220 # expected_status Expected status while adding static ipv4 address
221 # .... (e.g. Invalid format / Field required).
222
223 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_add_static_ipv4_address_button}
224
225 Input Text ${xpath_input_ip_address} ${ip_address}
226 Input Text ${xpath_input_subnetmask} ${subnet_mask}
227 Input Text ${xpath_input_gateway} ${gateway_address}
228
meghagn97f7eb42022-03-02 02:59:35 -0600229 Click Element ${xpath_add_button}
meghagn122340d2022-02-01 04:57:37 -0600230 Run Keyword If '${expected_status}' == 'Valid format'
231 ... Run Keywords Wait Until Page Contains ${ip_address} timeout=40sec
232 ... AND Validate Network Config On BMC
233
234 ... ELSE IF '${expected_status}' == 'Invalid format'
235 ... Run Keywords Page Should Contain Invalid format AND
236 ... Click Button ${xpath_cancel_button}
meghagn97f7eb42022-03-02 02:59:35 -0600237
238
239Configure And Verify Network Settings Via GUI
240 [Documentation] Configure and verify network settings via GUI.
241 [Arguments] ${xpath_nw_settings} ${xpath_nw_settings_input_field} ${input_value}
242
243 # Description of argument(s):
244 # xpath_nw_settings xpath of the network settings.
245 # xpath_nw_settings_input_field xpath of the network setting's input field.
246 # input_value Input value for configuration. E.g. hostname, IP etc.
247
248 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_nw_settings}
249 Input Text ${xpath_nw_settings_input_field} ${input_value}
250 Click Button ${xpath_add_button}
251 Wait Until Page Contains ${input_value} timeout=30sec