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