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 11*** Variables *** 12 13${xpath_network_heading} //h1[text()="Network"] 14${xpath_interface} //h2[text()="Interface"] 15${xpath_system} //h2[text()="System"] 16${xpath_static_ipv4} //h2[text()="IPV4"] 17${xpath_static_dns} //h2[text()="Static DNS"] 18${xpath_hostname_input} //*[@data-test-id="network-input-hostname"] 19${xpath_network_save_settings} //button[@data-test-id="network-button-saveNetworkSettings"] 20${xpath_default_gateway_input} //*[@data-test-id="network-input-gateway"] 21${xpath_mac_address_input} //*[@data-test-id="network-input-macAddress"] 22${xpath_static_input_ip0} //*[@data-test-id="network-input-staticIpv4-0"] 23${xpath_static_input_ip1} //*[@data-test-id="network-input-staticIpv4-1"] 24${xpath_add_static_ip} //button[contains(text(),"Add static IP")] 25${xpath_setting_success} //*[contains(text(),"Successfully saved network settings.")] 26${xpath_add_dns_server} //button[contains(text(),"Add DNS server")] 27${xpath_network_interface} //*[@data-test-id="network-select-interface"] 28${xpath_input_netmask_addr0} //*[@data-test-id="network-input-subnetMask-0"] 29${xpath_input_netmask_addr1} //*[@data-test-id="network-input-subnetMask-1"] 30${xpath_delete_static_ip} //*[@title="Delete IPv4 row"] 31${xpath_input_dns_server} //*[@data-test-id="network-input-dnsAddress-0"] 32${xpath_delete_dns_server} //*[@title="Delete DNS row"] 33${xpath_delete_static_ip} //*[@title="Delete IPv4 row"] 34 35@{static_name_servers} 10.10.10.10 36@{null_value} null 37@{empty_dictionary} {} 38@{string_value} aa.bb.cc.dd 39@{special_char_value} @@@.%%.44.11 40 41${test_ipv4_addr} 10.7.7.7 42${test_ipv4_addr2} 10.7.7.8 43${test_subnet_mask} 255.255.0.0 44 45# Valid netmask is 4 bytes long and has continuous block of 1s. 46# Maximum valid value in each octet is 255 and least value is 0. 47# Maximum value of octet in netmask is 255. 48${alpha_netmask} ff.ff.ff.ff 49${out_of_range_netmask} 255.256.255.0 50${more_byte_netmask} 255.255.255.0.0 51${lowest_netmask} 128.0.0.0 52${test_hostname} openbmc 53 54*** Test Cases *** 55 56Verify Navigation To Network Page 57 [Documentation] Verify navigation to network page. 58 [Tags] Verify_Navigation_To_Network_Page 59 60 Page Should Contain Element ${xpath_network_heading} 61 62 63Verify Existence Of All Sections In Network Page 64 [Documentation] Verify existence of all sections in network settings page. 65 [Tags] Verify_Existence_Of_All_Sections_In_Network_Page 66 67 Page Should Contain Element ${xpath_interface} 68 Page Should Contain Element ${xpath_system} 69 Page Should Contain Element ${xpath_static_ipv4} 70 Page Should Contain Element ${xpath_static_dns} 71 Page Should Contain Button ${xpath_delete_static_ip} 72 73 74Verify Existence Of All Buttons In Network Page 75 [Documentation] Verify existence of all buttons in network page. 76 [Tags] Verify_Existence_Of_All_Buttons_In_Network_Page 77 78 Page Should Contain Element ${xpath_add_static_ip} 79 Page Should Contain Element ${xpath_add_dns_server} 80 81 82Verify Network From Server Configuration 83 [Documentation] Verify ability to select "Network" sub-menu option 84 ... of "Settings". 85 [Tags] Verify_Network_From_Server_Configuration 86 87 Page Should Contain IP address 88 89 90Verify Hostname Text Configuration 91 [Documentation] Verify hostname text is configurable from "network settings" 92 ... sub-menu. 93 [Tags] Verify_Hostname_Text_Configuration 94 95 Wait Until Element Is Enabled ${xpath_hostname_input} 96 Input Text ${xpath_hostname_input} witherspoon1 97 Click Button ${xpath_network_save_settings} 98 Wait Until Page Contains Element ${xpath_setting_success} timeout=10 99 Wait Until Keyword Succeeds 15 sec 5 sec Textfield Should Contain ${xpath_hostname_input} 100 ... witherspoon1 101 102 103Verify Default Gateway Editable 104 [Documentation] Verify default gateway text input allowed from "network 105 ... settings". 106 [Tags] Verify_Default_Gateway_Editable 107 [Teardown] Click Element ${xpath_refresh_button} 108 109 Wait Until Page Contains Element ${xpath_default_gateway_input} 110 Input Text ${xpath_default_gateway_input} 10.6.6.7 111 112 113Verify MAC Address Editable 114 [Documentation] Verify MAC address text input allowed from "network 115 ... settings". 116 [Tags] Verify_MAC_Address_Editable 117 [Teardown] Click Element ${xpath_refresh_button} 118 119 Wait Until Element Is Enabled ${xpath_mac_address_input} 120 Input Text ${xpath_mac_address_input} AA:E2:84:14:28:79 121 122 123Verify Static IP Address Editable 124 [Documentation] Verify static IP address is editable. 125 [Tags] Verify_Static_IP_Address_Editable 126 [Teardown] Click Element ${xpath_refresh_button} 127 128 ${exists}= Run Keyword And Return Status Wait Until Page Contains Element ${xpath_static_input_ip0} 129 Run Keyword If '${exists}' == '${False}' 130 ... Click Element ${xpath_add_static_ip} 131 132 Input Text ${xpath_static_input_ip0} ${OPENBMC_HOST} 133 134 135Verify System Section In Network Setting page 136 [Documentation] Verify hostname, MAC address and default gateway 137 ... under system section of network setting page. 138 [Tags] Verify_System_Section 139 140 ${host_name}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName 141 Textfield Value Should Be ${xpath_hostname_input} ${host_name} 142 143 ${mac_address}= Get BMC MAC Address 144 Textfield Value Should Be ${xpath_mac_address_input} ${mac_address} 145 146 ${default_gateway}= Get BMC Default Gateway 147 Textfield Value Should Be ${xpath_default_gateway_input} ${default_gateway} 148 149 150Verify Network Interface Details 151 [Documentation] Verify network interface name in network setting page. 152 [Tags] Verify_Network_Interface_Details 153 154 ${active_channel_config}= Get Active Channel Config 155 ${ethernet_interface_redfish}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 156 ${ethernet_interface_gui}= Get Text ${xpath_network_interface} 157 Should Contain ${ethernet_interface_gui} ${ethernet_interface_redfish} 158 159 160Verify Network Static IPv4 Details 161 [Documentation] Verify network static IPv4 details. 162 [Tags] Verify_Network_static_IPv4_Details 163 164 @{network_configurations}= Get Network Configuration 165 ${ip_addresses}= Get Static IPv4 Addresses From GUI 166 FOR ${network_configuration} IN @{network_configurations} 167 List Should Contain Value ${ip_addresses} ${network_configuration["Address"]} 168 END 169 170 171Configure Invalid Network Addresses And Verify 172 [Documentation] Configure invalid network addresses and verify. 173 [Tags] Configure_Invalid_Network_Addresses_And_Verify 174 [Template] Configure Invalid Network Address And Verify 175 176 # locator invalid_address 177 ${xpath_mac_address_input} A.A.A.A 178 ${xpath_default_gateway_input} a.b.c.d 179 ${xpath_static_input_ip0} a.b.c.d 180 ${xpath_input_netmask_addr0} 255.256.255.0 181 182 183Configure And Verify Empty Network Addresses 184 [Documentation] Configure and verify empty network addresses. 185 [Tags] Configure_And_Verify_Empty_Network_Addresses 186 [Template] Configure Invalid Network Address And Verify 187 188 # locator invalid_address expected_error 189 ${xpath_mac_address_input} ${empty} Field required 190 ${xpath_default_gateway_input} ${empty} Field required 191 ${xpath_static_input_ip0} ${empty} Field required 192 ${xpath_input_netmask_addr0} ${empty} Field required 193 ${xpath_hostname_input} ${empty} Field required 194 195 196Config And Verify DNS Server Via GUI 197 [Documentation] Configure DNS server and verify. 198 [Tags] Config_And_Verify_DNS_Server_Via_GUI 199 [Setup] DNS Test Setup Execution 200 [Teardown] Run Keywords Delete DNS Server And Verify ${static_name_servers} 201 ... AND DNS Test Teardown Execution 202 203 Add DNS Server And Verify ${static_name_servers} 204 205 206Delete And Verify DNS Server Via GUI 207 [Documentation] Delete DNS server and verify. 208 [Tags] Delete_And_Verify_DNS_Server_Via_GUI 209 [Setup] Run Keywords DNS Test Setup Execution AND 210 ... Add DNS Server And Verify ${static_name_servers} 211 [Teardown] DNS Test Teardown Execution 212 213 Delete DNS Server And Verify ${static_name_servers} 214 215Configure And Verify Static IP Address 216 [Documentation] Configure and verify static ip addresses. 217 [Tags] Configure_And_Verify_Static_IP_Address 218 [Teardown] Delete And Verify Static IP Address On BMC ${test_ipv4_addr} 219 220 Add Static IP Address And Verify ${test_ipv4_addr} ${test_subnet_mask} 221 222 223Configure And Verify Invalid DNS Server 224 [Documentation] Configure invalid DNS server and verify error. 225 [Tags] Configure_And_Verify_Invalid_DNS_Server 226 [Template] Add DNS Server And Verify 227 [Setup] DNS Test Setup Execution 228 [Teardown] Run Keywords Click Element ${xpath_refresh_button} 229 ... AND DNS Test Teardown Execution 230 231 # invalid_ address expected_status 232 ${string_value} Invalid format 233 ${special_char_value} Invalid format 234 ${empty_dictionary} Field required 235 ${null_value} Invalid format 236 237Modify IP Address And Verify 238 [Documentation] Modify IP address and verify. 239 [Tags] Modify_IP_Address_And_Verify 240 [Teardown] Delete And Verify Static IP Address On BMC ${test_ipv4_addr2} 241 242 Add Static IP Address And Verify ${test_ipv4_addr} ${test_subnet_mask} 243 Update IP Address And Verify ${test_ipv4_addr} ${test_ipv4_addr2} 244 245 246Configure Netmask And Verify 247 [Documentation] Configure and verify netmask. 248 [Tags] Configure_And_Verify_Netmask 249 [Template] Add Static IP Address And Verify 250 [Teardown] Run Keywords Click Element ${xpath_refresh_button} 251 ... AND Delete And Verify Static IP Address On BMC ${test_ipv4_addr} 252 253 # ip_addresses subnet_masks expected_status 254 ${test_ipv4_addr} ${lowest_netmask} Valid format 255 ${test_ipv4_addr} ${more_byte_netmask} Invalid format 256 ${test_ipv4_addr} ${alpha_netmask} Invalid format 257 ${test_ipv4_addr} ${out_of_range_netmask} Invalid format 258 259 260Configure Hostname And Verify 261 [Documentation] Configure hostname and verify. 262 [Tags] Configure_Hostname_And_Verify 263 [Teardown] Configure And Verify Network Settings 264 ... ${xpath_hostname_input} ${hostname} 265 266 ${hostname}= Get Value ${xpath_hostname_input} 267 Configure And Verify Network Settings ${xpath_hostname_input} ${test_hostname} 268 269 270*** Keywords *** 271 272Suite Setup Execution 273 [Documentation] Do test case setup tasks. 274 275 Launch Browser And Login GUI 276 Click Element ${xpath_settings_menu} 277 Click Element ${xpath_network_sub_menu} 278 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network 279 ${host_name} ${BMC_IP}= Get Host Name IP host=${OPENBMC_HOST} 280 Set Suite Variable ${BMC_IP} 281 282 283Configure Invalid Network Address And Verify 284 [Documentation] Configure invalid network address And verify. 285 [Arguments] ${locator} ${invalid_address} ${expected_error}=Invalid format 286 [Teardown] Click Element ${xpath_refresh_button} 287 288 # Description of the argument(s): 289 # locator Xpath to identify an HTML element on a web page. 290 # invalid_address Invalid address to be added. 291 # expected_error Expected error optionally provided in testcase 292 # .... (e.g. Invalid format / Field required) 293 294 Wait Until Element Is Enabled ${locator} 295 Clear Element Text ${locator} 296 Input Text ${locator} ${invalid_address} 297 Click Element ${xpath_network_save_settings} 298 Page Should Contain ${expected_error} 299 300 301Add DNS Server And Verify 302 [Documentation] Add DNS server on BMC and verify it via BMC CLI. 303 [Arguments] ${static_name_servers} ${expected_status}=Valid format 304 305 # Description of the argument(s): 306 # static_name_servers A list of static name server IPs to be 307 # configured on the BMC. 308 # expected_status Expected status while adding DNS server address 309 # ... (e.g. Invalid format / Field required). 310 311 Wait Until Page Contains Element ${xpath_add_dns_server} 312 ${length}= Get Length ${static_name_servers} 313 FOR ${i} IN RANGE ${length} 314 Click Button ${xpath_add_dns_server} 315 Input Text //*[@data-test-id="network-input-dnsAddress-${i}"] 316 ... ${static_name_servers}[${i}] 317 END 318 319 Click Button ${xpath_network_save_settings} 320 Run keyword if '${expected_status}' != 'Valid format' 321 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword 322 323 Wait Until Page Contains Element ${xpath_setting_success} timeout=15 324 Sleep ${NETWORK_TIMEOUT}s 325 Verify Static Name Server Details On GUI ${static_name_servers} 326 # Check if newly added DNS server is configured on BMC. 327 ${cli_name_servers}= CLI Get Nameservers 328 List Should Contain Sub List ${cli_name_servers} ${static_name_servers} 329 330 331Delete DNS Server And Verify 332 [Documentation] Delete static name servers. 333 [Arguments] ${static_name_servers} 334 335 # Description of the argument(s): 336 # static_name_servers A list of static name server IPs to be 337 # configured on the BMC. 338 339 ${length}= Get Length ${static_name_servers} 340 FOR ${i} IN RANGE ${length} 341 ${status}= Run Keyword And Return Status 342 ... Page Should Contain Element ${xpath_delete_dns_server} 343 Exit For Loop If "${status}" == "False" 344 Wait Until Element Is Enabled ${xpath_delete_dns_server} 345 Click Button ${xpath_delete_dns_server} 346 END 347 348 Click Button ${xpath_network_save_settings} 349 Wait Until Page Contains Element ${xpath_setting_success} timeout=15 350 351 Sleep ${NETWORK_TIMEOUT}s 352 Page Should Not Contain Element ${xpath_input_dns_server} 353 # Check if all name servers deleted on BMC. 354 ${nameservers}= CLI Get Nameservers 355 Should Be Empty ${nameservers} 356 357 358DNS Test Setup Execution 359 [Documentation] Do DNS test setup execution. 360 361 ${original_name_server}= CLI Get Nameservers 362 Set Suite Variable ${original_name_server} 363 Run Keyword If ${original_name_server} != @{EMPTY} 364 ... Delete DNS Server And Verify ${original_name_server} 365 366 367DNS Test Teardown Execution 368 [Documentation] Do DNS test teardown execution. 369 370 Run Keyword If ${original_name_server} != @{EMPTY} 371 ... Add DNS Server And Verify ${original_name_server} 372 373 374Verify Static Name Server Details On GUI 375 [Documentation] Verify static name servers on GUI. 376 [Arguments] ${static_name_servers} 377 378 # Description of the argument(s): 379 # static_name_servers A list of static name server IPs to be 380 # configured on the BMC. 381 382 ${length}= Get Length ${static_name_servers} 383 FOR ${i} IN RANGE ${length} 384 Page Should Contain Element //*[@data-test-id="network-input-dnsAddress-${i}"] 385 Textfield Value Should Be //*[@data-test-id="network-input-dnsAddress-${i}"] 386 ... ${static_name_servers}[${i}] 387 END 388 389Add Static IP Address And Verify 390 [Documentation] Add static IP on BMC and verify. 391 [Arguments] ${ip_address} ${subnet_mask} ${expected_status}=Valid format 392 393 # Description of argument(s): 394 # ip_address IP address to be added (e.g. 10.7.7.7). 395 # subnet_masks Subnet mask for the IP to be added (e.g. 255.255.0.0). 396 # expected_status Expected status while adding static ipv4 address 397 # .... (e.g. Invalid format / Field required). 398 399 ${available_ip_addresses}= Get Static IPv4 Addresses From GUI 400 401 # New IP address location is GUI is equivalent to the available IP address 402 # in Redfish. i.e. if two IP address are available in GUI then location 403 # on IP address in GUI is also 2. 404 ${location}= Get Length ${available_ip_addresses} 405 Wait Until Element Is Enabled ${xpath_add_static_ip} 406 Click Button ${xpath_add_static_ip} 407 408 Input Text 409 ... //*[@data-test-id="network-input-staticIpv4-${location}"] ${ip_address} 410 Input Text 411 ... //*[@data-test-id="network-input-subnetMask-${location}"] ${subnet_mask} 412 413 Click Button ${xpath_network_save_settings} 414 Run keyword if '${expected_status}' != 'Valid format' 415 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword 416 Wait Until Page Contains Element ${xpath_setting_success} timeout=15 417 Click Element ${xpath_refresh_button} 418 Wait Until Page Contains Element ${xpath_static_input_ip0} 419 Validate Network Config On BMC 420 ${ip_addresses}= Get Static IPv4 Addresses From GUI 421 Should Contain ${ip_addresses} ${ip_address} 422 423 424Delete And Verify Static IP Address On BMC 425 [Documentation] Delete static IP address and verify 426 [Arguments] ${ip_address} 427 428 # Description of argument(s): 429 # ip_address IP address to be deleted (e.g. "10.7.7.7"). 430 431 ${ip_addresses}= Get Static IPv4 Addresses From GUI 432 Should Contain ${ip_addresses} ${ip_address} msg=${ip_address} does not exist on BMC 433 434 ${delete_ip_buttons}= Get WebElements ${xpath_delete_static_ip} 435 FOR ${location} IN RANGE len(${ip_addresses}) 436 ${gui_ip}= Get Value //*[@data-test-id="network-input-staticIpv4-${location}"] 437 Run Keyword If '${gui_ip}' == '${ip_address}' and '${gui_ip}' != '${BMC_IP}' 438 ... Run Keywords Click Element ${delete_ip_buttons}[${location}] 439 ... AND Exit For Loop 440 END 441 442 Click Button ${xpath_network_save_settings} 443 Wait Until Page Contains Element ${xpath_setting_success} timeout=15 444 Wait Until Page Contains Element ${xpath_static_input_ip0} 445 Validate Network Config On BMC 446 ${ip_addresses}= Get Static IPv4 Addresses From GUI 447 Should Not Contain ${ip_addresses} ${ip_address} 448 449 450Update IP Address And Verify 451 [Documentation] Update and verify static IP address on BMC. 452 [Arguments] ${ip} ${new_ip} 453 454 # Description of argument(s): 455 # ip IP address to be replaced (e.g. "10.7.7.7"). 456 # new_ip New IP address to be configured. 457 458 ${ip_addresses}= Get Static IPv4 Addresses From GUI 459 Should Contain ${ip_addresses} ${ip} msg=${ip} does not exist on BMC 460 461 FOR ${location} IN RANGE len(${ip_addresses}) 462 ${gui_ip}= Get Value //*[@data-test-id="network-input-staticIpv4-${location}"] 463 Run Keyword If '${gui_ip}' == '${ip}' 464 ... Run Keywords 465 ... Clear Element Text //*[@data-test-id="network-input-staticIpv4-${location}"] 466 ... AND Input Text 467 ... //*[@data-test-id="network-input-staticIpv4-${location}"] ${new_ip} 468 ... AND Exit For Loop 469 END 470 Click Button ${xpath_network_save_settings} 471 Wait Until Page Contains Element ${xpath_setting_success} timeout=15 472 Click Element ${xpath_refresh_button} 473 Wait Until Page Contains Element ${xpath_static_input_ip0} 474 Validate Network Config On BMC 475 ${ip_addresses}= Get Static IPv4 Addresses From GUI 476 Should Contain ${ip_addresses} ${new_ip} 477 478 479Get Static IPv4 Addresses From GUI 480 [Documentation] Get static IPV4 addresses from GUI. 481 482 ${availble_ip_addresses}= Get Network Configuration 483 ${static_ipv4_addresses}= Create List 484 485 FOR ${locator} IN RANGE len(${availble_ip_addresses}) 486 ${ip_address}= Get value //*[@data-test-id="network-input-staticIpv4-${locator}"] 487 Append To List ${static_ipv4_addresses} ${ip_address} 488 END 489 490 [Return] ${static_ipv4_addresses} 491 492 493Configure And Verify Network Settings 494 [Documentation] Configure and verify network settings. 495 [Arguments] ${xpath} ${nw_settings} 496 497 # Description of argument(s): 498 # xpath xpath of the network settings. 499 # nw_settings The mac address, hostname etc. 500 501 Wait Until Element Is Enabled ${xpath} 502 Input Text ${xpath} ${nw_settings} 503 Click Button ${xpath_network_save_settings} 504 Wait Until Page Contains Element ${xpath_setting_success} timeout=10 505 Textfield Value Should Be ${xpath} ${nw_settings} 506 507