blob: 02142882ffd764f1a1b3c0c62a71443888f6dd77 [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
meghagn5d987662022-02-17 22:47:44 -0600159Configure And Verify Static IP Address
160 [Documentation] Login to GUI Network page, configure static ip address and verify.
161 [Tags] Configure_And_Verify_Static_IP_Address
162
163 ${default_gateway}= Get BMC Default Gateway
164 Add Static IP Address And Verify ${test_ipv4_addr} ${test_subnet_mask} ${defaut_gateway} Success
165
166
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500167*** Keywords ***
168
169Suite Setup Execution
meghagn1bd39282021-12-19 23:56:42 -0600170 [Documentation] Do suite setup tasks.
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500171
172 Launch Browser And Login GUI
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500173 Click Element ${xpath_settings_menu}
174 Click Element ${xpath_network_sub_menu}
175 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network
meghagn2007beb2022-01-11 08:23:13 -0600176
177
178Add DNS Servers And Verify
179 [Documentation] Login to GUI Network page,add DNS server on BMC
180 ... and verify it via BMC CLI.
181 [Arguments] ${dns_server} ${expected_status}=Valid format
182
183 # Description of the argument(s):
184 # dns_server A list of static name server IPs to be
185 # configured on the BMC.
186 # expected_status Expected status while adding DNS server address
187 # ... (e.g. Invalid format / Field required).
188
189 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15sec
190
191 Click Button ${xpath_add_dns_ip_address_button}
192 Input Text ${xpath_input_static_dns} ${dns_server}
meghagn97f7eb42022-03-02 02:59:35 -0600193 Click Button ${xpath_add_button}
meghagn2007beb2022-01-11 08:23:13 -0600194 Run keyword if '${expected_status}' != 'Valid format'
195 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword
196
197 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=10sec
198 Wait Until Page Contains ${dns_server} timeout=40sec
199
200 # Check if newly added DNS server is configured on BMC.
201 ${cli_name_servers}= CLI Get Nameservers
202 ${cmd_status}= Run Keyword And Return Status
203 ... List Should Contain Sub List ${cli_name_servers} ${dns_server}
204
205
206Delete DNS Servers And Verify
207 [Documentation] Login to GUI Network page,delete static name servers
George Keishingc91aadd2022-02-23 09:30:48 -0600208 ... and verify that page does not reflect static name servers.
meghagn2007beb2022-01-11 08:23:13 -0600209
210 Page Should Contain Element ${xpath_delete_dns_server}
211 Wait Until Element Is Enabled ${xpath_delete_dns_server}
212 Click Button ${xpath_delete_dns_server}
213 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15
214 # Check if all name servers deleted on BMC.
215 ${nameservers}= CLI Get Nameservers
216 Should Be Empty ${nameservers}
meghagn122340d2022-02-01 04:57:37 -0600217
218
219Add Static IP Address And Verify
220 [Documentation] Add static IP address, subnet mask and
221 ... gateway via GUI and verify.
222 [Arguments] ${ip_address} ${subnet_mask} ${gateway_address} ${expected_status}=error
223
224 # Description of argument(s):
225 # ip_address IP address to be added (e.g. 10.7.7.7).
226 # subnet_mask Subnet mask for the IP to be added (e.g. 255.255.0.0).
227 # gateway_address Gateway address for the IP to be added (e.g. 10.7.7.1).
228 # expected_status Expected status while adding static ipv4 address
229 # .... (e.g. Invalid format / Field required).
230
231 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_add_static_ipv4_address_button}
232
233 Input Text ${xpath_input_ip_address} ${ip_address}
234 Input Text ${xpath_input_subnetmask} ${subnet_mask}
235 Input Text ${xpath_input_gateway} ${gateway_address}
236
meghagn97f7eb42022-03-02 02:59:35 -0600237 Click Element ${xpath_add_button}
meghagn5d987662022-02-17 22:47:44 -0600238 Run Keyword If '${expected_status}' == 'Success'
meghagn122340d2022-02-01 04:57:37 -0600239 ... Run Keywords Wait Until Page Contains ${ip_address} timeout=40sec
240 ... AND Validate Network Config On BMC
241
242 ... ELSE IF '${expected_status}' == 'Invalid format'
243 ... Run Keywords Page Should Contain Invalid format AND
244 ... Click Button ${xpath_cancel_button}
meghagn97f7eb42022-03-02 02:59:35 -0600245
246
247Configure And Verify Network Settings Via GUI
248 [Documentation] Configure and verify network settings via GUI.
249 [Arguments] ${xpath_nw_settings} ${xpath_nw_settings_input_field} ${input_value}
250
251 # Description of argument(s):
252 # xpath_nw_settings xpath of the network settings.
253 # xpath_nw_settings_input_field xpath of the network setting's input field.
254 # input_value Input value for configuration. E.g. hostname, IP etc.
255
256 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_nw_settings}
257 Input Text ${xpath_nw_settings_input_field} ${input_value}
258 Click Button ${xpath_add_button}
259 Wait Until Page Contains ${input_value} timeout=30sec