1*** Settings *** 2 3Documentation Test OpenBMC GUI "Network" sub-menu of "Settings". 4 5Resource ../../lib/gui_resource.robot 6Resource ../../../lib/bmc_network_utils.robot 7 8Suite Setup Suite Setup Execution 9Suite Teardown Close Browser 10 11Force Tags Network_Sub_Menu 12 13*** Variables *** 14 15${xpath_network_heading} //h1[text()="Network"] 16${xpath_interface_settings} //h2[text()="Interface settings"] 17${xpath_network_settings} //h2[text()="Network settings"] 18${xpath_static_ipv4} //h2[text()="IPv4"] 19${xpath_domain_name_toggle} //*[@data-test-id="networkSettings-switch-useDomainName"] 20${xpath_ntp_servers_toggle} //*[@data-test-id="networkSettings-switch-useNtp"] 21${xpath_add_static_ipv4_address_button} //button[contains(text(),"Add static IPv4 address")] 22${xpath_hostname} //*[@title="Edit hostname"] 23${xpath_hostname_input} //*[@id="hostname"] 24${xpath_input_ip_address} //*[@id="ipAddress"] 25${xpath_input_gateway} //*[@id="gateway"] 26${xpath_input_subnetmask} //*[@id="subnetMask"] 27${xpath_cancel_button} //button[contains(text(),'Cancel')] 28${xpath_delete_dns_server} //*[@title="Delete DNS address"] 29${xpath_save_button} //button[contains(text(),'Save')] 30${xpath_dhcp_toggle_switch} //*[@id='dhcpSwitch'] 31 32${dns_server} 10.10.10.10 33${test_ipv4_addr} 10.7.7.7 34${test_ipv4_addr_1} 10.7.7.8 35${out_of_range_ip} 10.7.7.256 36${string_ip} aa.bb.cc.dd 37${negative_ip} 10.-7.-7.-7 38${less_octet_ip} 10.3.36 39${hex_ip} 0xa.0xb.0xc.0xd 40${spl_char_ip} @@@.%%.44.11 41${test_subnet_mask} 255.255.0.0 42${alpha_netmask} ff.ff.ff.ff 43${out_of_range_netmask} 255.256.255.0 44${more_byte_netmask} 255.255.255.0.0 45${lowest_netmask} 128.0.0.0 46${test_hostname} openbmc 47 48*** Test Cases *** 49 50Verify Navigation To Network Page 51 [Documentation] Login to GUI and navigate to the settings sub-menu network page. 52 [Tags] Verify_Navigation_To_Network_Page 53 54 Page Should Contain Element ${xpath_network_heading} 55 56 57Verify Existence Of All Sections In Network Page 58 [Documentation] Login to GUI and navigate to the settings sub-menu network page 59 ... and confirm the page contains sections that should be accessible. 60 [Tags] Verify_Existence_Of_All_Sections_In_Network_Page 61 62 Wait Until Page Contains Element ${xpath_network_settings} timeout=1min 63 Page Should Contain Element ${xpath_interface_settings} 64 Page Should Contain Element ${xpath_static_ipv4} 65 Page Should Contain Element ${xpath_static_dns} 66 67 68Verify Existence Of All Buttons In Network Page 69 [Documentation] Login to GUI and navigate to the settings sub-menu network page 70 ... and confirm the page contains basic features button that should be accessible. 71 [Tags] Verify_Existence_Of_All_Buttons_In_Network_Page 72 73 Page Should Contain Button ${xpath_add_static_ipv4_address_button} 74 Page Should Contain Button ${xpath_add_dns_ip_address_button} 75 Page Should Contain Button ${xpath_domain_name_toggle} 76 Page Should Contain Button ${xpath_dns_servers_toggle} 77 Page Should Contain Button ${xpath_ntp_servers_toggle} 78 Page Should Contain Button ${xpath_dhcp_toggle_switch} 79 80 81Verify Existence Of All Fields In Hostname 82 [Documentation] Login to GUI and navigate to the settings sub-menu network page 83 ... and confirm hostname contains all the fields. 84 [Tags] Verify_Existence_Of_All_Fields_In_Hostname 85 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND 86 ... Wait Until Keyword Succeeds 10 sec 5 sec 87 ... Refresh GUI And Verify Element Value ${xpath_network_heading} Network 88 89 Click Element ${xpath_hostname} 90 Wait Until Page Contains Edit hostname timeout=1min 91 Page Should Contain Textfield ${xpath_hostname_input} 92 Page Should Contain Button ${xpath_cancel_button} 93 Page Should Contain Button ${xpath_save_button} 94 95 96Verify Existence Of All Fields In Static IP Address 97 [Documentation] Login to GUI and navigate to the settings sub-menu network page 98 ... and confirm section static IPv4 contains all the fields. 99 [Tags] Verify_Existence_Of_All_Fields_In_Static_IP_Address 100 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND 101 ... Wait Until Keyword Succeeds 10 sec 5 sec 102 ... Refresh GUI And Verify Element Value ${xpath_network_heading} Network 103 104 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_add_static_ipv4_address_button} 105 Wait Until Page Contains Add static IPv4 address timeout=15s 106 Page Should Contain Textfield ${xpath_input_ip_address} 107 Page Should Contain Textfield ${xpath_input_gateway} 108 Page Should Contain Textfield ${xpath_input_subnetmask} 109 Page Should Contain Button ${xpath_cancel_button} 110 Page Should Contain Button ${xpath_add_button} 111 112 113Verify Existence Of All Fields In Static DNS 114 [Documentation] Login to GUI and navigate to the settings sub-menu network page 115 ... and confirm section static DNS contains all the fields. 116 [Tags] Verify_Existence_Of_All_Fields_In_Static_DNS 117 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND 118 ... Wait Until Keyword Succeeds 10 sec 5 sec 119 ... Refresh GUI And Verify Element Value ${xpath_network_heading} Network 120 121 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_add_dns_ip_address_button} 122 Wait Until Page Contains Add IP address timeout=11s 123 Page Should Contain Textfield ${xpath_input_static_dns} 124 Page Should Contain Button ${xpath_cancel_button} 125 Page Should Contain Button ${xpath_add_button} 126 127 128Configure And Verify DNS Server Via GUI 129 [Documentation] Login to GUI Network page, add DNS server IP 130 ... and verify that the page reflects server IP. 131 [Tags] Configure_And_Verify_DNS_Server_Via_GUI 132 [Setup] DNS Test Setup Execution 133 [Teardown] Run Keywords Delete Static Name Servers AND 134 ... Configure Static Name Servers 135 136 Add DNS Servers And Verify ${dns_server} 137 138 139Configure Static IPv4 Netmask Via GUI And Verify 140 [Documentation] Login to GUI Network page, configure static IPv4 netmask and verify. 141 [Tags] Configure_Static_IPv4_Netmask_Via_GUI_And_Verify 142 [Setup] Redfish.Login 143 [Teardown] Redfish.Logout 144 [Template] Add Static IP Address And Verify 145 146 # ip_addresses subnet_masks gateway expected_status 147 ${test_ipv4_addr} ${lowest_netmask} ${default_gateway} Success 148 ${test_ipv4_addr} ${more_byte_netmask} ${default_gateway} Invalid format 149 ${test_ipv4_addr} ${alpha_netmask} ${default_gateway} Invalid format 150 ${test_ipv4_addr} ${out_of_range_netmask} ${default_gateway} Invalid format 151 ${test_ipv4_addr} ${test_subnet_mask} ${default_gateway} Success 152 153 154Configure And Verify Static IP Address 155 [Documentation] Login to GUI Network page, configure static ip address and verify. 156 [Tags] Configure_And_Verify_Static_IP_Address 157 [Setup] Redfish.Login 158 [Teardown] Redfish.Logout 159 160 Add Static IP Address And Verify ${test_ipv4_addr} ${test_subnet_mask} ${default_gateway} Success 161 162 163Configure And Verify Multiple Static IP Address 164 [Documentation] Login to GUI Network page, configure multiple static IP address and verify. 165 [Setup] Redfish.Login 166 [Teardown] Redfish.Logout 167 [Tags] Configure_And_Verify_Multiple_Static_IP_Address 168 169 Add Static IP Address And Verify ${test_ipv4_addr} ${test_subnet_mask} ${default_gateway} Success 170 Add Static IP Address And Verify ${test_ipv4_addr_1} ${test_subnet_mask} ${default_gateway} Success 171 172 173Configure And Verify Invalid Static IP Address 174 [Documentation] Login to GUI Network page, configure invalid static IP address and verify. 175 [Tags] Configure_And_Verify_Invalid_Static_IP_Address 176 [Setup] Redfish.Login 177 [Teardown] Redfish.Logout 178 [Template] Add Static IP Address And Verify 179 180 # ip subnet_mask gateway status 181 ${out_of_range_ip} ${test_subnet_mask} ${default_gateway} Invalid format 182 ${less_octet_ip} ${test_subnet_mask} ${default_gateway} Invalid format 183 ${string_ip} ${test_subnet_mask} ${default_gateway} Invalid format 184 ${negative_ip} ${test_subnet_mask} ${default_gateway} Invalid format 185 ${hex_ip} ${test_subnet_mask} ${default_gateway} Invalid format 186 ${spl_char_ip} ${test_subnet_mask} ${default_gateway} Invalid format 187 188 189Configure Hostname Via GUI And Verify 190 [Documentation] Login to GUI Network page, configure hostname and verify. 191 [Tags] Configure_Hostname_Via_GUI_And_Verify 192 [Teardown] Configure the Hostname Back And Verify 193 194 ${hostname}= Get BMC Hostname 195 Set Suite Variable ${hostname} 196 Configure And Verify Network Settings Via GUI ${xpath_hostname} 197 ... ${xpath_hostname_input} ${test_hostname} 198 199 ${bmc_hostname}= Get BMC Hostname 200 Should Be Equal As Strings ${bmc_hostname} ${test_hostname} 201 202 203*** Keywords *** 204 205Suite Setup Execution 206 [Documentation] Do suite setup tasks. 207 208 Launch Browser And Login GUI 209 Wait Until Keyword Succeeds 1 min 15 sec 210 ... Click Element ${xpath_settings_menu} 211 Click Element ${xpath_network_sub_menu} 212 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network 213 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30 214 ${default_gateway}= Get BMC Default Gateway 215 Set Suite Variable ${default_gateway} 216 217Launch Browser Login GUI And Navigate To Network Page 218 [Documentation] Launch browser Login GUI and navigate to network page. 219 220 Launch Browser And Login GUI 221 Wait Until Keyword Succeeds 1 min 15 sec 222 ... Click Element ${xpath_settings_menu} 223 Click Element ${xpath_network_sub_menu} 224 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network 225 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30 226 227Configure the Hostname Back And Verify 228 [Documentation] Configure the hostname back. 229 230 Configure And Verify Network Settings Via GUI 231 ... ${xpath_hostname} ${xpath_hostname_input} ${hostname} 232 ${bmc_hostname_after}= Get BMC Hostname 233 Should Be Equal As Strings ${bmc_hostname_after} ${hostname} 234 235Delete DNS Servers And Verify 236 [Documentation] Login to GUI Network page,delete static name servers 237 ... and verify that page does not reflect static name servers. 238 239 Page Should Contain Element ${xpath_delete_dns_server} 240 Wait Until Element Is Enabled ${xpath_delete_dns_server} 241 Click Button ${xpath_delete_dns_server} 242 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15 243 # Check if all name servers deleted on BMC. 244 ${nameservers}= CLI Get Nameservers 245 Should Not Contain ${nameservers} ${original_nameservers} 246 247 DNS Test Setup Execution 248 249 Should Be Empty ${original_nameservers} 250 251 252Add Static IP Address And Verify 253 [Documentation] Add static IP address, subnet mask and 254 ... gateway via GUI and verify. 255 [Arguments] ${ip_address} ${subnet_mask} ${gateway_address} ${expected_status}=error 256 257 # Description of argument(s): 258 # ip_address IP address to be added (e.g. 10.7.7.7). 259 # subnet_mask Subnet mask for the IP to be added (e.g. 255.255.0.0). 260 # gateway_address Gateway address for the IP to be added (e.g. 10.7.7.1). 261 # expected_status Expected status while adding static ipv4 address 262 # .... (e.g. Invalid format / Field required). 263 264 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_add_static_ipv4_address_button} 265 266 Input Text ${xpath_input_ip_address} ${ip_address} 267 Input Text ${xpath_input_subnetmask} ${subnet_mask} 268 Input Text ${xpath_input_gateway} ${gateway_address} 269 270 Click Element ${xpath_add_button} 271 Run Keyword If '${expected_status}' == 'Success' 272 ... Run Keywords Wait Until Page Contains ${ip_address} timeout=40sec 273 ... AND Validate Network Config On BMC 274 275 ... ELSE IF '${expected_status}' == 'Invalid format' 276 ... Run Keywords Page Should Contain Invalid format AND 277 ... Click Button ${xpath_cancel_button} 278 279 280Configure And Verify Network Settings Via GUI 281 [Documentation] Configure and verify network settings via GUI. 282 [Arguments] ${xpath_nw_settings} ${xpath_nw_settings_input_field} ${input_value} 283 284 # Description of argument(s): 285 # xpath_nw_settings xpath of the network settings. 286 # xpath_nw_settings_input_field xpath of the network setting's input field. 287 # input_value Input value for configuration. E.g. hostname, IP etc. 288 289 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_nw_settings} 290 Input Text ${xpath_nw_settings_input_field} ${input_value} 291 Click Button ${xpath_save_button} 292 293 # Re-Login gui and navigate to network page. 294 Launch Browser Login GUI And Navigate To Network Page 295 296 Wait Until Page Contains ${input_value} timeout=30sec 297