1*** Settings *** 2Documentation Network interface IPv6 configuration and verification 3 ... tests. 4 5Resource ../../lib/bmc_redfish_resource.robot 6Resource ../../lib/openbmc_ffdc.robot 7Resource ../../lib/bmc_ipv6_utils.robot 8Resource ../../lib/external_intf/vmi_utils.robot 9Library ../../lib/bmc_network_utils.py 10Library Collections 11 12Test Setup Test Setup Execution 13Test Teardown Test Teardown Execution 14Suite Setup Suite Setup Execution 15 16Test Tags BMC_IPv6 17 18*** Variables *** 19${test_ipv6_addr} 2001:db8:3333:4444:5555:6666:7777:8888 20${test_ipv6_invalid_addr} 2001:db8:3333:4444:5555:6666:7777:JJKK 21${test_ipv6_addr1} 2001:db8:3333:4444:5555:6666:7777:9999 22 23# Valid prefix length is a integer ranges from 1 to 128. 24${test_prefix_length} 64 25 26*** Test Cases *** 27 28Get IPv6 Address And Verify 29 [Documentation] Get IPv6 Address And Verify. 30 [Tags] Get_IPv6_Address_And_Verify 31 32 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 33 Verify IPv6 On BMC ${ipv6_network_configuration['Address']} 34 END 35 36 37Get PrefixLength And Verify 38 [Documentation] Get IPv6 prefix length and verify. 39 [Tags] Get_PrefixLength_And_Verify 40 41 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 42 Verify IPv6 On BMC ${ipv6_network_configuration['PrefixLength']} 43 END 44 45 46Get IPv6 Default Gateway And Verify 47 [Documentation] Get IPv6 default gateway and verify. 48 [Tags] Get_IPv6_Default_Gateway_And_Verify 49 50 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 51 ${ipv6_gateway}= Get From Dictionary ${resp.dict} IPv6DefaultGateway 52 Verify IPv6 Default Gateway On BMC ${ipv6_gateway} 53 54 55Verify All Configured IPv6 And PrefixLength On BMC 56 [Documentation] Verify IPv6 address and its prefix length on BMC. 57 [Tags] Verify_All_Configured_IPv6_And_PrefixLength_On_BMC 58 59 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 60 Verify IPv6 And PrefixLength ${ipv6_network_configuration['Address']} 61 ... ${ipv6_network_configuration['PrefixLength']} 62 END 63 64 65Configure IPv6 Address And Verify 66 [Documentation] Configure IPv6 address and verify. 67 [Tags] Configure_IPv6_Address_And_Verify 68 [Template] Configure IPv6 Address On BMC 69 70 71 # IPv6 address Prefix length 72 ${test_ipv6_addr} ${test_prefix_length} 73 74 75Delete IPv6 Address And Verify 76 [Documentation] Delete IPv6 address and verify. 77 [Tags] Delete_IPv6_Address_And_Verify 78 79 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 80 81 Delete IPv6 Address ${test_ipv6_addr} 82 83 84 85Modify IPv6 Address And Verify 86 [Documentation] Modify IPv6 address and verify. 87 [Tags] Modify_IPv6_Address_And_Verify 88 [Teardown] Run Keywords 89 ... Delete IPv6 Address ${test_ipv6_addr1} AND Test Teardown Execution 90 91 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 92 93 Modify IPv6 Address ${test_ipv6_addr} ${test_ipv6_addr1} ${test_prefix_length} 94 95 96Verify Persistency Of IPv6 After BMC Reboot 97 [Documentation] Verify persistency of IPv6 after BMC reboot. 98 [Tags] Verify_Persistency_Of_IPv6_After_BMC_Reboot 99 [Teardown] Run Keywords 100 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution 101 102 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 103 104 Redfish OBMC Reboot (off) stack_mode=skip 105 106 # Verifying persistency of IPv6. 107 Verify IPv6 On BMC ${test_ipv6_addr} 108 109 110Enable SLAACv6 On BMC And Verify 111 [Documentation] Enable SLAACv6 on BMC and verify. 112 [Tags] Enable_SLAACv6_On_BMC_And_Verify 113 114 Set SLAACv6 Configuration State And Verify ${True} 115 116 117*** Keywords *** 118 119Suite Setup Execution 120 [Documentation] Do suite setup execution. 121 122 ${active_channel_config}= Get Active Channel Config 123 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 124 125 Set Suite variable ${ethernet_interface} 126 127 128Test Setup Execution 129 [Documentation] Test setup execution. 130 131 Redfish.Login 132 133 @{ipv6_network_configurations}= Get IPv6 Network Configuration 134 Set Test Variable @{ipv6_network_configurations} 135 136 # Get BMC IPv6 address and prefix length. 137 ${ipv6_data}= Get BMC IPv6 Info 138 Set Test Variable ${ipv6_data} 139 140 141Test Teardown Execution 142 [Documentation] Test teardown execution. 143 144 FFDC On Test Case Fail 145 Redfish.Logout 146 147 148Get IPv6 Network Configuration 149 [Documentation] Get Ipv6 network configuration. 150 # Sample output: 151 # { 152 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0", 153 # "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface", 154 # "DHCPv4": { 155 # "DHCPEnabled": false, 156 # "UseDNSServers": false, 157 # "UseDomainName": true, 158 # "UseNTPServers": false 159 # }, 160 # "DHCPv6": { 161 # "OperatingMode": "Disabled", 162 # "UseDNSServers": false, 163 # "UseDomainName": true, 164 # "UseNTPServers": false 165 # }, 166 # "Description": "Management Network Interface", 167 # "FQDN": "localhost", 168 # "HostName": "localhost", 169 # "IPv4Addresses": [ 170 # { 171 # "Address": "xx.xx.xx.xx", 172 # "AddressOrigin": "Static", 173 # "Gateway": "xx.xx.xx.1", 174 # "SubnetMask": "xx.xx.xx.0" 175 # }, 176 # { 177 # "Address": "169.254.xx.xx", 178 # "AddressOrigin": "IPv4LinkLocal", 179 # "Gateway": "0.0.0.0", 180 # "SubnetMask": "xx.xx.0.0" 181 # }, 182 # ], 183 # "IPv4StaticAddresses": [ 184 # { 185 # "Address": "xx.xx.xx.xx", 186 # "AddressOrigin": "Static", 187 # "Gateway": "xx.xx.xx.1", 188 # "SubnetMask": "xx.xx.0.0" 189 # } 190 # } 191 # ], 192 # "IPv6AddressPolicyTable": [], 193 # "IPv6Addresses": [ 194 # { 195 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx", 196 # "AddressOrigin": "LinkLocal", 197 # "AddressState": null, 198 # "PrefixLength": xx 199 # } 200 # ], 201 # "IPv6DefaultGateway": "", 202 # "IPv6StaticAddresses": [ 203 # { "Address": "xxxx:xxxx:xxxx:xxxx::xxxx", 204 # "AddressOrigin": "Static", 205 # "AddressState": null, 206 # "PrefixLength": xxx 207 # } 208 # ], 209 # "Id": "eth0", 210 # "InterfaceEnabled": true, 211 # "LinkStatus": "LinkUp", 212 # "MACAddress": "xx:xx:xx:xx:xx:xx", 213 # "Name": "Manager Ethernet Interface", 214 # "NameServers": [], 215 # "SpeedMbps": 0, 216 # "StaticNameServers": [], 217 # "Status": { 218 # "Health": "OK", 219 # "HealthRollup": "OK", 220 # "State": "Enabled" 221 # }, 222 # "VLANs": { 223 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0/VLANs" 224 225 226 ${active_channel_config}= Get Active Channel Config 227 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} 228 229 @{ipv6_network_configurations}= Get From Dictionary ${resp.dict} IPv6StaticAddresses 230 RETURN @{ipv6_network_configurations} 231 232 233Verify IPv6 And PrefixLength 234 [Documentation] Verify IPv6 address and prefix length on BMC. 235 [Arguments] ${ipv6_addr} ${prefix_len} 236 237 # Description of the argument(s): 238 # ipv6_addr IPv6 address to be verified. 239 # prefix_len PrefixLength value to be verified. 240 241 # Catenate IPv6 address and its prefix length. 242 ${ipv6_with_prefix}= Catenate ${ipv6_addr}/${prefix_len} 243 244 # Get IPv6 address details on BMC using IP command. 245 @{ip_data}= Get BMC IPv6 Info 246 247 # Verify if IPv6 and prefix length is configured on BMC. 248 249 Should Contain ${ip_data} ${ipv6_with_prefix} 250 ... msg=IPv6 and prefix length pair does not exist. 251 252 253Configure IPv6 Address On BMC 254 [Documentation] Add IPv6 Address on BMC. 255 [Arguments] ${ipv6_addr} ${prefix_len} ${valid_status_codes}=${HTTP_OK} 256 257 # Description of argument(s): 258 # ipv6_addr IPv6 address to be added (e.g. "2001:EEEE:2222::2022"). 259 # prefix_len Prefix length for the IPv6 to be added 260 # (e.g. "64"). 261 # valid_status_codes Expected return code from patch operation 262 # (e.g. "200"). 263 264 ${prefix_length}= Convert To Integer ${prefix_len} 265 ${empty_dict}= Create Dictionary 266 ${ipv6_data}= Create Dictionary Address=${ipv6_addr} 267 ... PrefixLength=${prefix_length} 268 269 ${patch_list}= Create List 270 271 # Get existing static IPv6 configurations on BMC. 272 ${ipv6_network_configurations}= Get IPv6 Network Configuration 273 ${num_entries}= Get Length ${ipv6_network_configurations} 274 275 FOR ${INDEX} IN RANGE 0 ${num_entries} 276 Append To List ${patch_list} ${empty_dict} 277 END 278 279 ${valid_status_codes}= Run Keyword If '${valid_status_codes}' == '${HTTP_OK}' 280 ... Set Variable ${HTTP_OK},${HTTP_NO_CONTENT} 281 ... ELSE Set Variable ${valid_status_codes} 282 283 # We need not check for existence of IPv6 on BMC while adding. 284 Append To List ${patch_list} ${ipv6_data} 285 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 286 287 ${active_channel_config}= Get Active Channel Config 288 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 289 290 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 291 ... valid_status_codes=[${valid_status_codes}] 292 293 Return From Keyword If '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}' 294 295 # Note: Network restart takes around 15-18s after patch request processing. 296 Sleep ${NETWORK_TIMEOUT}s 297 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 298 299 Verify IPv6 And PrefixLength ${ipv6_addr} ${prefix_len} 300 301 # Verify if existing static IPv6 addresses still exist. 302 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 303 Verify IPv6 On BMC ${ipv6_network_configuration['Address']} 304 END 305 306 Validate IPv6 Network Config On BMC 307 308 309Validate IPv6 Network Config On BMC 310 [Documentation] Check that IPv6 network info obtained via redfish matches info 311 ... obtained via CLI. 312 @{ipv6_network_configurations}= Get IPv6 Network Configuration 313 ${ipv6_data}= Get BMC IPv6 Info 314 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 315 Should Contain Match ${ipv6_data} ${ipv6_network_configuration['Address']}/* 316 ... msg=IPv6 address does not exist. 317 END 318 319 320Delete IPv6 Address 321 [Documentation] Delete IPv6 address of BMC. 322 [Arguments] ${ipv6_addr} ${valid_status_codes}=${HTTP_OK} 323 324 # Description of argument(s): 325 # ipv6_addr IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234"). 326 # valid_status_codes Expected return code from patch operation 327 # (e.g. "200"). See prolog of rest_request 328 # method in redfish_plus.py for details. 329 330 ${empty_dict}= Create Dictionary 331 ${patch_list}= Create List 332 333 @{ipv6_network_configurations}= Get IPv6 Network Configuration 334 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 335 IF '${ipv6_network_configuration['Address']}' == '${ipv6_addr}' 336 Append To List ${patch_list} ${null} 337 ELSE 338 Append To List ${patch_list} ${empty_dict} 339 END 340 END 341 342 ${ip_found}= Run Keyword And Return Status List Should Contain Value 343 ... ${patch_list} ${null} msg=${ipv6_addr} does not exist on BMC 344 Pass Execution If ${ip_found} == ${False} ${ipv6_addr} does not exist on BMC 345 346 # Run patch command only if given IP is found on BMC 347 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 348 349 ${active_channel_config}= Get Active Channel Config 350 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 351 352 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 353 ... valid_status_codes=[${valid_status_codes}] 354 355 # Note: Network restart takes around 15-18s after patch request processing 356 Sleep ${NETWORK_TIMEOUT}s 357 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 358 359 # IPv6 address that is deleted should not be there on BMC. 360 ${delete_status}= Run Keyword And Return Status Verify IPv6 On BMC ${ipv6_addr} 361 IF '${valid_status_codes}' == '${HTTP_OK}' 362 Should Be True '${delete_status}' == '${False}' 363 ELSE 364 Should Be True '${delete_status}' == '${True}' 365 END 366 367 Validate IPv6 Network Config On BMC 368 369 370Modify IPv6 Address 371 [Documentation] Modify and verify IPv6 address of BMC. 372 [Arguments] ${ipv6} ${new_ipv6} ${prefix_len} 373 ... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 374 375 # Description of argument(s): 376 # ipv6 IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF"). 377 # new_ipv6 New IPv6 address to be configured. 378 # prefix_len Prefix length value (Range 1 to 128). 379 # valid_status_codes Expected return code from patch operation 380 # (e.g. "200", "201"). 381 382 ${empty_dict}= Create Dictionary 383 ${patch_list}= Create List 384 ${prefix_length}= Convert To Integer ${prefix_len} 385 ${ipv6_data}= Create Dictionary 386 ... Address=${new_ipv6} PrefixLength=${prefix_length} 387 388 # Sample IPv6 network configurations: 389 # "IPv6AddressPolicyTable": [], 390 # "IPv6Addresses": [ 391 # { 392 # "Address": "X002:db8:0:2::XX0", 393 # "AddressOrigin": "DHCPv6", 394 # "PrefixLength": 128 395 # }, 396 # { 397 # "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX", 398 # "AddressOrigin": "SLAAC", 399 # "PrefixLength": 64 400 # }, 401 # { 402 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000", 403 # "AddressOrigin": "Static", 404 # "PrefixLength": 56 405 # }, 406 # { 407 # "Address": “Z002:db8:0:2:a94:efff:fe82:5000", 408 # "AddressOrigin": "Static", 409 # "PrefixLength": 56 410 # }, 411 # { 412 # "Address": “Xe80::a94:efff:YYYY:XXXX", 413 # "AddressOrigin": "LinkLocal", 414 # "PrefixLength": 64 415 # }, 416 # { 417 # "Address": “X002:db8:1:2:eff:233:fee:546", 418 # "AddressOrigin": "Static", 419 # "PrefixLength": 56 420 # } 421 # ], 422 # "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”, 423 # "IPv6StaticAddresses": [ 424 # { 425 # "Address": “X002:db8:0:2:a94:efff:fe82:5000", 426 # "PrefixLength": 56 427 # }, 428 # { 429 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000", 430 # "PrefixLength": 56 431 # }, 432 # { 433 # "Address": “Z002:db8:1:2:eff:233:fee:546", 434 # "PrefixLength": 56 435 # } 436 # ], 437 # "IPv6StaticDefaultGateways": [], 438 439 # Find the position of IPv6 address to be modified. 440 @{ipv6_network_configurations}= Get IPv6 Network Configuration 441 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 442 Run Keyword If '${ipv6_network_configuration['Address']}' == '${ipv6}' 443 ... Append To List ${patch_list} ${ipv6_data} 444 ... ELSE Append To List ${patch_list} ${empty_dict} 445 END 446 447 # Modify the IPv6 address only if given IPv6 is found 448 ${ip_found}= Run Keyword And Return Status List Should Contain Value 449 ... ${patch_list} ${ipv6_data} msg=${ipv6} does not exist on BMC 450 Pass Execution If ${ip_found} == ${False} ${ipv6} does not exist on BMC 451 452 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 453 454 ${active_channel_config}= Get Active Channel Config 455 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 456 457 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 458 ... body=&{data} valid_status_codes=${valid_status_codes} 459 460 # Note: Network restart takes around 15-18s after patch request processing. 461 Sleep ${NETWORK_TIMEOUT}s 462 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 463 464 # Verify if new IPv6 address is configured on BMC. 465 Verify IPv6 On BMC ${new_ipv6} 466 467 # Verify if old IPv6 address is erased. 468 ${cmd_status}= Run Keyword And Return Status 469 ... Verify IPv6 On BMC ${ipv6} 470 Should Be Equal ${cmd_status} ${False} msg=Old IPv6 address is not deleted. 471 472 Validate IPv6 Network Config On BMC 473 474 475Set SLAACv6 Configuration State And Verify 476 [Documentation] Set SLAACv6 configuration state and verify. 477 [Arguments] ${slaac_state} ${valid_status_codes}=${HTTP_OK} 478 479 # Description of argument(s): 480 # slaac_state SLAACv6 state('True' or 'False'). 481 # valid_status_code Expected valid status codes. 482 483 ${active_channel_config}= Get Active Channel Config 484 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 485 486 ${data}= Set Variable If ${slaac_state} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC} 487 ${resp}= Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 488 ... body=${data} valid_status_codes=[${valid_status_codes}] 489 490 # Verify SLAACv6 is set correctly. 491 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 492 ${slaac_verify}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig 493 494 Run Keyword If '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}' 495 ... Fail msg=SLAACv6 not set properly. 496