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 12*** Variables *** 13 14${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")] 24${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_delete_dns_server} //*[@title="Delete DNS address"] 32 33${dns_server} 10.10.10.10 34${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 41${test_hostname} openbmc 42 43 44*** Test Cases *** 45 46Verify Navigation To Network Page 47 [Documentation] Login to GUI and navigate to the settings sub-menu network page. 48 [Tags] Verify_Navigation_To_Network_Page 49 50 Page Should Contain Element ${xpath_network_heading} 51 52 53Verify Existence Of All Sections In Network Page 54 [Documentation] Login to GUI and navigate to the settings sub-menu network page 55 ... and confirm the page contains sections that should be accessible. 56 [Tags] Verify_Existence_Of_All_Sections_In_Network_Page 57 58 Wait Until Page Contains Element ${xpath_network_settings} timeout=1min 59 Page Should Contain Element ${xpath_interface_settings} 60 Page Should Contain Element ${xpath_static_ipv4} 61 Page Should Contain Element ${xpath_static_dns} 62 63 64Verify Existence Of All Buttons In Network Page 65 [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. 67 [Tags] Verify_Existence_Of_All_Buttons_In_Network_Page 68 69 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} 74 75 76Verify 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 123Configure 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 132Configure 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 145Configure 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 159Configure 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 167*** Keywords *** 168 169Suite Setup Execution 170 [Documentation] Do suite setup tasks. 171 172 Launch Browser And Login GUI 173 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 176 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} 193 Click Button ${xpath_add_button} 194 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 208 ... and verify that page does not reflect static name servers. 209 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} 217 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 237 Click Element ${xpath_add_button} 238 Run Keyword If '${expected_status}' == 'Success' 239 ... 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} 245 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 260