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 11Test 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${xpath_ntp_switch_button} //*[@id="useNtpSwitch"]/following-sibling::label 32${xpath_dns_switch_button} //*[@id="useDnsSwitch"]/following-sibling::label 33${xpath_domainname_switch_button} //*[@id="useDomainNameSwitch"]/following-sibling::label 34${xpath_success_popup} //*[contains(text(),'Success')]/following-sibling::button 35${xpath_delete_ipv4_addres} //*[text()='${test_ipv4_addr}']/following::td[4] 36... //*[@title="Delete IPv4 address"] 37${xpath_delete_button} //*[text()="Delete"] 38${xpath_eth1_interface} //*[text()="eth1"] 39 40${dns_server} 10.10.10.10 41${test_ipv4_addr} 10.7.7.7 42${test_ipv4_addr_1} 10.7.7.8 43${out_of_range_ip} 10.7.7.256 44${string_ip} aa.bb.cc.dd 45${negative_ip} 10.-7.-7.-7 46${less_octet_ip} 10.3.36 47${hex_ip} 0xa.0xb.0xc.0xd 48${spl_char_ip} @@@.%%.44.11 49${test_subnet_mask} 255.255.0.0 50${alpha_netmask} ff.ff.ff.ff 51${out_of_range_netmask} 255.256.255.0 52${more_byte_netmask} 255.255.255.0.0 53${lowest_netmask} 128.0.0.0 54${test_hostname} openbmc 55 56*** Test Cases *** 57 58Verify Navigation To Network Page 59 [Documentation] Login to GUI and navigate to the settings sub-menu network page. 60 [Tags] Verify_Navigation_To_Network_Page 61 62 Page Should Contain Element ${xpath_network_heading} 63 64 65Verify Existence Of All Sections In Network Page 66 [Documentation] Login to GUI and navigate to the settings sub-menu network page 67 ... and confirm the page contains sections that should be accessible. 68 [Tags] Verify_Existence_Of_All_Sections_In_Network_Page 69 70 Wait Until Page Contains Element ${xpath_network_settings} timeout=1min 71 Page Should Contain Element ${xpath_interface_settings} 72 Page Should Contain Element ${xpath_static_ipv4} 73 Page Should Contain Element ${xpath_static_dns} 74 75 76Verify Existence Of All Buttons In Network Page 77 [Documentation] Login to GUI and navigate to the settings sub-menu network page 78 ... and confirm the page contains basic features button that should be accessible. 79 [Tags] Verify_Existence_Of_All_Buttons_In_Network_Page 80 81 Page Should Contain Button ${xpath_add_static_ipv4_address_button} 82 Page Should Contain Button ${xpath_add_dns_ip_address_button} 83 Page Should Contain Button ${xpath_domain_name_toggle} 84 Page Should Contain Button ${xpath_dns_servers_toggle} 85 Page Should Contain Button ${xpath_ntp_servers_toggle} 86 Page Should Contain Button ${xpath_dhcp_toggle_switch} 87 88 89Verify Existence Of All Fields In Hostname 90 [Documentation] Login to GUI and navigate to the settings sub-menu network page 91 ... and confirm hostname contains all the fields. 92 [Tags] Verify_Existence_Of_All_Fields_In_Hostname 93 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND 94 ... Wait Until Keyword Succeeds 10 sec 5 sec 95 ... Refresh GUI And Verify Element Value ${xpath_network_heading} Network 96 97 Click Element ${xpath_hostname} 98 Wait Until Page Contains Edit hostname timeout=1min 99 Page Should Contain Textfield ${xpath_hostname_input} 100 Page Should Contain Button ${xpath_cancel_button} 101 Page Should Contain Button ${xpath_save_button} 102 103 104Verify Existence Of All Fields In Static IP Address 105 [Documentation] Login to GUI and navigate to the settings sub-menu network page 106 ... and confirm section static IPv4 contains all the fields. 107 [Tags] Verify_Existence_Of_All_Fields_In_Static_IP_Address 108 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND 109 ... Wait Until Keyword Succeeds 10 sec 5 sec 110 ... Refresh GUI And Verify Element Value ${xpath_network_heading} Network 111 112 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_add_static_ipv4_address_button} 113 Wait Until Page Contains Add static IPv4 address timeout=15s 114 Page Should Contain Textfield ${xpath_input_ip_address} 115 Page Should Contain Textfield ${xpath_input_gateway} 116 Page Should Contain Textfield ${xpath_input_subnetmask} 117 Page Should Contain Button ${xpath_cancel_button} 118 Page Should Contain Button ${xpath_add_button} 119 120 121Verify Existence Of All Fields In Static DNS 122 [Documentation] Login to GUI and navigate to the settings sub-menu network page 123 ... and confirm section static DNS contains all the fields. 124 [Tags] Verify_Existence_Of_All_Fields_In_Static_DNS 125 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND 126 ... Wait Until Keyword Succeeds 10 sec 5 sec 127 ... Refresh GUI And Verify Element Value ${xpath_network_heading} Network 128 129 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_add_dns_ip_address_button} 130 Wait Until Page Contains Add IP address timeout=11s 131 Page Should Contain Textfield ${xpath_input_static_dns} 132 Page Should Contain Button ${xpath_cancel_button} 133 Page Should Contain Button ${xpath_add_button} 134 135 136Configure And Verify DNS Server Via GUI 137 [Documentation] Login to GUI Network page, add DNS server IP 138 ... and verify that the page reflects server IP. 139 [Tags] Configure_And_Verify_DNS_Server_Via_GUI 140 [Setup] DNS Test Setup Execution 141 [Teardown] Run Keywords Delete Static Name Servers AND 142 ... Configure Static Name Servers 143 144 Add DNS Servers And Verify ${dns_server} 145 146 147Configure Static IPv4 Netmask Via GUI And Verify 148 [Documentation] Login to GUI Network page, configure static IPv4 netmask and verify. 149 [Tags] Configure_Static_IPv4_Netmask_Via_GUI_And_Verify 150 [Setup] Redfish.Login 151 [Teardown] Redfish.Logout 152 [Template] Add Static IP Address And Verify 153 154 # ip_addresses subnet_masks gateway expected_status 155 ${test_ipv4_addr} ${lowest_netmask} ${default_gateway} Success 156 ${test_ipv4_addr} ${more_byte_netmask} ${default_gateway} Invalid format 157 ${test_ipv4_addr} ${alpha_netmask} ${default_gateway} Invalid format 158 ${test_ipv4_addr} ${out_of_range_netmask} ${default_gateway} Invalid format 159 ${test_ipv4_addr} ${test_subnet_mask} ${default_gateway} Success 160 161 162Configure And Verify Static IP Address 163 [Documentation] Login to GUI Network page, configure static ip address and verify. 164 [Tags] Configure_And_Verify_Static_IP_Address 165 [Setup] Redfish.Login 166 [Teardown] Redfish.Logout 167 168 Add Static IP Address And Verify ${test_ipv4_addr} ${test_subnet_mask} ${default_gateway} Success 169 170 171Configure And Verify Multiple Static IP Address 172 [Documentation] Login to GUI Network page, configure multiple static IP address and verify. 173 [Setup] Redfish.Login 174 [Teardown] Redfish.Logout 175 [Tags] Configure_And_Verify_Multiple_Static_IP_Address 176 177 Add Static IP Address And Verify ${test_ipv4_addr} ${test_subnet_mask} ${default_gateway} Success 178 Add Static IP Address And Verify ${test_ipv4_addr_1} ${test_subnet_mask} ${default_gateway} Success 179 180 181Configure And Verify Invalid Static IP Address 182 [Documentation] Login to GUI Network page, configure invalid static IP address and verify. 183 [Tags] Configure_And_Verify_Invalid_Static_IP_Address 184 [Setup] Redfish.Login 185 [Teardown] Redfish.Logout 186 [Template] Add Static IP Address And Verify 187 188 # ip subnet_mask gateway status 189 ${out_of_range_ip} ${test_subnet_mask} ${default_gateway} Invalid format 190 ${less_octet_ip} ${test_subnet_mask} ${default_gateway} Invalid format 191 ${string_ip} ${test_subnet_mask} ${default_gateway} Invalid format 192 ${negative_ip} ${test_subnet_mask} ${default_gateway} Invalid format 193 ${hex_ip} ${test_subnet_mask} ${default_gateway} Invalid format 194 ${spl_char_ip} ${test_subnet_mask} ${default_gateway} Invalid format 195 196 197Modify DHCP Properties By Toggling And Verify 198 [Documentation] Modify DHCP properties by toggling and verify. 199 [Tags] Modify_DHCP_Properties_By_Toggling_And_Verify 200 [Setup] Redfish.Login 201 [Teardown] Redfish.Logout 202 [Template] Toggle DHCPv4 property And Verify 203 204 # property xpath_property 205 206 UseNTPServers ${xpath_ntp_switch_button} 207 UseDNSServers ${xpath_dns_switch_button} 208 UseDomainName ${xpath_domainname_switch_button} 209 210 211Delete IPv4 Address Via GUI And Verify 212 [Documentation] Delete IPv4 Address via GUI and verify. 213 [Tags] Delete_IPv4_Address_Via_GUI_And_Verify 214 [Setup] Redfish.Login 215 [Teardown] Redfish.Logout 216 217 Add Static IP Address And Verify ${test_ipv4_addr} ${test_subnet_mask} ${default_gateway} Success 218 Delete IPv4 Address And Verify ${test_ipv4_addr} 219 220 221Verify MAC Address Is Displayed 222 [Documentation] Verify MAC address is displayed. 223 [Tags] Verify_MAC_Address_Is_Displayed 224 [Setup] Redfish.Login 225 [Teardown] Redfish.Logout 226 227 ${network_details}= Get Network Interface Details ${CHANNEL_NUMBER} 228 229 # Verify the MAC address on GUI. 230 Page Should Contain ${network_details['MACAddress']} 231 232 233Verify MAC Address On Eth1 Interface 234 [Documentation] Verify MAC address on eth1 interface. 235 [Tags] Verify_MAC_Address_On_Eth1_Interface 236 [Setup] Redfish.Login 237 [Teardown] Redfish.Logout 238 239 Click Element ${xpath_eth1_interface} 240 241 ${network_details}= Get Network Interface Details ${SECONDARY_CHANNEL_NUMBER} 242 243 # Verify eth1 interface MAC address on GUI. 244 Page Should Contain ${network_details['MACAddress']} 245 246 247Configure Hostname Via GUI And Verify 248 [Documentation] Login to GUI Network page, configure hostname and verify. 249 [Tags] Configure_Hostname_Via_GUI_And_Verify 250 [Teardown] Configure the Hostname Back And Verify 251 252 ${hostname}= Get BMC Hostname 253 Set Suite Variable ${hostname} 254 Configure And Verify Network Settings Via GUI ${xpath_hostname} 255 ... ${xpath_hostname_input} ${test_hostname} 256 257 ${bmc_hostname}= Get BMC Hostname 258 Should Be Equal As Strings ${bmc_hostname} ${test_hostname} 259 260 261*** Keywords *** 262 263Suite Setup Execution 264 [Documentation] Do suite setup tasks. 265 266 Launch Browser And Login GUI 267 Wait Until Keyword Succeeds 1 min 15 sec 268 ... Click Element ${xpath_settings_menu} 269 Click Element ${xpath_network_sub_menu} 270 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network 271 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30 272 ${default_gateway}= Get BMC Default Gateway 273 Set Suite Variable ${default_gateway} 274 275Launch Browser Login GUI And Navigate To Network Page 276 [Documentation] Launch browser Login GUI and navigate to network page. 277 278 Launch Browser And Login GUI 279 Wait Until Keyword Succeeds 1 min 15 sec 280 ... Click Element ${xpath_settings_menu} 281 Click Element ${xpath_network_sub_menu} 282 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network 283 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30 284 285Configure the Hostname Back And Verify 286 [Documentation] Configure the hostname back. 287 288 Configure And Verify Network Settings Via GUI 289 ... ${xpath_hostname} ${xpath_hostname_input} ${hostname} 290 ${bmc_hostname_after}= Get BMC Hostname 291 Should Be Equal As Strings ${bmc_hostname_after} ${hostname} 292 293Delete DNS Servers And Verify 294 [Documentation] Login to GUI Network page,delete static name servers 295 ... and verify that page does not reflect static name servers. 296 297 Page Should Contain Element ${xpath_delete_dns_server} 298 Wait Until Element Is Enabled ${xpath_delete_dns_server} 299 Click Button ${xpath_delete_dns_server} 300 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15 301 # Check if all name servers deleted on BMC. 302 ${nameservers}= CLI Get Nameservers 303 Should Not Contain ${nameservers} ${original_nameservers} 304 305 DNS Test Setup Execution 306 307 Should Be Empty ${original_nameservers} 308 309 310Add Static IP Address And Verify 311 [Documentation] Add static IP address, subnet mask and 312 ... gateway via GUI and verify. 313 [Arguments] ${ip_address} ${subnet_mask} ${gateway_address} ${expected_status}=error 314 315 # Description of argument(s): 316 # ip_address IP address to be added (e.g. 10.7.7.7). 317 # subnet_mask Subnet mask for the IP to be added (e.g. 255.255.0.0). 318 # gateway_address Gateway address for the IP to be added (e.g. 10.7.7.1). 319 # expected_status Expected status while adding static ipv4 address 320 # .... (e.g. Invalid format / Field required). 321 322 Wait Until Element Is Enabled ${xpath_add_static_ipv4_address_button} timeout=60sec 323 Click Element ${xpath_add_static_ipv4_address_button} 324 325 Input Text ${xpath_input_ip_address} ${ip_address} 326 Input Text ${xpath_input_subnetmask} ${subnet_mask} 327 Input Text ${xpath_input_gateway} ${gateway_address} 328 329 Click Element ${xpath_add_button} 330 Run Keyword If '${expected_status}' == 'Success' 331 ... Run Keywords Wait Until Page Contains ${ip_address} timeout=40sec 332 ... AND Validate Network Config On BMC 333 334 ... ELSE IF '${expected_status}' == 'Invalid format' 335 ... Run Keywords Page Should Contain Invalid format AND 336 ... Click Button ${xpath_cancel_button} AND 337 ... Wait Until Page Does Not Contain Element ${xpath_cancel_button} 338 339 340Configure And Verify Network Settings Via GUI 341 [Documentation] Configure and verify network settings via GUI. 342 [Arguments] ${xpath_nw_settings} ${xpath_nw_settings_input_field} ${input_value} 343 344 # Description of argument(s): 345 # xpath_nw_settings xpath of the network settings. 346 # xpath_nw_settings_input_field xpath of the network setting's input field. 347 # input_value Input value for configuration. E.g. hostname, IP etc. 348 349 Wait Until Keyword Succeeds 30 sec 10 sec Click Element ${xpath_nw_settings} 350 Input Text ${xpath_nw_settings_input_field} ${input_value} 351 Click Button ${xpath_save_button} 352 353 # Re-Login gui and navigate to network page. 354 Launch Browser Login GUI And Navigate To Network Page 355 356 Wait Until Page Contains ${input_value} timeout=30sec 357 358 359Toggle DHCPv4 Property And Verify 360 [Documentation] Toggle DHVPv4 property and verify. 361 [Arguments] ${property} ${xpath_property} 362 363 # Description of argument(s): 364 # property DHCP Property name (e.g. UseDNSServers, UseDomainName, etc.). 365 # xpath_property xpath of the DHCPv4 property. 366 367 Wait Until Page Contains Element ${xpath_property} 368 369 ${redfish_before_set}= Get DHCP Property Via Redfish ${property} 370 ${gui_before_set}= Get Text ${xpath_property} 371 372 Click Element ${xpath_property} 373 Verify Popup Message And Close Popup ${xpath_success_popup} 374 Wait Until Element Is Not Visible 375 ... ${xpath_page_loading_progress_bar} timeout=120s 376 377 ${redfish_after_set}= Get DHCP Property Via Redfish ${property} 378 Should Not Be Equal ${redfish_before_set} ${redfish_after_set} 379 380 ${gui_after_set}= Get Text ${xpath_property} 381 Should Not Be Equal ${gui_before_set} ${gui_after_set} 382 383 Click Element At Coordinates ${xpath_property} 0 0 384 Verify Popup Message And Close Popup ${xpath_success_popup} 385 386 387Get DHCP Property Via Redfish 388 [Documentation] Get DHCPv4 property value via redfish. 389 [Arguments] ${property} 390 391 # Description of argument(s): 392 # ${property} DHCP Property name. 393 394 ${active_channel_config}= Get Active Channel Config 395 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 396 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 397 RETURN ${resp.dict["DHCPv4"]["${property}"]} 398 399 400Verify Popup Message And Close Popup 401 [Documentation] Verify popup message and close popup. 402 [Arguments] ${popup_msg} 403 404 # Description of argument(s): 405 # popup_msg Popup message (Eg: Success or Error). 406 407 Wait Until Keyword Succeeds 1 min 15 sec 408 ... Wait Until Page Contains Element ${popup_msg} 409 Click Element ${popup_msg} 410 411 412Delete IPv4 Address And Verify 413 [Documentation] Delete IPv4 address and verify. 414 [Arguments] ${ip_addr} 415 416 # Description of argument(s): 417 # ip_addr IP address to be deleted. 418 419 Wait Until Page Contains ${ip_addr} 420 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=120s 421 Wait Until Element Is Enabled ${xpath_delete_ipv4_addres} 422 Click Element ${xpath_delete_ipv4_addres} 423 Click Element ${xpath_delete_button} 424 Wait Until Page Contains Element ${xpath_success_message} 425 Sleep ${NETWORK_TIMEOUT}s 426 427 # Verify IP on BMC via Redfish. 428 ${delete_status}= Run Keyword And Return Status Verify IP On BMC ${ip_addr} 429 Should Be Equal ${delete_status} ${False} 430 431 Wait Until Page Does Not Contain ${ip_addr} 432 433 434Get Network Interface Details 435 [Documentation] Get network interface details. 436 [Arguments] ${channel_number} 437 438 # Description of argument(s): 439 # channel_number Interface Channel Number(eg.eth0 or eth1). 440 441 ${active_channel_config}= Get Active Channel Config 442 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']} 443 ${resp}= redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 444 RETURN ${resp.dict} 445