Anusha Dathatri | 21ac59f | 2020-07-14 13:12:58 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Test OpenBMC GUI "Network settings" sub-menu of |
| 4 | ... "Server configuration". |
| 5 | |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 6 | Resource ../../lib/gui_resource.robot |
Anves Kumar rayankula | 65e5ed2 | 2020-09-17 04:44:44 -0500 | [diff] [blame] | 7 | Resource ../../../lib/bmc_network_utils.robot |
Anusha Dathatri | 21ac59f | 2020-07-14 13:12:58 -0500 | [diff] [blame] | 8 | |
| 9 | Suite Setup Suite Setup Execution |
| 10 | Suite Teardown Close Browser |
| 11 | |
| 12 | *** Variables *** |
| 13 | |
Anusha Dathatri | e11a54d | 2020-08-31 08:35:47 -0500 | [diff] [blame] | 14 | ${xpath_network_setting_heading} //h1[text()="Network settings"] |
| 15 | ${xpath_interface} //h2[text()="Interface"] |
| 16 | ${xpath_system} //h2[text()="System"] |
| 17 | ${xpath_static_ipv4} //h2[text()="Static IPv4"] |
| 18 | ${xpath_static_dns} //h2[text()="Static DNS"] |
| 19 | ${xpath_hostname_input} //*[@data-test-id="networkSettings-input-hostname"] |
| 20 | ${xpath_network_save_settings} //button[@data-test-id="networkSettings-button-saveNetworkSettings"] |
| 21 | ${xpath_default_gateway_input} //*[@data-test-id="networkSettings-input-gateway"] |
| 22 | ${xpath_mac_address_input} //*[@data-test-id="networkSettings-input-macAddress"] |
| 23 | ${xpath_static_input_ip0} //*[@data-test-id="networkSettings-input-staticIpv4-0"] |
Anves Kumar rayankula | ef4d34f | 2021-02-12 03:26:42 -0600 | [diff] [blame] | 24 | ${xpath_static_input_ip1} //*[@data-test-id="networkSettings-input-staticIpv4-1"] |
Anusha Dathatri | e11a54d | 2020-08-31 08:35:47 -0500 | [diff] [blame] | 25 | ${xpath_add_static_ip} //button[contains(text(),"Add static IP")] |
| 26 | ${xpath_setting_success} //*[contains(text(),"Successfully saved network settings.")] |
| 27 | ${xpath_add_dns_server} //button[contains(text(),"Add DNS server")] |
Anves Kumar rayankula | 65e5ed2 | 2020-09-17 04:44:44 -0500 | [diff] [blame] | 28 | ${xpath_network_interface} //*[@data-test-id="networkSettings-select-interface"] |
| 29 | ${xpath_input_netmask_addr0} //*[@data-test-id="networkSettings-input-subnetMask-0"] |
Anves Kumar rayankula | ef4d34f | 2021-02-12 03:26:42 -0600 | [diff] [blame] | 30 | ${xpath_input_netmask_addr1} //*[@data-test-id="networkSettings-input-subnetMask-1"] |
Anves Kumar rayankula | 43d8fe8 | 2020-12-08 21:21:38 -0600 | [diff] [blame] | 31 | ${xpath_delete_static_ip} //*[@title="Delete IPv4 row"] |
Anves Kumar rayankula | 4c88447 | 2020-11-24 05:03:45 -0600 | [diff] [blame] | 32 | ${xpath_input_dns_server} //*[@data-test-id="networkSettings-input-dnsAddress-0"] |
| 33 | ${xpath_delete_dns_server} //*[@title="Delete DNS row"] |
Anves Kumar rayankula | da39434 | 2021-01-17 23:51:16 -0600 | [diff] [blame] | 34 | ${xpath_ip_table} //*[@aria-colcount="3"] |
Anves Kumar rayankula | 4c88447 | 2020-11-24 05:03:45 -0600 | [diff] [blame] | 35 | |
Anves Kumar rayankula | 4c88447 | 2020-11-24 05:03:45 -0600 | [diff] [blame] | 36 | @{static_name_servers} 10.10.10.10 |
Anves Kumar rayankula | 8926629 | 2020-12-28 01:29:23 -0600 | [diff] [blame] | 37 | @{null_value} null |
| 38 | @{empty_dictionary} {} |
| 39 | @{string_value} aa.bb.cc.dd |
| 40 | @{special_char_value} @@@.%%.44.11 |
Anusha Dathatri | 21ac59f | 2020-07-14 13:12:58 -0500 | [diff] [blame] | 41 | |
Anves Kumar rayankula | da39434 | 2021-01-17 23:51:16 -0600 | [diff] [blame] | 42 | @{test_ipv4_addr} 10.7.7.7 |
| 43 | @{test_subnet_mask} 255.255.0.0 |
| 44 | |
Anves Kumar rayankula | ef4d34f | 2021-02-12 03:26:42 -0600 | [diff] [blame] | 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 | |
Anusha Dathatri | 21ac59f | 2020-07-14 13:12:58 -0500 | [diff] [blame] | 53 | *** Test Cases *** |
| 54 | |
Anusha Dathatri | e11a54d | 2020-08-31 08:35:47 -0500 | [diff] [blame] | 55 | Verify Navigation To Network Settings Page |
| 56 | [Documentation] Verify navigation to network settings page. |
| 57 | [Tags] Verify_Navigation_To_Network_Settings_Page |
| 58 | |
| 59 | Page Should Contain Element ${xpath_network_setting_heading} |
| 60 | |
| 61 | |
| 62 | Verify Existence Of All Sections In Network Settings Page |
| 63 | [Documentation] Verify existence of all sections in network settings page. |
| 64 | [Tags] Verify_Existence_Of_All_Sections_In_Network_Settings_Page |
| 65 | |
| 66 | Page Should Contain Element ${xpath_interface} |
| 67 | Page Should Contain Element ${xpath_system} |
| 68 | Page Should Contain Element ${xpath_static_ipv4} |
| 69 | Page Should Contain Element ${xpath_static_dns} |
Anves Kumar rayankula | 43d8fe8 | 2020-12-08 21:21:38 -0600 | [diff] [blame] | 70 | Page Should Contain Button ${xpath_delete_static_ip} |
Anusha Dathatri | e11a54d | 2020-08-31 08:35:47 -0500 | [diff] [blame] | 71 | |
| 72 | |
| 73 | Verify Existence Of All Buttons In Network Settings Page |
| 74 | [Documentation] Verify existence of all buttons in network settings page. |
| 75 | [Tags] Verify_Existence_Of_All_Buttons_In_Network_Settings_Page |
| 76 | |
| 77 | Page Should Contain Element ${xpath_add_static_ip} |
| 78 | Page Should Contain Element ${xpath_add_dns_server} |
| 79 | |
| 80 | |
Anusha Dathatri | 21ac59f | 2020-07-14 13:12:58 -0500 | [diff] [blame] | 81 | Verify Network Settings From Server Configuration |
| 82 | [Documentation] Verify ability to select "Network Settings" sub-menu option |
| 83 | ... of "Server Configuration". |
| 84 | [Tags] Verify_Network_Settings_From_Server_Configuration |
| 85 | |
| 86 | Page Should Contain IP address |
| 87 | |
| 88 | |
| 89 | Verify Hostname Text Configuration |
| 90 | [Documentation] Verify hostname text is configurable from "network settings" |
| 91 | ... sub-menu. |
| 92 | [Tags] Verify_Hostname_Text_Configuration |
| 93 | |
Anves Kumar rayankula | 76c0a8a | 2020-11-17 03:36:32 -0600 | [diff] [blame] | 94 | Wait Until Element Is Enabled ${xpath_hostname_input} |
Anusha Dathatri | 21ac59f | 2020-07-14 13:12:58 -0500 | [diff] [blame] | 95 | Input Text ${xpath_hostname_input} witherspoon1 |
| 96 | Click Button ${xpath_network_save_settings} |
| 97 | Wait Until Page Contains Element ${xpath_setting_success} timeout=10 |
Anusha Dathatri | 21ac59f | 2020-07-14 13:12:58 -0500 | [diff] [blame] | 98 | Wait Until Keyword Succeeds 15 sec 5 sec Textfield Should Contain ${xpath_hostname_input} |
| 99 | ... witherspoon1 |
| 100 | |
| 101 | |
| 102 | Verify Default Gateway Editable |
| 103 | [Documentation] Verify default gateway text input allowed from "network |
| 104 | ... settings". |
| 105 | [Tags] Verify_Default_Gateway_Editable |
Anves Kumar rayankula | 2760367 | 2021-01-21 04:26:08 -0600 | [diff] [blame] | 106 | [Teardown] Click Element ${xpath_refresh_button} |
Anusha Dathatri | 21ac59f | 2020-07-14 13:12:58 -0500 | [diff] [blame] | 107 | |
| 108 | Wait Until Page Contains Element ${xpath_default_gateway_input} |
| 109 | Input Text ${xpath_default_gateway_input} 10.6.6.7 |
| 110 | |
| 111 | |
| 112 | Verify MAC Address Editable |
| 113 | [Documentation] Verify MAC address text input allowed from "network |
| 114 | ... settings". |
| 115 | [Tags] Verify_MAC_Address_Editable |
Anves Kumar rayankula | 2760367 | 2021-01-21 04:26:08 -0600 | [diff] [blame] | 116 | [Teardown] Click Element ${xpath_refresh_button} |
Anusha Dathatri | 21ac59f | 2020-07-14 13:12:58 -0500 | [diff] [blame] | 117 | |
Anves Kumar rayankula | 2760367 | 2021-01-21 04:26:08 -0600 | [diff] [blame] | 118 | Wait Until Element Is Enabled ${xpath_mac_address_input} |
Anusha Dathatri | 21ac59f | 2020-07-14 13:12:58 -0500 | [diff] [blame] | 119 | Input Text ${xpath_mac_address_input} AA:E2:84:14:28:79 |
| 120 | |
| 121 | |
| 122 | Verify Static IP Address Editable |
| 123 | [Documentation] Verify static IP address is editable. |
| 124 | [Tags] Verify_Static_IP_Address_Editable |
Anves Kumar rayankula | 2760367 | 2021-01-21 04:26:08 -0600 | [diff] [blame] | 125 | [Teardown] Click Element ${xpath_refresh_button} |
Anusha Dathatri | 21ac59f | 2020-07-14 13:12:58 -0500 | [diff] [blame] | 126 | |
| 127 | ${exists}= Run Keyword And Return Status Wait Until Page Contains Element ${xpath_static_input_ip0} |
| 128 | Run Keyword If '${exists}' == '${False}' |
| 129 | ... Click Element ${xpath_add_static_ip} |
| 130 | |
| 131 | Input Text ${xpath_static_input_ip0} ${OPENBMC_HOST} |
| 132 | |
| 133 | |
Anves Kumar rayankula | 475811b | 2020-08-31 06:22:11 -0500 | [diff] [blame] | 134 | Verify System Section In Network Setting page |
| 135 | [Documentation] Verify hostname, MAC address and default gateway |
Anves Kumar rayankula | b172fbe | 2020-09-09 00:27:21 -0500 | [diff] [blame] | 136 | ... under system section of network setting page. |
Anves Kumar rayankula | 475811b | 2020-08-31 06:22:11 -0500 | [diff] [blame] | 137 | [Tags] Verify_System_Section |
| 138 | |
Anves Kumar rayankula | b172fbe | 2020-09-09 00:27:21 -0500 | [diff] [blame] | 139 | ${host_name}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName |
Anves Kumar rayankula | ba8a48e | 2020-10-05 06:18:09 -0500 | [diff] [blame] | 140 | Textfield Value Should Be ${xpath_hostname_input} ${host_name} |
Anves Kumar rayankula | 475811b | 2020-08-31 06:22:11 -0500 | [diff] [blame] | 141 | |
| 142 | ${mac_address}= Get BMC MAC Address |
| 143 | Textfield Value Should Be ${xpath_mac_address_input} ${mac_address} |
| 144 | |
| 145 | ${default_gateway}= Get BMC Default Gateway |
| 146 | Textfield Value Should Be ${xpath_default_gateway_input} ${default_gateway} |
| 147 | |
| 148 | |
Anves Kumar rayankula | 65e5ed2 | 2020-09-17 04:44:44 -0500 | [diff] [blame] | 149 | Verify Network Interface Details |
| 150 | [Documentation] Verify network interface name in network setting page. |
| 151 | [Tags] Verify_Network_Interface_Details |
| 152 | |
| 153 | ${active_channel_config}= Get Active Channel Config |
| 154 | ${ethernet_interface_redfish}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 155 | ${ethernet_interface_gui}= Get Text ${xpath_network_interface} |
| 156 | Should Contain ${ethernet_interface_gui} ${ethernet_interface_redfish} |
| 157 | |
| 158 | |
| 159 | Verify Network Static IPv4 Details |
| 160 | [Documentation] Verify network static IPv4 details. |
| 161 | [Tags] Verify_Network_static_IPv4_Details |
| 162 | |
| 163 | @{network_configurations}= Get Network Configuration |
| 164 | FOR ${network_configuration} IN @{network_configurations} |
| 165 | Textfield Value Should Be ${xpath_static_input_ip0} ${network_configuration["Address"]} |
| 166 | Textfield Value Should Be ${xpath_input_netmask_addr0} ${network_configuration['SubnetMask']} |
| 167 | END |
| 168 | |
| 169 | |
Anves Kumar rayankula | 550eba9 | 2020-09-21 23:36:44 -0500 | [diff] [blame] | 170 | Configure Invalid Network Addresses And Verify |
| 171 | [Documentation] Configure invalid network addresses and verify. |
| 172 | [Tags] Configure_Invalid_Network_Addresses_And_Verify |
| 173 | [Template] Configure Invalid Network Address And Verify |
| 174 | |
| 175 | # locator invalid_address |
| 176 | ${xpath_mac_address_input} A.A.A.A |
| 177 | ${xpath_default_gateway_input} a.b.c.d |
| 178 | ${xpath_static_input_ip0} a.b.c.d |
| 179 | ${xpath_input_netmask_addr0} 255.256.255.0 |
| 180 | |
| 181 | |
Anves Kumar rayankula | 43d8fe8 | 2020-12-08 21:21:38 -0600 | [diff] [blame] | 182 | Configure And Verify Empty Network Addresses |
| 183 | [Documentation] Configure and verify empty network addresses. |
| 184 | [Tags] Configure_And_Verify_Empty_Network_Addresses |
| 185 | [Template] Configure Invalid Network Address And Verify |
| 186 | |
| 187 | # locator invalid_address expected_error |
| 188 | ${xpath_mac_address_input} ${empty} Field required |
| 189 | ${xpath_default_gateway_input} ${empty} Field required |
| 190 | ${xpath_static_input_ip0} ${empty} Field required |
| 191 | ${xpath_input_netmask_addr0} ${empty} Field required |
| 192 | ${xpath_hostname_input} ${empty} Field required |
| 193 | |
| 194 | |
Anves Kumar rayankula | 4c88447 | 2020-11-24 05:03:45 -0600 | [diff] [blame] | 195 | Config And Verify DNS Server Via GUI |
| 196 | [Documentation] Configure DNS server and verify. |
| 197 | [Tags] Config_And_Verify_DNS_Server_Via_GUI |
| 198 | [Setup] DNS Test Setup Execution |
| 199 | [Teardown] Run Keywords Delete DNS Server And Verify ${static_name_servers} |
| 200 | ... AND DNS Test Teardown Execution |
| 201 | |
| 202 | Add DNS Server And Verify ${static_name_servers} |
| 203 | |
| 204 | |
| 205 | Delete And Verify DNS Server Via GUI |
| 206 | [Documentation] Delete DNS server and verify. |
| 207 | [Tags] Delete_And_Verify_DNS_Server_Via_GUI |
| 208 | [Setup] Run Keywords DNS Test Setup Execution AND |
| 209 | ... Add DNS Server And Verify ${static_name_servers} |
| 210 | [Teardown] DNS Test Teardown Execution |
| 211 | |
| 212 | Delete DNS Server And Verify ${static_name_servers} |
| 213 | |
Anves Kumar rayankula | da39434 | 2021-01-17 23:51:16 -0600 | [diff] [blame] | 214 | Configure And Verify Static IP Address |
| 215 | [Documentation] Configure and verify static ip addresses. |
| 216 | [Setup] Test Setup Execution |
| 217 | [Tags] Configure_And_Verify_Static_IP_Address |
| 218 | [Teardown] Run Keywords Delete And Verify Static IP Address On BMC |
| 219 | ... AND Test Teardown Execution |
| 220 | |
| 221 | Add Static IP Address And Verify ${test_ipv4_addr} ${test_subnet_mask} |
| 222 | |
Anves Kumar rayankula | 4c88447 | 2020-11-24 05:03:45 -0600 | [diff] [blame] | 223 | |
Anves Kumar rayankula | 8926629 | 2020-12-28 01:29:23 -0600 | [diff] [blame] | 224 | Configure And Verify Invalid DNS Server |
| 225 | [Documentation] Configure invalid DNS server and verify error. |
| 226 | [Tags] Configure_And_Verify_Invalid_DNS_Server |
| 227 | [Template] Add DNS Server And Verify |
| 228 | [Setup] DNS Test Setup Execution |
Anves Kumar rayankula | 2760367 | 2021-01-21 04:26:08 -0600 | [diff] [blame] | 229 | [Teardown] Run Keywords Click Element ${xpath_refresh_button} |
| 230 | ... AND DNS Test Teardown Execution |
Anves Kumar rayankula | 8926629 | 2020-12-28 01:29:23 -0600 | [diff] [blame] | 231 | |
| 232 | # invalid_ address expected_status |
| 233 | ${string_value} Invalid format |
| 234 | ${special_char_value} Invalid format |
| 235 | ${empty_dictionary} Field required |
| 236 | ${null_value} Invalid format |
| 237 | |
Anves Kumar rayankula | ef4d34f | 2021-02-12 03:26:42 -0600 | [diff] [blame] | 238 | Modify IP Address And Verify |
| 239 | [Documentation] Modify IP address and verify. |
| 240 | [Setup] Test Setup Execution |
| 241 | [Tags] Modify_IP_Address_And_Verify |
| 242 | [Teardown] Run Keywords Delete And Verify Static IP Address On BMC |
| 243 | ... AND Test Teardown Execution |
| 244 | |
| 245 | Add IP Address And Verify 10.7.7.8 255.255.0.0 |
| 246 | Update IP Address And Verify 10.7.7.8 10.7.7.9 255.255.0.0 |
| 247 | |
| 248 | |
| 249 | Configure Netmask And Verify |
| 250 | [Documentation] Configure and verify netmask. |
| 251 | [Tags] Configure_And_Verify_Netmask |
| 252 | [Setup] Test Setup Execution |
| 253 | [Template] Add Static IP Address And Verify |
| 254 | [Teardown] Run Keywords Click Element ${xpath_refresh_button} |
| 255 | ... AND Delete And Verify Static IP Address On BMC |
| 256 | ... AND Test Teardown Execution |
| 257 | |
| 258 | # ip_addresses subnet_masks expected_status |
| 259 | ${test_ipv4_addr} ${lowest_netmask} Valid format |
| 260 | ${test_ipv4_addr} ${more_byte_netmask} Invalid format |
| 261 | ${test_ipv4_addr} ${alpha_netmask} Invalid format |
| 262 | ${test_ipv4_addr} ${out_of_range_netmask} Invalid format |
Anves Kumar rayankula | 8926629 | 2020-12-28 01:29:23 -0600 | [diff] [blame] | 263 | |
Anusha Dathatri | 21ac59f | 2020-07-14 13:12:58 -0500 | [diff] [blame] | 264 | *** Keywords *** |
| 265 | |
| 266 | Suite Setup Execution |
| 267 | [Documentation] Do test case setup tasks. |
| 268 | |
| 269 | Launch Browser And Login GUI |
| 270 | Click Element ${xpath_server_configuration} |
| 271 | Click Element ${xpath_select_network_settings} |
| 272 | Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network-settings |
Anves Kumar rayankula | da39434 | 2021-01-17 23:51:16 -0600 | [diff] [blame] | 273 | ${host_name} ${BMC_IP}= Get Host Name IP host=${OPENBMC_HOST} |
| 274 | Set Suite Variable ${BMC_IP} |
Anusha Dathatri | 21ac59f | 2020-07-14 13:12:58 -0500 | [diff] [blame] | 275 | |
Anves Kumar rayankula | 550eba9 | 2020-09-21 23:36:44 -0500 | [diff] [blame] | 276 | |
Anves Kumar rayankula | 550eba9 | 2020-09-21 23:36:44 -0500 | [diff] [blame] | 277 | Configure Invalid Network Address And Verify |
| 278 | [Documentation] Configure invalid network address And verify. |
Anves Kumar rayankula | 43d8fe8 | 2020-12-08 21:21:38 -0600 | [diff] [blame] | 279 | [Arguments] ${locator} ${invalid_address} ${expected_error}=Invalid format |
Anves Kumar rayankula | 2760367 | 2021-01-21 04:26:08 -0600 | [diff] [blame] | 280 | [Teardown] Click Element ${xpath_refresh_button} |
Anves Kumar rayankula | 550eba9 | 2020-09-21 23:36:44 -0500 | [diff] [blame] | 281 | |
| 282 | # Description of the argument(s): |
| 283 | # locator Xpath to identify an HTML element on a web page. |
| 284 | # invalid_address Invalid address to be added. |
Anves Kumar rayankula | 43d8fe8 | 2020-12-08 21:21:38 -0600 | [diff] [blame] | 285 | # expected_error Expected error optionally provided in testcase |
| 286 | # .... (e.g. Invalid format / Field required) |
Anves Kumar rayankula | 550eba9 | 2020-09-21 23:36:44 -0500 | [diff] [blame] | 287 | |
Anves Kumar rayankula | 43d8fe8 | 2020-12-08 21:21:38 -0600 | [diff] [blame] | 288 | Wait Until Element Is Enabled ${locator} |
| 289 | Clear Element Text ${locator} |
Anves Kumar rayankula | 550eba9 | 2020-09-21 23:36:44 -0500 | [diff] [blame] | 290 | Input Text ${locator} ${invalid_address} |
Anves Kumar rayankula | 5548115 | 2020-10-21 07:51:07 -0500 | [diff] [blame] | 291 | Click Element ${xpath_network_save_settings} |
Anves Kumar rayankula | 43d8fe8 | 2020-12-08 21:21:38 -0600 | [diff] [blame] | 292 | Page Should Contain ${expected_error} |
Anves Kumar rayankula | 550eba9 | 2020-09-21 23:36:44 -0500 | [diff] [blame] | 293 | |
Anves Kumar rayankula | 4c88447 | 2020-11-24 05:03:45 -0600 | [diff] [blame] | 294 | |
| 295 | Add DNS Server And Verify |
| 296 | [Documentation] Add DNS server on BMC and verify it via BMC CLI. |
Anves Kumar rayankula | 2760367 | 2021-01-21 04:26:08 -0600 | [diff] [blame] | 297 | [Arguments] ${static_name_servers} ${expected_status}=Valid format |
Anves Kumar rayankula | 4c88447 | 2020-11-24 05:03:45 -0600 | [diff] [blame] | 298 | |
| 299 | # Description of the argument(s): |
| 300 | # static_name_servers A list of static name server IPs to be |
| 301 | # configured on the BMC. |
Anves Kumar rayankula | 8926629 | 2020-12-28 01:29:23 -0600 | [diff] [blame] | 302 | # expected_status Expected status while adding DNS server address |
| 303 | # ... (e.g. Invalid format / Field required). |
Anves Kumar rayankula | 4c88447 | 2020-11-24 05:03:45 -0600 | [diff] [blame] | 304 | |
| 305 | Wait Until Page Contains Element ${xpath_add_dns_server} |
| 306 | ${length}= Get Length ${static_name_servers} |
| 307 | FOR ${i} IN RANGE ${length} |
| 308 | Click Button ${xpath_add_dns_server} |
| 309 | Input Text //*[@data-test-id="networkSettings-input-dnsAddress-${i}"] |
| 310 | ... ${static_name_servers}[${i}] |
| 311 | END |
| 312 | |
| 313 | Click Button ${xpath_network_save_settings} |
Anves Kumar rayankula | 8926629 | 2020-12-28 01:29:23 -0600 | [diff] [blame] | 314 | Run keyword if '${expected_status}' != 'Valid format' |
| 315 | ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword |
Anves Kumar rayankula | 4c88447 | 2020-11-24 05:03:45 -0600 | [diff] [blame] | 316 | |
Anves Kumar rayankula | 8926629 | 2020-12-28 01:29:23 -0600 | [diff] [blame] | 317 | Wait Until Page Contains Element ${xpath_setting_success} timeout=15 |
Anves Kumar rayankula | 4c88447 | 2020-11-24 05:03:45 -0600 | [diff] [blame] | 318 | Sleep ${NETWORK_TIMEOUT}s |
| 319 | Verify Static Name Server Details On GUI ${static_name_servers} |
| 320 | # Check if newly added DNS server is configured on BMC. |
| 321 | ${cli_name_servers}= CLI Get Nameservers |
| 322 | List Should Contain Sub List ${cli_name_servers} ${static_name_servers} |
| 323 | |
| 324 | |
| 325 | Delete DNS Server And Verify |
| 326 | [Documentation] Delete static name servers. |
| 327 | [Arguments] ${static_name_servers} |
| 328 | |
| 329 | # Description of the argument(s): |
| 330 | # static_name_servers A list of static name server IPs to be |
| 331 | # configured on the BMC. |
| 332 | |
| 333 | ${length}= Get Length ${static_name_servers} |
| 334 | FOR ${i} IN RANGE ${length} |
| 335 | ${status}= Run Keyword And Return Status |
| 336 | ... Page Should Contain Element ${xpath_delete_dns_server} |
| 337 | Exit For Loop If "${status}" == "False" |
| 338 | Wait Until Element Is Enabled ${xpath_delete_dns_server} |
| 339 | Click Button ${xpath_delete_dns_server} |
| 340 | END |
| 341 | |
| 342 | Click Button ${xpath_network_save_settings} |
| 343 | Wait Until Page Contains Element ${xpath_setting_success} timeout=15 |
| 344 | |
| 345 | Sleep ${NETWORK_TIMEOUT}s |
| 346 | Page Should Not Contain Element ${xpath_input_dns_server} |
| 347 | # Check if all name servers deleted on BMC. |
| 348 | ${nameservers}= CLI Get Nameservers |
| 349 | Should Be Empty ${nameservers} |
| 350 | |
| 351 | |
| 352 | DNS Test Setup Execution |
| 353 | [Documentation] Do DNS test setup execution. |
| 354 | |
| 355 | ${original_name_server}= CLI Get Nameservers |
| 356 | Set Suite Variable ${original_name_server} |
| 357 | Run Keyword If ${original_name_server} != @{EMPTY} |
| 358 | ... Delete DNS Server And Verify ${original_name_server} |
| 359 | |
| 360 | |
| 361 | DNS Test Teardown Execution |
| 362 | [Documentation] Do DNS test teardown execution. |
| 363 | |
| 364 | Run Keyword If ${original_name_server} != @{EMPTY} |
| 365 | ... Add DNS Server And Verify ${original_name_server} |
| 366 | |
| 367 | |
| 368 | Verify Static Name Server Details On GUI |
| 369 | [Documentation] Verify static name servers on GUI. |
| 370 | [Arguments] ${static_name_servers} |
| 371 | |
| 372 | # Description of the argument(s): |
| 373 | # static_name_servers A list of static name server IPs to be |
| 374 | # configured on the BMC. |
| 375 | |
| 376 | ${length}= Get Length ${static_name_servers} |
| 377 | FOR ${i} IN RANGE ${length} |
| 378 | Page Should Contain Element //*[@data-test-id="networkSettings-input-dnsAddress-${i}"] |
| 379 | Textfield Value Should Be //*[@data-test-id="networkSettings-input-dnsAddress-${i}"] |
| 380 | ... ${static_name_servers}[${i}] |
| 381 | END |
| 382 | |
Anves Kumar rayankula | da39434 | 2021-01-17 23:51:16 -0600 | [diff] [blame] | 383 | Add Static IP Address And Verify |
| 384 | [Documentation] Add static IP on BMC and verify. |
| 385 | [Arguments] ${ip_addresses} ${subnet_masks} ${expected_status}=Valid format |
Anves Kumar rayankula | 8926629 | 2020-12-28 01:29:23 -0600 | [diff] [blame] | 386 | |
Anves Kumar rayankula | da39434 | 2021-01-17 23:51:16 -0600 | [diff] [blame] | 387 | # Description of argument(s): |
| 388 | # ip_addresses A list of IP address to be added (e.g. ["10.7.7.7"]). |
| 389 | # subnet_masks A list of Subnet mask for the IP to be added (e.g. ["255.255.0.0"]). |
| 390 | # expected_status Expected status while adding static ipv4 address |
| 391 | # .... (e.g. Invalid format / Field required). |
| 392 | |
| 393 | ${ip_count}= Get Length ${ip_addresses} |
| 394 | FOR ${i} IN RANGE ${ip_count} |
| 395 | ${ip_location}= Evaluate ${i} + ${1} |
| 396 | Wait Until Element Is Enabled ${xpath_add_static_ip} |
| 397 | Click Button ${xpath_add_static_ip} |
| 398 | Wait Until Element Is Enabled //*[@data-test-id="networkSettings-input-staticIpv4-${ip_location}"] |
| 399 | Wait Until Element Is Enabled //*[@data-test-id="networkSettings-input-subnetMask-${ip_location}"] |
| 400 | Input Text //*[@data-test-id="networkSettings-input-staticIpv4-${ip_location}"] ${ip_addresses}[${i}] |
| 401 | Input Text //*[@data-test-id="networkSettings-input-subnetMask-${ip_location}"] ${subnet_masks}[${i}] |
| 402 | END |
| 403 | |
| 404 | Click Button ${xpath_network_save_settings} |
| 405 | Run keyword if '${expected_status}' != 'Valid format' |
| 406 | ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword |
| 407 | Wait Until Page Contains Element ${xpath_setting_success} timeout=15 |
| 408 | Sleep ${NETWORK_TIMEOUT}s |
| 409 | Click Element ${xpath_refresh_button} |
| 410 | Verify IP And Netmask On BMC Using GUI ${ip_addresses} ${subnet_masks} |
| 411 | |
| 412 | Delete And Verify Static IP Address On BMC |
| 413 | [Documentation] Delete static IP address and verify |
| 414 | |
| 415 | ${all_match_elements}= Get Element Count ${xpath_delete_static_ip} |
| 416 | FOR ${element} IN RANGE ${all_match_elements} |
| 417 | ${ip_location}= Evaluate ${element} + ${1} |
| 418 | Delete Static IPv4 Addresses Except BMC IP ${element} |
| 419 | ${status}= Run Keyword And Return Status Page Should Contain Textfield |
| 420 | ... //*[@data-test-id="networkSettings-input-staticIpv4-${ip_location}"] |
| 421 | Exit For Loop IF "${status}" == "${False}" |
| 422 | END |
| 423 | |
| 424 | Click Button ${xpath_network_save_settings} |
| 425 | Wait Until Page Contains Element ${xpath_setting_success} timeout=15 |
| 426 | ${all_match_elements}= Get Element Count ${xpath_delete_static_ip} |
| 427 | Should Be Equal ${all_match_elements} ${1} |
| 428 | Textfield Value Should Be ${xpath_static_input_ip0} ${BMC_IP} |
| 429 | Sleep ${NETWORK_TIMEOUT}s |
| 430 | Ping Host ${OPENBMC_HOST} |
| 431 | Validate Network Config On BMC |
| 432 | |
| 433 | Delete Static IPv4 Addresses Except BMC IP |
| 434 | [Documentation] Delete static IP addresses from IPv4 section on GUI except BMC IP. |
| 435 | [Arguments] ${element} |
| 436 | |
| 437 | # Description of argument(s): |
| 438 | # element IP address location on GUI(e.g. 0 or 1). |
| 439 | |
| 440 | ${ip_location}= Evaluate ${element} + ${1} |
| 441 | Wait Until Element Is Enabled //*[@data-test-id="networkSettings-input-staticIpv4-${element}"] |
| 442 | ${input_ip}= Get Value //*[@data-test-id="networkSettings-input-staticIpv4-${element}"] |
| 443 | Run Keyword If "${BMC_IP}" != "${input_ip}" |
| 444 | ... Click Button ${xpath_ip_table}/tbody/tr[${ip_location}]/td[3]/span/button |
| 445 | |
| 446 | # Get delete ip elements. |
| 447 | ${delete_ip_elements}= Get Element Count ${xpath_delete_static_ip} |
| 448 | |
| 449 | # Delete IP Address on BMC if avilable more than 1. |
| 450 | Run Keyword If ${delete_ip_elements} != ${1} |
| 451 | ... Delete Static IPv4 Addresses Except BMC IP ${element} |
| 452 | |
| 453 | Test Setup Execution |
| 454 | [Documentation] Get and delete existing IPv4 addresses and netmask if any.. |
| 455 | |
| 456 | ${ip_data}= Create List |
| 457 | ${netmask_data}= Create List |
| 458 | |
| 459 | # Get all IPv4 addresses and netmask on BMC. |
| 460 | ${network_configurations}= Get Network Configuration |
| 461 | FOR ${network_configuration} IN @{network_configurations} |
| 462 | Continue For Loop If '${BMC_IP}' == '${network_configuration['Address']}' |
| 463 | Append To List ${ip_data} ${network_configuration['Address']} |
| 464 | Append To List ${netmask_data} ${network_configuration['SubnetMask']} |
| 465 | END |
| 466 | Set Suite Variable ${ip_data} |
| 467 | Set Suite Variable ${netmask_data} |
| 468 | |
| 469 | # Delete existing static IPv4 addresses and netmask if avilable. |
anvesr77 | dd83e25 | 2021-03-08 22:17:51 -0600 | [diff] [blame] | 470 | Run Keyword If ${ip_data} != @{empty} and ${netmask_data} != @{empty} |
Anves Kumar rayankula | da39434 | 2021-01-17 23:51:16 -0600 | [diff] [blame] | 471 | ... Delete And Verify Static IP Address On BMC |
| 472 | |
| 473 | |
| 474 | Test Teardown Execution |
| 475 | [Documentation] Restore existing IPv4 addresses and netmasks. |
| 476 | |
| 477 | ${ip_length}= Get Length ${ip_data} |
| 478 | ${netmask_length}= Get Length ${netmask_data} |
| 479 | |
| 480 | # Restore existing IPv4 addresses and netmasks if any.. |
anvesr77 | dd83e25 | 2021-03-08 22:17:51 -0600 | [diff] [blame] | 481 | Run Keyword If ${ip_length} != ${0} and ${netmask_length} != ${0} |
Anves Kumar rayankula | da39434 | 2021-01-17 23:51:16 -0600 | [diff] [blame] | 482 | ... Add Static IP Address And Verify ${ip_data} ${netmask_data} |
| 483 | |
| 484 | |
| 485 | Verify IP And Netmask On BMC Using GUI |
| 486 | [Documentation] Verify IP and netmask on GUI. |
| 487 | [Arguments] ${ip_addresses} ${subnet_masks} |
| 488 | |
| 489 | # Description of argument(s): |
| 490 | # ip_addresses A list of IP address to be added (e.g. ["10.7.7.7"]). |
| 491 | # subnet_masks A list of Subnet mask for the IP to be added (e.g. ["255.255.0.0]"). |
| 492 | |
| 493 | ${ip_count}= Get Length ${ip_addresses} |
| 494 | FOR ${i} IN RANGE ${ip_count} |
| 495 | ${input_ip}= Get Value //*[@data-test-id="networkSettings-input-staticIpv4-${i}"] |
| 496 | Continue For Loop If '${BMC_IP}' == '${input_ip}' |
| 497 | Textfield Value Should Be //*[@data-test-id="networkSettings-input-staticIpv4-${i}"] |
| 498 | ... ${ip_addresses}[${i}] |
| 499 | Textfield Value Should Be //*[@data-test-id="networkSettings-input-subnetMask-${i}"] |
| 500 | ... ${subnet_masks}[${i}] |
| 501 | END |
| 502 | Validate Network Config On BMC |
Anves Kumar rayankula | ef4d34f | 2021-02-12 03:26:42 -0600 | [diff] [blame] | 503 | |
| 504 | |
| 505 | Update IP Address And Verify |
| 506 | [Documentation] Update static IPv4 address and verify. |
| 507 | [Arguments] ${ip} ${new_ip} ${subnet_mask} |
| 508 | |
| 509 | # Description of argument(s): |
| 510 | # ip IP address to be replaced (e.g. "10.7.7.7"). |
| 511 | # new_ip New IP address to be configured. |
| 512 | # subnet_mask Netmask value. |
| 513 | |
| 514 | ${get_ip}= Get Value ${xpath_static_input_ip0} |
| 515 | Run Keyword If '${ip}'== '${get_ip}' |
| 516 | ... Run Keywords Clear Element Text ${xpath_static_input_ip0} |
| 517 | ... AND Input Text ${xpath_static_input_ip0} ${new_ip} |
| 518 | |
| 519 | Click Button ${xpath_network_save_settings} |
| 520 | Wait Until Page Contains Element ${xpath_setting_success} timeout=15 |
| 521 | Sleep ${NETWORK_TIMEOUT}s |
| 522 | Click Element ${xpath_refresh_button} |
| 523 | Verfiy IP On BMC ${new_ip} ${subnet_mask} |
| 524 | Validate Network Config On BMC |
| 525 | |
| 526 | |
| 527 | Add IP Address And Verify |
| 528 | [Documentation] Add only one static IPv4 address and verify. |
| 529 | [Arguments] ${ip} ${subnet_mask} |
| 530 | |
| 531 | # Description of argument(s): |
| 532 | # ip IP address to be set (e.g. "10.7.7.7"). |
| 533 | # subnet_mask Netmask value to be set (e.g. "255.255.0.0"). |
| 534 | |
| 535 | Click Button ${xpath_add_static_ip} |
| 536 | Clear Element Text ${xpath_static_input_ip1} |
| 537 | Input Text ${xpath_static_input_ip1} ${ip} |
| 538 | Input Text ${xpath_input_netmask_addr1} ${subnet_mask} |
| 539 | Click Button ${xpath_network_save_settings} |
| 540 | Wait Until Page Contains Element ${xpath_setting_success} timeout=15 |
| 541 | Sleep ${NETWORK_TIMEOUT}s |
| 542 | Click Element ${xpath_refresh_button} |
| 543 | Verfiy IP On BMC ${ip} ${subnet_mask} |
| 544 | Validate Network Config On BMC |
| 545 | |
| 546 | |
| 547 | Verfiy IP On BMC |
| 548 | [Documentation] Verify only one static IPv4 address. |
| 549 | [Arguments] ${ip} ${subnet_mask} |
| 550 | |
| 551 | # Description of argument(s): |
| 552 | # ip IP address which needs to be verified (e.g. "10.7.7.7"). |
| 553 | # subnet_mask Netmask value which needs to be verified.(e.g. "255.255.0.0"). |
| 554 | |
| 555 | ${get_ip}= Get Value ${xpath_static_input_ip0} |
| 556 | ${get_netmask}= Get Value ${xpath_input_netmask_addr0} |
| 557 | Should Be Equal ${get_ip} ${ip} |
| 558 | Should Be Equal ${get_netmask} ${subnet_mask} |