Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Network interface configuration and verification |
| 3 | ... tests. |
| 4 | |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 5 | Resource ../../lib/bmc_redfish_resource.robot |
| 6 | Resource ../../lib/bmc_network_utils.robot |
| 7 | Resource ../../lib/openbmc_ffdc.robot |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 8 | Library ../../lib/bmc_network_utils.py |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 9 | Library Collections |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 10 | |
| 11 | Test Setup Test Setup Execution |
| 12 | Test Teardown Test Teardown Execution |
| 13 | |
Prashanth Katti | f34fafa | 2019-06-20 05:04:40 -0500 | [diff] [blame] | 14 | Force Tags Network_Conf_Test |
| 15 | |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 16 | *** Variables *** |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 17 | ${test_hostname} openbmc |
| 18 | ${test_ipv4_addr} 10.7.7.7 |
| 19 | ${test_ipv4_invalid_addr} 0.0.1.a |
| 20 | ${test_subnet_mask} 255.255.0.0 |
| 21 | ${test_gateway} 10.7.7.1 |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 22 | ${broadcast_ip} 10.7.7.255 |
| 23 | ${loopback_ip} 127.0.0.2 |
| 24 | ${multicast_ip} 224.6.6.6 |
| 25 | ${out_of_range_ip} 10.7.7.256 |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 26 | |
Prashanth Katti | 040c8c1 | 2019-05-31 04:42:05 -0500 | [diff] [blame] | 27 | # Valid netmask is 4 bytes long and has continuos block of 1s. |
| 28 | # Maximum valid value in each octet is 255 and least value is 0. |
| 29 | # 253 is not valid, as binary value is 11111101. |
| 30 | ${invalid_netmask} 255.255.253.0 |
| 31 | ${alpha_netmask} ff.ff.ff.ff |
| 32 | # Maximum value of octet in netmask is 255. |
| 33 | ${out_of_range_netmask} 255.256.255.0 |
| 34 | ${more_byte_netmask} 255.255.255.0.0 |
| 35 | ${less_byte_netmask} 255.255.255 |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 36 | ${threshold_netmask} 255.255.255.255 |
| 37 | ${lowest_netmask} 128.0.0.0 |
| 38 | |
| 39 | # There will be 4 octets in IP address (e.g. xx.xx.xx.xx) |
| 40 | # but trying to configure xx.xx.xx |
| 41 | ${less_octet_ip} 10.3.36 |
| 42 | |
| 43 | # For the address 10.6.6.6, the 10.6.6.0 portion describes the |
| 44 | # network ID and the 6 describe the host. |
| 45 | |
| 46 | ${network_id} 10.7.7.0 |
| 47 | ${hex_ip} 0xa.0xb.0xc.0xd |
| 48 | ${negative_ip} 10.-7.-7.7 |
| 49 | ${hex_ip} 0xa.0xb.0xc.0xd |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 50 | @{static_name_servers} 10.5.5.5 |
Prashanth Katti | 040c8c1 | 2019-05-31 04:42:05 -0500 | [diff] [blame] | 51 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 52 | *** Test Cases *** |
| 53 | |
| 54 | Get IP Address And Verify |
| 55 | [Documentation] Get IP Address And Verify. |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 56 | [Tags] Get_IP_Address_And_Verify |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 57 | |
| 58 | : FOR ${network_configuration} IN @{network_configurations} |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 59 | \ Verify IP On BMC ${network_configuration['Address']} |
| 60 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 61 | Get Netmask And Verify |
| 62 | [Documentation] Get Netmask And Verify. |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 63 | [Tags] Get_Netmask_And_Verify |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 64 | |
| 65 | : FOR ${network_configuration} IN @{network_configurations} |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 66 | \ Verify Netmask On BMC ${network_configuration['SubnetMask']} |
| 67 | |
Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 68 | Get Gateway And Verify |
| 69 | [Documentation] Get gateway and verify it's existence on the BMC. |
| 70 | [Tags] Get_Gateway_And_Verify |
| 71 | |
| 72 | : FOR ${network_configuration} IN @{network_configurations} |
| 73 | \ Verify Gateway On BMC ${network_configuration['Gateway']} |
| 74 | |
| 75 | Get MAC Address And Verify |
| 76 | [Documentation] Get MAC address and verify it's existence on the BMC. |
| 77 | [Tags] Get_MAC_Address_And_Verify |
| 78 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 79 | ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI} |
Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 80 | ${macaddr}= Get From Dictionary ${resp.dict} MACAddress |
| 81 | Validate MAC On BMC ${macaddr} |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 82 | |
Prashanth Katti | 2c5c3bb | 2019-02-14 04:23:07 -0600 | [diff] [blame] | 83 | Verify All Configured IP And Netmask |
| 84 | [Documentation] Verify all configured IP and netmask on BMC. |
| 85 | [Tags] Verify_All_Configured_IP_And_Netmask |
| 86 | |
| 87 | : FOR ${network_configuration} IN @{network_configurations} |
| 88 | \ Verify IP And Netmask On BMC ${network_configuration['Address']} |
| 89 | ... ${network_configuration['SubnetMask']} |
| 90 | |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 91 | Get Hostname And Verify |
| 92 | [Documentation] Get hostname via Redfish and verify. |
| 93 | [Tags] Get_Hostname_And_Verify |
| 94 | |
| 95 | ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName |
| 96 | |
| 97 | Validate Hostname On BMC ${hostname} |
| 98 | |
| 99 | Configure Hostname And Verify |
| 100 | [Documentation] Configure hostname via Redfish and verify. |
| 101 | [Tags] Configure_Hostname_And_Verify |
| 102 | |
Prashanth Katti | adf0b4e | 2019-06-10 04:20:30 -0500 | [diff] [blame] | 103 | ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 104 | |
Prashanth Katti | adf0b4e | 2019-06-10 04:20:30 -0500 | [diff] [blame] | 105 | Configure Hostname ${test_hostname} |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 106 | Validate Hostname On BMC ${test_hostname} |
| 107 | |
Prashanth Katti | adf0b4e | 2019-06-10 04:20:30 -0500 | [diff] [blame] | 108 | # Revert back to initial hostname. |
| 109 | Configure Hostname ${hostname} |
| 110 | Validate Hostname On BMC ${hostname} |
| 111 | |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 112 | Add Valid IPv4 Address And Verify |
| 113 | [Documentation] Add IPv4 Address via Redfish and verify. |
| 114 | [Tags] Add_Valid_IPv4_Addres_And_Verify |
| 115 | |
| 116 | Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} |
| 117 | Delete IP Address ${test_ipv4_addr} |
| 118 | |
| 119 | Add Invalid IPv4 Address And Verify |
| 120 | [Documentation] Add Invalid IPv4 Address via Redfish and verify. |
| 121 | [Tags] Add_Invalid_IPv4_Addres_And_Verify |
| 122 | |
| 123 | Add IP Address ${test_ipv4_invalid_addr} ${test_subnet_mask} |
| 124 | ... ${test_gateway} valid_status_codes=${HTTP_BAD_REQUEST} |
| 125 | |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 126 | Configure Out Of Range IP |
| 127 | [Documentation] Configure out-of-range IP address. |
| 128 | [Tags] Configure_Out_Of_Range_IP |
| 129 | [Template] Add IP Address |
| 130 | |
| 131 | # ip subnet_mask gateway valid_status_codes |
| 132 | ${out_of_range_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 133 | |
| 134 | Configure Broadcast IP |
| 135 | [Documentation] Configure broadcast IP address. |
| 136 | [Tags] Configure_Broadcast_IP |
| 137 | [Template] Add IP Address |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 138 | [Teardown] Clear IP Settings On Fail ${broadcast_ip} |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 139 | |
| 140 | # ip subnet_mask gateway valid_status_codes |
| 141 | ${broadcast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 142 | |
| 143 | Configure Multicast IP |
| 144 | [Documentation] Configure multicast IP address. |
| 145 | [Tags] Configure_Multicast_IP |
| 146 | [Template] Add IP Address |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 147 | [Teardown] Clear IP Settings On Fail ${multicast_ip} |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 148 | |
| 149 | # ip subnet_mask gateway valid_status_codes |
| 150 | ${multicast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 151 | |
| 152 | Configure Loopback IP |
| 153 | [Documentation] Configure loopback IP address. |
| 154 | [Tags] Configure_Loopback_IP |
| 155 | [Template] Add IP Address |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 156 | [Teardown] Clear IP Settings On Fail ${loopback_ip} |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 157 | |
| 158 | # ip subnet_mask gateway valid_status_codes |
| 159 | ${loopback_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 160 | |
| 161 | Add Valid IPv4 Address And Check Persistency |
| 162 | [Documentation] Add IPv4 address and check peristency. |
| 163 | [Tags] Add_Valid_IPv4_Addres_And_Check_Persistency |
| 164 | |
| 165 | Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} |
| 166 | |
| 167 | # Reboot BMC and verify persistency. |
| 168 | OBMC Reboot (off) |
| 169 | Verify IP On BMC ${test_ipv4_addr} |
| 170 | Delete IP Address ${test_ipv4_addr} |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 171 | |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 172 | Add Fourth Octet Threshold IP And Verify |
| 173 | [Documentation] Add fourth octet threshold IP and verify. |
| 174 | [Tags] Add_Fourth_Octet_Threshold_IP_And_Verify |
| 175 | |
| 176 | Add IP Address 10.7.7.254 ${test_subnet_mask} ${test_gateway} |
| 177 | Delete IP Address 10.7.7.254 |
| 178 | |
| 179 | Add Fourth Octet Lowest IP And Verify |
| 180 | [Documentation] Add fourth octet lowest IP and verify. |
| 181 | [Tags] Add_Fourth_Octet_Lowest_IP_And_Verify |
| 182 | |
| 183 | Add IP Address 10.7.7.1 ${test_subnet_mask} ${test_gateway} |
| 184 | Delete IP Address 10.7.7.1 |
| 185 | |
| 186 | Add Third Octet Threshold IP And Verify |
| 187 | [Documentation] Add third octet threshold IP and verify. |
| 188 | [Tags] Add_Third_Octet_Threshold_IP_And_Verify |
| 189 | |
| 190 | Add IP Address 10.7.255.7 ${test_subnet_mask} ${test_gateway} |
| 191 | Delete IP Address 10.7.255.7 |
| 192 | |
| 193 | Add Third Octet Lowest IP And Verify |
| 194 | [Documentation] Add third octet lowest IP and verify. |
| 195 | [Tags] Add_Third_Octet_Lowest_IP_And_Verify |
| 196 | |
| 197 | Add IP Address 10.7.0.7 ${test_subnet_mask} ${test_gateway} |
| 198 | Delete IP Address 10.7.0.7 |
| 199 | |
| 200 | Add Second Octet Threshold IP And Verify |
| 201 | [Documentation] Add second octet threshold IP and verify. |
| 202 | [Tags] Add_Second_Octet_Threshold_IP_And_Verify |
| 203 | |
| 204 | Add IP Address 10.255.7.7 ${test_subnet_mask} ${test_gateway} |
| 205 | Delete IP Address 10.255.7.7 |
| 206 | |
| 207 | Add Second Octet Lowest IP And Verify |
| 208 | [Documentation] Add second octet lowest IP and verify. |
| 209 | [Tags] Add_Second_Octet_Lowest_IP_And_Verify |
| 210 | |
| 211 | Add IP Address 10.0.7.7 ${test_subnet_mask} ${test_gateway} |
| 212 | Delete IP Address 10.0.7.7 |
| 213 | |
| 214 | Add First Octet Threshold IP And Verify |
| 215 | [Documentation] Add first octet threshold IP and verify. |
| 216 | [Tags] Add_First_Octet_Threshold_IP_And_Verify |
| 217 | |
| 218 | Add IP Address 223.7.7.7 ${test_subnet_mask} ${test_gateway} |
| 219 | Delete IP Address 223.7.7.7 |
| 220 | |
| 221 | Add First Octet Lowest IP And Verify |
| 222 | [Documentation] Add first octet lowest IP and verify. |
| 223 | [Tags] Add_First_Octet_Lowest_IP_And_Verify |
| 224 | |
| 225 | Add IP Address 1.7.7.7 ${test_subnet_mask} ${test_gateway} |
| 226 | Delete IP Address 1.7.7.7 |
| 227 | |
Prashanth Katti | 040c8c1 | 2019-05-31 04:42:05 -0500 | [diff] [blame] | 228 | Configure Invalid Netmask |
| 229 | [Documentation] Verify error while setting invalid netmask. |
| 230 | [Tags] Configure_Invalid_Netmask |
| 231 | [Template] Add IP Address |
| 232 | |
| 233 | # ip subnet_mask gateway valid_status_codes |
| 234 | ${test_ipv4_addr} ${invalid_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 235 | |
| 236 | Configure Out Of Range Netmask |
| 237 | [Documentation] Verify error while setting out of range netmask. |
| 238 | [Tags] Configure_Out_Of_Range_Netmask |
| 239 | [Template] Add IP Address |
| 240 | |
| 241 | # ip subnet_mask gateway valid_status_codes |
| 242 | ${test_ipv4_addr} ${out_of_range_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 243 | |
| 244 | Configure Alpha Netmask |
| 245 | [Documentation] Verify error while setting alpha netmask. |
| 246 | [Tags] Configure_Alpha_Netmask |
| 247 | [Template] Add IP Address |
| 248 | |
| 249 | # ip subnet_mask gateway valid_status_codes |
| 250 | ${test_ipv4_addr} ${alpha_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 251 | |
| 252 | Configure More Byte Netmask |
| 253 | [Documentation] Verify error while setting more byte netmask. |
| 254 | [Tags] Configure_More_Byte_Netmask |
| 255 | [Template] Add IP Address |
| 256 | |
| 257 | # ip subnet_mask gateway valid_status_codes |
| 258 | ${test_ipv4_addr} ${more_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 259 | |
| 260 | Configure Less Byte Netmask |
| 261 | [Documentation] Verify error while setting less byte netmask. |
| 262 | [Tags] Configure_Less_Byte_Netmask |
| 263 | [Template] Add IP Address |
| 264 | |
| 265 | # ip subnet_mask gateway valid_status_codes |
| 266 | ${test_ipv4_addr} ${less_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 267 | |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 268 | Configure Threshold Netmask And Verify |
| 269 | [Documentation] Configure threshold netmask and verify. |
| 270 | [Tags] Configure_Threshold_Netmask_And_verify |
| 271 | |
| 272 | Add IP Address ${test_ipv4_addr} ${threshold_netmask} ${test_gateway} |
| 273 | Delete IP Address ${test_ipv4_addr} |
| 274 | |
| 275 | Configure Lowest Netmask And Verify |
| 276 | [Documentation] Configure lowest netmask and verify. |
| 277 | [Tags] Configure_Lowest_Netmask_And_verify |
| 278 | |
| 279 | Add IP Address ${test_ipv4_addr} ${lowest_netmask} ${test_gateway} |
| 280 | Delete IP Address ${test_ipv4_addr} |
| 281 | |
| 282 | Configure Network ID |
| 283 | [Documentation] Verify error while configuring network ID. |
| 284 | [Tags] Configure_Network_ID |
| 285 | [Template] Add IP Address |
| 286 | [Teardown] Clear IP Settings On Fail ${network_id} |
| 287 | |
| 288 | # ip subnet_mask gateway valid_status_codes |
| 289 | ${network_id} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 290 | |
| 291 | Configure Less Octet IP |
| 292 | [Documentation] Verify error while Configuring less octet IP address. |
| 293 | [Tags] Configure_Less_Octet_IP |
| 294 | [Template] Add IP Address |
| 295 | |
| 296 | # ip subnet_mask gateway valid_status_codes |
| 297 | ${less_octet_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 298 | |
| 299 | Configure Empty IP |
| 300 | [Documentation] Verify error while Configuring empty IP address. |
| 301 | [Tags] Configure_Empty_IP |
| 302 | [Template] Add IP Address |
| 303 | |
| 304 | # ip subnet_mask gateway valid_status_codes |
| 305 | ${EMPTY} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 306 | |
| 307 | Configure Special Char IP |
| 308 | [Documentation] Configure invalid IP address containing special chars. |
| 309 | [Tags] Configure_Special_Char_IP |
| 310 | [Template] Add IP Address |
| 311 | |
| 312 | # ip subnet_mask gateway valid_status_codes |
| 313 | @@@.%%.44.11 ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 314 | |
| 315 | Configure Hexadecimal IP |
| 316 | [Documentation] Configure invalid IP address containing hex value. |
| 317 | [Tags] Configure_Hexadecimal_IP |
| 318 | [Template] Add IP Address |
| 319 | |
| 320 | # ip subnet_mask gateway valid_status_codes |
| 321 | ${hex_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 322 | |
| 323 | Configure Negative Octet IP |
| 324 | [Documentation] Configure invalid IP address containing negative octet. |
| 325 | [Tags] Configure_Negative_Octet_IP |
| 326 | [Template] Add IP Address |
| 327 | |
| 328 | # ip subnet_mask gateway valid_status_codes |
| 329 | ${negative_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 330 | |
Prashanth Katti | 5cad5a0 | 2019-06-20 07:27:10 -0500 | [diff] [blame] | 331 | Configure Incomplete IP For Gateway |
| 332 | [Documentation] Configure incomplete IP for gateway and expect an error. |
| 333 | [Tags] Configure_Incomplete_IP_For_Gateway |
| 334 | [Template] Add IP Address |
| 335 | |
| 336 | # ip subnet_mask gateway valid_status_codes |
| 337 | ${test_ipv4_addr} ${test_subnet_mask} ${less_octet_ip} ${HTTP_BAD_REQUEST} |
| 338 | |
| 339 | Configure Special Char IP For Gateway |
| 340 | [Documentation] Configure special char IP for gateway and expect an error. |
| 341 | [Tags] Configure_Special_Char_IP_For_Gateway |
| 342 | [Template] Add IP Address |
| 343 | |
| 344 | # ip subnet_mask gateway valid_status_codes |
| 345 | ${test_ipv4_addr} ${test_subnet_mask} @@@.%%.44.11 ${HTTP_BAD_REQUEST} |
| 346 | |
| 347 | Configure Hexadecimal IP For Gateway |
| 348 | [Documentation] Configure hexadecimal IP for gateway and expect an error. |
| 349 | [Tags] Configure_Hexadecimal_IP_For_Gateway |
| 350 | [Template] Add IP Address |
| 351 | |
| 352 | # ip subnet_mask gateway valid_status_codes |
| 353 | ${test_ipv4_addr} ${test_subnet_mask} ${hex_ip} ${HTTP_BAD_REQUEST} |
| 354 | |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 355 | Get DNS Server And Verify |
| 356 | [Documentation] Get DNS server via Redfish and verify. |
| 357 | [Tags] Get_DNS_Server_And_Verify |
| 358 | |
| 359 | Verify CLI and Redfish Nameservers |
| 360 | |
| 361 | Configure DNS Server And Verify |
| 362 | [Documentation] Configure DNS server and verify. |
| 363 | [Tags] Configure_DNS_Server_And_Verify |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 364 | [Setup] DNS Test Setup Execution |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 365 | [Teardown] Run Keywords |
| 366 | ... Configure Static Name Servers AND Test Teardown Execution |
| 367 | |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 368 | Configure Static Name Servers ${static_name_servers} |
| 369 | Verify CLI and Redfish Nameservers |
| 370 | |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 371 | Delete DNS Server And Verify |
| 372 | [Documentation] Delete DNS server and verify. |
| 373 | [Tags] Delete_DNS_Server_And_Verify |
| 374 | [Setup] DNS Test Setup Execution |
| 375 | [Teardown] Run Keywords |
| 376 | ... Configure Static Name Servers AND Test Teardown Execution |
| 377 | |
| 378 | Delete Static Name Servers |
| 379 | Verify CLI and Redfish Nameservers |
| 380 | |
| 381 | Configure DNS Server And Check Persistency |
| 382 | [Documentation] Configure DNS server and check persistency on reboot. |
| 383 | [Tags] Configure_DNS_Server_And_Check_Persistency |
| 384 | [Setup] DNS Test Setup Execution |
| 385 | [Teardown] Run Keywords |
| 386 | ... Configure Static Name Servers AND Test Teardown Execution |
| 387 | |
| 388 | Configure Static Name Servers ${static_name_servers} |
| 389 | # Reboot BMC and verify persistency. |
| 390 | OBMC Reboot (off) |
| 391 | Verify CLI and Redfish Nameservers |
| 392 | |
| 393 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 394 | *** Keywords *** |
| 395 | |
| 396 | Test Setup Execution |
| 397 | [Documentation] Test setup execution. |
| 398 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 399 | Redfish.Login |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 400 | |
| 401 | @{network_configurations}= Get Network Configuration |
| 402 | Set Test Variable @{network_configurations} |
| 403 | |
| 404 | # Get BMC IP address and prefix length. |
| 405 | ${ip_data}= Get BMC IP Info |
| 406 | Set Test Variable ${ip_data} |
| 407 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 408 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 409 | Get Network Configuration |
| 410 | [Documentation] Get network configuration. |
| 411 | |
| 412 | # Sample output: |
| 413 | #{ |
| 414 | # "@odata.context": "/redfish/v1/$metadata#EthernetInterface.EthernetInterface", |
| 415 | # "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0", |
| 416 | # "@odata.type": "#EthernetInterface.v1_2_0.EthernetInterface", |
| 417 | # "Description": "Management Network Interface", |
| 418 | # "IPv4Addresses": [ |
| 419 | # { |
| 420 | # "Address": "169.254.xx.xx", |
| 421 | # "AddressOrigin": "IPv4LinkLocal", |
| 422 | # "Gateway": "0.0.0.0", |
| 423 | # "SubnetMask": "255.255.0.0" |
| 424 | # }, |
| 425 | # { |
| 426 | # "Address": "xx.xx.xx.xx", |
| 427 | # "AddressOrigin": "Static", |
| 428 | # "Gateway": "xx.xx.xx.1", |
| 429 | # "SubnetMask": "xx.xx.xx.xx" |
| 430 | # } |
| 431 | # ], |
| 432 | # "Id": "eth0", |
| 433 | # "MACAddress": "xx:xx:xx:xx:xx:xx", |
| 434 | # "Name": "Manager Ethernet Interface", |
| 435 | # "SpeedMbps": 0, |
| 436 | # "VLAN": { |
| 437 | # "VLANEnable": false, |
| 438 | # "VLANId": 0 |
| 439 | # } |
| 440 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 441 | ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI} |
Prashanth Katti | ff54bff | 2019-07-09 05:50:17 -0500 | [diff] [blame] | 442 | @{network_configurations}= Get From Dictionary ${resp.dict} IPv4StaticAddresses |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 443 | [Return] @{network_configurations} |
| 444 | |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 445 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 446 | Verify IP On BMC |
| 447 | [Documentation] Verify IP on BMC. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 448 | [Arguments] ${ip} |
| 449 | |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 450 | # Description of argument(s): |
| 451 | # ip IP address to be verified (e.g. "10.7.7.7"). |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 452 | |
| 453 | # Get IP address details on BMC using IP command. |
| 454 | @{ip_data}= Get BMC IP Info |
| 455 | Should Contain Match ${ip_data} ${ip}/* |
| 456 | ... msg=IP address does not exist. |
| 457 | |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 458 | Add IP Address |
| 459 | [Documentation] Add IP Address To BMC. |
| 460 | [Arguments] ${ip} ${subnet_mask} ${gateway} |
| 461 | ... ${valid_status_codes}=${HTTP_OK} |
| 462 | |
| 463 | # Description of argument(s): |
| 464 | # ip IP address to be added (e.g. "10.7.7.7"). |
| 465 | # subnet_mask Subnet mask for the IP to be added |
| 466 | # (e.g. "255.255.0.0"). |
| 467 | # gateway Gateway for the IP to be added (e.g. "10.7.7.1"). |
| 468 | # valid_status_codes Expected return code from patch operation |
| 469 | # (e.g. "200"). See prolog of rest_request |
| 470 | # method in redfish_plut.py for details. |
| 471 | |
| 472 | ${empty_dict}= Create Dictionary |
| 473 | ${ip_data}= Create Dictionary Address=${ip} |
Prashanth Katti | ff54bff | 2019-07-09 05:50:17 -0500 | [diff] [blame] | 474 | ... SubnetMask=${subnet_mask} Gateway=${gateway} |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 475 | |
| 476 | ${patch_list}= Create List |
| 477 | ${network_configurations}= Get Network Configuration |
| 478 | ${num_entries}= Get Length ${network_configurations} |
| 479 | |
| 480 | : FOR ${INDEX} IN RANGE 0 ${num_entries} |
| 481 | \ Append To List ${patch_list} ${empty_dict} |
| 482 | |
George Keishing | 98ffa86 | 2019-05-23 10:07:45 -0500 | [diff] [blame] | 483 | # We need not check for existence of IP on BMC while adding. |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 484 | Append To List ${patch_list} ${ip_data} |
Prashanth Katti | ff54bff | 2019-07-09 05:50:17 -0500 | [diff] [blame] | 485 | ${data}= Create Dictionary IPv4StaticAddresses=${patch_list} |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 486 | |
| 487 | Redfish.patch ${REDFISH_NW_ETH0_URI} body=&{data} |
| 488 | ... valid_status_codes=[${valid_status_codes}] |
| 489 | |
| 490 | Return From Keyword If '${valid_status_codes}' != '${HTTP_OK}' |
| 491 | |
| 492 | # Note: Network restart takes around 15-18s after patch request processing. |
| 493 | Sleep ${NETWORK_TIMEOUT}s |
| 494 | Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} |
| 495 | |
| 496 | Verify IP On BMC ${ip} |
| 497 | Validate Network Config On BMC |
| 498 | |
| 499 | |
| 500 | Delete IP Address |
| 501 | [Documentation] Delete IP Address Of BMC. |
| 502 | [Arguments] ${ip} ${valid_status_codes}=${HTTP_OK} |
| 503 | |
| 504 | # Description of argument(s): |
| 505 | # ip IP address to be deleted (e.g. "10.7.7.7"). |
| 506 | # valid_status_codes Expected return code from patch operation |
| 507 | # (e.g. "200"). See prolog of rest_request |
| 508 | # method in redfish_plut.py for details. |
| 509 | |
| 510 | ${empty_dict}= Create Dictionary |
| 511 | ${patch_list}= Create List |
| 512 | |
| 513 | @{network_configurations}= Get Network Configuration |
| 514 | : FOR ${network_configuration} IN @{network_configurations} |
| 515 | \ Run Keyword If '${network_configuration['Address']}' == '${ip}' |
| 516 | ... Append To List ${patch_list} ${null} |
| 517 | ... ELSE Append To List ${patch_list} ${empty_dict} |
| 518 | |
| 519 | ${ip_found}= Run Keyword And Return Status List Should Contain Value |
| 520 | ... ${patch_list} ${null} msg=${ip} does not exist on BMC |
| 521 | Pass Execution If ${ip_found} == ${False} ${ip} does not exist on BMC |
| 522 | |
| 523 | # Run patch command only if given IP is found on BMC |
Prashanth Katti | ff54bff | 2019-07-09 05:50:17 -0500 | [diff] [blame] | 524 | ${data}= Create Dictionary IPv4StaticAddresses=${patch_list} |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 525 | |
| 526 | Redfish.patch ${REDFISH_NW_ETH0_URI} body=&{data} |
| 527 | ... valid_status_codes=[${valid_status_codes}] |
| 528 | |
| 529 | # Note: Network restart takes around 15-18s after patch request processing |
| 530 | Sleep ${NETWORK_TIMEOUT}s |
| 531 | Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} |
| 532 | |
| 533 | ${delete_status}= Run Keyword And Return Status Verify IP On BMC ${ip} |
| 534 | Run Keyword If '${valid_status_codes}' == '${HTTP_OK}' |
| 535 | ... Should Be True ${delete_status} == ${False} |
| 536 | ... ELSE Should Be True ${delete_status} == ${True} |
| 537 | |
| 538 | Validate Network Config On BMC |
| 539 | |
| 540 | |
| 541 | Validate Network Config On BMC |
| 542 | [Documentation] Check that network info obtained via redfish matches info |
| 543 | ... obtained via CLI. |
| 544 | |
| 545 | @{network_configurations}= Get Network Configuration |
| 546 | ${ip_data}= Get BMC IP Info |
| 547 | : FOR ${network_configuration} IN @{network_configurations} |
| 548 | \ Should Contain Match ${ip_data} ${network_configuration['Address']}/* |
| 549 | ... msg=IP address does not exist. |
| 550 | |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 551 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 552 | Verify Netmask On BMC |
| 553 | [Documentation] Verify netmask on BMC. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 554 | [Arguments] ${netmask} |
| 555 | |
| 556 | # Description of the argument(s): |
| 557 | # netmask netmask value to be verified. |
| 558 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 559 | ${prefix_length}= Netmask Prefix Length ${netmask} |
| 560 | |
| 561 | Should Contain Match ${ip_data} */${prefix_length} |
| 562 | ... msg=Prefix length does not exist. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 563 | |
Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 564 | Verify Gateway On BMC |
| 565 | [Documentation] Verify gateway on BMC. |
| 566 | [Arguments] ${gateway_ip}=0.0.0.0 |
| 567 | |
| 568 | # Description of argument(s): |
| 569 | # gateway_ip Gateway IP address. |
| 570 | |
| 571 | ${route_info}= Get BMC Route Info |
| 572 | |
| 573 | # If gateway IP is empty or 0.0.0.0 it will not have route entry. |
| 574 | |
| 575 | Run Keyword If '${gateway_ip}' == '0.0.0.0' |
| 576 | ... Pass Execution Gateway IP is "0.0.0.0". |
| 577 | ... ELSE |
| 578 | ... Should Contain ${route_info} ${gateway_ip} |
| 579 | ... msg=Gateway IP address not matching. |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 580 | |
Prashanth Katti | 2c5c3bb | 2019-02-14 04:23:07 -0600 | [diff] [blame] | 581 | Verify IP And Netmask On BMC |
| 582 | [Documentation] Verify IP and netmask on BMC. |
| 583 | [Arguments] ${ip} ${netmask} |
| 584 | |
| 585 | # Description of the argument(s): |
| 586 | # ip IP address to be verified. |
| 587 | # netmask netmask value to be verified. |
| 588 | |
| 589 | ${prefix_length}= Netmask Prefix Length ${netmask} |
| 590 | @{ip_data}= Get BMC IP Info |
| 591 | |
| 592 | ${ip_with_netmask}= Catenate ${ip}/${prefix_length} |
| 593 | Should Contain ${ip_data} ${ip_with_netmask} |
| 594 | ... msg=IP and netmask pair does not exist. |
| 595 | |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 596 | Validate Hostname On BMC |
| 597 | [Documentation] Verify that the hostname read via Redfish is the same as the |
| 598 | ... hostname configured on system. |
| 599 | [Arguments] ${hostname} |
| 600 | |
| 601 | # Description of argument(s): |
| 602 | # hostname A hostname value which is to be compared to the hostname |
| 603 | # configured on system. |
| 604 | |
| 605 | ${sys_hostname}= Get BMC Hostname |
Prashanth Katti | 466d834 | 2019-03-21 08:58:50 -0500 | [diff] [blame] | 606 | Should Be Equal ${sys_hostname} ${hostname} |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 607 | ... ignore_case=True msg=Hostname does not exist. |
| 608 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 609 | Test Teardown Execution |
| 610 | [Documentation] Test teardown execution. |
| 611 | |
| 612 | FFDC On Test Case Fail |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 613 | Redfish.Logout |
Prashanth Katti | a844251 | 2019-06-07 06:47:09 -0500 | [diff] [blame] | 614 | |
| 615 | Clear IP Settings On Fail |
| 616 | [Documentation] Clear IP settings on fail. |
| 617 | [Arguments] ${ip} |
| 618 | |
| 619 | # Description of argument(s): |
| 620 | # ip IP address to be deleted. |
| 621 | |
| 622 | Run Keyword If '${TEST STATUS}' == 'FAIL' |
| 623 | ... Delete IP Address ${ip} |
| 624 | |
| 625 | Test Teardown Execution |
Prashanth Katti | adf0b4e | 2019-06-10 04:20:30 -0500 | [diff] [blame] | 626 | |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 627 | Verify CLI and Redfish Nameservers |
| 628 | [Documentation] Verify that nameservers obtained via Redfish do not |
| 629 | ... match those found in /etc/resolv.conf. |
| 630 | |
| 631 | ${redfish_nameservers}= Redfish.Get Attribute ${REDFISH_NW_ETH0_URI} StaticNameServers |
| 632 | ${resolve_conf_nameservers}= CLI Get Nameservers |
Michael Walsh | 39c0051 | 2019-07-17 10:54:06 -0500 | [diff] [blame] | 633 | Rqprint Vars redfish_nameservers resolve_conf_nameservers |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 634 | |
| 635 | # Check that the 2 lists are equivalent. |
| 636 | ${match}= Evaluate set($redfish_nameservers) == set($resolve_conf_nameservers) |
| 637 | Should Be True ${match} |
| 638 | ... The nameservers obtained via Redfish do not match those found in /etc/resolv.conf. |
| 639 | |
| 640 | CLI Get Nameservers |
| 641 | [Documentation] Get the nameserver IPs from /etc/resolv.conf and return as a list. |
| 642 | |
| 643 | # Example of /etc/resolv.conf data: |
| 644 | # nameserver x.x.x.x |
| 645 | # nameserver y.y.y.y |
| 646 | |
| 647 | ${stdout} ${stderr} ${rc}= BMC Execute Command egrep nameserver /etc/resolv.conf | cut -f2- -d ' ' |
| 648 | ${nameservers}= Split String ${stdout} |
| 649 | |
| 650 | [Return] ${nameservers} |
| 651 | |
| 652 | |
| 653 | Configure Static Name Servers |
| 654 | [Documentation] Configure DNS server on BMC. |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 655 | [Arguments] ${static_name_servers}=${original_nameservers} |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 656 | |
George Keishing | 9cb2e59 | 2019-07-12 09:37:33 -0500 | [diff] [blame] | 657 | # Description of the argument(s): |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 658 | # static_name_servers A list of static name server IPs to be |
| 659 | # configured on the BMC. |
| 660 | |
| 661 | Redfish.Patch ${REDFISH_NW_ETH0_URI} body={'StaticNameServers': ${static_name_servers}} |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 662 | |
| 663 | Delete Static Name Servers |
| 664 | [Documentation] Delete static name servers. |
| 665 | |
| 666 | Configure Static Name Servers @{EMPTY} |
| 667 | |
| 668 | # Check if all name servers deleted on BMC. |
| 669 | ${nameservers}= CLI Get Nameservers |
| 670 | Should Be Empty ${nameservers} |
| 671 | |
| 672 | DNS Test Setup Execution |
| 673 | [Documentation] Do DNS test setup execution. |
| 674 | |
| 675 | Redfish.Login |
| 676 | |
| 677 | ${original_nameservers}= Redfish.Get Attribute ${REDFISH_NW_ETH0_URI} StaticNameServers |
| 678 | Rprint Vars original_nameservers |
| 679 | # Set suite variables to trigger restoration during teardown. |
| 680 | Set Suite Variable ${original_nameservers} |