blob: e5085445766b444143e7b4ffaf232e03162a8c7a [file] [log] [blame]
Prashanth Katti8abbb4d2021-01-29 02:17:45 -06001*** 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
Sweta Potthuri8ba74322025-03-19 12:29:06 -05008Resource ../../lib/external_intf/vmi_utils.robot
Prashanth Katti8abbb4d2021-01-29 02:17:45 -06009Library ../../lib/bmc_network_utils.py
10Library Collections
Sweta Potthuri35c503b2025-07-27 23:36:20 -050011Library Process
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060012
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -050013Test Setup Test Setup Execution
14Test Teardown Test Teardown Execution
15Suite Setup Suite Setup Execution
16Suite Teardown Redfish.Logout
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060017
Matt Fischer6fb70d92023-10-24 19:06:33 -060018Test Tags BMC_IPv6
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060019
20*** Variables ***
Sweta Potthuri2edacd32025-07-02 01:04:43 -050021${test_ipv6_addr} 2001:db8:3333:4444:5555:6666:7777:8888
22${test_ipv6_invalid_addr} 2001:db8:3333:4444:5555:6666:7777:JJKK
23${test_ipv6_addr1} 2001:db8:3333:4444:5555:6666:7777:9999
kvishal9c6774c2025-09-10 02:14:07 -050024${invalid_hexadec_ipv6} x:x:x:x:x:x:10.5.5.6
25${ipv6_multi_short} 2001::33::111
George Keishinge16f1582022-12-15 07:32:21 -060026# Valid prefix length is a integer ranges from 1 to 128.
Sweta Potthuri2edacd32025-07-02 01:04:43 -050027${test_prefix_length} 64
28${ipv6_gw_addr} 2002:903:15F:32:9:3:32:1
29${prefix_length_def} None
30${invalid_staticv6_gateway} 9.41.164.1
Sweta Potthuri35c503b2025-07-27 23:36:20 -050031${linklocal_addr_format} fe80::[0-9a-f:]+$
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060032
33*** Test Cases ***
34
35Get IPv6 Address And Verify
36 [Documentation] Get IPv6 Address And Verify.
37 [Tags] Get_IPv6_Address_And_Verify
38
39 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
40 Verify IPv6 On BMC ${ipv6_network_configuration['Address']}
41 END
42
43
Prashanth Katti2c73abc2021-03-17 07:42:25 -050044Get PrefixLength And Verify
45 [Documentation] Get IPv6 prefix length and verify.
46 [Tags] Get_PrefixLength_And_Verify
47
48 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
49 Verify IPv6 On BMC ${ipv6_network_configuration['PrefixLength']}
50 END
51
52
53Get IPv6 Default Gateway And Verify
George Keishing96143832021-03-23 07:55:08 -050054 [Documentation] Get IPv6 default gateway and verify.
George Keishingade6ab42022-07-19 11:41:03 -050055 [Tags] Get_IPv6_Default_Gateway_And_Verify
Prashanth Katti2c73abc2021-03-17 07:42:25 -050056
57 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
58 ${ipv6_gateway}= Get From Dictionary ${resp.dict} IPv6DefaultGateway
59 Verify IPv6 Default Gateway On BMC ${ipv6_gateway}
60
61
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050062Verify All Configured IPv6 And PrefixLength On BMC
63 [Documentation] Verify IPv6 address and its prefix length on BMC.
64 [Tags] Verify_All_Configured_IPv6_And_PrefixLength_On_BMC
65
66 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
George Keishingf02ca2b2023-04-05 22:11:03 +053067 Verify IPv6 And PrefixLength ${ipv6_network_configuration['Address']}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050068 ... ${ipv6_network_configuration['PrefixLength']}
69 END
70
71
72Configure IPv6 Address And Verify
73 [Documentation] Configure IPv6 address and verify.
74 [Tags] Configure_IPv6_Address_And_Verify
Anvesh-Kumar_Rayankula3a26c662025-04-16 01:19:26 -050075 [Teardown] Run Keywords
76 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050077 [Template] Configure IPv6 Address On BMC
78
79
80 # IPv6 address Prefix length
81 ${test_ipv6_addr} ${test_prefix_length}
82
83
Prashanth Katti12ed4b72023-05-16 05:24:00 -050084Delete IPv6 Address And Verify
85 [Documentation] Delete IPv6 address and verify.
86 [Tags] Delete_IPv6_Address_And_Verify
87
88 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
89
90 Delete IPv6 Address ${test_ipv6_addr}
91
92
George Keishingcc288312024-10-22 10:13:12 +053093Modify IPv6 Address And Verify
Prashanth Katti5f7d2e42023-05-22 03:17:25 -050094 [Documentation] Modify IPv6 address and verify.
95 [Tags] Modify_IPv6_Address_And_Verify
kvishal88de8c42025-03-04 01:45:10 -060096 [Teardown] Run Keywords
George Keishingcfdd0992025-03-17 11:59:20 +053097 ... Delete IPv6 Address ${test_ipv6_addr1} AND Test Teardown Execution
Prashanth Katti5f7d2e42023-05-22 03:17:25 -050098
99 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
100
101 Modify IPv6 Address ${test_ipv6_addr} ${test_ipv6_addr1} ${test_prefix_length}
102
103
Sweta Potthuriafe858e2025-02-25 23:52:51 -0600104Verify Persistency Of IPv6 After BMC Reboot
105 [Documentation] Verify persistency of IPv6 after BMC reboot.
106 [Tags] Verify_Persistency_Of_IPv6_After_BMC_Reboot
107 [Teardown] Run Keywords
108 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution
109
110 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
111
112 Redfish OBMC Reboot (off) stack_mode=skip
113
114 # Verifying persistency of IPv6.
115 Verify IPv6 On BMC ${test_ipv6_addr}
116
117
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500118Enable SLAAC On BMC And Verify
119 [Documentation] Enable SLAAC on BMC and verify.
120 [Tags] Enable_SLAAC_On_BMC_And_Verify
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500121
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500122 Set SLAAC Configuration State And Verify ${True}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500123
124
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500125Enable DHCPv6 Property On BMC And Verify
126 [Documentation] Enable DHCPv6 property on BMC and verify.
127 [Tags] Enable_DHCPv6_Property_On_BMC_And_Verify
128
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500129 Set And Verify DHCPv6 Property Enabled
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500130
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500131
kvishal0d199a92025-05-29 02:35:18 -0500132Disable DHCPv6 Property On BMC And Verify
133 [Documentation] Disable DHCPv6 property on BMC and verify.
134 [Tags] Disable_DHCPv6_Property_On_BMC_And_Verify
135
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500136 Set And Verify DHCPv6 Property Disabled
kvishalbd04bd62025-08-05 03:57:53 -0500137
138
139Verify Persistency Of DHCPv6 On Reboot
140 [Documentation] Verify persistency of DHCPv6 property on reboot.
141 [Tags] Verify_Persistency_Of_DHCPv6_On_Reboot
142
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500143 Set And Verify DHCPv6 Property Enabled
144 Redfish OBMC Reboot (off) stack_mode=skip
145 Verify DHCPv6 Property Enabled
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500146
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500147
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500148Configure Invalid Static IPv6 And Verify
149 [Documentation] Configure invalid static IPv6 and verify.
150 [Tags] Configure_Invalid_Static_IPv6_And_Verify
151 [Template] Configure IPv6 Address On BMC
152
kvishal9c6774c2025-09-10 02:14:07 -0500153 #invalid_ipv6 prefix length valid_status_code
154 ${ipv4_hexword_addr} ${test_prefix_length} ${HTTP_BAD_REQUEST}
155 ${invalid_hexadec_ipv6} ${test_prefix_length} ${HTTP_BAD_REQUEST}
156 ${ipv6_multi_short} ${test_prefix_length} ${HTTP_BAD_REQUEST}
157
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500158
Sweta Potthuri565318d2025-06-09 06:13:46 -0500159
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500160Configure IPv6 Static Default Gateway And Verify
161 [Documentation] Configure IPv6 static default gateway and verify.
162 [Tags] Configure_IPv6_Static_Default_Gateway_And_Verify
163 [Template] Configure IPv6 Static Default Gateway On BMC
Sweta Potthuri565318d2025-06-09 06:13:46 -0500164
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500165 # static_def_gw prefix length valid_status_code
166 ${ipv6_gw_addr} ${prefix_length_def} ${HTTP_OK}
167 ${invalid_staticv6_gateway} ${test_prefix_length} ${HTTP_BAD_REQUEST}
Sweta Potthuri565318d2025-06-09 06:13:46 -0500168
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500169
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500170Modify Static Default Gateway And Verify
171 [Documentation] Modify static default gateway and verify.
172 [Tags] Modify_Static_Default_Gateway_And_Verify
173 [Setup] Configure IPv6 Static Default Gateway On BMC ${ipv6_gw_addr} ${prefix_length_def}
174
175 Modify IPv6 Static Default Gateway On BMC ${test_ipv6_addr1} ${prefix_length_def} ${HTTP_OK} ${ipv6_gw_addr}
176
177
Sweta Potthuri2d085732025-07-16 09:10:08 -0500178Delete IPv6 Static Default Gateway And Verify
179 [Documentation] Delete IPv6 static default gateway and verify.
180 [Tags] Delete_IPv6_Static_Default_Gateway_And_Verify
181 [Setup] Configure IPv6 Static Default Gateway On BMC ${ipv6_gw_addr} ${prefix_length_def}
182
183 Delete IPv6 Static Default Gateway ${ipv6_gw_addr}
184
185
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500186Verify Coexistence Of Linklocalv6 And Static IPv6 On BMC
187 [Documentation] Verify linklocalv6 And static IPv6 both exist.
188 [Tags] Verify_Coexistence_Of_Linklocalv6_And_Static_IPv6_On_BMC
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -0500189 [Setup] Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
190 [Teardown] Delete IPv6 Address ${test_ipv6_addr}
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500191
192 Check Coexistence Of Linklocalv6 And Static IPv6
193
194
George Keishingbadb4c62025-09-18 16:14:12 +0530195Verify IPv6 Linklocal Address Is In Correct Format
196 [Documentation] Verify linklocal address has network part as fe80 and
197 ... host part as EUI64.
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -0500198 [Tags] Verify_IPv6_Linklocal_Address_Is_In_Correct_Format
199
200 Check If Linklocal Address Is In Correct Format
201
202
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500203Verify BMC Gets SLAAC Address On Enabling SLAAC
204 [Documentation] On enabling SLAAC verify SLAAC address comes up.
205 [Tags] Verify_BMC_Gets_SLAAC_Address_On_Enabling_SLAAC
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500206 [Setup] Set SLAAC Configuration State And Verify ${False}
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500207
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500208 Set SLAAC Configuration State And Verify ${True}
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500209 Sleep ${NETWORK_TIMEOUT}
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500210 Check BMC Gets SLAAC Address
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500211
212
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500213Enable And Verify DHCPv6 Property On Eth1 When DHCPv6 Property Enabled On Eth0
214 [Documentation] Verify DHCPv6 on eth1 when DHCPv6 property is enabled on eth0.
215 [Tags] Enable_And_Verify_DHCPv6_Property_On_Eth1_When_DHCPv6_Property_Enabled_On_Eth0
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500216 [Setup] Get The Initial DHCPv6 Settings
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500217 [Teardown] Run Keywords Set And Verify DHCPv6 Property ${dhcpv6_channel_1} ${1}
218 ... AND Set And Verify DHCPv6 Property ${dhcpv6_channel_2} ${2}
219
220 Set And Verify DHCPv6 Property Enabled ${1}
221 Set And Verify DHCPv6 Property Enabled ${2}
222
223
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500224Enable And Verify SLAAC Property On Eth1 When SLAAC Property Enabled On Eth0
225 [Documentation] Enable and verify SLAAC property on Eth1 when SLAAC property enabled on Eth0.
226 [Tags] Enable_And_Verify_SLAAC_Property_On_Eth1_When_SLAAC_Property_Enabled_On_Eth0
227 [Setup] Get The Initial SLAAC Settings
228 [Teardown] Run Keywords Set SLAAC Configuration State And Verify ${slaac_channel_1} [${HTTP_OK}] ${1}
229 ... AND Set SLAAC Configuration State And Verify ${slaac_channel_2} [${HTTP_OK}] ${2}
230
231 Set SLAAC Configuration State And Verify ${True} [${HTTP_OK}] ${1}
232 Set SLAAC Configuration State And Verify ${True} [${HTTP_OK}] ${2}
233
234 # Check all the addresses and address origins remain intact.
235 Verify All The Addresses Are Intact
236
237
abhijith-1213a645902025-09-08 01:12:34 -0500238Verify Autoconfig Is Present On Ethernet Interface
239 [Documentation] Verify autoconfig is present on ethernet interface.
240 [Tags] Verify_Autoconfig_Is_Present_On_Ethernet_Interface
241
242 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
243 Should Contain ${resp.dict} StatelessAddressAutoConfig
244
245
Sweta Potthurif3d188f2025-09-08 07:17:31 -0500246Verify Interface ID Of SLAAC And LinkLocal Addresses Are Same
247 [Documentation] Validate interface id of SLAAC and link-local addresses are same.
248 [Tags] Verify_Interface_ID_Of_SLAAC_And_LinkLocal_Addresses_Are_Same
249
250 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
251 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC
252
253 ${linklocal_interface_id}= Get Interface ID Of IPv6 ${ipv6_linklocal_addr}
254 ${slaac_interface_id}= Get Interface ID Of IPv6 ${ipv6_slaac_addr}
255
256 Should Be Equal ${linklocal_interface_id} ${slaac_interface_id}
257
258
abhijith-121c3e96d72025-09-09 11:35:09 -0500259Verify Persistency Of Link Local IPv6 On BMC Reboot
260 [Documentation] Verify persistency of link local on BMC reboot.
261 [Tags] Verify_Persistency_Of_Link_Local_IPv6_On_BMC_Reboot
262
263 # Capturing the linklocal before reboot.
264 @{ipv6_address_origin_list} ${linklocal_addr_before_reboot}=
265 ... Get Address Origin List And Address For Type LinkLocal
266
267 # Rebooting BMC.
268 Redfish OBMC Reboot (off) stack_mode=skip
269
270 @{ipv6_address_origin_list} ${linklocal_addr_after_reboot}=
271 ... Get Address Origin List And Address For Type LinkLocal
272
273 # Verifying the linklocal must be the same before and after reboot.
274 Should Be Equal ${linklocal_addr_before_reboot} ${linklocal_addr_after_reboot}
275 ... msg=IPv6 Linklocal address has changed after reboot.
276
277
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600278*** Keywords ***
279
Prashanth Katti3270fd02021-06-11 08:02:22 -0500280Suite Setup Execution
281 [Documentation] Do suite setup execution.
282
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -0500283 Redfish.Login
Prashanth Katti3270fd02021-06-11 08:02:22 -0500284 ${active_channel_config}= Get Active Channel Config
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -0500285 Set Suite Variable ${active_channel_config}
286
Prashanth Katti3270fd02021-06-11 08:02:22 -0500287 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
288
289 Set Suite variable ${ethernet_interface}
290
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500291 ${initial_ipv4_addressorigin_list} ${initial_ipv4_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses
292 ${initial_ipv6_addressorigin_list} ${initial_ipv6_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses
293
294 Set Suite Variable ${initial_ipv4_addressorigin_list}
295 Set Suite Variable ${initial_ipv4_addr_list}
296 Set Suite Variable ${initial_ipv6_addressorigin_list}
297 Set Suite Variable ${initial_ipv6_addr_list}
298
Prashanth Katti3270fd02021-06-11 08:02:22 -0500299
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600300Test Setup Execution
301 [Documentation] Test setup execution.
302
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600303 @{ipv6_network_configurations}= Get IPv6 Network Configuration
304 Set Test Variable @{ipv6_network_configurations}
305
306 # Get BMC IPv6 address and prefix length.
307 ${ipv6_data}= Get BMC IPv6 Info
308 Set Test Variable ${ipv6_data}
309
310
311Test Teardown Execution
312 [Documentation] Test teardown execution.
313
314 FFDC On Test Case Fail
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600315
316
317Get IPv6 Network Configuration
318 [Documentation] Get Ipv6 network configuration.
319 # Sample output:
320 # {
ganesanb4d430282023-04-27 14:33:23 +0000321 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0",
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600322 # "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface",
323 # "DHCPv4": {
324 # "DHCPEnabled": false,
325 # "UseDNSServers": false,
326 # "UseDomainName": true,
327 # "UseNTPServers": false
328 # },
329 # "DHCPv6": {
330 # "OperatingMode": "Disabled",
331 # "UseDNSServers": false,
332 # "UseDomainName": true,
333 # "UseNTPServers": false
334 # },
335 # "Description": "Management Network Interface",
336 # "FQDN": "localhost",
337 # "HostName": "localhost",
338 # "IPv4Addresses": [
339 # {
340 # "Address": "xx.xx.xx.xx",
341 # "AddressOrigin": "Static",
342 # "Gateway": "xx.xx.xx.1",
343 # "SubnetMask": "xx.xx.xx.0"
344 # },
345 # {
346 # "Address": "169.254.xx.xx",
347 # "AddressOrigin": "IPv4LinkLocal",
348 # "Gateway": "0.0.0.0",
349 # "SubnetMask": "xx.xx.0.0"
350 # },
351 # ],
352 # "IPv4StaticAddresses": [
353 # {
354 # "Address": "xx.xx.xx.xx",
355 # "AddressOrigin": "Static",
356 # "Gateway": "xx.xx.xx.1",
357 # "SubnetMask": "xx.xx.0.0"
358 # }
359 # }
360 # ],
361 # "IPv6AddressPolicyTable": [],
362 # "IPv6Addresses": [
363 # {
364 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx",
365 # "AddressOrigin": "LinkLocal",
366 # "AddressState": null,
367 # "PrefixLength": xx
368 # }
369 # ],
370 # "IPv6DefaultGateway": "",
371 # "IPv6StaticAddresses": [
372 # { "Address": "xxxx:xxxx:xxxx:xxxx::xxxx",
373 # "AddressOrigin": "Static",
374 # "AddressState": null,
375 # "PrefixLength": xxx
376 # }
377 # ],
378 # "Id": "eth0",
379 # "InterfaceEnabled": true,
380 # "LinkStatus": "LinkUp",
381 # "MACAddress": "xx:xx:xx:xx:xx:xx",
382 # "Name": "Manager Ethernet Interface",
383 # "NameServers": [],
384 # "SpeedMbps": 0,
385 # "StaticNameServers": [],
386 # "Status": {
387 # "Health": "OK",
388 # "HealthRollup": "OK",
389 # "State": "Enabled"
390 # },
391 # "VLANs": {
ganesanb4d430282023-04-27 14:33:23 +0000392 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0/VLANs"
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600393
394
395 ${active_channel_config}= Get Active Channel Config
396 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
397
398 @{ipv6_network_configurations}= Get From Dictionary ${resp.dict} IPv6StaticAddresses
George Keishing409df052024-01-17 22:36:14 +0530399 RETURN @{ipv6_network_configurations}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500400
401
402Verify IPv6 And PrefixLength
403 [Documentation] Verify IPv6 address and prefix length on BMC.
404 [Arguments] ${ipv6_addr} ${prefix_len}
405
406 # Description of the argument(s):
407 # ipv6_addr IPv6 address to be verified.
408 # prefix_len PrefixLength value to be verified.
409
410 # Catenate IPv6 address and its prefix length.
411 ${ipv6_with_prefix}= Catenate ${ipv6_addr}/${prefix_len}
412
413 # Get IPv6 address details on BMC using IP command.
414 @{ip_data}= Get BMC IPv6 Info
415
416 # Verify if IPv6 and prefix length is configured on BMC.
417
418 Should Contain ${ip_data} ${ipv6_with_prefix}
419 ... msg=IPv6 and prefix length pair does not exist.
420
421
422Configure IPv6 Address On BMC
423 [Documentation] Add IPv6 Address on BMC.
424 [Arguments] ${ipv6_addr} ${prefix_len} ${valid_status_codes}=${HTTP_OK}
425
426 # Description of argument(s):
427 # ipv6_addr IPv6 address to be added (e.g. "2001:EEEE:2222::2022").
428 # prefix_len Prefix length for the IPv6 to be added
429 # (e.g. "64").
430 # valid_status_codes Expected return code from patch operation
431 # (e.g. "200").
432
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500433 ${prefix_length}= Convert To Integer ${prefix_len}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500434 ${empty_dict}= Create Dictionary
435 ${ipv6_data}= Create Dictionary Address=${ipv6_addr}
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500436 ... PrefixLength=${prefix_length}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500437
438 ${patch_list}= Create List
439
440 # Get existing static IPv6 configurations on BMC.
441 ${ipv6_network_configurations}= Get IPv6 Network Configuration
442 ${num_entries}= Get Length ${ipv6_network_configurations}
443
444 FOR ${INDEX} IN RANGE 0 ${num_entries}
445 Append To List ${patch_list} ${empty_dict}
446 END
447
George Keishinge6e161e2025-05-08 10:18:30 +0530448 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}'
449 ... ${HTTP_OK},${HTTP_NO_CONTENT}
450 ... ${valid_status_codes}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500451
452 # We need not check for existence of IPv6 on BMC while adding.
453 Append To List ${patch_list} ${ipv6_data}
454 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
455
456 ${active_channel_config}= Get Active Channel Config
457 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
458
459 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
460 ... valid_status_codes=[${valid_status_codes}]
461
462 Return From Keyword If '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}'
463
464 # Note: Network restart takes around 15-18s after patch request processing.
465 Sleep ${NETWORK_TIMEOUT}s
466 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
467
468 Verify IPv6 And PrefixLength ${ipv6_addr} ${prefix_len}
469
470 # Verify if existing static IPv6 addresses still exist.
471 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
472 Verify IPv6 On BMC ${ipv6_network_configuration['Address']}
473 END
474
475 Validate IPv6 Network Config On BMC
476
477
478Validate IPv6 Network Config On BMC
479 [Documentation] Check that IPv6 network info obtained via redfish matches info
480 ... obtained via CLI.
Sridevi Rameshed94c692025-09-07 23:41:10 -0500481
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500482 @{ipv6_network_configurations}= Get IPv6 Network Configuration
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500483 ${ipv6_data}= Get BMC IPv6 Info
484 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
485 Should Contain Match ${ipv6_data} ${ipv6_network_configuration['Address']}/*
486 ... msg=IPv6 address does not exist.
487 END
488
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500489
490Delete IPv6 Address
491 [Documentation] Delete IPv6 address of BMC.
Prashanth Kattibcb9dab2025-04-01 12:58:37 -0500492 [Arguments] ${ipv6_addr}
493 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500494
495 # Description of argument(s):
496 # ipv6_addr IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234").
497 # valid_status_codes Expected return code from patch operation
498 # (e.g. "200"). See prolog of rest_request
499 # method in redfish_plus.py for details.
500
501 ${empty_dict}= Create Dictionary
502 ${patch_list}= Create List
503
504 @{ipv6_network_configurations}= Get IPv6 Network Configuration
505 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
506 IF '${ipv6_network_configuration['Address']}' == '${ipv6_addr}'
507 Append To List ${patch_list} ${null}
508 ELSE
509 Append To List ${patch_list} ${empty_dict}
510 END
511 END
512
513 ${ip_found}= Run Keyword And Return Status List Should Contain Value
514 ... ${patch_list} ${null} msg=${ipv6_addr} does not exist on BMC
515 Pass Execution If ${ip_found} == ${False} ${ipv6_addr} does not exist on BMC
516
517 # Run patch command only if given IP is found on BMC
518 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
519
520 ${active_channel_config}= Get Active Channel Config
521 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
522
523 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
Sweta Potthuria1981612025-05-09 05:41:10 -0500524 ... valid_status_codes=${valid_status_codes}
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500525
526 # Note: Network restart takes around 15-18s after patch request processing
527 Sleep ${NETWORK_TIMEOUT}s
528 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
529
530 # IPv6 address that is deleted should not be there on BMC.
531 ${delete_status}= Run Keyword And Return Status Verify IPv6 On BMC ${ipv6_addr}
Anvesh-Kumar_Rayankula3a26c662025-04-16 01:19:26 -0500532 IF '${valid_status_codes}' == '[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]'
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500533 Should Be True '${delete_status}' == '${False}'
534 ELSE
535 Should Be True '${delete_status}' == '${True}'
536 END
537
538 Validate IPv6 Network Config On BMC
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500539
540
541Modify IPv6 Address
542 [Documentation] Modify and verify IPv6 address of BMC.
543 [Arguments] ${ipv6} ${new_ipv6} ${prefix_len}
544 ... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
545
546 # Description of argument(s):
547 # ipv6 IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
548 # new_ipv6 New IPv6 address to be configured.
549 # prefix_len Prefix length value (Range 1 to 128).
550 # valid_status_codes Expected return code from patch operation
551 # (e.g. "200", "201").
552
553 ${empty_dict}= Create Dictionary
554 ${patch_list}= Create List
555 ${prefix_length}= Convert To Integer ${prefix_len}
556 ${ipv6_data}= Create Dictionary
557 ... Address=${new_ipv6} PrefixLength=${prefix_length}
558
559 # Sample IPv6 network configurations:
560 # "IPv6AddressPolicyTable": [],
561 # "IPv6Addresses": [
562 # {
563 # "Address": "X002:db8:0:2::XX0",
564 # "AddressOrigin": "DHCPv6",
565 # "PrefixLength": 128
566 # },
567 # {
568 # "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX",
569 # "AddressOrigin": "SLAAC",
570 # "PrefixLength": 64
571 # },
572 # {
573 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
574 # "AddressOrigin": "Static",
575 # "PrefixLength": 56
576 # },
577 # {
578 # "Address": “Z002:db8:0:2:a94:efff:fe82:5000",
579 # "AddressOrigin": "Static",
580 # "PrefixLength": 56
581 # },
582 # {
583 # "Address": “Xe80::a94:efff:YYYY:XXXX",
584 # "AddressOrigin": "LinkLocal",
585 # "PrefixLength": 64
586 # },
587 # {
588 # "Address": “X002:db8:1:2:eff:233:fee:546",
589 # "AddressOrigin": "Static",
590 # "PrefixLength": 56
591 # }
592 # ],
593 # "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”,
594 # "IPv6StaticAddresses": [
595 # {
596 # "Address": “X002:db8:0:2:a94:efff:fe82:5000",
597 # "PrefixLength": 56
598 # },
599 # {
600 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
601 # "PrefixLength": 56
602 # },
603 # {
604 # "Address": “Z002:db8:1:2:eff:233:fee:546",
605 # "PrefixLength": 56
606 # }
607 # ],
608 # "IPv6StaticDefaultGateways": [],
609
610 # Find the position of IPv6 address to be modified.
611 @{ipv6_network_configurations}= Get IPv6 Network Configuration
612 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
George Keishinge6e161e2025-05-08 10:18:30 +0530613 IF '${ipv6_network_configuration['Address']}' == '${ipv6}'
614 Append To List ${patch_list} ${ipv6_data}
615 ELSE
616 Append To List ${patch_list} ${empty_dict}
617 END
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500618 END
619
620 # Modify the IPv6 address only if given IPv6 is found
621 ${ip_found}= Run Keyword And Return Status List Should Contain Value
622 ... ${patch_list} ${ipv6_data} msg=${ipv6} does not exist on BMC
623 Pass Execution If ${ip_found} == ${False} ${ipv6} does not exist on BMC
624
625 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
626
627 ${active_channel_config}= Get Active Channel Config
628 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
629
630 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
631 ... body=&{data} valid_status_codes=${valid_status_codes}
632
633 # Note: Network restart takes around 15-18s after patch request processing.
634 Sleep ${NETWORK_TIMEOUT}s
635 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
636
637 # Verify if new IPv6 address is configured on BMC.
638 Verify IPv6 On BMC ${new_ipv6}
639
640 # Verify if old IPv6 address is erased.
641 ${cmd_status}= Run Keyword And Return Status
642 ... Verify IPv6 On BMC ${ipv6}
643 Should Be Equal ${cmd_status} ${False} msg=Old IPv6 address is not deleted.
644
645 Validate IPv6 Network Config On BMC
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500646
647
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500648Set SLAAC Configuration State And Verify
649 [Documentation] Set SLAAC configuration state and verify.
Sridevi Rameshed94c692025-09-07 23:41:10 -0500650 [Arguments] ${slaac_state} ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
651 ... ${channel_number}=${CHANNEL_NUMBER}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500652
653 # Description of argument(s):
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500654 # slaac_state SLAAC state('True' or 'False').
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500655 # valid_status_code Expected valid status codes.
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500656 # channel_number Channel number 1(eth0) or 2(eth1).
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500657
658 ${active_channel_config}= Get Active Channel Config
659 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
660
661 ${data}= Set Variable If ${slaac_state} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC}
662 ${resp}= Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
Sweta Potthuri610f86f2025-05-30 00:47:23 -0500663 ... body=${data} valid_status_codes=${valid_status_codes}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500664
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500665 # Verify SLAAC is set correctly.
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500666 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
667 ${slaac_verify}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig
668
George Keishinge6e161e2025-05-08 10:18:30 +0530669 IF '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}'
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500670 Fail msg=SLAAC not set properly.
George Keishinge6e161e2025-05-08 10:18:30 +0530671 END
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500672
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500673Set And Verify DHCPv6 Property
674 [Documentation] Set DHCPv6 property and verify.
675 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER}
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500676
677 # Description of argument(s):
678 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled').
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500679 # channel_number Channel number 1 or 2.
680
681 Set DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number}
682 Verify DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number}
683
684
685Set DHCPv6 Property
686 [Documentation] Set DHCPv6 attribute is enables or disabled.
687 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER}
688
689 # Description of argument(s):
690 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled').
691 # channel_number Channel number 1 or 2.
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500692
693 ${data}= Set Variable If '${dhcpv6_operating_mode}' == 'Disabled' ${DISABLE_DHCPv6} ${ENABLE_DHCPv6}
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500694 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
695
696 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
697 ... body=${data} valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}]
698
kvishalbd04bd62025-08-05 03:57:53 -0500699
700Verify DHCPv6 Property
701 [Documentation] Verify DHCPv6 settings is enabled or disabled.
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500702 [Arguments] ${dhcpv6_operating_mode} ${channel_number}=${CHANNEL_NUMBER}
kvishalbd04bd62025-08-05 03:57:53 -0500703
704 # Description of Argument(s):
705 # dhcpv6_operating_mode Enable/ Disable DHCPv6.
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500706 # channel_number Channel number 1 or 2.
707
708 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
kvishalbd04bd62025-08-05 03:57:53 -0500709
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500710 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
711 ${dhcpv6_verify}= Get From Dictionary ${resp.dict} DHCPv6
712
713 Should Be Equal '${dhcpv6_verify['OperatingMode']}' '${dhcpv6_operating_mode}'
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500714
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500715
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500716Get IPv6 Static Default Gateway
717 [Documentation] Get IPv6 static default gateway.
718
719 ${active_channel_config}= Get Active Channel Config
720 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
721
722 @{ipv6_static_defgw_configurations}= Get From Dictionary ${resp.dict} IPv6StaticDefaultGateways
723 RETURN @{ipv6_static_defgw_configurations}
724
Sweta Potthuri2d085732025-07-16 09:10:08 -0500725
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500726Configure IPv6 Static Default Gateway On BMC
727 [Documentation] Configure IPv6 static default gateway on BMC.
728 [Arguments] ${ipv6_gw_addr} ${prefix_length_def}
729 ... ${valid_status_codes}=${HTTP_OK}
Sridevi Rameshed94c692025-09-07 23:41:10 -0500730
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500731 # Description of argument(s):
732 # ipv6_gw_addr IPv6 Static Default Gateway address to be configured.
733 # prefix_len_def Prefix length value (Range 1 to 128).
734 # valid_status_codes Expected return code from patch operation
735 # (e.g. "200", "204".)
736
737 # Prefix Length is passed as None.
738 IF '${prefix_length_def}' == '${None}'
739 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr}
740 ELSE
741 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr} Prefix Length=${prefix_length_def}
742 END
743
744 ${ipv6_static_def_gw}= Get IPv6 Static Default Gateway
745
746 ${num_entries}= Get Length ${ipv6_static_def_gw}
747
748 ${patch_list}= Create List
749 ${empty_dict}= Create Dictionary
750
751 FOR ${INDEX} IN RANGE 0 ${num_entries}
752 Append To List ${patch_list} ${empty_dict}
753 END
754
755 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}'
756 ... ${HTTP_OK},${HTTP_NO_CONTENT}
757 ... ${valid_status_codes}
758
759 Append To List ${patch_list} ${ipv6_gw}
760 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
761
762 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
763 ... body=${data} valid_status_codes=[${valid_status_codes}]
764
765 # Verify the added static default gateway is present in Redfish Get Output.
766 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway
767
768 ${ipv6_static_def_gw_list}= Create List
769 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway}
770 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
771 Append To List ${ipv6_static_def_gw_list} ${value}
772 END
773
774 IF '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}'
775 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
776 ELSE
777 Should Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
778 END
779
Sweta Potthuri2d085732025-07-16 09:10:08 -0500780
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -0500781Modify IPv6 Static Default Gateway On BMC
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500782 [Documentation] Modify and verify IPv6 address of BMC.
783 [Arguments] ${ipv6_gw_addr} ${new_static_def_gw} ${prefix_length}
784 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED}]
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500785
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500786 # Description of argument(s):
787 # ipv6_gw_addr IPv6 static default gateway address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
788 # new_static_def_gw New static default gateway address to be configured.
Sridevi Rameshed94c692025-09-07 23:41:10 -0500789 # prefix_length Prefix length value (Range 1 to 128).
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500790 # valid_status_codes Expected return code from patch operation
791 # (e.g. "200", "204").
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500792
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500793 ${empty_dict}= Create Dictionary
794 ${patch_list}= Create List
795 # Prefix Length is passed as None.
796 IF '${prefix_length_def}' == '${None}'
797 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw}
798 ELSE
799 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw} Prefix Length=${prefix_length_def}
800 END
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500801
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500802 @{ipv6_static_def_gw_list}= Get IPv6 Static Default Gateway
803
804 FOR ${ipv6_static_def_gw} IN @{ipv6_static_def_gw_list}
805 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}'
806 Append To List ${patch_list} ${modified_ipv6_gw_addripv6_data}
807 ELSE
808 Append To List ${patch_list} ${empty_dict}
809 END
810 END
811
812 # Modify the IPv6 address only if given IPv6 static default gateway is found.
813 ${ip_static_def_gw_found}= Run Keyword And Return Status List Should Contain Value
814 ... ${patch_list} ${modified_ipv6_gw_addripv6_data} msg=${ipv6_gw_addr} does not exist on BMC
815 Pass Execution If ${ip_static_def_gw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC
816
817 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
818
819 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
820 ... body=&{data} valid_status_codes=${valid_status_codes}
821
822 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway
823
824 ${ipv6_static_def_gw_list}= Create List
825 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway}
Sweta Potthuri2d085732025-07-16 09:10:08 -0500826 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500827 Append To List ${ipv6_static_def_gw_list} ${value}
828 END
829
830 Should Contain ${ipv6_static_def_gw_list} ${new_static_def_gw}
831 # Verify if old static default gateway address is erased.
832 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
833
Sweta Potthuri2d085732025-07-16 09:10:08 -0500834
835Delete IPv6 Static Default Gateway
836 [Documentation] Delete IPv6 static default gateway on BMC.
837 [Arguments] ${ipv6_gw_addr}
838 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
839
840 # Description of argument(s):
841 # ipv6_gw_addr IPv6 Static Default Gateway address to be deleted.
842 # valid_status_codes Expected return code from patch operation
843 # (e.g. "200").
844
845 ${patch_list}= Create List
846 ${empty_dict}= Create Dictionary
847
848 ${ipv6_static_def_gw_list}= Create List
849 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway
850
851 FOR ${ipv6_staticdef_gateway} IN @{ipv6_static_defgw_configurations}
852 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
853 Append To List ${ipv6_static_def_gw_list} ${value}
854 END
855
856 ${defgw_found}= Run Keyword And Return Status List Should Contain Value
857 ... ${ipv6_static_def_gw_list} ${ipv6_gw_addr} msg=${ipv6_gw_addr} does not exist on BMC
858 Skip If ${defgw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC
859
860 FOR ${ipv6_static_def_gw} IN @{ipv6_static_defgw_configurations}
861 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}'
862 Append To List ${patch_list} ${null}
863 ELSE
864 Append To List ${patch_list} ${empty_dict}
865 END
866 END
867
868 # Run patch command only if given IP is found on BMC.
869 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
870
871 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
872 ... valid_status_codes=${valid_status_codes}
873
874 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
875
876 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway
877 Should Not Contain Match ${ipv6_static_defgw_configurations} ${ipv6_gw_addr}
878 ... msg=IPv6 Static default gateway does not exist.
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500879
880
881Check Coexistence Of Linklocalv6 And Static IPv6
882 [Documentation] Verify both linklocalv6 and static IPv6 exist.
883
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500884 # Verify the address origin contains static and linklocal.
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500885 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500886
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500887 Should Match Regexp ${ipv6_linklocal_addr} ${linklocal_addr_format}
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500888 Should Contain ${ipv6_addressorigin_list} Static
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -0500889
890
891Check If Linklocal Address Is In Correct Format
892 [Documentation] Linklocal address has network part fe80 and host part EUI64.
893
894 # Fetch the linklocal address.
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500895 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -0500896
897 # Follow EUI64 from MAC.
898 ${system_mac}= Get BMC MAC Address
899 ${split_octets}= Split String ${system_mac} :
900 ${first_octet}= Evaluate int('${split_octets[0]}', 16)
901 ${flipped_hex}= Evaluate format(${first_octet} ^ 2, '02x')
902 ${grp1}= Evaluate re.sub(r'^0+', '', '${flipped_hex}${split_octets[1]}') modules=re
903 ${grp2}= Evaluate re.sub(r'^0+', '', '${split_octets[2]}ff') modules=re
904 ${grp3}= Evaluate re.sub(r'^0+', '', '${split_octets[4]}${split_octets[5]}') modules=re
905 ${linklocal}= Set Variable fe80::${grp1}:${grp2}:fe${split_octets[3]}:${grp3}
906
907 # Verify the linklocal obtained is the same as on the machine.
908 Should Be Equal ${linklocal} ${ipv6_linklocal_addr}
909
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500910
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500911Check BMC Gets SLAAC Address
912 [Documentation] Check BMC gets slaac address.
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500913
914 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC
915
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500916
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500917Get The Initial DHCPv6 Setting On Each Interface
918 [Documentation] Get the initial DHCPv6 setting of each interface.
919 [Arguments] ${channel_number}
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500920
921 # Description of the argument(s):
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500922 # channel_number Channel number 1 or 2.
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500923
924 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']}
925 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
926 ${initial_dhcpv6_iface}= Get From Dictionary ${resp.dict} DHCPv6
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500927 IF ${channel_number}==${1}
928 Set Test Variable ${dhcpv6_channel_1} ${initial_dhcpv6_iface['OperatingMode']}
929 ELSE
930 Set Test Variable ${dhcpv6_channel_2} ${initial_dhcpv6_iface['OperatingMode']}
931 END
932
933
934Get The Initial DHCPv6 Settings
935 [Documentation] Get the initial DHCPv6 settings of both the interfaces.
936
937 Get The Initial DHCPv6 Setting On Each Interface ${1}
938 Get The Initial DHCPv6 Setting On Each Interface ${2}
939
940
941Get The Initial SLAAC Settings
942 [Documentation] Get the initial SLAAC settings of both the interfaces.
943
944 Get The Initial SLAAC Setting On Each Interface ${1}
945 Get The Initial SLAAC Setting On Each Interface ${2}
946
947
948Get The Initial SLAAC Setting On Each Interface
949 [Documentation] Get the initial SLAAC setting of the interface.
950 [Arguments] ${channel_number}
951
952 # Description of the argument(s):
953 # channel_number Channel number 1 or 2.
954
955 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']}
956 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
957 ${initial_slaac_iface}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig
958 IF ${channel_number}==${1}
959 Set Test Variable ${slaac_channel_1} ${initial_slaac_iface['IPv6AutoConfigEnabled']}
960 ELSE
961 Set Test Variable ${slaac_channel_2} ${initial_slaac_iface['IPv6AutoConfigEnabled']}
962 END
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500963
964
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500965Get Address Origin List And Address For Type
966 [Documentation] Get address origin list and address for type.
967 [Arguments] ${ipv6_address_type}
968
969 # Description of the argument(s):
970 # ipv6_address_type Type of IPv6 address to be checked.
971
972 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
973 @{ipv6_addresses}= Get From Dictionary ${resp.dict} IPv6Addresses
974
975 ${ipv6_addressorigin_list}= Create List
976 ${ipv6_slaac_addr}= Set Variable ${None}
977 FOR ${ipv6_address} IN @{ipv6_addresses}
978 ${ipv6_addressorigin}= Get From Dictionary ${ipv6_address} AddressOrigin
979 Append To List ${ipv6_addressorigin_list} ${ipv6_addressorigin}
980 IF '${ipv6_addressorigin}' == '${ipv6_address_type}'
981 Set Test Variable ${ipv6_type_addr} ${ipv6_address['Address']}
982 END
983 END
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500984 Should Contain ${ipv6_addressorigin_list} ${ipv6_address_type}
985 Should Not Be Empty ${ipv6_type_addr} msg=${ipv6_address_type} address is not present
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500986 RETURN @{ipv6_addressorigin_list} ${ipv6_type_addr}
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500987
988
989Get Address Origin List And IPv4 or IPv6 Address
990 [Documentation] Get address origin list and address for type.
991 [Arguments] ${ip_address_type}
992
993 # Description of the argument(s):
Sridevi Rameshed94c692025-09-07 23:41:10 -0500994 # ip_address_type Type of IPv4 or IPv6 address to be checked.
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500995
996 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
997 @{ip_addresses}= Get From Dictionary ${resp.dict} ${ip_address_type}
998
999 ${ip_addressorigin_list}= Create List
1000 ${ip_addr_list}= Create List
1001 FOR ${ip_address} IN @{ip_addresses}
1002 ${ip_addressorigin}= Get From Dictionary ${ip_address} AddressOrigin
1003 Append To List ${ip_addressorigin_list} ${ip_addressorigin}
1004 Append To List ${ip_addr_list} ${ip_address['Address']}
1005 END
1006 RETURN ${ip_addressorigin_list} ${ip_addr_list}
1007
1008
1009Verify All The Addresses Are Intact
1010 [Documentation] Verify all the addresses and address origins remain intact.
1011
1012 # Verify that it will not impact the IPv4 configuration.
1013 Sleep ${NETWORK_TIMEOUT}
1014 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
1015
1016 # IPv6 address must be present.
1017 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC
1018 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
1019
1020 # IPv4 and IPv6 addresses must remain intact.
1021 ${ipv4_addressorigin_list} ${ipv4_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses
1022 ${ipv6_addressorigin_list} ${ipv6_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses
1023
1024 ${ipv6_is_subset}= Evaluate set(${initial_ipv6_addr_list}).issubset(set(${ipv6_addr_list}))
1025 Should Be True ${ipv6_is_subset}
1026
1027 Should be Equal ${initial_ipv4_addressorigin_list} ${ipv4_addressorigin_list}
1028 Should be Equal ${initial_ipv4_addr_list} ${ipv4_addr_list}
Sweta Potthurif3d188f2025-09-08 07:17:31 -05001029
1030
1031Get Interface ID Of IPv6
1032 [Documentation] Get interface id of IPv6 address.
1033 [Arguments] ${ipv6_address}
1034
1035 # Description of the argument(s):
1036 # ${ipv6_address} IPv6 Address to extract the last 4 hextets.
1037
1038 # Last 64 bits of SLAAC and Linklocal must be the same.
1039 # Sample IPv6 network configurations.
1040 #"IPv6AddressPolicyTable": [],
1041 # "IPv6Addresses": [
1042 # {
1043 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx",
1044 # "AddressOrigin": "LinkLocal",
1045 # "AddressState": null,
1046 # "PrefixLength": xx
1047 # }
1048 # ],
1049 # {
1050 # "Address": "2002:xxxx:xxxx:xxxx:xxxx",
1051 # "AddressOrigin": "SLAAC",
1052 # "PrefixLength": 64
1053 # }
1054 # ],
1055
1056 ${split_ip_address}= Split String ${ipv6_address} :
1057 ${missing_ip}= Evaluate 8 - len(${split_ip_address}) + 1
1058 ${expanded_ip}= Create List
1059
1060 FOR ${hextet} IN @{split_ip_address}
1061 IF '${hextet}' == ''
1062 FOR ${i} IN RANGE ${missing_ip}
1063 Append To List ${expanded_ip} 0000
1064 END
1065 ELSE
1066 Append To List ${expanded_ip} ${hextet}
1067 END
1068 END
1069 ${interface_id}= Evaluate ':'.join(${expanded_ip}[-4:])
1070 RETURN ${interface_id}