blob: ad390f7d8fc89eddfcd33898800ddd61a92a1415 [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')]
31${xpath_add_button} //button[contains(text(),'Add')]
meghagn2007beb2022-01-11 08:23:13 -060032${xpath_delete_dns_server} //*[@title="Delete DNS address"]
33${xpath_add_dns_server} //button[normalize-space(text())='Add']
meghagn122340d2022-02-01 04:57:37 -060034${xpath_add_ip_address_button} //button[normalize-space(text())='Add']
meghagn2007beb2022-01-11 08:23:13 -060035
36${dns_server} 10.10.10.10
meghagn122340d2022-02-01 04:57:37 -060037${test_ipv4_addr} 10.7.7.7
38${test_subnet_mask} 255.255.0.0
39${alpha_netmask} ff.ff.ff.ff
40${out_of_range_netmask} 255.256.255.0
41${more_byte_netmask} 255.255.255.0.0
42${lowest_netmask} 128.0.0.0
43${test_gateway} 10.7.7.1
Anves Kumar rayankula4c884472020-11-24 05:03:45 -060044
Anves Kumar rayankulaef4d34f2021-02-12 03:26:42 -060045
Anusha Dathatri21ac59f2020-07-14 13:12:58 -050046*** Test Cases ***
47
Rahul Maheshwari142642d2021-08-24 00:00:15 -050048Verify Navigation To Network Page
meghagn1bd39282021-12-19 23:56:42 -060049 [Documentation] Login to GUI and navigate to the settings sub-menu network page.
Rahul Maheshwari142642d2021-08-24 00:00:15 -050050 [Tags] Verify_Navigation_To_Network_Page
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050051
Rahul Maheshwari142642d2021-08-24 00:00:15 -050052 Page Should Contain Element ${xpath_network_heading}
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050053
54
Rahul Maheshwari142642d2021-08-24 00:00:15 -050055Verify Existence Of All Sections In Network Page
meghagn1bd39282021-12-19 23:56:42 -060056 [Documentation] Login to GUI and navigate to the settings sub-menu network page
57 ... and confirm the page contains sections that should be accessible.
Rahul Maheshwari142642d2021-08-24 00:00:15 -050058 [Tags] Verify_Existence_Of_All_Sections_In_Network_Page
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050059
meghagn1bd39282021-12-19 23:56:42 -060060 Wait Until Page Contains Element ${xpath_network_settings} timeout=1min
61 Page Should Contain Element ${xpath_interface_settings}
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050062 Page Should Contain Element ${xpath_static_ipv4}
63 Page Should Contain Element ${xpath_static_dns}
64
65
Rahul Maheshwari142642d2021-08-24 00:00:15 -050066Verify Existence Of All Buttons In Network Page
meghagn1bd39282021-12-19 23:56:42 -060067 [Documentation] Login to GUI and navigate to the settings sub-menu network page
68 ... and confirm the page contains basic features button that should be accessible.
Rahul Maheshwari142642d2021-08-24 00:00:15 -050069 [Tags] Verify_Existence_Of_All_Buttons_In_Network_Page
Anusha Dathatrie11a54d2020-08-31 08:35:47 -050070
meghagn1bd39282021-12-19 23:56:42 -060071 Page Should Contain Button ${xpath_add_static_ipv4_address_button}
72 Page Should Contain Button ${xpath_add_dns_ip_address_button}
73 Page Should Contain Button ${xpath_domain_name_toggle}
74 Page Should Contain Button ${xpath_dns_servers_toggle}
75 Page Should Contain Button ${xpath_ntp_servers_toggle}
Anves Kumar rayankulac3a37e42021-06-17 06:56:51 -050076
77
meghagncca733c2021-12-20 04:34:55 -060078Verify Existence Of All Fields In Hostname
79 [Documentation] Login to GUI and navigate to the settings sub-menu network page
80 ... and confirm hostname contains all the fields.
81 [Tags] Verify_Existence_Of_All_Fields_In_Hostname
82 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND
83 ... Wait Until Keyword Succeeds 10 sec 5 sec
84 ... Refresh GUI And Verify Element Value ${xpath_network_heading} Network
85
86 Click Element ${xpath_hostname}
87 Wait Until Page Contains Edit hostname timeout=1min
88 Page Should Contain Textfield ${xpath_hostname_input}
89 Page Should Contain Button ${xpath_cancel_button}
90 Page Should Contain Button ${xpath_add_button}
91
92
93Verify Existence Of All Fields In Static IP Address
94 [Documentation] Login to GUI and navigate to the settings sub-menu network page
95 ... and confirm section static IPv4 contains all the fields.
96 [Tags] Verify_Existence_Of_All_Fields_In_Static_IP_Address
97 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND
98 ... Wait Until Keyword Succeeds 10 sec 5 sec
99 ... Refresh GUI And Verify Element Value ${xpath_network_heading} Network
100
101 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_add_static_ipv4_address_button}
102 Wait Until Page Contains Add static IPv4 address timeout=15s
103 Page Should Contain Textfield ${xpath_input_ip_address}
104 Page Should Contain Textfield ${xpath_input_gateway}
105 Page Should Contain Textfield ${xpath_input_subnetmask}
106 Page Should Contain Button ${xpath_cancel_button}
107 Page Should Contain Button ${xpath_add_button}
108
109
110Verify Existence Of All Fields In Static DNS
111 [Documentation] Login to GUI and navigate to the settings sub-menu network page
112 ... and confirm section static DNS contains all the fields.
113 [Tags] Verify_Existence_Of_All_Fields_In_Static_DNS
114 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND
115 ... Wait Until Keyword Succeeds 10 sec 5 sec
116 ... Refresh GUI And Verify Element Value ${xpath_network_heading} Network
117
118 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_add_dns_ip_address_button}
119 Wait Until Page Contains Add IP address timeout=11s
120 Page Should Contain Textfield ${xpath_input_static_dns}
121 Page Should Contain Button ${xpath_cancel_button}
122 Page Should Contain Button ${xpath_add_button}
123
124
meghagn2007beb2022-01-11 08:23:13 -0600125Configure And Verify DNS Server Via GUI
126 [Documentation] Login to GUI Network page, add DNS server IP
127 ... and verify that the page reflects server IP.
128 [Tags] Configure_And_Verify_DNS_Server_Via_GUI
129 [Teardown] Delete DNS Servers And Verify
130
131 Add DNS Servers And Verify ${dns_server}
132
133
meghagn122340d2022-02-01 04:57:37 -0600134Configure Static IPv4 Netmask Via GUI And Verify
135 [Documentation] Login to GUI Network page, configure static IPv4 netmask and verify.
136 [Tags] Configure_Static_IPv4_Netmask_Via_GUI_And_Verify
137 [Template] Add Static IP Address And Verify
138
139 # ip_addresses subnet_masks gateway expected_status
140 ${test_ipv4_addr} ${lowest_netmask} ${test_gateway} Success
141 ${test_ipv4_addr} ${more_byte_netmask} ${test_gateway} Invalid format
142 ${test_ipv4_addr} ${alpha_netmask} ${test_gateway} Invalid format
143 ${test_ipv4_addr} ${out_of_range_netmask} ${test_gateway} Invalid format
144 ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} Success
145
146
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500147*** Keywords ***
148
149Suite Setup Execution
meghagn1bd39282021-12-19 23:56:42 -0600150 [Documentation] Do suite setup tasks.
Anusha Dathatri21ac59f2020-07-14 13:12:58 -0500151
152 Launch Browser And Login GUI
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500153 Click Element ${xpath_settings_menu}
154 Click Element ${xpath_network_sub_menu}
155 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network
meghagn2007beb2022-01-11 08:23:13 -0600156
157
158Add DNS Servers And Verify
159 [Documentation] Login to GUI Network page,add DNS server on BMC
160 ... and verify it via BMC CLI.
161 [Arguments] ${dns_server} ${expected_status}=Valid format
162
163 # Description of the argument(s):
164 # dns_server A list of static name server IPs to be
165 # configured on the BMC.
166 # expected_status Expected status while adding DNS server address
167 # ... (e.g. Invalid format / Field required).
168
169 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15sec
170
171 Click Button ${xpath_add_dns_ip_address_button}
172 Input Text ${xpath_input_static_dns} ${dns_server}
173 Click Button ${xpath_add_dns_server}
174 Run keyword if '${expected_status}' != 'Valid format'
175 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword
176
177 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=10sec
178 Wait Until Page Contains ${dns_server} timeout=40sec
179
180 # Check if newly added DNS server is configured on BMC.
181 ${cli_name_servers}= CLI Get Nameservers
182 ${cmd_status}= Run Keyword And Return Status
183 ... List Should Contain Sub List ${cli_name_servers} ${dns_server}
184
185
186Delete DNS Servers And Verify
187 [Documentation] Login to GUI Network page,delete static name servers
188 ... and verify that page doesnot reflects static name servers.
189
190 Page Should Contain Element ${xpath_delete_dns_server}
191 Wait Until Element Is Enabled ${xpath_delete_dns_server}
192 Click Button ${xpath_delete_dns_server}
193 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15
194 # Check if all name servers deleted on BMC.
195 ${nameservers}= CLI Get Nameservers
196 Should Be Empty ${nameservers}
meghagn122340d2022-02-01 04:57:37 -0600197
198
199Add Static IP Address And Verify
200 [Documentation] Add static IP address, subnet mask and
201 ... gateway via GUI and verify.
202 [Arguments] ${ip_address} ${subnet_mask} ${gateway_address} ${expected_status}=error
203
204 # Description of argument(s):
205 # ip_address IP address to be added (e.g. 10.7.7.7).
206 # subnet_mask Subnet mask for the IP to be added (e.g. 255.255.0.0).
207 # gateway_address Gateway address for the IP to be added (e.g. 10.7.7.1).
208 # expected_status Expected status while adding static ipv4 address
209 # .... (e.g. Invalid format / Field required).
210
211 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_add_static_ipv4_address_button}
212
213 Input Text ${xpath_input_ip_address} ${ip_address}
214 Input Text ${xpath_input_subnetmask} ${subnet_mask}
215 Input Text ${xpath_input_gateway} ${gateway_address}
216
217 Click Element ${xpath_add_ip_address_button}
218 Run Keyword If '${expected_status}' == 'Valid format'
219 ... Run Keywords Wait Until Page Contains ${ip_address} timeout=40sec
220 ... AND Validate Network Config On BMC
221
222 ... ELSE IF '${expected_status}' == 'Invalid format'
223 ... Run Keywords Page Should Contain Invalid format AND
224 ... Click Button ${xpath_cancel_button}