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 | 040c8c1 | 2019-05-31 04:42:05 -0500 | [diff] [blame] | 50 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 51 | *** Test Cases *** |
| 52 | |
| 53 | Get IP Address And Verify |
| 54 | [Documentation] Get IP Address And Verify. |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 55 | [Tags] Get_IP_Address_And_Verify |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 56 | |
| 57 | : FOR ${network_configuration} IN @{network_configurations} |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 58 | \ Verify IP On BMC ${network_configuration['Address']} |
| 59 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 60 | Get Netmask And Verify |
| 61 | [Documentation] Get Netmask And Verify. |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 62 | [Tags] Get_Netmask_And_Verify |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 63 | |
| 64 | : FOR ${network_configuration} IN @{network_configurations} |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 65 | \ Verify Netmask On BMC ${network_configuration['SubnetMask']} |
| 66 | |
Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 67 | Get Gateway And Verify |
| 68 | [Documentation] Get gateway and verify it's existence on the BMC. |
| 69 | [Tags] Get_Gateway_And_Verify |
| 70 | |
| 71 | : FOR ${network_configuration} IN @{network_configurations} |
| 72 | \ Verify Gateway On BMC ${network_configuration['Gateway']} |
| 73 | |
| 74 | Get MAC Address And Verify |
| 75 | [Documentation] Get MAC address and verify it's existence on the BMC. |
| 76 | [Tags] Get_MAC_Address_And_Verify |
| 77 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 78 | ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI} |
Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 79 | ${macaddr}= Get From Dictionary ${resp.dict} MACAddress |
| 80 | Validate MAC On BMC ${macaddr} |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 81 | |
Prashanth Katti | 2c5c3bb | 2019-02-14 04:23:07 -0600 | [diff] [blame] | 82 | Verify All Configured IP And Netmask |
| 83 | [Documentation] Verify all configured IP and netmask on BMC. |
| 84 | [Tags] Verify_All_Configured_IP_And_Netmask |
| 85 | |
| 86 | : FOR ${network_configuration} IN @{network_configurations} |
| 87 | \ Verify IP And Netmask On BMC ${network_configuration['Address']} |
| 88 | ... ${network_configuration['SubnetMask']} |
| 89 | |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 90 | Get Hostname And Verify |
| 91 | [Documentation] Get hostname via Redfish and verify. |
| 92 | [Tags] Get_Hostname_And_Verify |
| 93 | |
| 94 | ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName |
| 95 | |
| 96 | Validate Hostname On BMC ${hostname} |
| 97 | |
| 98 | Configure Hostname And Verify |
| 99 | [Documentation] Configure hostname via Redfish and verify. |
| 100 | [Tags] Configure_Hostname_And_Verify |
| 101 | |
Prashanth Katti | adf0b4e | 2019-06-10 04:20:30 -0500 | [diff] [blame] | 102 | ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 103 | |
Prashanth Katti | adf0b4e | 2019-06-10 04:20:30 -0500 | [diff] [blame] | 104 | Configure Hostname ${test_hostname} |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 105 | Validate Hostname On BMC ${test_hostname} |
| 106 | |
Prashanth Katti | adf0b4e | 2019-06-10 04:20:30 -0500 | [diff] [blame] | 107 | # Revert back to initial hostname. |
| 108 | Configure Hostname ${hostname} |
| 109 | Validate Hostname On BMC ${hostname} |
| 110 | |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 111 | Add Valid IPv4 Address And Verify |
| 112 | [Documentation] Add IPv4 Address via Redfish and verify. |
| 113 | [Tags] Add_Valid_IPv4_Addres_And_Verify |
| 114 | |
| 115 | Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} |
| 116 | Delete IP Address ${test_ipv4_addr} |
| 117 | |
| 118 | Add Invalid IPv4 Address And Verify |
| 119 | [Documentation] Add Invalid IPv4 Address via Redfish and verify. |
| 120 | [Tags] Add_Invalid_IPv4_Addres_And_Verify |
| 121 | |
| 122 | Add IP Address ${test_ipv4_invalid_addr} ${test_subnet_mask} |
| 123 | ... ${test_gateway} valid_status_codes=${HTTP_BAD_REQUEST} |
| 124 | |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 125 | Configure Out Of Range IP |
| 126 | [Documentation] Configure out-of-range IP address. |
| 127 | [Tags] Configure_Out_Of_Range_IP |
| 128 | [Template] Add IP Address |
| 129 | |
| 130 | # ip subnet_mask gateway valid_status_codes |
| 131 | ${out_of_range_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 132 | |
| 133 | Configure Broadcast IP |
| 134 | [Documentation] Configure broadcast IP address. |
| 135 | [Tags] Configure_Broadcast_IP |
| 136 | [Template] Add IP Address |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 137 | [Teardown] Clear IP Settings On Fail ${broadcast_ip} |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 138 | |
| 139 | # ip subnet_mask gateway valid_status_codes |
| 140 | ${broadcast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 141 | |
| 142 | Configure Multicast IP |
| 143 | [Documentation] Configure multicast IP address. |
| 144 | [Tags] Configure_Multicast_IP |
| 145 | [Template] Add IP Address |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 146 | [Teardown] Clear IP Settings On Fail ${multicast_ip} |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 147 | |
| 148 | # ip subnet_mask gateway valid_status_codes |
| 149 | ${multicast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 150 | |
| 151 | Configure Loopback IP |
| 152 | [Documentation] Configure loopback IP address. |
| 153 | [Tags] Configure_Loopback_IP |
| 154 | [Template] Add IP Address |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 155 | [Teardown] Clear IP Settings On Fail ${loopback_ip} |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 156 | |
| 157 | # ip subnet_mask gateway valid_status_codes |
| 158 | ${loopback_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 159 | |
| 160 | Add Valid IPv4 Address And Check Persistency |
| 161 | [Documentation] Add IPv4 address and check peristency. |
| 162 | [Tags] Add_Valid_IPv4_Addres_And_Check_Persistency |
| 163 | |
| 164 | Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} |
| 165 | |
| 166 | # Reboot BMC and verify persistency. |
| 167 | OBMC Reboot (off) |
| 168 | Verify IP On BMC ${test_ipv4_addr} |
| 169 | Delete IP Address ${test_ipv4_addr} |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 170 | |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 171 | Add Fourth Octet Threshold IP And Verify |
| 172 | [Documentation] Add fourth octet threshold IP and verify. |
| 173 | [Tags] Add_Fourth_Octet_Threshold_IP_And_Verify |
| 174 | |
| 175 | Add IP Address 10.7.7.254 ${test_subnet_mask} ${test_gateway} |
| 176 | Delete IP Address 10.7.7.254 |
| 177 | |
| 178 | Add Fourth Octet Lowest IP And Verify |
| 179 | [Documentation] Add fourth octet lowest IP and verify. |
| 180 | [Tags] Add_Fourth_Octet_Lowest_IP_And_Verify |
| 181 | |
| 182 | Add IP Address 10.7.7.1 ${test_subnet_mask} ${test_gateway} |
| 183 | Delete IP Address 10.7.7.1 |
| 184 | |
| 185 | Add Third Octet Threshold IP And Verify |
| 186 | [Documentation] Add third octet threshold IP and verify. |
| 187 | [Tags] Add_Third_Octet_Threshold_IP_And_Verify |
| 188 | |
| 189 | Add IP Address 10.7.255.7 ${test_subnet_mask} ${test_gateway} |
| 190 | Delete IP Address 10.7.255.7 |
| 191 | |
| 192 | Add Third Octet Lowest IP And Verify |
| 193 | [Documentation] Add third octet lowest IP and verify. |
| 194 | [Tags] Add_Third_Octet_Lowest_IP_And_Verify |
| 195 | |
| 196 | Add IP Address 10.7.0.7 ${test_subnet_mask} ${test_gateway} |
| 197 | Delete IP Address 10.7.0.7 |
| 198 | |
| 199 | Add Second Octet Threshold IP And Verify |
| 200 | [Documentation] Add second octet threshold IP and verify. |
| 201 | [Tags] Add_Second_Octet_Threshold_IP_And_Verify |
| 202 | |
| 203 | Add IP Address 10.255.7.7 ${test_subnet_mask} ${test_gateway} |
| 204 | Delete IP Address 10.255.7.7 |
| 205 | |
| 206 | Add Second Octet Lowest IP And Verify |
| 207 | [Documentation] Add second octet lowest IP and verify. |
| 208 | [Tags] Add_Second_Octet_Lowest_IP_And_Verify |
| 209 | |
| 210 | Add IP Address 10.0.7.7 ${test_subnet_mask} ${test_gateway} |
| 211 | Delete IP Address 10.0.7.7 |
| 212 | |
| 213 | Add First Octet Threshold IP And Verify |
| 214 | [Documentation] Add first octet threshold IP and verify. |
| 215 | [Tags] Add_First_Octet_Threshold_IP_And_Verify |
| 216 | |
| 217 | Add IP Address 223.7.7.7 ${test_subnet_mask} ${test_gateway} |
| 218 | Delete IP Address 223.7.7.7 |
| 219 | |
| 220 | Add First Octet Lowest IP And Verify |
| 221 | [Documentation] Add first octet lowest IP and verify. |
| 222 | [Tags] Add_First_Octet_Lowest_IP_And_Verify |
| 223 | |
| 224 | Add IP Address 1.7.7.7 ${test_subnet_mask} ${test_gateway} |
| 225 | Delete IP Address 1.7.7.7 |
| 226 | |
Prashanth Katti | 040c8c1 | 2019-05-31 04:42:05 -0500 | [diff] [blame] | 227 | Configure Invalid Netmask |
| 228 | [Documentation] Verify error while setting invalid netmask. |
| 229 | [Tags] Configure_Invalid_Netmask |
| 230 | [Template] Add IP Address |
| 231 | |
| 232 | # ip subnet_mask gateway valid_status_codes |
| 233 | ${test_ipv4_addr} ${invalid_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 234 | |
| 235 | Configure Out Of Range Netmask |
| 236 | [Documentation] Verify error while setting out of range netmask. |
| 237 | [Tags] Configure_Out_Of_Range_Netmask |
| 238 | [Template] Add IP Address |
| 239 | |
| 240 | # ip subnet_mask gateway valid_status_codes |
| 241 | ${test_ipv4_addr} ${out_of_range_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 242 | |
| 243 | Configure Alpha Netmask |
| 244 | [Documentation] Verify error while setting alpha netmask. |
| 245 | [Tags] Configure_Alpha_Netmask |
| 246 | [Template] Add IP Address |
| 247 | |
| 248 | # ip subnet_mask gateway valid_status_codes |
| 249 | ${test_ipv4_addr} ${alpha_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 250 | |
| 251 | Configure More Byte Netmask |
| 252 | [Documentation] Verify error while setting more byte netmask. |
| 253 | [Tags] Configure_More_Byte_Netmask |
| 254 | [Template] Add IP Address |
| 255 | |
| 256 | # ip subnet_mask gateway valid_status_codes |
| 257 | ${test_ipv4_addr} ${more_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 258 | |
| 259 | Configure Less Byte Netmask |
| 260 | [Documentation] Verify error while setting less byte netmask. |
| 261 | [Tags] Configure_Less_Byte_Netmask |
| 262 | [Template] Add IP Address |
| 263 | |
| 264 | # ip subnet_mask gateway valid_status_codes |
| 265 | ${test_ipv4_addr} ${less_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 266 | |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 267 | Configure Threshold Netmask And Verify |
| 268 | [Documentation] Configure threshold netmask and verify. |
| 269 | [Tags] Configure_Threshold_Netmask_And_verify |
| 270 | |
| 271 | Add IP Address ${test_ipv4_addr} ${threshold_netmask} ${test_gateway} |
| 272 | Delete IP Address ${test_ipv4_addr} |
| 273 | |
| 274 | Configure Lowest Netmask And Verify |
| 275 | [Documentation] Configure lowest netmask and verify. |
| 276 | [Tags] Configure_Lowest_Netmask_And_verify |
| 277 | |
| 278 | Add IP Address ${test_ipv4_addr} ${lowest_netmask} ${test_gateway} |
| 279 | Delete IP Address ${test_ipv4_addr} |
| 280 | |
| 281 | Configure Network ID |
| 282 | [Documentation] Verify error while configuring network ID. |
| 283 | [Tags] Configure_Network_ID |
| 284 | [Template] Add IP Address |
| 285 | [Teardown] Clear IP Settings On Fail ${network_id} |
| 286 | |
| 287 | # ip subnet_mask gateway valid_status_codes |
| 288 | ${network_id} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 289 | |
| 290 | Configure Less Octet IP |
| 291 | [Documentation] Verify error while Configuring less octet IP address. |
| 292 | [Tags] Configure_Less_Octet_IP |
| 293 | [Template] Add IP Address |
| 294 | |
| 295 | # ip subnet_mask gateway valid_status_codes |
| 296 | ${less_octet_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 297 | |
| 298 | Configure Empty IP |
| 299 | [Documentation] Verify error while Configuring empty IP address. |
| 300 | [Tags] Configure_Empty_IP |
| 301 | [Template] Add IP Address |
| 302 | |
| 303 | # ip subnet_mask gateway valid_status_codes |
| 304 | ${EMPTY} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 305 | |
| 306 | Configure Special Char IP |
| 307 | [Documentation] Configure invalid IP address containing special chars. |
| 308 | [Tags] Configure_Special_Char_IP |
| 309 | [Template] Add IP Address |
| 310 | |
| 311 | # ip subnet_mask gateway valid_status_codes |
| 312 | @@@.%%.44.11 ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 313 | |
| 314 | Configure Hexadecimal IP |
| 315 | [Documentation] Configure invalid IP address containing hex value. |
| 316 | [Tags] Configure_Hexadecimal_IP |
| 317 | [Template] Add IP Address |
| 318 | |
| 319 | # ip subnet_mask gateway valid_status_codes |
| 320 | ${hex_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 321 | |
| 322 | Configure Negative Octet IP |
| 323 | [Documentation] Configure invalid IP address containing negative octet. |
| 324 | [Tags] Configure_Negative_Octet_IP |
| 325 | [Template] Add IP Address |
| 326 | |
| 327 | # ip subnet_mask gateway valid_status_codes |
| 328 | ${negative_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 329 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 330 | *** Keywords *** |
| 331 | |
| 332 | Test Setup Execution |
| 333 | [Documentation] Test setup execution. |
| 334 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 335 | Redfish.Login |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 336 | |
| 337 | @{network_configurations}= Get Network Configuration |
| 338 | Set Test Variable @{network_configurations} |
| 339 | |
| 340 | # Get BMC IP address and prefix length. |
| 341 | ${ip_data}= Get BMC IP Info |
| 342 | Set Test Variable ${ip_data} |
| 343 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 344 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 345 | Get Network Configuration |
| 346 | [Documentation] Get network configuration. |
| 347 | |
| 348 | # Sample output: |
| 349 | #{ |
| 350 | # "@odata.context": "/redfish/v1/$metadata#EthernetInterface.EthernetInterface", |
| 351 | # "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0", |
| 352 | # "@odata.type": "#EthernetInterface.v1_2_0.EthernetInterface", |
| 353 | # "Description": "Management Network Interface", |
| 354 | # "IPv4Addresses": [ |
| 355 | # { |
| 356 | # "Address": "169.254.xx.xx", |
| 357 | # "AddressOrigin": "IPv4LinkLocal", |
| 358 | # "Gateway": "0.0.0.0", |
| 359 | # "SubnetMask": "255.255.0.0" |
| 360 | # }, |
| 361 | # { |
| 362 | # "Address": "xx.xx.xx.xx", |
| 363 | # "AddressOrigin": "Static", |
| 364 | # "Gateway": "xx.xx.xx.1", |
| 365 | # "SubnetMask": "xx.xx.xx.xx" |
| 366 | # } |
| 367 | # ], |
| 368 | # "Id": "eth0", |
| 369 | # "MACAddress": "xx:xx:xx:xx:xx:xx", |
| 370 | # "Name": "Manager Ethernet Interface", |
| 371 | # "SpeedMbps": 0, |
| 372 | # "VLAN": { |
| 373 | # "VLANEnable": false, |
| 374 | # "VLANId": 0 |
| 375 | # } |
| 376 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 377 | ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI} |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 378 | @{network_configurations}= Get From Dictionary ${resp.dict} IPv4Addresses |
| 379 | [Return] @{network_configurations} |
| 380 | |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 381 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 382 | Verify IP On BMC |
| 383 | [Documentation] Verify IP on BMC. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 384 | [Arguments] ${ip} |
| 385 | |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 386 | # Description of argument(s): |
| 387 | # ip IP address to be verified (e.g. "10.7.7.7"). |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 388 | |
| 389 | # Get IP address details on BMC using IP command. |
| 390 | @{ip_data}= Get BMC IP Info |
| 391 | Should Contain Match ${ip_data} ${ip}/* |
| 392 | ... msg=IP address does not exist. |
| 393 | |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 394 | Add IP Address |
| 395 | [Documentation] Add IP Address To BMC. |
| 396 | [Arguments] ${ip} ${subnet_mask} ${gateway} |
| 397 | ... ${valid_status_codes}=${HTTP_OK} |
| 398 | |
| 399 | # Description of argument(s): |
| 400 | # ip IP address to be added (e.g. "10.7.7.7"). |
| 401 | # subnet_mask Subnet mask for the IP to be added |
| 402 | # (e.g. "255.255.0.0"). |
| 403 | # gateway Gateway for the IP to be added (e.g. "10.7.7.1"). |
| 404 | # valid_status_codes Expected return code from patch operation |
| 405 | # (e.g. "200"). See prolog of rest_request |
| 406 | # method in redfish_plut.py for details. |
| 407 | |
| 408 | ${empty_dict}= Create Dictionary |
| 409 | ${ip_data}= Create Dictionary Address=${ip} |
| 410 | ... AddressOrigin=Static SubnetMask=${subnet_mask} |
| 411 | ... Gateway=${gateway} |
| 412 | |
| 413 | ${patch_list}= Create List |
| 414 | ${network_configurations}= Get Network Configuration |
| 415 | ${num_entries}= Get Length ${network_configurations} |
| 416 | |
| 417 | : FOR ${INDEX} IN RANGE 0 ${num_entries} |
| 418 | \ Append To List ${patch_list} ${empty_dict} |
| 419 | |
George Keishing | 98ffa86 | 2019-05-23 10:07:45 -0500 | [diff] [blame] | 420 | # We need not check for existence of IP on BMC while adding. |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 421 | Append To List ${patch_list} ${ip_data} |
| 422 | ${data}= Create Dictionary IPv4Addresses=${patch_list} |
| 423 | |
| 424 | Redfish.patch ${REDFISH_NW_ETH0_URI} body=&{data} |
| 425 | ... valid_status_codes=[${valid_status_codes}] |
| 426 | |
| 427 | Return From Keyword If '${valid_status_codes}' != '${HTTP_OK}' |
| 428 | |
| 429 | # Note: Network restart takes around 15-18s after patch request processing. |
| 430 | Sleep ${NETWORK_TIMEOUT}s |
| 431 | Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} |
| 432 | |
| 433 | Verify IP On BMC ${ip} |
| 434 | Validate Network Config On BMC |
| 435 | |
| 436 | |
| 437 | Delete IP Address |
| 438 | [Documentation] Delete IP Address Of BMC. |
| 439 | [Arguments] ${ip} ${valid_status_codes}=${HTTP_OK} |
| 440 | |
| 441 | # Description of argument(s): |
| 442 | # ip IP address to be deleted (e.g. "10.7.7.7"). |
| 443 | # valid_status_codes Expected return code from patch operation |
| 444 | # (e.g. "200"). See prolog of rest_request |
| 445 | # method in redfish_plut.py for details. |
| 446 | |
| 447 | ${empty_dict}= Create Dictionary |
| 448 | ${patch_list}= Create List |
| 449 | |
| 450 | @{network_configurations}= Get Network Configuration |
| 451 | : FOR ${network_configuration} IN @{network_configurations} |
| 452 | \ Run Keyword If '${network_configuration['Address']}' == '${ip}' |
| 453 | ... Append To List ${patch_list} ${null} |
| 454 | ... ELSE Append To List ${patch_list} ${empty_dict} |
| 455 | |
| 456 | ${ip_found}= Run Keyword And Return Status List Should Contain Value |
| 457 | ... ${patch_list} ${null} msg=${ip} does not exist on BMC |
| 458 | Pass Execution If ${ip_found} == ${False} ${ip} does not exist on BMC |
| 459 | |
| 460 | # Run patch command only if given IP is found on BMC |
| 461 | ${data}= Create Dictionary IPv4Addresses=${patch_list} |
| 462 | |
| 463 | Redfish.patch ${REDFISH_NW_ETH0_URI} body=&{data} |
| 464 | ... valid_status_codes=[${valid_status_codes}] |
| 465 | |
| 466 | # Note: Network restart takes around 15-18s after patch request processing |
| 467 | Sleep ${NETWORK_TIMEOUT}s |
| 468 | Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} |
| 469 | |
| 470 | ${delete_status}= Run Keyword And Return Status Verify IP On BMC ${ip} |
| 471 | Run Keyword If '${valid_status_codes}' == '${HTTP_OK}' |
| 472 | ... Should Be True ${delete_status} == ${False} |
| 473 | ... ELSE Should Be True ${delete_status} == ${True} |
| 474 | |
| 475 | Validate Network Config On BMC |
| 476 | |
| 477 | |
| 478 | Validate Network Config On BMC |
| 479 | [Documentation] Check that network info obtained via redfish matches info |
| 480 | ... obtained via CLI. |
| 481 | |
| 482 | @{network_configurations}= Get Network Configuration |
| 483 | ${ip_data}= Get BMC IP Info |
| 484 | : FOR ${network_configuration} IN @{network_configurations} |
| 485 | \ Should Contain Match ${ip_data} ${network_configuration['Address']}/* |
| 486 | ... msg=IP address does not exist. |
| 487 | |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 488 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 489 | Verify Netmask On BMC |
| 490 | [Documentation] Verify netmask on BMC. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 491 | [Arguments] ${netmask} |
| 492 | |
| 493 | # Description of the argument(s): |
| 494 | # netmask netmask value to be verified. |
| 495 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 496 | ${prefix_length}= Netmask Prefix Length ${netmask} |
| 497 | |
| 498 | Should Contain Match ${ip_data} */${prefix_length} |
| 499 | ... msg=Prefix length does not exist. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 500 | |
Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 501 | Verify Gateway On BMC |
| 502 | [Documentation] Verify gateway on BMC. |
| 503 | [Arguments] ${gateway_ip}=0.0.0.0 |
| 504 | |
| 505 | # Description of argument(s): |
| 506 | # gateway_ip Gateway IP address. |
| 507 | |
| 508 | ${route_info}= Get BMC Route Info |
| 509 | |
| 510 | # If gateway IP is empty or 0.0.0.0 it will not have route entry. |
| 511 | |
| 512 | Run Keyword If '${gateway_ip}' == '0.0.0.0' |
| 513 | ... Pass Execution Gateway IP is "0.0.0.0". |
| 514 | ... ELSE |
| 515 | ... Should Contain ${route_info} ${gateway_ip} |
| 516 | ... msg=Gateway IP address not matching. |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 517 | |
Prashanth Katti | 2c5c3bb | 2019-02-14 04:23:07 -0600 | [diff] [blame] | 518 | Verify IP And Netmask On BMC |
| 519 | [Documentation] Verify IP and netmask on BMC. |
| 520 | [Arguments] ${ip} ${netmask} |
| 521 | |
| 522 | # Description of the argument(s): |
| 523 | # ip IP address to be verified. |
| 524 | # netmask netmask value to be verified. |
| 525 | |
| 526 | ${prefix_length}= Netmask Prefix Length ${netmask} |
| 527 | @{ip_data}= Get BMC IP Info |
| 528 | |
| 529 | ${ip_with_netmask}= Catenate ${ip}/${prefix_length} |
| 530 | Should Contain ${ip_data} ${ip_with_netmask} |
| 531 | ... msg=IP and netmask pair does not exist. |
| 532 | |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 533 | Validate Hostname On BMC |
| 534 | [Documentation] Verify that the hostname read via Redfish is the same as the |
| 535 | ... hostname configured on system. |
| 536 | [Arguments] ${hostname} |
| 537 | |
| 538 | # Description of argument(s): |
| 539 | # hostname A hostname value which is to be compared to the hostname |
| 540 | # configured on system. |
| 541 | |
| 542 | ${sys_hostname}= Get BMC Hostname |
Prashanth Katti | 466d834 | 2019-03-21 08:58:50 -0500 | [diff] [blame] | 543 | Should Be Equal ${sys_hostname} ${hostname} |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 544 | ... ignore_case=True msg=Hostname does not exist. |
| 545 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 546 | Test Teardown Execution |
| 547 | [Documentation] Test teardown execution. |
| 548 | |
| 549 | FFDC On Test Case Fail |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 550 | Redfish.Logout |
Prashanth Katti | a844251 | 2019-06-07 06:47:09 -0500 | [diff] [blame] | 551 | |
| 552 | Clear IP Settings On Fail |
| 553 | [Documentation] Clear IP settings on fail. |
| 554 | [Arguments] ${ip} |
| 555 | |
| 556 | # Description of argument(s): |
| 557 | # ip IP address to be deleted. |
| 558 | |
| 559 | Run Keyword If '${TEST STATUS}' == 'FAIL' |
| 560 | ... Delete IP Address ${ip} |
| 561 | |
| 562 | Test Teardown Execution |
Prashanth Katti | adf0b4e | 2019-06-10 04:20:30 -0500 | [diff] [blame] | 563 | |