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