blob: 4ed645ddf21214f2bd3b7d0ecd0c99e92c55689c [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
Sweta Potthuria5e5e5c2022-11-22 07:50:52 -060035${test_ipv4_addr_1} 10.7.7.8
meghagn122340d2022-02-01 04:57:37 -060036${test_subnet_mask} 255.255.0.0
37${alpha_netmask} ff.ff.ff.ff
38${out_of_range_netmask} 255.256.255.0
39${more_byte_netmask} 255.255.255.0.0
40${lowest_netmask} 128.0.0.0
41${test_gateway} 10.7.7.1
meghagn97f7eb42022-03-02 02:59:35 -060042${test_hostname} openbmc
Anves Kumar rayankula4c884472020-11-24 05:03:45 -060043
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -060044
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050045*** Test Cases ***
46
Rahul Maheshwari142642d2021-08-24 00:00:15 -050047Verify Navigation To Network Page
meghagn1bd39282021-12-19 23:56:42 -060048 [Documentation] Login to GUI and navigate to the settings sub-menu network page.
Rahul Maheshwari142642d2021-08-24 00:00:15 -050049 [Tags] Verify_Navigation_To_Network_Page
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050050
Rahul Maheshwari142642d2021-08-24 00:00:15 -050051 Page Should Contain Element ${xpath_network_heading}
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050052
53
Rahul Maheshwari142642d2021-08-24 00:00:15 -050054Verify Existence Of All Sections In Network Page
meghagn1bd39282021-12-19 23:56:42 -060055 [Documentation] Login to GUI and navigate to the settings sub-menu network page
56 ... and confirm the page contains sections that should be accessible.
Rahul Maheshwari142642d2021-08-24 00:00:15 -050057 [Tags] Verify_Existence_Of_All_Sections_In_Network_Page
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050058
meghagn1bd39282021-12-19 23:56:42 -060059 Wait Until Page Contains Element ${xpath_network_settings} timeout=1min
60 Page Should Contain Element ${xpath_interface_settings}
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050061 Page Should Contain Element ${xpath_static_ipv4}
62 Page Should Contain Element ${xpath_static_dns}
63
64
Rahul Maheshwari142642d2021-08-24 00:00:15 -050065Verify Existence Of All Buttons In Network Page
meghagn1bd39282021-12-19 23:56:42 -060066 [Documentation] Login to GUI and navigate to the settings sub-menu network page
67 ... and confirm the page contains basic features button that should be accessible.
Rahul Maheshwari142642d2021-08-24 00:00:15 -050068 [Tags] Verify_Existence_Of_All_Buttons_In_Network_Page
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050069
meghagn1bd39282021-12-19 23:56:42 -060070 Page Should Contain Button ${xpath_add_static_ipv4_address_button}
71 Page Should Contain Button ${xpath_add_dns_ip_address_button}
72 Page Should Contain Button ${xpath_domain_name_toggle}
73 Page Should Contain Button ${xpath_dns_servers_toggle}
74 Page Should Contain Button ${xpath_ntp_servers_toggle}
Anves Kumar rayankulac3a37e42021-06-17 06:56:51 -050075
76
meghagncca733c2021-12-20 04:34:55 -060077Verify Existence Of All Fields In Hostname
78 [Documentation] Login to GUI and navigate to the settings sub-menu network page
79 ... and confirm hostname contains all the fields.
80 [Tags] Verify_Existence_Of_All_Fields_In_Hostname
81 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND
82 ... Wait Until Keyword Succeeds 10 sec 5 sec
83 ... Refresh GUI And Verify Element Value ${xpath_network_heading} Network
84
85 Click Element ${xpath_hostname}
86 Wait Until Page Contains Edit hostname timeout=1min
87 Page Should Contain Textfield ${xpath_hostname_input}
88 Page Should Contain Button ${xpath_cancel_button}
89 Page Should Contain Button ${xpath_add_button}
90
91
92Verify Existence Of All Fields In Static IP Address
93 [Documentation] Login to GUI and navigate to the settings sub-menu network page
94 ... and confirm section static IPv4 contains all the fields.
95 [Tags] Verify_Existence_Of_All_Fields_In_Static_IP_Address
96 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND
97 ... Wait Until Keyword Succeeds 10 sec 5 sec
98 ... Refresh GUI And Verify Element Value ${xpath_network_heading} Network
99
100 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_add_static_ipv4_address_button}
101 Wait Until Page Contains Add static IPv4 address timeout=15s
102 Page Should Contain Textfield ${xpath_input_ip_address}
103 Page Should Contain Textfield ${xpath_input_gateway}
104 Page Should Contain Textfield ${xpath_input_subnetmask}
105 Page Should Contain Button ${xpath_cancel_button}
106 Page Should Contain Button ${xpath_add_button}
107
108
109Verify Existence Of All Fields In Static DNS
110 [Documentation] Login to GUI and navigate to the settings sub-menu network page
111 ... and confirm section static DNS contains all the fields.
112 [Tags] Verify_Existence_Of_All_Fields_In_Static_DNS
113 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND
114 ... Wait Until Keyword Succeeds 10 sec 5 sec
115 ... Refresh GUI And Verify Element Value ${xpath_network_heading} Network
116
117 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_add_dns_ip_address_button}
118 Wait Until Page Contains Add IP address timeout=11s
119 Page Should Contain Textfield ${xpath_input_static_dns}
120 Page Should Contain Button ${xpath_cancel_button}
121 Page Should Contain Button ${xpath_add_button}
122
123
meghagn2007beb2022-01-11 08:23:13 -0600124Configure And Verify DNS Server Via GUI
125 [Documentation] Login to GUI Network page, add DNS server IP
126 ... and verify that the page reflects server IP.
127 [Tags] Configure_And_Verify_DNS_Server_Via_GUI
128 [Teardown] Delete DNS Servers And Verify
129
130 Add DNS Servers And Verify ${dns_server}
131
132
meghagn122340d2022-02-01 04:57:37 -0600133Configure Static IPv4 Netmask Via GUI And Verify
134 [Documentation] Login to GUI Network page, configure static IPv4 netmask and verify.
135 [Tags] Configure_Static_IPv4_Netmask_Via_GUI_And_Verify
136 [Template] Add Static IP Address And Verify
137
138 # ip_addresses subnet_masks gateway expected_status
139 ${test_ipv4_addr} ${lowest_netmask} ${test_gateway} Success
140 ${test_ipv4_addr} ${more_byte_netmask} ${test_gateway} Invalid format
141 ${test_ipv4_addr} ${alpha_netmask} ${test_gateway} Invalid format
142 ${test_ipv4_addr} ${out_of_range_netmask} ${test_gateway} Invalid format
143 ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} Success
144
145
meghagn97f7eb42022-03-02 02:59:35 -0600146Configure Hostname Via GUI And Verify
147 [Documentation] Login to GUI Network page, configure hostname and verify.
148 [Tags] Configure_Hostname_Via_GUI_And_Verify
149 [Teardown] Configure And Verify Network Settings Via GUI
150 ... ${xpath_hostname} ${xpath_hostname_input} ${hostname}
151
152 ${hostname}= Get BMC Hostname
153 Configure And Verify Network Settings Via GUI ${xpath_hostname}
154 ... ${xpath_hostname_input} ${test_hostname}
155
156 ${bmc_hostname}= Get BMC Hostname
157 Should Be Equal As Strings ${bmc_hostname} ${test_hostname}
158
159
meghagn5d987662022-02-17 22:47:44 -0600160Configure And Verify Static IP Address
161 [Documentation] Login to GUI Network page, configure static ip address and verify.
162 [Tags] Configure_And_Verify_Static_IP_Address
163
Sweta Potthuria5e5e5c2022-11-22 07:50:52 -0600164 Add Static IP Address And Verify ${test_ipv4_addr} ${test_subnet_mask} ${default_gateway} Success
165
166
167Configure And Verify Multiple Static IP Address
168 [Documentation] Login to GUI Network page, configure multiple static IP address and verify.
169 [Tags] Configure_And_Verify_Multiple_Static_IP_Address
170
171 Add Static IP Address And Verify ${test_ipv4_addr} ${test_subnet_mask} ${default_gateway} Success
172 Add Static IP Address And Verify ${test_ipv4_addr_1} ${test_subnet_mask} ${default_gateway} Success
meghagn5d987662022-02-17 22:47:44 -0600173
174
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500175*** Keywords ***
176
177Suite Setup Execution
meghagn1bd39282021-12-19 23:56:42 -0600178 [Documentation] Do suite setup tasks.
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500179
180 Launch Browser And Login GUI
Sweta Potthuria5e5e5c2022-11-22 07:50:52 -0600181 Wait Until Keyword Succeeds 1 min 15 sec
182 .. Click Element ${xpath_settings_menu}
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500183 Click Element ${xpath_network_sub_menu}
184 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network
Sweta Potthuria5e5e5c2022-11-22 07:50:52 -0600185 ${default_gateway}= Get BMC Default Gateway
186 Set Suite Variable ${default_gateway}
meghagn2007beb2022-01-11 08:23:13 -0600187
188
189Add DNS Servers And Verify
190 [Documentation] Login to GUI Network page,add DNS server on BMC
191 ... and verify it via BMC CLI.
192 [Arguments] ${dns_server} ${expected_status}=Valid format
193
194 # Description of the argument(s):
195 # dns_server A list of static name server IPs to be
196 # configured on the BMC.
197 # expected_status Expected status while adding DNS server address
198 # ... (e.g. Invalid format / Field required).
199
200 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15sec
201
202 Click Button ${xpath_add_dns_ip_address_button}
203 Input Text ${xpath_input_static_dns} ${dns_server}
meghagn97f7eb42022-03-02 02:59:35 -0600204 Click Button ${xpath_add_button}
meghagn2007beb2022-01-11 08:23:13 -0600205 Run keyword if '${expected_status}' != 'Valid format'
206 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword
207
208 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=10sec
209 Wait Until Page Contains ${dns_server} timeout=40sec
210
211 # Check if newly added DNS server is configured on BMC.
212 ${cli_name_servers}= CLI Get Nameservers
213 ${cmd_status}= Run Keyword And Return Status
214 ... List Should Contain Sub List ${cli_name_servers} ${dns_server}
215
216
217Delete DNS Servers And Verify
218 [Documentation] Login to GUI Network page,delete static name servers
George Keishingc91aadd2022-02-23 09:30:48 -0600219 ... and verify that page does not reflect static name servers.
meghagn2007beb2022-01-11 08:23:13 -0600220
221 Page Should Contain Element ${xpath_delete_dns_server}
222 Wait Until Element Is Enabled ${xpath_delete_dns_server}
223 Click Button ${xpath_delete_dns_server}
224 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15
225 # Check if all name servers deleted on BMC.
226 ${nameservers}= CLI Get Nameservers
227 Should Be Empty ${nameservers}
meghagn122340d2022-02-01 04:57:37 -0600228
229
230Add Static IP Address And Verify
231 [Documentation] Add static IP address, subnet mask and
232 ... gateway via GUI and verify.
233 [Arguments] ${ip_address} ${subnet_mask} ${gateway_address} ${expected_status}=error
234
235 # Description of argument(s):
236 # ip_address IP address to be added (e.g. 10.7.7.7).
237 # subnet_mask Subnet mask for the IP to be added (e.g. 255.255.0.0).
238 # gateway_address Gateway address for the IP to be added (e.g. 10.7.7.1).
239 # expected_status Expected status while adding static ipv4 address
240 # .... (e.g. Invalid format / Field required).
241
242 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_add_static_ipv4_address_button}
243
244 Input Text ${xpath_input_ip_address} ${ip_address}
245 Input Text ${xpath_input_subnetmask} ${subnet_mask}
246 Input Text ${xpath_input_gateway} ${gateway_address}
247
meghagn97f7eb42022-03-02 02:59:35 -0600248 Click Element ${xpath_add_button}
meghagn5d987662022-02-17 22:47:44 -0600249 Run Keyword If '${expected_status}' == 'Success'
meghagn122340d2022-02-01 04:57:37 -0600250 ... Run Keywords Wait Until Page Contains ${ip_address} timeout=40sec
251 ... AND Validate Network Config On BMC
252
253 ... ELSE IF '${expected_status}' == 'Invalid format'
254 ... Run Keywords Page Should Contain Invalid format AND
255 ... Click Button ${xpath_cancel_button}
meghagn97f7eb42022-03-02 02:59:35 -0600256
257
258Configure And Verify Network Settings Via GUI
259 [Documentation] Configure and verify network settings via GUI.
260 [Arguments] ${xpath_nw_settings} ${xpath_nw_settings_input_field} ${input_value}
261
262 # Description of argument(s):
263 # xpath_nw_settings xpath of the network settings.
264 # xpath_nw_settings_input_field xpath of the network setting's input field.
265 # input_value Input value for configuration. E.g. hostname, IP etc.
266
267 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_nw_settings}
268 Input Text ${xpath_nw_settings_input_field} ${input_value}
269 Click Button ${xpath_add_button}
270 Wait Until Page Contains ${input_value} timeout=30sec