Prashanth Katti | 8abbb4d | 2021-01-29 02:17:45 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Network interface IPv6 configuration and verification |
| 3 | ... tests. |
| 4 | |
| 5 | Resource ../../lib/bmc_redfish_resource.robot |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | Resource ../../lib/bmc_ipv6_utils.robot |
Sweta Potthuri | 8ba7432 | 2025-03-19 12:29:06 -0500 | [diff] [blame] | 8 | Resource ../../lib/external_intf/vmi_utils.robot |
Prashanth Katti | 8abbb4d | 2021-01-29 02:17:45 -0600 | [diff] [blame] | 9 | Library ../../lib/bmc_network_utils.py |
| 10 | Library Collections |
| 11 | |
| 12 | Test Setup Test Setup Execution |
| 13 | Test Teardown Test Teardown Execution |
Prashanth Katti | 3270fd0 | 2021-06-11 08:02:22 -0500 | [diff] [blame] | 14 | Suite Setup Suite Setup Execution |
Prashanth Katti | 8abbb4d | 2021-01-29 02:17:45 -0600 | [diff] [blame] | 15 | |
Matt Fischer | 6fb70d9 | 2023-10-24 19:06:33 -0600 | [diff] [blame] | 16 | Test Tags BMC_IPv6 |
Prashanth Katti | 8abbb4d | 2021-01-29 02:17:45 -0600 | [diff] [blame] | 17 | |
| 18 | *** Variables *** |
Sweta Potthuri | 2edacd3 | 2025-07-02 01:04:43 -0500 | [diff] [blame] | 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 |
Prashanth Katti | 8abbb4d | 2021-01-29 02:17:45 -0600 | [diff] [blame] | 22 | |
George Keishing | e16f158 | 2022-12-15 07:32:21 -0600 | [diff] [blame] | 23 | # Valid prefix length is a integer ranges from 1 to 128. |
Sweta Potthuri | 2edacd3 | 2025-07-02 01:04:43 -0500 | [diff] [blame] | 24 | ${test_prefix_length} 64 |
| 25 | ${ipv6_gw_addr} 2002:903:15F:32:9:3:32:1 |
| 26 | ${prefix_length_def} None |
| 27 | ${invalid_staticv6_gateway} 9.41.164.1 |
Prashanth Katti | 8abbb4d | 2021-01-29 02:17:45 -0600 | [diff] [blame] | 28 | |
| 29 | *** Test Cases *** |
| 30 | |
| 31 | Get IPv6 Address And Verify |
| 32 | [Documentation] Get IPv6 Address And Verify. |
| 33 | [Tags] Get_IPv6_Address_And_Verify |
| 34 | |
| 35 | FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} |
| 36 | Verify IPv6 On BMC ${ipv6_network_configuration['Address']} |
| 37 | END |
| 38 | |
| 39 | |
Prashanth Katti | 2c73abc | 2021-03-17 07:42:25 -0500 | [diff] [blame] | 40 | Get PrefixLength And Verify |
| 41 | [Documentation] Get IPv6 prefix length and verify. |
| 42 | [Tags] Get_PrefixLength_And_Verify |
| 43 | |
| 44 | FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} |
| 45 | Verify IPv6 On BMC ${ipv6_network_configuration['PrefixLength']} |
| 46 | END |
| 47 | |
| 48 | |
| 49 | Get IPv6 Default Gateway And Verify |
George Keishing | 9614383 | 2021-03-23 07:55:08 -0500 | [diff] [blame] | 50 | [Documentation] Get IPv6 default gateway and verify. |
George Keishing | ade6ab4 | 2022-07-19 11:41:03 -0500 | [diff] [blame] | 51 | [Tags] Get_IPv6_Default_Gateway_And_Verify |
Prashanth Katti | 2c73abc | 2021-03-17 07:42:25 -0500 | [diff] [blame] | 52 | |
| 53 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
| 54 | ${ipv6_gateway}= Get From Dictionary ${resp.dict} IPv6DefaultGateway |
| 55 | Verify IPv6 Default Gateway On BMC ${ipv6_gateway} |
| 56 | |
| 57 | |
Prashanth Katti | c1d2daa | 2022-07-26 03:53:06 -0500 | [diff] [blame] | 58 | Verify All Configured IPv6 And PrefixLength On BMC |
| 59 | [Documentation] Verify IPv6 address and its prefix length on BMC. |
| 60 | [Tags] Verify_All_Configured_IPv6_And_PrefixLength_On_BMC |
| 61 | |
| 62 | FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} |
George Keishing | f02ca2b | 2023-04-05 22:11:03 +0530 | [diff] [blame] | 63 | Verify IPv6 And PrefixLength ${ipv6_network_configuration['Address']} |
Prashanth Katti | c1d2daa | 2022-07-26 03:53:06 -0500 | [diff] [blame] | 64 | ... ${ipv6_network_configuration['PrefixLength']} |
| 65 | END |
| 66 | |
| 67 | |
| 68 | Configure IPv6 Address And Verify |
| 69 | [Documentation] Configure IPv6 address and verify. |
| 70 | [Tags] Configure_IPv6_Address_And_Verify |
Anvesh-Kumar_Rayankula | 3a26c66 | 2025-04-16 01:19:26 -0500 | [diff] [blame] | 71 | [Teardown] Run Keywords |
| 72 | ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution |
Prashanth Katti | c1d2daa | 2022-07-26 03:53:06 -0500 | [diff] [blame] | 73 | [Template] Configure IPv6 Address On BMC |
| 74 | |
| 75 | |
| 76 | # IPv6 address Prefix length |
| 77 | ${test_ipv6_addr} ${test_prefix_length} |
| 78 | |
| 79 | |
Prashanth Katti | 12ed4b7 | 2023-05-16 05:24:00 -0500 | [diff] [blame] | 80 | Delete IPv6 Address And Verify |
| 81 | [Documentation] Delete IPv6 address and verify. |
| 82 | [Tags] Delete_IPv6_Address_And_Verify |
| 83 | |
| 84 | Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} |
| 85 | |
| 86 | Delete IPv6 Address ${test_ipv6_addr} |
| 87 | |
| 88 | |
Prashanth Katti | 5f7d2e4 | 2023-05-22 03:17:25 -0500 | [diff] [blame] | 89 | |
George Keishing | cc28831 | 2024-10-22 10:13:12 +0530 | [diff] [blame] | 90 | Modify IPv6 Address And Verify |
Prashanth Katti | 5f7d2e4 | 2023-05-22 03:17:25 -0500 | [diff] [blame] | 91 | [Documentation] Modify IPv6 address and verify. |
| 92 | [Tags] Modify_IPv6_Address_And_Verify |
kvishal | 88de8c4 | 2025-03-04 01:45:10 -0600 | [diff] [blame] | 93 | [Teardown] Run Keywords |
George Keishing | cfdd099 | 2025-03-17 11:59:20 +0530 | [diff] [blame] | 94 | ... Delete IPv6 Address ${test_ipv6_addr1} AND Test Teardown Execution |
Prashanth Katti | 5f7d2e4 | 2023-05-22 03:17:25 -0500 | [diff] [blame] | 95 | |
| 96 | Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} |
| 97 | |
| 98 | Modify IPv6 Address ${test_ipv6_addr} ${test_ipv6_addr1} ${test_prefix_length} |
| 99 | |
| 100 | |
Sweta Potthuri | afe858e | 2025-02-25 23:52:51 -0600 | [diff] [blame] | 101 | Verify Persistency Of IPv6 After BMC Reboot |
| 102 | [Documentation] Verify persistency of IPv6 after BMC reboot. |
| 103 | [Tags] Verify_Persistency_Of_IPv6_After_BMC_Reboot |
| 104 | [Teardown] Run Keywords |
| 105 | ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution |
| 106 | |
| 107 | Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} |
| 108 | |
| 109 | Redfish OBMC Reboot (off) stack_mode=skip |
| 110 | |
| 111 | # Verifying persistency of IPv6. |
| 112 | Verify IPv6 On BMC ${test_ipv6_addr} |
| 113 | |
| 114 | |
Sweta Potthuri | 8ba7432 | 2025-03-19 12:29:06 -0500 | [diff] [blame] | 115 | Enable SLAACv6 On BMC And Verify |
| 116 | [Documentation] Enable SLAACv6 on BMC and verify. |
| 117 | [Tags] Enable_SLAACv6_On_BMC_And_Verify |
| 118 | |
| 119 | Set SLAACv6 Configuration State And Verify ${True} |
| 120 | |
| 121 | |
Sweta Potthuri | 0df4a86 | 2025-03-24 12:05:09 -0500 | [diff] [blame] | 122 | Enable DHCPv6 Property On BMC And Verify |
| 123 | [Documentation] Enable DHCPv6 property on BMC and verify. |
| 124 | [Tags] Enable_DHCPv6_Property_On_BMC_And_Verify |
| 125 | |
| 126 | Set And Verify DHCPv6 Property Enabled |
| 127 | |
Sweta Potthuri | 4b0083f | 2025-07-09 11:34:40 -0500 | [diff] [blame^] | 128 | |
kvishal | 0d199a9 | 2025-05-29 02:35:18 -0500 | [diff] [blame] | 129 | Disable DHCPv6 Property On BMC And Verify |
| 130 | [Documentation] Disable DHCPv6 property on BMC and verify. |
| 131 | [Tags] Disable_DHCPv6_Property_On_BMC_And_Verify |
| 132 | |
| 133 | Set And Verify DHCPv6 Property Disabled |
Sweta Potthuri | 0df4a86 | 2025-03-24 12:05:09 -0500 | [diff] [blame] | 134 | |
Sweta Potthuri | 4b0083f | 2025-07-09 11:34:40 -0500 | [diff] [blame^] | 135 | |
Sweta Potthuri | cb61ff0 | 2025-04-09 05:16:09 -0500 | [diff] [blame] | 136 | Configure Invalid Static IPv6 And Verify |
| 137 | [Documentation] Configure invalid static IPv6 and verify. |
| 138 | [Tags] Configure_Invalid_Static_IPv6_And_Verify |
| 139 | [Template] Configure IPv6 Address On BMC |
| 140 | |
| 141 | #invalid_ipv6 prefix length valid_status_code |
| 142 | ${ipv4_hexword_addr} ${test_prefix_length} ${HTTP_BAD_REQUEST} |
| 143 | |
Sweta Potthuri | 565318d | 2025-06-09 06:13:46 -0500 | [diff] [blame] | 144 | |
Sweta Potthuri | 2edacd3 | 2025-07-02 01:04:43 -0500 | [diff] [blame] | 145 | Configure IPv6 Static Default Gateway And Verify |
| 146 | [Documentation] Configure IPv6 static default gateway and verify. |
| 147 | [Tags] Configure_IPv6_Static_Default_Gateway_And_Verify |
| 148 | [Template] Configure IPv6 Static Default Gateway On BMC |
Sweta Potthuri | 565318d | 2025-06-09 06:13:46 -0500 | [diff] [blame] | 149 | |
Sweta Potthuri | 2edacd3 | 2025-07-02 01:04:43 -0500 | [diff] [blame] | 150 | # static_def_gw prefix length valid_status_code |
| 151 | ${ipv6_gw_addr} ${prefix_length_def} ${HTTP_OK} |
| 152 | ${invalid_staticv6_gateway} ${test_prefix_length} ${HTTP_BAD_REQUEST} |
Sweta Potthuri | 565318d | 2025-06-09 06:13:46 -0500 | [diff] [blame] | 153 | |
Sweta Potthuri | cb61ff0 | 2025-04-09 05:16:09 -0500 | [diff] [blame] | 154 | |
Sweta Potthuri | 4b0083f | 2025-07-09 11:34:40 -0500 | [diff] [blame^] | 155 | Modify Static Default Gateway And Verify |
| 156 | [Documentation] Modify static default gateway and verify. |
| 157 | [Tags] Modify_Static_Default_Gateway_And_Verify |
| 158 | [Setup] Configure IPv6 Static Default Gateway On BMC ${ipv6_gw_addr} ${prefix_length_def} |
| 159 | |
| 160 | Modify IPv6 Static Default Gateway On BMC ${test_ipv6_addr1} ${prefix_length_def} ${HTTP_OK} ${ipv6_gw_addr} |
| 161 | |
| 162 | |
Prashanth Katti | 8abbb4d | 2021-01-29 02:17:45 -0600 | [diff] [blame] | 163 | *** Keywords *** |
| 164 | |
Prashanth Katti | 3270fd0 | 2021-06-11 08:02:22 -0500 | [diff] [blame] | 165 | Suite Setup Execution |
| 166 | [Documentation] Do suite setup execution. |
| 167 | |
| 168 | ${active_channel_config}= Get Active Channel Config |
| 169 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 170 | |
| 171 | Set Suite variable ${ethernet_interface} |
| 172 | |
| 173 | |
Prashanth Katti | 8abbb4d | 2021-01-29 02:17:45 -0600 | [diff] [blame] | 174 | Test Setup Execution |
| 175 | [Documentation] Test setup execution. |
| 176 | |
| 177 | Redfish.Login |
| 178 | |
| 179 | @{ipv6_network_configurations}= Get IPv6 Network Configuration |
| 180 | Set Test Variable @{ipv6_network_configurations} |
| 181 | |
| 182 | # Get BMC IPv6 address and prefix length. |
| 183 | ${ipv6_data}= Get BMC IPv6 Info |
| 184 | Set Test Variable ${ipv6_data} |
| 185 | |
| 186 | |
| 187 | Test Teardown Execution |
| 188 | [Documentation] Test teardown execution. |
| 189 | |
| 190 | FFDC On Test Case Fail |
| 191 | Redfish.Logout |
| 192 | |
| 193 | |
| 194 | Get IPv6 Network Configuration |
| 195 | [Documentation] Get Ipv6 network configuration. |
| 196 | # Sample output: |
| 197 | # { |
ganesanb | 4d43028 | 2023-04-27 14:33:23 +0000 | [diff] [blame] | 198 | # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0", |
Prashanth Katti | 8abbb4d | 2021-01-29 02:17:45 -0600 | [diff] [blame] | 199 | # "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface", |
| 200 | # "DHCPv4": { |
| 201 | # "DHCPEnabled": false, |
| 202 | # "UseDNSServers": false, |
| 203 | # "UseDomainName": true, |
| 204 | # "UseNTPServers": false |
| 205 | # }, |
| 206 | # "DHCPv6": { |
| 207 | # "OperatingMode": "Disabled", |
| 208 | # "UseDNSServers": false, |
| 209 | # "UseDomainName": true, |
| 210 | # "UseNTPServers": false |
| 211 | # }, |
| 212 | # "Description": "Management Network Interface", |
| 213 | # "FQDN": "localhost", |
| 214 | # "HostName": "localhost", |
| 215 | # "IPv4Addresses": [ |
| 216 | # { |
| 217 | # "Address": "xx.xx.xx.xx", |
| 218 | # "AddressOrigin": "Static", |
| 219 | # "Gateway": "xx.xx.xx.1", |
| 220 | # "SubnetMask": "xx.xx.xx.0" |
| 221 | # }, |
| 222 | # { |
| 223 | # "Address": "169.254.xx.xx", |
| 224 | # "AddressOrigin": "IPv4LinkLocal", |
| 225 | # "Gateway": "0.0.0.0", |
| 226 | # "SubnetMask": "xx.xx.0.0" |
| 227 | # }, |
| 228 | # ], |
| 229 | # "IPv4StaticAddresses": [ |
| 230 | # { |
| 231 | # "Address": "xx.xx.xx.xx", |
| 232 | # "AddressOrigin": "Static", |
| 233 | # "Gateway": "xx.xx.xx.1", |
| 234 | # "SubnetMask": "xx.xx.0.0" |
| 235 | # } |
| 236 | # } |
| 237 | # ], |
| 238 | # "IPv6AddressPolicyTable": [], |
| 239 | # "IPv6Addresses": [ |
| 240 | # { |
| 241 | # "Address": "fe80::xxxx:xxxx:xxxx:xxxx", |
| 242 | # "AddressOrigin": "LinkLocal", |
| 243 | # "AddressState": null, |
| 244 | # "PrefixLength": xx |
| 245 | # } |
| 246 | # ], |
| 247 | # "IPv6DefaultGateway": "", |
| 248 | # "IPv6StaticAddresses": [ |
| 249 | # { "Address": "xxxx:xxxx:xxxx:xxxx::xxxx", |
| 250 | # "AddressOrigin": "Static", |
| 251 | # "AddressState": null, |
| 252 | # "PrefixLength": xxx |
| 253 | # } |
| 254 | # ], |
| 255 | # "Id": "eth0", |
| 256 | # "InterfaceEnabled": true, |
| 257 | # "LinkStatus": "LinkUp", |
| 258 | # "MACAddress": "xx:xx:xx:xx:xx:xx", |
| 259 | # "Name": "Manager Ethernet Interface", |
| 260 | # "NameServers": [], |
| 261 | # "SpeedMbps": 0, |
| 262 | # "StaticNameServers": [], |
| 263 | # "Status": { |
| 264 | # "Health": "OK", |
| 265 | # "HealthRollup": "OK", |
| 266 | # "State": "Enabled" |
| 267 | # }, |
| 268 | # "VLANs": { |
ganesanb | 4d43028 | 2023-04-27 14:33:23 +0000 | [diff] [blame] | 269 | # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0/VLANs" |
Prashanth Katti | 8abbb4d | 2021-01-29 02:17:45 -0600 | [diff] [blame] | 270 | |
| 271 | |
| 272 | ${active_channel_config}= Get Active Channel Config |
| 273 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 274 | |
| 275 | @{ipv6_network_configurations}= Get From Dictionary ${resp.dict} IPv6StaticAddresses |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 276 | RETURN @{ipv6_network_configurations} |
Prashanth Katti | c1d2daa | 2022-07-26 03:53:06 -0500 | [diff] [blame] | 277 | |
| 278 | |
| 279 | Verify IPv6 And PrefixLength |
| 280 | [Documentation] Verify IPv6 address and prefix length on BMC. |
| 281 | [Arguments] ${ipv6_addr} ${prefix_len} |
| 282 | |
| 283 | # Description of the argument(s): |
| 284 | # ipv6_addr IPv6 address to be verified. |
| 285 | # prefix_len PrefixLength value to be verified. |
| 286 | |
| 287 | # Catenate IPv6 address and its prefix length. |
| 288 | ${ipv6_with_prefix}= Catenate ${ipv6_addr}/${prefix_len} |
| 289 | |
| 290 | # Get IPv6 address details on BMC using IP command. |
| 291 | @{ip_data}= Get BMC IPv6 Info |
| 292 | |
| 293 | # Verify if IPv6 and prefix length is configured on BMC. |
| 294 | |
| 295 | Should Contain ${ip_data} ${ipv6_with_prefix} |
| 296 | ... msg=IPv6 and prefix length pair does not exist. |
| 297 | |
| 298 | |
| 299 | Configure IPv6 Address On BMC |
| 300 | [Documentation] Add IPv6 Address on BMC. |
| 301 | [Arguments] ${ipv6_addr} ${prefix_len} ${valid_status_codes}=${HTTP_OK} |
| 302 | |
| 303 | # Description of argument(s): |
| 304 | # ipv6_addr IPv6 address to be added (e.g. "2001:EEEE:2222::2022"). |
| 305 | # prefix_len Prefix length for the IPv6 to be added |
| 306 | # (e.g. "64"). |
| 307 | # valid_status_codes Expected return code from patch operation |
| 308 | # (e.g. "200"). |
| 309 | |
Prashanth Katti | 12ed4b7 | 2023-05-16 05:24:00 -0500 | [diff] [blame] | 310 | ${prefix_length}= Convert To Integer ${prefix_len} |
Prashanth Katti | c1d2daa | 2022-07-26 03:53:06 -0500 | [diff] [blame] | 311 | ${empty_dict}= Create Dictionary |
| 312 | ${ipv6_data}= Create Dictionary Address=${ipv6_addr} |
Prashanth Katti | 12ed4b7 | 2023-05-16 05:24:00 -0500 | [diff] [blame] | 313 | ... PrefixLength=${prefix_length} |
Prashanth Katti | c1d2daa | 2022-07-26 03:53:06 -0500 | [diff] [blame] | 314 | |
| 315 | ${patch_list}= Create List |
| 316 | |
| 317 | # Get existing static IPv6 configurations on BMC. |
| 318 | ${ipv6_network_configurations}= Get IPv6 Network Configuration |
| 319 | ${num_entries}= Get Length ${ipv6_network_configurations} |
| 320 | |
| 321 | FOR ${INDEX} IN RANGE 0 ${num_entries} |
| 322 | Append To List ${patch_list} ${empty_dict} |
| 323 | END |
| 324 | |
George Keishing | e6e161e | 2025-05-08 10:18:30 +0530 | [diff] [blame] | 325 | ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}' |
| 326 | ... ${HTTP_OK},${HTTP_NO_CONTENT} |
| 327 | ... ${valid_status_codes} |
Prashanth Katti | c1d2daa | 2022-07-26 03:53:06 -0500 | [diff] [blame] | 328 | |
| 329 | # We need not check for existence of IPv6 on BMC while adding. |
| 330 | Append To List ${patch_list} ${ipv6_data} |
| 331 | ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} |
| 332 | |
| 333 | ${active_channel_config}= Get Active Channel Config |
| 334 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 335 | |
| 336 | Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} |
| 337 | ... valid_status_codes=[${valid_status_codes}] |
| 338 | |
| 339 | Return From Keyword If '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}' |
| 340 | |
| 341 | # Note: Network restart takes around 15-18s after patch request processing. |
| 342 | Sleep ${NETWORK_TIMEOUT}s |
| 343 | Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} |
| 344 | |
| 345 | Verify IPv6 And PrefixLength ${ipv6_addr} ${prefix_len} |
| 346 | |
| 347 | # Verify if existing static IPv6 addresses still exist. |
| 348 | FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} |
| 349 | Verify IPv6 On BMC ${ipv6_network_configuration['Address']} |
| 350 | END |
| 351 | |
| 352 | Validate IPv6 Network Config On BMC |
| 353 | |
| 354 | |
| 355 | Validate IPv6 Network Config On BMC |
| 356 | [Documentation] Check that IPv6 network info obtained via redfish matches info |
| 357 | ... obtained via CLI. |
Prashanth Katti | 5f7d2e4 | 2023-05-22 03:17:25 -0500 | [diff] [blame] | 358 | @{ipv6_network_configurations}= Get IPv6 Network Configuration |
Prashanth Katti | c1d2daa | 2022-07-26 03:53:06 -0500 | [diff] [blame] | 359 | ${ipv6_data}= Get BMC IPv6 Info |
| 360 | FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} |
| 361 | Should Contain Match ${ipv6_data} ${ipv6_network_configuration['Address']}/* |
| 362 | ... msg=IPv6 address does not exist. |
| 363 | END |
| 364 | |
Prashanth Katti | 12ed4b7 | 2023-05-16 05:24:00 -0500 | [diff] [blame] | 365 | |
| 366 | Delete IPv6 Address |
| 367 | [Documentation] Delete IPv6 address of BMC. |
Prashanth Katti | bcb9dab | 2025-04-01 12:58:37 -0500 | [diff] [blame] | 368 | [Arguments] ${ipv6_addr} |
| 369 | ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] |
Prashanth Katti | 12ed4b7 | 2023-05-16 05:24:00 -0500 | [diff] [blame] | 370 | |
| 371 | # Description of argument(s): |
| 372 | # ipv6_addr IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234"). |
| 373 | # valid_status_codes Expected return code from patch operation |
| 374 | # (e.g. "200"). See prolog of rest_request |
| 375 | # method in redfish_plus.py for details. |
| 376 | |
| 377 | ${empty_dict}= Create Dictionary |
| 378 | ${patch_list}= Create List |
| 379 | |
| 380 | @{ipv6_network_configurations}= Get IPv6 Network Configuration |
| 381 | FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} |
| 382 | IF '${ipv6_network_configuration['Address']}' == '${ipv6_addr}' |
| 383 | Append To List ${patch_list} ${null} |
| 384 | ELSE |
| 385 | Append To List ${patch_list} ${empty_dict} |
| 386 | END |
| 387 | END |
| 388 | |
| 389 | ${ip_found}= Run Keyword And Return Status List Should Contain Value |
| 390 | ... ${patch_list} ${null} msg=${ipv6_addr} does not exist on BMC |
| 391 | Pass Execution If ${ip_found} == ${False} ${ipv6_addr} does not exist on BMC |
| 392 | |
| 393 | # Run patch command only if given IP is found on BMC |
| 394 | ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} |
| 395 | |
| 396 | ${active_channel_config}= Get Active Channel Config |
| 397 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 398 | |
| 399 | Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} |
Sweta Potthuri | a198161 | 2025-05-09 05:41:10 -0500 | [diff] [blame] | 400 | ... valid_status_codes=${valid_status_codes} |
Prashanth Katti | 12ed4b7 | 2023-05-16 05:24:00 -0500 | [diff] [blame] | 401 | |
| 402 | # Note: Network restart takes around 15-18s after patch request processing |
| 403 | Sleep ${NETWORK_TIMEOUT}s |
| 404 | Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} |
| 405 | |
| 406 | # IPv6 address that is deleted should not be there on BMC. |
| 407 | ${delete_status}= Run Keyword And Return Status Verify IPv6 On BMC ${ipv6_addr} |
Anvesh-Kumar_Rayankula | 3a26c66 | 2025-04-16 01:19:26 -0500 | [diff] [blame] | 408 | IF '${valid_status_codes}' == '[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]' |
Prashanth Katti | 12ed4b7 | 2023-05-16 05:24:00 -0500 | [diff] [blame] | 409 | Should Be True '${delete_status}' == '${False}' |
| 410 | ELSE |
| 411 | Should Be True '${delete_status}' == '${True}' |
| 412 | END |
| 413 | |
| 414 | Validate IPv6 Network Config On BMC |
Prashanth Katti | 5f7d2e4 | 2023-05-22 03:17:25 -0500 | [diff] [blame] | 415 | |
| 416 | |
| 417 | Modify IPv6 Address |
| 418 | [Documentation] Modify and verify IPv6 address of BMC. |
| 419 | [Arguments] ${ipv6} ${new_ipv6} ${prefix_len} |
| 420 | ... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 421 | |
| 422 | # Description of argument(s): |
| 423 | # ipv6 IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF"). |
| 424 | # new_ipv6 New IPv6 address to be configured. |
| 425 | # prefix_len Prefix length value (Range 1 to 128). |
| 426 | # valid_status_codes Expected return code from patch operation |
| 427 | # (e.g. "200", "201"). |
| 428 | |
| 429 | ${empty_dict}= Create Dictionary |
| 430 | ${patch_list}= Create List |
| 431 | ${prefix_length}= Convert To Integer ${prefix_len} |
| 432 | ${ipv6_data}= Create Dictionary |
| 433 | ... Address=${new_ipv6} PrefixLength=${prefix_length} |
| 434 | |
| 435 | # Sample IPv6 network configurations: |
| 436 | # "IPv6AddressPolicyTable": [], |
| 437 | # "IPv6Addresses": [ |
| 438 | # { |
| 439 | # "Address": "X002:db8:0:2::XX0", |
| 440 | # "AddressOrigin": "DHCPv6", |
| 441 | # "PrefixLength": 128 |
| 442 | # }, |
| 443 | # { |
| 444 | # "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX", |
| 445 | # "AddressOrigin": "SLAAC", |
| 446 | # "PrefixLength": 64 |
| 447 | # }, |
| 448 | # { |
| 449 | # "Address": “Y002:db8:0:2:a94:efff:fe82:5000", |
| 450 | # "AddressOrigin": "Static", |
| 451 | # "PrefixLength": 56 |
| 452 | # }, |
| 453 | # { |
| 454 | # "Address": “Z002:db8:0:2:a94:efff:fe82:5000", |
| 455 | # "AddressOrigin": "Static", |
| 456 | # "PrefixLength": 56 |
| 457 | # }, |
| 458 | # { |
| 459 | # "Address": “Xe80::a94:efff:YYYY:XXXX", |
| 460 | # "AddressOrigin": "LinkLocal", |
| 461 | # "PrefixLength": 64 |
| 462 | # }, |
| 463 | # { |
| 464 | # "Address": “X002:db8:1:2:eff:233:fee:546", |
| 465 | # "AddressOrigin": "Static", |
| 466 | # "PrefixLength": 56 |
| 467 | # } |
| 468 | # ], |
| 469 | # "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”, |
| 470 | # "IPv6StaticAddresses": [ |
| 471 | # { |
| 472 | # "Address": “X002:db8:0:2:a94:efff:fe82:5000", |
| 473 | # "PrefixLength": 56 |
| 474 | # }, |
| 475 | # { |
| 476 | # "Address": “Y002:db8:0:2:a94:efff:fe82:5000", |
| 477 | # "PrefixLength": 56 |
| 478 | # }, |
| 479 | # { |
| 480 | # "Address": “Z002:db8:1:2:eff:233:fee:546", |
| 481 | # "PrefixLength": 56 |
| 482 | # } |
| 483 | # ], |
| 484 | # "IPv6StaticDefaultGateways": [], |
| 485 | |
| 486 | # Find the position of IPv6 address to be modified. |
| 487 | @{ipv6_network_configurations}= Get IPv6 Network Configuration |
| 488 | FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} |
George Keishing | e6e161e | 2025-05-08 10:18:30 +0530 | [diff] [blame] | 489 | IF '${ipv6_network_configuration['Address']}' == '${ipv6}' |
| 490 | Append To List ${patch_list} ${ipv6_data} |
| 491 | ELSE |
| 492 | Append To List ${patch_list} ${empty_dict} |
| 493 | END |
Prashanth Katti | 5f7d2e4 | 2023-05-22 03:17:25 -0500 | [diff] [blame] | 494 | END |
| 495 | |
| 496 | # Modify the IPv6 address only if given IPv6 is found |
| 497 | ${ip_found}= Run Keyword And Return Status List Should Contain Value |
| 498 | ... ${patch_list} ${ipv6_data} msg=${ipv6} does not exist on BMC |
| 499 | Pass Execution If ${ip_found} == ${False} ${ipv6} does not exist on BMC |
| 500 | |
| 501 | ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} |
| 502 | |
| 503 | ${active_channel_config}= Get Active Channel Config |
| 504 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 505 | |
| 506 | Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
| 507 | ... body=&{data} valid_status_codes=${valid_status_codes} |
| 508 | |
| 509 | # Note: Network restart takes around 15-18s after patch request processing. |
| 510 | Sleep ${NETWORK_TIMEOUT}s |
| 511 | Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} |
| 512 | |
| 513 | # Verify if new IPv6 address is configured on BMC. |
| 514 | Verify IPv6 On BMC ${new_ipv6} |
| 515 | |
| 516 | # Verify if old IPv6 address is erased. |
| 517 | ${cmd_status}= Run Keyword And Return Status |
| 518 | ... Verify IPv6 On BMC ${ipv6} |
| 519 | Should Be Equal ${cmd_status} ${False} msg=Old IPv6 address is not deleted. |
| 520 | |
| 521 | Validate IPv6 Network Config On BMC |
Sweta Potthuri | 8ba7432 | 2025-03-19 12:29:06 -0500 | [diff] [blame] | 522 | |
| 523 | |
| 524 | Set SLAACv6 Configuration State And Verify |
| 525 | [Documentation] Set SLAACv6 configuration state and verify. |
Sweta Potthuri | 610f86f | 2025-05-30 00:47:23 -0500 | [diff] [blame] | 526 | [Arguments] ${slaac_state} ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] |
Sweta Potthuri | 8ba7432 | 2025-03-19 12:29:06 -0500 | [diff] [blame] | 527 | |
| 528 | # Description of argument(s): |
| 529 | # slaac_state SLAACv6 state('True' or 'False'). |
| 530 | # valid_status_code Expected valid status codes. |
| 531 | |
| 532 | ${active_channel_config}= Get Active Channel Config |
| 533 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 534 | |
| 535 | ${data}= Set Variable If ${slaac_state} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC} |
| 536 | ${resp}= Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
Sweta Potthuri | 610f86f | 2025-05-30 00:47:23 -0500 | [diff] [blame] | 537 | ... body=${data} valid_status_codes=${valid_status_codes} |
Sweta Potthuri | 8ba7432 | 2025-03-19 12:29:06 -0500 | [diff] [blame] | 538 | |
| 539 | # Verify SLAACv6 is set correctly. |
| 540 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
| 541 | ${slaac_verify}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig |
| 542 | |
George Keishing | e6e161e | 2025-05-08 10:18:30 +0530 | [diff] [blame] | 543 | IF '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}' |
| 544 | Fail msg=SLAACv6 not set properly. |
| 545 | END |
Sweta Potthuri | 0df4a86 | 2025-03-24 12:05:09 -0500 | [diff] [blame] | 546 | |
Sweta Potthuri | cb61ff0 | 2025-04-09 05:16:09 -0500 | [diff] [blame] | 547 | |
Sweta Potthuri | 0df4a86 | 2025-03-24 12:05:09 -0500 | [diff] [blame] | 548 | Set And Verify DHCPv6 Property |
| 549 | [Documentation] Set DHCPv6 attribute and verify. |
| 550 | [Arguments] ${dhcpv6_operating_mode}=${Disabled} |
| 551 | |
| 552 | # Description of argument(s): |
| 553 | # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled'). |
| 554 | |
| 555 | ${data}= Set Variable If '${dhcpv6_operating_mode}' == 'Disabled' ${DISABLE_DHCPv6} ${ENABLE_DHCPv6} |
| 556 | ${active_channel_config}= Get Active Channel Config |
| 557 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 558 | |
| 559 | Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
| 560 | ... body=${data} valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}] |
| 561 | |
| 562 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
| 563 | ${dhcpv6_verify}= Get From Dictionary ${resp.dict} DHCPv6 |
| 564 | |
| 565 | Should Be Equal '${dhcpv6_verify['OperatingMode']}' '${dhcpv6_operating_mode}' |
Sweta Potthuri | cb61ff0 | 2025-04-09 05:16:09 -0500 | [diff] [blame] | 566 | |
Sweta Potthuri | 2edacd3 | 2025-07-02 01:04:43 -0500 | [diff] [blame] | 567 | |
Sweta Potthuri | 4b0083f | 2025-07-09 11:34:40 -0500 | [diff] [blame^] | 568 | Get IPv6 Static Default Gateway |
| 569 | [Documentation] Get IPv6 static default gateway. |
| 570 | |
| 571 | ${active_channel_config}= Get Active Channel Config |
| 572 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 573 | |
| 574 | @{ipv6_static_defgw_configurations}= Get From Dictionary ${resp.dict} IPv6StaticDefaultGateways |
| 575 | RETURN @{ipv6_static_defgw_configurations} |
| 576 | |
Sweta Potthuri | 2edacd3 | 2025-07-02 01:04:43 -0500 | [diff] [blame] | 577 | Configure IPv6 Static Default Gateway On BMC |
| 578 | [Documentation] Configure IPv6 static default gateway on BMC. |
| 579 | [Arguments] ${ipv6_gw_addr} ${prefix_length_def} |
| 580 | ... ${valid_status_codes}=${HTTP_OK} |
Sweta Potthuri | 2edacd3 | 2025-07-02 01:04:43 -0500 | [diff] [blame] | 581 | # Description of argument(s): |
| 582 | # ipv6_gw_addr IPv6 Static Default Gateway address to be configured. |
| 583 | # prefix_len_def Prefix length value (Range 1 to 128). |
| 584 | # valid_status_codes Expected return code from patch operation |
| 585 | # (e.g. "200", "204".) |
| 586 | |
| 587 | # Prefix Length is passed as None. |
| 588 | IF '${prefix_length_def}' == '${None}' |
| 589 | ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr} |
| 590 | ELSE |
| 591 | ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr} Prefix Length=${prefix_length_def} |
| 592 | END |
| 593 | |
| 594 | ${ipv6_static_def_gw}= Get IPv6 Static Default Gateway |
| 595 | |
| 596 | ${num_entries}= Get Length ${ipv6_static_def_gw} |
| 597 | |
| 598 | ${patch_list}= Create List |
| 599 | ${empty_dict}= Create Dictionary |
| 600 | |
| 601 | FOR ${INDEX} IN RANGE 0 ${num_entries} |
| 602 | Append To List ${patch_list} ${empty_dict} |
| 603 | END |
| 604 | |
| 605 | ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}' |
| 606 | ... ${HTTP_OK},${HTTP_NO_CONTENT} |
| 607 | ... ${valid_status_codes} |
| 608 | |
| 609 | Append To List ${patch_list} ${ipv6_gw} |
| 610 | ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} |
| 611 | |
| 612 | Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
| 613 | ... body=${data} valid_status_codes=[${valid_status_codes}] |
| 614 | |
| 615 | # Verify the added static default gateway is present in Redfish Get Output. |
| 616 | ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway |
| 617 | |
| 618 | ${ipv6_static_def_gw_list}= Create List |
| 619 | FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway} |
| 620 | ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address |
| 621 | Append To List ${ipv6_static_def_gw_list} ${value} |
| 622 | END |
| 623 | |
| 624 | IF '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}' |
| 625 | Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr} |
| 626 | ELSE |
| 627 | Should Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr} |
| 628 | END |
| 629 | |
Sweta Potthuri | 4b0083f | 2025-07-09 11:34:40 -0500 | [diff] [blame^] | 630 | Modify Static Default Gateway |
| 631 | [Documentation] Modify and verify IPv6 address of BMC. |
| 632 | [Arguments] ${ipv6_gw_addr} ${new_static_def_gw} ${prefix_length} |
| 633 | ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED}] |
Sweta Potthuri | 2edacd3 | 2025-07-02 01:04:43 -0500 | [diff] [blame] | 634 | |
Sweta Potthuri | 4b0083f | 2025-07-09 11:34:40 -0500 | [diff] [blame^] | 635 | # Description of argument(s): |
| 636 | # ipv6_gw_addr IPv6 static default gateway address to be replaced (e.g. "2001:AABB:CCDD::AAFF"). |
| 637 | # new_static_def_gw New static default gateway address to be configured. |
| 638 | # prefix length Prefix length value (Range 1 to 128). |
| 639 | # valid_status_codes Expected return code from patch operation |
| 640 | # (e.g. "200", "204"). |
Sweta Potthuri | 2edacd3 | 2025-07-02 01:04:43 -0500 | [diff] [blame] | 641 | |
Sweta Potthuri | 4b0083f | 2025-07-09 11:34:40 -0500 | [diff] [blame^] | 642 | ${empty_dict}= Create Dictionary |
| 643 | ${patch_list}= Create List |
| 644 | # Prefix Length is passed as None. |
| 645 | IF '${prefix_length_def}' == '${None}' |
| 646 | ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw} |
| 647 | ELSE |
| 648 | ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw} Prefix Length=${prefix_length_def} |
| 649 | END |
Sweta Potthuri | 2edacd3 | 2025-07-02 01:04:43 -0500 | [diff] [blame] | 650 | |
Sweta Potthuri | 4b0083f | 2025-07-09 11:34:40 -0500 | [diff] [blame^] | 651 | @{ipv6_static_def_gw_list}= Get IPv6 Static Default Gateway |
| 652 | |
| 653 | FOR ${ipv6_static_def_gw} IN @{ipv6_static_def_gw_list} |
| 654 | IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}' |
| 655 | Append To List ${patch_list} ${modified_ipv6_gw_addripv6_data} |
| 656 | ELSE |
| 657 | Append To List ${patch_list} ${empty_dict} |
| 658 | END |
| 659 | END |
| 660 | |
| 661 | # Modify the IPv6 address only if given IPv6 static default gateway is found. |
| 662 | ${ip_static_def_gw_found}= Run Keyword And Return Status List Should Contain Value |
| 663 | ... ${patch_list} ${modified_ipv6_gw_addripv6_data} msg=${ipv6_gw_addr} does not exist on BMC |
| 664 | Pass Execution If ${ip_static_def_gw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC |
| 665 | |
| 666 | ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} |
| 667 | |
| 668 | Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
| 669 | ... body=&{data} valid_status_codes=${valid_status_codes} |
| 670 | |
| 671 | ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway |
| 672 | |
| 673 | ${ipv6_static_def_gw_list}= Create List |
| 674 | FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway} |
| 675 | ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address |
| 676 | Append To List ${ipv6_static_def_gw_list} ${value} |
| 677 | END |
| 678 | |
| 679 | Should Contain ${ipv6_static_def_gw_list} ${new_static_def_gw} |
| 680 | # Verify if old static default gateway address is erased. |
| 681 | Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr} |
| 682 | |