blob: 5a9d57294d0e92bb210b5845d1a44372a4142c8b [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
Sweta Potthuri2f3fbb52025-09-19 00:50:47 -05009Resource ../../lib/bmc_network_utils.robot
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060010Library ../../lib/bmc_network_utils.py
11Library Collections
Sweta Potthuri35c503b2025-07-27 23:36:20 -050012Library Process
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060013
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -050014Test Setup Test Setup Execution
15Test Teardown Test Teardown Execution
16Suite Setup Suite Setup Execution
17Suite Teardown Redfish.Logout
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060018
Matt Fischer6fb70d92023-10-24 19:06:33 -060019Test Tags BMC_IPv6
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060020
21*** Variables ***
Sweta Potthuri2edacd32025-07-02 01:04:43 -050022${test_ipv6_addr} 2001:db8:3333:4444:5555:6666:7777:8888
23${test_ipv6_invalid_addr} 2001:db8:3333:4444:5555:6666:7777:JJKK
24${test_ipv6_addr1} 2001:db8:3333:4444:5555:6666:7777:9999
kvishal9c6774c2025-09-10 02:14:07 -050025${invalid_hexadec_ipv6} x:x:x:x:x:x:10.5.5.6
26${ipv6_multi_short} 2001::33::111
George Keishinge16f1582022-12-15 07:32:21 -060027# Valid prefix length is a integer ranges from 1 to 128.
Sweta Potthuri2edacd32025-07-02 01:04:43 -050028${test_prefix_length} 64
29${ipv6_gw_addr} 2002:903:15F:32:9:3:32:1
30${prefix_length_def} None
31${invalid_staticv6_gateway} 9.41.164.1
Sweta Potthuri2f3fbb52025-09-19 00:50:47 -050032${new_mac_addr} AA:E2:84:14:28:79
abhijith-1219e190dd2025-10-15 03:35:06 -050033${linklocal_addr_format} fe80::[0-9a-f:]+$
34${link_local_addr} fe80::
35${link_local_prefix_len} 10
abhijith-121b9fc2742025-10-14 09:46:43 -050036${ipv6_leading_zero} 2001:0022:0033::0111
37${ipv6_eliminate_zero} 2001:22:33::111
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060038
39*** Test Cases ***
40
41Get IPv6 Address And Verify
42 [Documentation] Get IPv6 Address And Verify.
43 [Tags] Get_IPv6_Address_And_Verify
44
45 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
46 Verify IPv6 On BMC ${ipv6_network_configuration['Address']}
47 END
48
49
Prashanth Katti2c73abc2021-03-17 07:42:25 -050050Get PrefixLength And Verify
51 [Documentation] Get IPv6 prefix length and verify.
52 [Tags] Get_PrefixLength_And_Verify
53
54 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
55 Verify IPv6 On BMC ${ipv6_network_configuration['PrefixLength']}
56 END
57
58
59Get IPv6 Default Gateway And Verify
George Keishing96143832021-03-23 07:55:08 -050060 [Documentation] Get IPv6 default gateway and verify.
George Keishingade6ab42022-07-19 11:41:03 -050061 [Tags] Get_IPv6_Default_Gateway_And_Verify
Prashanth Katti2c73abc2021-03-17 07:42:25 -050062
63 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
64 ${ipv6_gateway}= Get From Dictionary ${resp.dict} IPv6DefaultGateway
65 Verify IPv6 Default Gateway On BMC ${ipv6_gateway}
66
67
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050068Verify All Configured IPv6 And PrefixLength On BMC
69 [Documentation] Verify IPv6 address and its prefix length on BMC.
70 [Tags] Verify_All_Configured_IPv6_And_PrefixLength_On_BMC
71
72 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
George Keishingf02ca2b2023-04-05 22:11:03 +053073 Verify IPv6 And PrefixLength ${ipv6_network_configuration['Address']}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050074 ... ${ipv6_network_configuration['PrefixLength']}
75 END
76
77
78Configure IPv6 Address And Verify
79 [Documentation] Configure IPv6 address and verify.
80 [Tags] Configure_IPv6_Address_And_Verify
Anvesh-Kumar_Rayankula3a26c662025-04-16 01:19:26 -050081 [Teardown] Run Keywords
82 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050083 [Template] Configure IPv6 Address On BMC
84
85
86 # IPv6 address Prefix length
87 ${test_ipv6_addr} ${test_prefix_length}
88
89
Prashanth Katti12ed4b72023-05-16 05:24:00 -050090Delete IPv6 Address And Verify
91 [Documentation] Delete IPv6 address and verify.
92 [Tags] Delete_IPv6_Address_And_Verify
93
94 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
95
96 Delete IPv6 Address ${test_ipv6_addr}
97
98
George Keishingcc288312024-10-22 10:13:12 +053099Modify IPv6 Address And Verify
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500100 [Documentation] Modify IPv6 address and verify.
101 [Tags] Modify_IPv6_Address_And_Verify
kvishal88de8c42025-03-04 01:45:10 -0600102 [Teardown] Run Keywords
George Keishingcfdd0992025-03-17 11:59:20 +0530103 ... Delete IPv6 Address ${test_ipv6_addr1} AND Test Teardown Execution
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500104
105 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
106
107 Modify IPv6 Address ${test_ipv6_addr} ${test_ipv6_addr1} ${test_prefix_length}
108
109
Sweta Potthuriafe858e2025-02-25 23:52:51 -0600110Verify Persistency Of IPv6 After BMC Reboot
111 [Documentation] Verify persistency of IPv6 after BMC reboot.
112 [Tags] Verify_Persistency_Of_IPv6_After_BMC_Reboot
113 [Teardown] Run Keywords
114 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution
115
116 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
117
118 Redfish OBMC Reboot (off) stack_mode=skip
119
120 # Verifying persistency of IPv6.
121 Verify IPv6 On BMC ${test_ipv6_addr}
122
123
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500124Enable SLAAC On BMC And Verify
125 [Documentation] Enable SLAAC on BMC and verify.
126 [Tags] Enable_SLAAC_On_BMC_And_Verify
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500127
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500128 Set SLAAC Configuration State And Verify ${True}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500129
130
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500131Enable DHCPv6 Property On BMC And Verify
132 [Documentation] Enable DHCPv6 property on BMC and verify.
133 [Tags] Enable_DHCPv6_Property_On_BMC_And_Verify
134
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500135 Set And Verify DHCPv6 Property Enabled
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500136
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500137
kvishal0d199a92025-05-29 02:35:18 -0500138Disable DHCPv6 Property On BMC And Verify
139 [Documentation] Disable DHCPv6 property on BMC and verify.
140 [Tags] Disable_DHCPv6_Property_On_BMC_And_Verify
141
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500142 Set And Verify DHCPv6 Property Disabled
kvishalbd04bd62025-08-05 03:57:53 -0500143
144
145Verify Persistency Of DHCPv6 On Reboot
146 [Documentation] Verify persistency of DHCPv6 property on reboot.
147 [Tags] Verify_Persistency_Of_DHCPv6_On_Reboot
148
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500149 Set And Verify DHCPv6 Property Enabled
150 Redfish OBMC Reboot (off) stack_mode=skip
151 Verify DHCPv6 Property Enabled
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500152
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500153
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500154Configure Invalid Static IPv6 And Verify
155 [Documentation] Configure invalid static IPv6 and verify.
156 [Tags] Configure_Invalid_Static_IPv6_And_Verify
157 [Template] Configure IPv6 Address On BMC
158
kvishal9c6774c2025-09-10 02:14:07 -0500159 #invalid_ipv6 prefix length valid_status_code
160 ${ipv4_hexword_addr} ${test_prefix_length} ${HTTP_BAD_REQUEST}
161 ${invalid_hexadec_ipv6} ${test_prefix_length} ${HTTP_BAD_REQUEST}
162 ${ipv6_multi_short} ${test_prefix_length} ${HTTP_BAD_REQUEST}
163
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500164
Sweta Potthuri565318d2025-06-09 06:13:46 -0500165
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500166Configure IPv6 Static Default Gateway And Verify
167 [Documentation] Configure IPv6 static default gateway and verify.
168 [Tags] Configure_IPv6_Static_Default_Gateway_And_Verify
169 [Template] Configure IPv6 Static Default Gateway On BMC
Sweta Potthuri565318d2025-06-09 06:13:46 -0500170
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500171 # static_def_gw prefix length valid_status_code
172 ${ipv6_gw_addr} ${prefix_length_def} ${HTTP_OK}
173 ${invalid_staticv6_gateway} ${test_prefix_length} ${HTTP_BAD_REQUEST}
Sweta Potthuri565318d2025-06-09 06:13:46 -0500174
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500175
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500176Modify Static Default Gateway And Verify
177 [Documentation] Modify static default gateway and verify.
178 [Tags] Modify_Static_Default_Gateway_And_Verify
179 [Setup] Configure IPv6 Static Default Gateway On BMC ${ipv6_gw_addr} ${prefix_length_def}
180
181 Modify IPv6 Static Default Gateway On BMC ${test_ipv6_addr1} ${prefix_length_def} ${HTTP_OK} ${ipv6_gw_addr}
182
183
Sweta Potthuri2d085732025-07-16 09:10:08 -0500184Delete IPv6 Static Default Gateway And Verify
185 [Documentation] Delete IPv6 static default gateway and verify.
186 [Tags] Delete_IPv6_Static_Default_Gateway_And_Verify
187 [Setup] Configure IPv6 Static Default Gateway On BMC ${ipv6_gw_addr} ${prefix_length_def}
188
189 Delete IPv6 Static Default Gateway ${ipv6_gw_addr}
190
191
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500192Verify Coexistence Of Linklocalv6 And Static IPv6 On BMC
193 [Documentation] Verify linklocalv6 And static IPv6 both exist.
194 [Tags] Verify_Coexistence_Of_Linklocalv6_And_Static_IPv6_On_BMC
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -0500195 [Setup] Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
196 [Teardown] Delete IPv6 Address ${test_ipv6_addr}
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500197
198 Check Coexistence Of Linklocalv6 And Static IPv6
199
200
George Keishingbadb4c62025-09-18 16:14:12 +0530201Verify IPv6 Linklocal Address Is In Correct Format
202 [Documentation] Verify linklocal address has network part as fe80 and
203 ... host part as EUI64.
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -0500204 [Tags] Verify_IPv6_Linklocal_Address_Is_In_Correct_Format
205
206 Check If Linklocal Address Is In Correct Format
207
208
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500209Verify BMC Gets SLAAC Address On Enabling SLAAC
210 [Documentation] On enabling SLAAC verify SLAAC address comes up.
211 [Tags] Verify_BMC_Gets_SLAAC_Address_On_Enabling_SLAAC
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500212 [Setup] Set SLAAC Configuration State And Verify ${False}
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500213
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500214 Set SLAAC Configuration State And Verify ${True}
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500215 Sleep ${NETWORK_TIMEOUT}
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500216 Check BMC Gets SLAAC Address
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500217
218
Sweta Potthuri6370afd2025-10-08 00:07:46 -0500219Verify Enable And Disable SLAAC On Both Interfaces
220 [Documentation] Verify enable and disable SLAAC on both the interfaces.
221 [Tags] Verify_Enable_And_Disable_SLAAC_On_Both_Interfaces
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500222 [Setup] Get The Initial SLAAC Settings
Sweta Potthuri6370afd2025-10-08 00:07:46 -0500223 [Template] Set And Verify SLAAC Property On Both Interfaces
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500224 [Teardown] Run Keywords Set SLAAC Configuration State And Verify ${slaac_channel_1} [${HTTP_OK}] ${1}
225 ... AND Set SLAAC Configuration State And Verify ${slaac_channel_2} [${HTTP_OK}] ${2}
226
Sweta Potthuri6370afd2025-10-08 00:07:46 -0500227 # slaac_eth0 slaac_eth1
228 ${True} ${True}
229 ${True} ${False}
230 ${False} ${True}
231 ${False} ${False}
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500232
233
Sweta Potthuri425713a2025-10-16 00:28:20 -0500234Configure And Validate DHCPv6 Settings On Both Network Interfaces
235 [Documentation] Configure and validate the DHCPv6 enable/disable settings
236 ... on both network interfaces.
237 [Tags] Configure_And_Validate_DHCPv6_Settings_On_Both_Network_Interfaces
238 [Setup] Get The Initial DHCPv6 Settings
239 [Template] Set And Verify DHCPv6 Property On Both Interfaces
240 [Teardown] Run Keywords Set And Verify DHCPv6 Property ${dhcpv6_channel_1} ${1} AND
241 ... Set And Verify DHCPv6 Property ${dhcpv6_channel_2} ${2}
242
243 # DHCPv6_eth0 DHCPv6_eth1
244 Enabled Enabled
245 Enabled Disabled
246 Disabled Enabled
247 Disabled Disabled
248
249
abhijith-1213a645902025-09-08 01:12:34 -0500250Verify Autoconfig Is Present On Ethernet Interface
251 [Documentation] Verify autoconfig is present on ethernet interface.
252 [Tags] Verify_Autoconfig_Is_Present_On_Ethernet_Interface
253
254 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
255 Should Contain ${resp.dict} StatelessAddressAutoConfig
256
257
Sweta Potthurif3d188f2025-09-08 07:17:31 -0500258Verify Interface ID Of SLAAC And LinkLocal Addresses Are Same
259 [Documentation] Validate interface id of SLAAC and link-local addresses are same.
260 [Tags] Verify_Interface_ID_Of_SLAAC_And_LinkLocal_Addresses_Are_Same
261
262 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
263 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC
264
265 ${linklocal_interface_id}= Get Interface ID Of IPv6 ${ipv6_linklocal_addr}
266 ${slaac_interface_id}= Get Interface ID Of IPv6 ${ipv6_slaac_addr}
267
268 Should Be Equal ${linklocal_interface_id} ${slaac_interface_id}
269
270
abhijith-121c3e96d72025-09-09 11:35:09 -0500271Verify Persistency Of Link Local IPv6 On BMC Reboot
272 [Documentation] Verify persistency of link local on BMC reboot.
273 [Tags] Verify_Persistency_Of_Link_Local_IPv6_On_BMC_Reboot
274
275 # Capturing the linklocal before reboot.
276 @{ipv6_address_origin_list} ${linklocal_addr_before_reboot}=
277 ... Get Address Origin List And Address For Type LinkLocal
278
279 # Rebooting BMC.
280 Redfish OBMC Reboot (off) stack_mode=skip
281
282 @{ipv6_address_origin_list} ${linklocal_addr_after_reboot}=
283 ... Get Address Origin List And Address For Type LinkLocal
284
285 # Verifying the linklocal must be the same before and after reboot.
286 Should Be Equal ${linklocal_addr_before_reboot} ${linklocal_addr_after_reboot}
287 ... msg=IPv6 Linklocal address has changed after reboot.
288
289
Sweta Potthuri2f3fbb52025-09-19 00:50:47 -0500290Modify MAC and Verify BMC Reinitializing Linklocal
291 [Documentation] Modify MAC and verify BMC reinitializing linklocal.
292 [Tags] Modify_MAC_and_Verify_BMC_Reinitializing_Linklocal
293 [Teardown] Configure MAC Settings ${original_address}
294
295 ${original_address}= Get BMC MAC Address
296 @{ipv6_addressorigin_list} ${ipv6_before_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
297
298 # Modify MAC Address Of Ethernet Interface.
299 Configure MAC Settings ${new_mac_addr}
300 Sleep 30s
301 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
302 @{ipv6_addressorigin_list} ${ipv6_linklocal_after_addr}= Get Address Origin List And Address For Type LinkLocal
303
304 # Verify whether the linklocal has changed and is in the the correct format.
305 Check If Linklocal Address Is In Correct Format
306 Should Not Be Equal ${ipv6_before_linklocal_addr} ${ipv6_linklocal_after_addr}
307
308
abhijith-121bfbd03a2025-09-15 01:40:35 -0500309Add Multiple IPv6 Address And Verify
310 [Documentation] Add multiple IPv6 address and verify.
311 [Tags] Add_Multiple_IPv6_Address_And_Verify
312 [Teardown] Run Keywords
313 ... Delete IPv6 Address ${test_ipv6_addr} AND Delete IPv6 Address ${test_ipv6_addr1}
314 ... AND Test Teardown Execution
315
316 Configure Multiple IPv6 Address on BMC ${test_prefix_length}
317
318
abhijith-12197078c52025-09-25 01:13:00 -0500319Verify Coexistence Of Static IPv6 And SLAAC On BMC
abhijith-1214dc01a02025-09-24 11:29:55 -0500320 [Documentation] Verify static IPv6 And SLAAC both coexist.
abhijith-12197078c52025-09-25 01:13:00 -0500321 [Tags] Verify_Coexistence_Of_Static_IPv6_And_SLAAC_On_BMC
322 [Setup] Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
323 Set SLAAC Configuration State And Verify ${True}
324 [Teardown] Delete IPv6 Address ${test_ipv6_addr}
325
326 Sleep ${NETWORK_TIMEOUT}s
327
328 Check Coexistence Of Static IPv6 And SLAAC
329
330
abhijith-1218ff5db42025-09-24 06:24:03 -0500331Verify Coexistence Of Link Local And DHCPv6 On BMC
332 [Documentation] Verify link local And dhcpv6 both coexist.
333 [Tags] Verify_Coexistence_Of_Link_Local_And_DHCPv6_On_BMC
334 [Setup] Set DHCPv6 Property Enabled ${2}
335
336 Sleep ${NETWORK_TIMEOUT}s
337
338 Check Coexistence Of Link Local And DHCPv6
339
340
abhijith-1214dc01a02025-09-24 11:29:55 -0500341Verify Coexistence Of Link Local And SLAAC On BMC
342 [Documentation] Verify link local And SLAAC both coexist.
343 [Tags] Verify_Coexistence_Of_Link_Local_And_SLAAC_On_BMC
344 [Setup] Set SLAAC Configuration State And Verify ${True}
345
346 Sleep ${NETWORK_TIMEOUT}s
347
348 Check Coexistence Of Link Local And SLAAC
349
350
abhijith-121ffea1912025-10-06 02:39:22 -0500351Verify Coexistence Of All IPv6 Type Addresses On BMC
352 [Documentation] Verify coexistence of link local, static, DHCPv6 and SLAAC ipv6 addresses.
353 [Tags] Verify_Coexistence_Of_All_IPv6_Type_Addresses_On_BMC
354 [Setup] Run Keywords Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
355 ... AND Get The Initial DHCPv6 Setting On Each Interface ${1}
356 ... AND Set And Verify DHCPv6 Property Enabled
357 ... AND Get The Initial SLAAC Setting On Each Interface ${1}
358 ... AND Set SLAAC Configuration State And Verify ${True}
359 [Teardown] Run Keywords Delete IPv6 Address ${test_ipv6_addr}
360 ... AND Set And Verify DHCPv6 Property ${dhcpv6_channel_1} ${1}
361 ... AND Set SLAAC Configuration State And Verify ${slaac_channel_1} [${HTTP_OK}] ${1}
362
363 Sleep ${NETWORK_TIMEOUT}s
364
365 # Verify link local, static, DHCPv6 and SLAAC ipv6 addresses coexist.
366 Verify The Coexistence Of The Address Type LinkLocal Static DHCPv6 SLAAC
367
368
abhijith-1219e190dd2025-10-15 03:35:06 -0500369Configure Link Local IPv6 Address And Verify
370 [Documentation] Configure link local IPv6 address and verify.
371 [Tags] Configure_Link_Local_IPv6_Address_And_Verify
372
373 Configure IPv6 Address On BMC ${link_local_addr} ${link_local_prefix_len}
374
375 # Verify the address origin contains link local.
376 @{ipv6_address_origin_list} ${ipv6_link_local_addr}=
377 ... Get Address Origin List And Address For Type LinkLocal
378
379 ${count}= Evaluate ${ipv6_address_origin_list}.count("LinkLocal")
380
381 Should Be Equal As Integers ${count} 2
382
383
abhijith-121b9fc2742025-10-14 09:46:43 -0500384Configure IPv6 With Leading Zeros And Verify
385 [Documentation] Configure IPv6 with leading zeros & verify address is configured by eliminating 0s in multiple hextets.
386 [Tags] Configure_IPv6_with_Leading_Zeros_And_Verify
387 [Teardown] Run Keywords
388 ... Delete IPv6 Address ${ipv6_eliminate_zero} AND Test Teardown Execution
389
390 #Verify 2001:0022:0033::0111 configured as 2001:22:33::111.
391 Configure IPv6 Address On BMC
392 ... ${ipv6_leading_zero} ${test_prefix_length} ${ipv6_eliminate_zero}
393
394
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600395*** Keywords ***
396
Prashanth Katti3270fd02021-06-11 08:02:22 -0500397Suite Setup Execution
398 [Documentation] Do suite setup execution.
399
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -0500400 Redfish.Login
Prashanth Katti3270fd02021-06-11 08:02:22 -0500401 ${active_channel_config}= Get Active Channel Config
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -0500402 Set Suite Variable ${active_channel_config}
403
Prashanth Katti3270fd02021-06-11 08:02:22 -0500404 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
405
406 Set Suite variable ${ethernet_interface}
407
Sweta Potthuri6370afd2025-10-08 00:07:46 -0500408 # Get initial IPv4 and IPv6 addresses and address origins for eth0.
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500409 ${initial_ipv4_addressorigin_list} ${initial_ipv4_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses
410 ${initial_ipv6_addressorigin_list} ${initial_ipv6_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses
411
412 Set Suite Variable ${initial_ipv4_addressorigin_list}
413 Set Suite Variable ${initial_ipv4_addr_list}
414 Set Suite Variable ${initial_ipv6_addressorigin_list}
415 Set Suite Variable ${initial_ipv6_addr_list}
416
Sweta Potthuri6370afd2025-10-08 00:07:46 -0500417 # Get initial IPv4 and IPv6 addresses and address origins for eth1.
418 ${eth1_initial_ipv4_addressorigin_list} ${eth1_initial_ipv4_addr_list}=
419 ... Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses ${2}
420 ${eth1_initial_ipv6_addressorigin_list} ${eth1_initial_ipv6_addr_list}=
421 ... Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses ${2}
422 Set Suite Variable ${eth1_initial_ipv4_addressorigin_list}
423 Set Suite Variable ${eth1_initial_ipv4_addr_list}
424 Set Suite Variable ${eth1_initial_ipv6_addressorigin_list}
425 Set Suite Variable ${eth1_initial_ipv6_addr_list}
426
Prashanth Katti3270fd02021-06-11 08:02:22 -0500427
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600428Test Setup Execution
429 [Documentation] Test setup execution.
430
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600431 @{ipv6_network_configurations}= Get IPv6 Network Configuration
432 Set Test Variable @{ipv6_network_configurations}
433
434 # Get BMC IPv6 address and prefix length.
435 ${ipv6_data}= Get BMC IPv6 Info
436 Set Test Variable ${ipv6_data}
437
438
439Test Teardown Execution
440 [Documentation] Test teardown execution.
441
442 FFDC On Test Case Fail
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600443
444
445Get IPv6 Network Configuration
446 [Documentation] Get Ipv6 network configuration.
447 # Sample output:
448 # {
ganesanb4d430282023-04-27 14:33:23 +0000449 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0",
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600450 # "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface",
451 # "DHCPv4": {
452 # "DHCPEnabled": false,
453 # "UseDNSServers": false,
454 # "UseDomainName": true,
455 # "UseNTPServers": false
456 # },
457 # "DHCPv6": {
458 # "OperatingMode": "Disabled",
459 # "UseDNSServers": false,
460 # "UseDomainName": true,
461 # "UseNTPServers": false
462 # },
463 # "Description": "Management Network Interface",
464 # "FQDN": "localhost",
465 # "HostName": "localhost",
466 # "IPv4Addresses": [
467 # {
468 # "Address": "xx.xx.xx.xx",
469 # "AddressOrigin": "Static",
470 # "Gateway": "xx.xx.xx.1",
471 # "SubnetMask": "xx.xx.xx.0"
472 # },
473 # {
474 # "Address": "169.254.xx.xx",
475 # "AddressOrigin": "IPv4LinkLocal",
476 # "Gateway": "0.0.0.0",
477 # "SubnetMask": "xx.xx.0.0"
478 # },
479 # ],
480 # "IPv4StaticAddresses": [
481 # {
482 # "Address": "xx.xx.xx.xx",
483 # "AddressOrigin": "Static",
484 # "Gateway": "xx.xx.xx.1",
485 # "SubnetMask": "xx.xx.0.0"
486 # }
487 # }
488 # ],
489 # "IPv6AddressPolicyTable": [],
490 # "IPv6Addresses": [
491 # {
492 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx",
493 # "AddressOrigin": "LinkLocal",
494 # "AddressState": null,
495 # "PrefixLength": xx
496 # }
497 # ],
498 # "IPv6DefaultGateway": "",
499 # "IPv6StaticAddresses": [
500 # { "Address": "xxxx:xxxx:xxxx:xxxx::xxxx",
501 # "AddressOrigin": "Static",
502 # "AddressState": null,
503 # "PrefixLength": xxx
504 # }
505 # ],
506 # "Id": "eth0",
507 # "InterfaceEnabled": true,
508 # "LinkStatus": "LinkUp",
509 # "MACAddress": "xx:xx:xx:xx:xx:xx",
510 # "Name": "Manager Ethernet Interface",
511 # "NameServers": [],
512 # "SpeedMbps": 0,
513 # "StaticNameServers": [],
514 # "Status": {
515 # "Health": "OK",
516 # "HealthRollup": "OK",
517 # "State": "Enabled"
518 # },
519 # "VLANs": {
ganesanb4d430282023-04-27 14:33:23 +0000520 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0/VLANs"
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600521
522
523 ${active_channel_config}= Get Active Channel Config
524 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
525
526 @{ipv6_network_configurations}= Get From Dictionary ${resp.dict} IPv6StaticAddresses
George Keishing409df052024-01-17 22:36:14 +0530527 RETURN @{ipv6_network_configurations}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500528
529
530Verify IPv6 And PrefixLength
531 [Documentation] Verify IPv6 address and prefix length on BMC.
532 [Arguments] ${ipv6_addr} ${prefix_len}
533
534 # Description of the argument(s):
535 # ipv6_addr IPv6 address to be verified.
536 # prefix_len PrefixLength value to be verified.
537
538 # Catenate IPv6 address and its prefix length.
539 ${ipv6_with_prefix}= Catenate ${ipv6_addr}/${prefix_len}
540
541 # Get IPv6 address details on BMC using IP command.
542 @{ip_data}= Get BMC IPv6 Info
543
544 # Verify if IPv6 and prefix length is configured on BMC.
545
546 Should Contain ${ip_data} ${ipv6_with_prefix}
547 ... msg=IPv6 and prefix length pair does not exist.
548
549
550Configure IPv6 Address On BMC
551 [Documentation] Add IPv6 Address on BMC.
abhijith-121b9fc2742025-10-14 09:46:43 -0500552 [Arguments] ${ipv6_addr1} ${prefix_len} ${ipv6_addr2}=${None}
553 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_NO_CONTENT}]
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500554
555 # Description of argument(s):
abhijith-121b9fc2742025-10-14 09:46:43 -0500556 # ipv6_addr1 IPv6 address to be added (e.g. "2001:0022:0033::0111").
557 # ipv6_addr2 IPv6 address to be Verified (e.g. "2001:22:33::111").
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500558 # prefix_len Prefix length for the IPv6 to be added
559 # (e.g. "64").
560 # valid_status_codes Expected return code from patch operation
561 # (e.g. "200").
562
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500563 ${prefix_length}= Convert To Integer ${prefix_len}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500564 ${empty_dict}= Create Dictionary
abhijith-121b9fc2742025-10-14 09:46:43 -0500565 ${ipv6_data}= Create Dictionary Address=${ipv6_addr1}
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500566 ... PrefixLength=${prefix_length}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500567
568 ${patch_list}= Create List
569
570 # Get existing static IPv6 configurations on BMC.
571 ${ipv6_network_configurations}= Get IPv6 Network Configuration
572 ${num_entries}= Get Length ${ipv6_network_configurations}
573
574 FOR ${INDEX} IN RANGE 0 ${num_entries}
575 Append To List ${patch_list} ${empty_dict}
576 END
577
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500578 # We need not check for existence of IPv6 on BMC while adding.
579 Append To List ${patch_list} ${ipv6_data}
580 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
581
582 ${active_channel_config}= Get Active Channel Config
583 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
584
585 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
abhijith-121b9fc2742025-10-14 09:46:43 -0500586 ... valid_status_codes=${valid_status_codes}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500587
abhijith-121b9fc2742025-10-14 09:46:43 -0500588 IF ${valid_status_codes} != [${HTTP_OK}, ${HTTP_NO_CONTENT}]
589 Fail msg=Static address not added correctly
590 END
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500591
592 # Note: Network restart takes around 15-18s after patch request processing.
593 Sleep ${NETWORK_TIMEOUT}s
594 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
595
abhijith-121b9fc2742025-10-14 09:46:43 -0500596 #Verify ip address on CLI.
597 IF '${ipv6_addr2}' != '${None}'
598 Verify IPv6 And PrefixLength ${ipv6_addr2} ${prefix_len}
599 ELSE
600 Verify IPv6 And PrefixLength ${ipv6_addr1} ${prefix_len}
601 END
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500602
603 # Verify if existing static IPv6 addresses still exist.
604 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
605 Verify IPv6 On BMC ${ipv6_network_configuration['Address']}
606 END
607
abhijith-121b9fc2742025-10-14 09:46:43 -0500608 #Verify redfish and CLI data matches.
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500609 Validate IPv6 Network Config On BMC
610
611
abhijith-121bfbd03a2025-09-15 01:40:35 -0500612Configure Multiple IPv6 Address on BMC
613 [Documentation] Add multiple IPv6 address on BMC.
614 [Arguments] ${prefix_len}
615 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_NO_CONTENT}]
616
617 # Description of argument(s):
618 # prefix_len Prefix length for the IPv6 to be added
619 # (e.g. "64").
620 # valid_status_codes Expected return code from patch operation
621 # (e.g. "200").
622
623 ${ipv6_list}= Create List ${test_ipv6_addr} ${test_ipv6_addr1}
624 ${prefix_length}= Convert To Integer ${prefix_len}
625 ${empty_dict}= Create Dictionary
626 ${patch_list}= Create List
627
628 # Get existing static IPv6 configurations on BMC.
629 ${ipv6_network_configurations}= Get IPv6 Network Configuration
630 ${num_entries}= Get Length ${ipv6_network_configurations}
631
632 FOR ${INDEX} IN RANGE 0 ${num_entries}
633 Append To List ${patch_list} ${empty_dict}
634 END
635
636 # We need not check for existence of IPv6 on BMC while adding.
637 FOR ${ipv6_addr} IN @{ipv6_list}
638 ${ipv6_data}= Create Dictionary Address=${ipv6_addr} PrefixLength=${prefix_length}
639 Append To List ${patch_list} ${ipv6_data}
640 END
641 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
642
643 ${active_channel_config}= Get Active Channel Config
644 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
645
646 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
647 ... valid_status_codes=${valid_status_codes}
648
649 IF ${valid_status_codes} != [${HTTP_OK}, ${HTTP_NO_CONTENT}]
650 Fail msg=Static address not added correctly
651 END
652
653 # Note: Network restart takes around 15-18s after patch request processing.
654 Sleep ${NETWORK_TIMEOUT}s
655 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
656
657 # Verify newly added ip address on CLI.
658 FOR ${ipv6_addr} IN @{ipv6_list}
659 Verify IPv6 And PrefixLength ${ipv6_addr} ${prefix_len}
660 END
661
662 # Verify if existing static IPv6 addresses still exist.
663 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
664 Verify IPv6 On BMC ${ipv6_network_configuration['Address']}
665 END
666
667 # Get the latest ipv6 network configurations.
668 @{ipv6_network_configurations}= Get IPv6 Network Configuration
669
670 # Verify newly added ip address on BMC.
671 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
672 Should Contain Match ${ipv6_list} ${ipv6_network_configuration['Address']}
673 END
674
675 Validate IPv6 Network Config On BMC
676
677
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500678Validate IPv6 Network Config On BMC
679 [Documentation] Check that IPv6 network info obtained via redfish matches info
680 ... obtained via CLI.
Sridevi Rameshed94c692025-09-07 23:41:10 -0500681
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500682 @{ipv6_network_configurations}= Get IPv6 Network Configuration
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500683 ${ipv6_data}= Get BMC IPv6 Info
684 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
685 Should Contain Match ${ipv6_data} ${ipv6_network_configuration['Address']}/*
686 ... msg=IPv6 address does not exist.
687 END
688
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500689
690Delete IPv6 Address
691 [Documentation] Delete IPv6 address of BMC.
Prashanth Kattibcb9dab2025-04-01 12:58:37 -0500692 [Arguments] ${ipv6_addr}
693 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500694
695 # Description of argument(s):
696 # ipv6_addr IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234").
697 # valid_status_codes Expected return code from patch operation
698 # (e.g. "200"). See prolog of rest_request
699 # method in redfish_plus.py for details.
700
701 ${empty_dict}= Create Dictionary
702 ${patch_list}= Create List
703
704 @{ipv6_network_configurations}= Get IPv6 Network Configuration
705 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
706 IF '${ipv6_network_configuration['Address']}' == '${ipv6_addr}'
707 Append To List ${patch_list} ${null}
708 ELSE
709 Append To List ${patch_list} ${empty_dict}
710 END
711 END
712
713 ${ip_found}= Run Keyword And Return Status List Should Contain Value
714 ... ${patch_list} ${null} msg=${ipv6_addr} does not exist on BMC
715 Pass Execution If ${ip_found} == ${False} ${ipv6_addr} does not exist on BMC
716
717 # Run patch command only if given IP is found on BMC
718 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
719
720 ${active_channel_config}= Get Active Channel Config
721 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
722
723 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
Sweta Potthuria1981612025-05-09 05:41:10 -0500724 ... valid_status_codes=${valid_status_codes}
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500725
726 # Note: Network restart takes around 15-18s after patch request processing
727 Sleep ${NETWORK_TIMEOUT}s
728 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
729
730 # IPv6 address that is deleted should not be there on BMC.
731 ${delete_status}= Run Keyword And Return Status Verify IPv6 On BMC ${ipv6_addr}
Anvesh-Kumar_Rayankula3a26c662025-04-16 01:19:26 -0500732 IF '${valid_status_codes}' == '[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]'
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500733 Should Be True '${delete_status}' == '${False}'
734 ELSE
735 Should Be True '${delete_status}' == '${True}'
736 END
737
738 Validate IPv6 Network Config On BMC
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500739
740
741Modify IPv6 Address
742 [Documentation] Modify and verify IPv6 address of BMC.
743 [Arguments] ${ipv6} ${new_ipv6} ${prefix_len}
744 ... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
745
746 # Description of argument(s):
747 # ipv6 IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
748 # new_ipv6 New IPv6 address to be configured.
749 # prefix_len Prefix length value (Range 1 to 128).
750 # valid_status_codes Expected return code from patch operation
751 # (e.g. "200", "201").
752
753 ${empty_dict}= Create Dictionary
754 ${patch_list}= Create List
755 ${prefix_length}= Convert To Integer ${prefix_len}
756 ${ipv6_data}= Create Dictionary
757 ... Address=${new_ipv6} PrefixLength=${prefix_length}
758
759 # Sample IPv6 network configurations:
760 # "IPv6AddressPolicyTable": [],
761 # "IPv6Addresses": [
762 # {
763 # "Address": "X002:db8:0:2::XX0",
764 # "AddressOrigin": "DHCPv6",
765 # "PrefixLength": 128
766 # },
767 # {
768 # "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX",
769 # "AddressOrigin": "SLAAC",
770 # "PrefixLength": 64
771 # },
772 # {
773 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
774 # "AddressOrigin": "Static",
775 # "PrefixLength": 56
776 # },
777 # {
778 # "Address": “Z002:db8:0:2:a94:efff:fe82:5000",
779 # "AddressOrigin": "Static",
780 # "PrefixLength": 56
781 # },
782 # {
783 # "Address": “Xe80::a94:efff:YYYY:XXXX",
784 # "AddressOrigin": "LinkLocal",
785 # "PrefixLength": 64
786 # },
787 # {
788 # "Address": “X002:db8:1:2:eff:233:fee:546",
789 # "AddressOrigin": "Static",
790 # "PrefixLength": 56
791 # }
792 # ],
793 # "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”,
794 # "IPv6StaticAddresses": [
795 # {
796 # "Address": “X002:db8:0:2:a94:efff:fe82:5000",
797 # "PrefixLength": 56
798 # },
799 # {
800 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
801 # "PrefixLength": 56
802 # },
803 # {
804 # "Address": “Z002:db8:1:2:eff:233:fee:546",
805 # "PrefixLength": 56
806 # }
807 # ],
808 # "IPv6StaticDefaultGateways": [],
809
810 # Find the position of IPv6 address to be modified.
811 @{ipv6_network_configurations}= Get IPv6 Network Configuration
812 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
George Keishinge6e161e2025-05-08 10:18:30 +0530813 IF '${ipv6_network_configuration['Address']}' == '${ipv6}'
814 Append To List ${patch_list} ${ipv6_data}
815 ELSE
816 Append To List ${patch_list} ${empty_dict}
817 END
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500818 END
819
820 # Modify the IPv6 address only if given IPv6 is found
821 ${ip_found}= Run Keyword And Return Status List Should Contain Value
822 ... ${patch_list} ${ipv6_data} msg=${ipv6} does not exist on BMC
823 Pass Execution If ${ip_found} == ${False} ${ipv6} does not exist on BMC
824
825 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
826
827 ${active_channel_config}= Get Active Channel Config
828 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
829
830 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
831 ... body=&{data} valid_status_codes=${valid_status_codes}
832
833 # Note: Network restart takes around 15-18s after patch request processing.
834 Sleep ${NETWORK_TIMEOUT}s
835 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
836
837 # Verify if new IPv6 address is configured on BMC.
838 Verify IPv6 On BMC ${new_ipv6}
839
840 # Verify if old IPv6 address is erased.
841 ${cmd_status}= Run Keyword And Return Status
842 ... Verify IPv6 On BMC ${ipv6}
843 Should Be Equal ${cmd_status} ${False} msg=Old IPv6 address is not deleted.
844
845 Validate IPv6 Network Config On BMC
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500846
847
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500848Set SLAAC Configuration State And Verify
849 [Documentation] Set SLAAC configuration state and verify.
Sridevi Rameshed94c692025-09-07 23:41:10 -0500850 [Arguments] ${slaac_state} ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
851 ... ${channel_number}=${CHANNEL_NUMBER}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500852
853 # Description of argument(s):
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500854 # slaac_state SLAAC state('True' or 'False').
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500855 # valid_status_code Expected valid status codes.
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500856 # channel_number Channel number 1(eth0) or 2(eth1).
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500857
858 ${active_channel_config}= Get Active Channel Config
859 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
860
861 ${data}= Set Variable If ${slaac_state} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC}
862 ${resp}= Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
Sweta Potthuri610f86f2025-05-30 00:47:23 -0500863 ... body=${data} valid_status_codes=${valid_status_codes}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500864
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500865 # Verify SLAAC is set correctly.
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500866 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
867 ${slaac_verify}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig
868
George Keishinge6e161e2025-05-08 10:18:30 +0530869 IF '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}'
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500870 Fail msg=SLAAC not set properly.
George Keishinge6e161e2025-05-08 10:18:30 +0530871 END
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500872
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500873Set And Verify DHCPv6 Property
874 [Documentation] Set DHCPv6 property and verify.
875 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER}
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500876
877 # Description of argument(s):
878 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled').
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500879 # channel_number Channel number 1 or 2.
880
881 Set DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number}
882 Verify DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number}
883
884
885Set DHCPv6 Property
886 [Documentation] Set DHCPv6 attribute is enables or disabled.
887 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER}
888
889 # Description of argument(s):
890 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled').
891 # channel_number Channel number 1 or 2.
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500892
893 ${data}= Set Variable If '${dhcpv6_operating_mode}' == 'Disabled' ${DISABLE_DHCPv6} ${ENABLE_DHCPv6}
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500894 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
895
896 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
897 ... body=${data} valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}]
898
kvishalbd04bd62025-08-05 03:57:53 -0500899
900Verify DHCPv6 Property
901 [Documentation] Verify DHCPv6 settings is enabled or disabled.
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500902 [Arguments] ${dhcpv6_operating_mode} ${channel_number}=${CHANNEL_NUMBER}
kvishalbd04bd62025-08-05 03:57:53 -0500903
904 # Description of Argument(s):
905 # dhcpv6_operating_mode Enable/ Disable DHCPv6.
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500906 # channel_number Channel number 1 or 2.
907
Sweta Potthuri425713a2025-10-16 00:28:20 -0500908 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']}
kvishalbd04bd62025-08-05 03:57:53 -0500909
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500910 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
911 ${dhcpv6_verify}= Get From Dictionary ${resp.dict} DHCPv6
912
913 Should Be Equal '${dhcpv6_verify['OperatingMode']}' '${dhcpv6_operating_mode}'
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500914
Sweta Potthuri425713a2025-10-16 00:28:20 -0500915 Sleep 30s
916
917 @{ipv6_addressorigin_list} ${ipv6_dhcpv6_addr}=
918 ... Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses ${channel_number}
919
920 IF "${dhcpv6_operating_mode}" == "Enabled"
921 @{ipv6_addressorigin_list} ${ipv6_dhcpv6_addr}=
922 ... Get Address Origin List And Address For Type DHCPv6 ${channel_number}
923 Should Not Be Empty ${ipv6_dhcpv6_addr} msg=DHCPv6 must be present.
924 ELSE
925 Should Not Contain ${ipv6_addressorigin_list} DHCPv6
926 END
927
928
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500929
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500930Get IPv6 Static Default Gateway
931 [Documentation] Get IPv6 static default gateway.
932
933 ${active_channel_config}= Get Active Channel Config
934 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
935
936 @{ipv6_static_defgw_configurations}= Get From Dictionary ${resp.dict} IPv6StaticDefaultGateways
937 RETURN @{ipv6_static_defgw_configurations}
938
Sweta Potthuri2d085732025-07-16 09:10:08 -0500939
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500940Configure IPv6 Static Default Gateway On BMC
941 [Documentation] Configure IPv6 static default gateway on BMC.
942 [Arguments] ${ipv6_gw_addr} ${prefix_length_def}
943 ... ${valid_status_codes}=${HTTP_OK}
Sridevi Rameshed94c692025-09-07 23:41:10 -0500944
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500945 # Description of argument(s):
946 # ipv6_gw_addr IPv6 Static Default Gateway address to be configured.
947 # prefix_len_def Prefix length value (Range 1 to 128).
948 # valid_status_codes Expected return code from patch operation
949 # (e.g. "200", "204".)
950
951 # Prefix Length is passed as None.
952 IF '${prefix_length_def}' == '${None}'
953 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr}
954 ELSE
955 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr} Prefix Length=${prefix_length_def}
956 END
957
958 ${ipv6_static_def_gw}= Get IPv6 Static Default Gateway
959
960 ${num_entries}= Get Length ${ipv6_static_def_gw}
961
962 ${patch_list}= Create List
963 ${empty_dict}= Create Dictionary
964
965 FOR ${INDEX} IN RANGE 0 ${num_entries}
966 Append To List ${patch_list} ${empty_dict}
967 END
968
969 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}'
970 ... ${HTTP_OK},${HTTP_NO_CONTENT}
971 ... ${valid_status_codes}
972
973 Append To List ${patch_list} ${ipv6_gw}
974 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
975
976 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
977 ... body=${data} valid_status_codes=[${valid_status_codes}]
978
979 # Verify the added static default gateway is present in Redfish Get Output.
980 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway
981
982 ${ipv6_static_def_gw_list}= Create List
983 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway}
984 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
985 Append To List ${ipv6_static_def_gw_list} ${value}
986 END
987
988 IF '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}'
989 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
990 ELSE
991 Should Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
992 END
993
Sweta Potthuri2d085732025-07-16 09:10:08 -0500994
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -0500995Modify IPv6 Static Default Gateway On BMC
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500996 [Documentation] Modify and verify IPv6 address of BMC.
997 [Arguments] ${ipv6_gw_addr} ${new_static_def_gw} ${prefix_length}
998 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED}]
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500999
Sweta Potthuri4b0083f2025-07-09 11:34:40 -05001000 # Description of argument(s):
1001 # ipv6_gw_addr IPv6 static default gateway address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
1002 # new_static_def_gw New static default gateway address to be configured.
Sridevi Rameshed94c692025-09-07 23:41:10 -05001003 # prefix_length Prefix length value (Range 1 to 128).
Sweta Potthuri4b0083f2025-07-09 11:34:40 -05001004 # valid_status_codes Expected return code from patch operation
1005 # (e.g. "200", "204").
Sweta Potthuri2edacd32025-07-02 01:04:43 -05001006
Sweta Potthuri4b0083f2025-07-09 11:34:40 -05001007 ${empty_dict}= Create Dictionary
1008 ${patch_list}= Create List
1009 # Prefix Length is passed as None.
1010 IF '${prefix_length_def}' == '${None}'
1011 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw}
1012 ELSE
1013 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw} Prefix Length=${prefix_length_def}
1014 END
Sweta Potthuri2edacd32025-07-02 01:04:43 -05001015
Sweta Potthuri4b0083f2025-07-09 11:34:40 -05001016 @{ipv6_static_def_gw_list}= Get IPv6 Static Default Gateway
1017
1018 FOR ${ipv6_static_def_gw} IN @{ipv6_static_def_gw_list}
1019 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}'
1020 Append To List ${patch_list} ${modified_ipv6_gw_addripv6_data}
1021 ELSE
1022 Append To List ${patch_list} ${empty_dict}
1023 END
1024 END
1025
1026 # Modify the IPv6 address only if given IPv6 static default gateway is found.
1027 ${ip_static_def_gw_found}= Run Keyword And Return Status List Should Contain Value
1028 ... ${patch_list} ${modified_ipv6_gw_addripv6_data} msg=${ipv6_gw_addr} does not exist on BMC
1029 Pass Execution If ${ip_static_def_gw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC
1030
1031 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
1032
1033 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1034 ... body=&{data} valid_status_codes=${valid_status_codes}
1035
1036 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway
1037
1038 ${ipv6_static_def_gw_list}= Create List
1039 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway}
Sweta Potthuri2d085732025-07-16 09:10:08 -05001040 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
Sweta Potthuri4b0083f2025-07-09 11:34:40 -05001041 Append To List ${ipv6_static_def_gw_list} ${value}
1042 END
1043
1044 Should Contain ${ipv6_static_def_gw_list} ${new_static_def_gw}
1045 # Verify if old static default gateway address is erased.
1046 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
1047
Sweta Potthuri2d085732025-07-16 09:10:08 -05001048
1049Delete IPv6 Static Default Gateway
1050 [Documentation] Delete IPv6 static default gateway on BMC.
1051 [Arguments] ${ipv6_gw_addr}
1052 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
1053
1054 # Description of argument(s):
1055 # ipv6_gw_addr IPv6 Static Default Gateway address to be deleted.
1056 # valid_status_codes Expected return code from patch operation
1057 # (e.g. "200").
1058
1059 ${patch_list}= Create List
1060 ${empty_dict}= Create Dictionary
1061
1062 ${ipv6_static_def_gw_list}= Create List
1063 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway
1064
1065 FOR ${ipv6_staticdef_gateway} IN @{ipv6_static_defgw_configurations}
1066 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
1067 Append To List ${ipv6_static_def_gw_list} ${value}
1068 END
1069
1070 ${defgw_found}= Run Keyword And Return Status List Should Contain Value
1071 ... ${ipv6_static_def_gw_list} ${ipv6_gw_addr} msg=${ipv6_gw_addr} does not exist on BMC
1072 Skip If ${defgw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC
1073
1074 FOR ${ipv6_static_def_gw} IN @{ipv6_static_defgw_configurations}
1075 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}'
1076 Append To List ${patch_list} ${null}
1077 ELSE
1078 Append To List ${patch_list} ${empty_dict}
1079 END
1080 END
1081
1082 # Run patch command only if given IP is found on BMC.
1083 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
1084
1085 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
1086 ... valid_status_codes=${valid_status_codes}
1087
1088 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
1089
1090 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway
1091 Should Not Contain Match ${ipv6_static_defgw_configurations} ${ipv6_gw_addr}
1092 ... msg=IPv6 Static default gateway does not exist.
Sweta Potthuri35c503b2025-07-27 23:36:20 -05001093
1094
1095Check Coexistence Of Linklocalv6 And Static IPv6
1096 [Documentation] Verify both linklocalv6 and static IPv6 exist.
1097
Sweta Potthuri35c503b2025-07-27 23:36:20 -05001098 # Verify the address origin contains static and linklocal.
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -05001099 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
Sweta Potthuri35c503b2025-07-27 23:36:20 -05001100
Sweta Potthuri35c503b2025-07-27 23:36:20 -05001101 Should Match Regexp ${ipv6_linklocal_addr} ${linklocal_addr_format}
Sweta Potthuri35c503b2025-07-27 23:36:20 -05001102 Should Contain ${ipv6_addressorigin_list} Static
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -05001103
1104
abhijith-12197078c52025-09-25 01:13:00 -05001105Check Coexistence Of Static IPv6 And SLAAC
abhijith-1214dc01a02025-09-24 11:29:55 -05001106 [Documentation] Verify both static IPv6 and SLAAC coexist.
abhijith-12197078c52025-09-25 01:13:00 -05001107
1108 # Verify the address origin contains static and slaac.
1109 @{ipv6_addressorigin_list} ${ipv6_static_addr}=
1110 ... Get Address Origin List And Address For Type Static
1111
1112 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}=
1113 ... Get Address Origin List And Address For Type SLAAC
1114
1115
abhijith-1214dc01a02025-09-24 11:29:55 -05001116Check Coexistence Of Link Local And SLAAC
1117 [Documentation] Verify both link local and SLAAC coexist.
1118
1119 # Verify the address origin contains SLAAC and link local.
1120 @{ipv6_addressorigin_list} ${ipv6_link_local_addr}=
1121 ... Get Address Origin List And Address For Type LinkLocal
1122
1123 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}=
1124 ... Get Address Origin List And Address For Type SLAAC
1125
1126 Should Match Regexp ${ipv6_link_local_addr} ${linklocal_addr_format}
1127
1128
abhijith-1218ff5db42025-09-24 06:24:03 -05001129Check Coexistence Of Link Local And DHCPv6
1130 [Documentation] Verify both link local and dhcpv6 coexist.
1131
1132 # Verify the address origin contains dhcpv6 and link local.
1133 @{ipv6_address_origin_list} ${ipv6_link_local_addr}=
1134 ... Get Address Origin List And Address For Type LinkLocal
1135
1136 @{ipv6_address_origin_list} ${ipv6_dhcpv6_addr}=
1137 ... Get Address Origin List And Address For Type DHCPv6
1138
1139 Should Match Regexp ${ipv6_link_local_addr} ${linklocal_addr_format}
1140
1141
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -05001142Check If Linklocal Address Is In Correct Format
1143 [Documentation] Linklocal address has network part fe80 and host part EUI64.
1144
1145 # Fetch the linklocal address.
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -05001146 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -05001147
1148 # Follow EUI64 from MAC.
1149 ${system_mac}= Get BMC MAC Address
1150 ${split_octets}= Split String ${system_mac} :
1151 ${first_octet}= Evaluate int('${split_octets[0]}', 16)
1152 ${flipped_hex}= Evaluate format(${first_octet} ^ 2, '02x')
1153 ${grp1}= Evaluate re.sub(r'^0+', '', '${flipped_hex}${split_octets[1]}') modules=re
1154 ${grp2}= Evaluate re.sub(r'^0+', '', '${split_octets[2]}ff') modules=re
1155 ${grp3}= Evaluate re.sub(r'^0+', '', '${split_octets[4]}${split_octets[5]}') modules=re
1156 ${linklocal}= Set Variable fe80::${grp1}:${grp2}:fe${split_octets[3]}:${grp3}
1157
1158 # Verify the linklocal obtained is the same as on the machine.
1159 Should Be Equal ${linklocal} ${ipv6_linklocal_addr}
1160
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -05001161
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001162Check BMC Gets SLAAC Address
1163 [Documentation] Check BMC gets slaac address.
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -05001164
1165 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC
1166
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -05001167
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001168Get The Initial DHCPv6 Setting On Each Interface
1169 [Documentation] Get the initial DHCPv6 setting of each interface.
1170 [Arguments] ${channel_number}
Sweta Potthuridb4a6d62025-08-18 11:29:16 -05001171
1172 # Description of the argument(s):
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001173 # channel_number Channel number 1 or 2.
Sweta Potthuridb4a6d62025-08-18 11:29:16 -05001174
1175 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']}
1176 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1177 ${initial_dhcpv6_iface}= Get From Dictionary ${resp.dict} DHCPv6
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001178 IF ${channel_number}==${1}
1179 Set Test Variable ${dhcpv6_channel_1} ${initial_dhcpv6_iface['OperatingMode']}
1180 ELSE
1181 Set Test Variable ${dhcpv6_channel_2} ${initial_dhcpv6_iface['OperatingMode']}
1182 END
1183
1184
1185Get The Initial DHCPv6 Settings
1186 [Documentation] Get the initial DHCPv6 settings of both the interfaces.
1187
1188 Get The Initial DHCPv6 Setting On Each Interface ${1}
1189 Get The Initial DHCPv6 Setting On Each Interface ${2}
1190
1191
1192Get The Initial SLAAC Settings
1193 [Documentation] Get the initial SLAAC settings of both the interfaces.
1194
Sweta Potthuri6370afd2025-10-08 00:07:46 -05001195 Get The Initial SLAAC Setting On Each Interface ${1}
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001196 Get The Initial SLAAC Setting On Each Interface ${2}
1197
1198
1199Get The Initial SLAAC Setting On Each Interface
1200 [Documentation] Get the initial SLAAC setting of the interface.
1201 [Arguments] ${channel_number}
1202
1203 # Description of the argument(s):
1204 # channel_number Channel number 1 or 2.
1205
1206 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']}
1207 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1208 ${initial_slaac_iface}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig
1209 IF ${channel_number}==${1}
1210 Set Test Variable ${slaac_channel_1} ${initial_slaac_iface['IPv6AutoConfigEnabled']}
1211 ELSE
1212 Set Test Variable ${slaac_channel_2} ${initial_slaac_iface['IPv6AutoConfigEnabled']}
1213 END
Sweta Potthuridb4a6d62025-08-18 11:29:16 -05001214
1215
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001216Get Address Origin List And IPv4 or IPv6 Address
1217 [Documentation] Get address origin list and address for type.
Sweta Potthuri6370afd2025-10-08 00:07:46 -05001218 [Arguments] ${ip_address_type} ${channel_number}=${CHANNEL_NUMBER}
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001219
1220 # Description of the argument(s):
Sridevi Rameshed94c692025-09-07 23:41:10 -05001221 # ip_address_type Type of IPv4 or IPv6 address to be checked.
Sweta Potthuri6370afd2025-10-08 00:07:46 -05001222 # channel_number Channel number 1(eth0) or 2(eth1).
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001223
Sweta Potthuri6370afd2025-10-08 00:07:46 -05001224 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']}
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001225 @{ip_addresses}= Get From Dictionary ${resp.dict} ${ip_address_type}
1226
1227 ${ip_addressorigin_list}= Create List
1228 ${ip_addr_list}= Create List
1229 FOR ${ip_address} IN @{ip_addresses}
1230 ${ip_addressorigin}= Get From Dictionary ${ip_address} AddressOrigin
1231 Append To List ${ip_addressorigin_list} ${ip_addressorigin}
1232 Append To List ${ip_addr_list} ${ip_address['Address']}
1233 END
1234 RETURN ${ip_addressorigin_list} ${ip_addr_list}
1235
1236
1237Verify All The Addresses Are Intact
1238 [Documentation] Verify all the addresses and address origins remain intact.
Sweta Potthuri6370afd2025-10-08 00:07:46 -05001239 [Arguments] ${channel_number}=${CHANNEL_NUMBER}
1240 ... ${initial_ipv4_addressorigin_list}=${initial_ipv4_addressorigin_list}
1241 ... ${initial_ipv4_addr_list}=${initial_ipv4_addr_list}
1242
1243 # Description of argument(s):
1244 # channel_number Channel number 1(eth0) or 2(eth1).
1245 # initial_ipv4_addressorigin_list Initial IPv4 address origin list.
1246 # initial_ipv4_addr_list Initial IPv4 address list.
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001247
1248 # Verify that it will not impact the IPv4 configuration.
1249 Sleep ${NETWORK_TIMEOUT}
1250 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
1251
Sweta Potthuri6370afd2025-10-08 00:07:46 -05001252 # IPv6 Linklocal address must be present.
1253 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}=
1254 ... Get Address Origin List And Address For Type LinkLocal ${channel_number}
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001255
Sweta Potthuri6370afd2025-10-08 00:07:46 -05001256 # IPv4 addresses must remain intact.
1257 ${ipv4_addressorigin_list} ${ipv4_addr_list}=
1258 ... Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses ${channel_number}
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001259
1260 Should be Equal ${initial_ipv4_addressorigin_list} ${ipv4_addressorigin_list}
1261 Should be Equal ${initial_ipv4_addr_list} ${ipv4_addr_list}
Sweta Potthurif3d188f2025-09-08 07:17:31 -05001262
1263
1264Get Interface ID Of IPv6
1265 [Documentation] Get interface id of IPv6 address.
1266 [Arguments] ${ipv6_address}
1267
1268 # Description of the argument(s):
1269 # ${ipv6_address} IPv6 Address to extract the last 4 hextets.
1270
1271 # Last 64 bits of SLAAC and Linklocal must be the same.
1272 # Sample IPv6 network configurations.
1273 #"IPv6AddressPolicyTable": [],
1274 # "IPv6Addresses": [
1275 # {
1276 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx",
1277 # "AddressOrigin": "LinkLocal",
1278 # "AddressState": null,
1279 # "PrefixLength": xx
1280 # }
1281 # ],
1282 # {
1283 # "Address": "2002:xxxx:xxxx:xxxx:xxxx",
1284 # "AddressOrigin": "SLAAC",
1285 # "PrefixLength": 64
1286 # }
1287 # ],
1288
1289 ${split_ip_address}= Split String ${ipv6_address} :
1290 ${missing_ip}= Evaluate 8 - len(${split_ip_address}) + 1
1291 ${expanded_ip}= Create List
1292
1293 FOR ${hextet} IN @{split_ip_address}
1294 IF '${hextet}' == ''
1295 FOR ${i} IN RANGE ${missing_ip}
1296 Append To List ${expanded_ip} 0000
1297 END
1298 ELSE
1299 Append To List ${expanded_ip} ${hextet}
1300 END
1301 END
1302 ${interface_id}= Evaluate ':'.join(${expanded_ip}[-4:])
1303 RETURN ${interface_id}
Sweta Potthuri6370afd2025-10-08 00:07:46 -05001304
1305
1306Set And Verify SLAAC Property On Both Interfaces
1307 [Documentation] Set and verify SLAAC property on both interfaces.
1308 [Arguments] ${slaac_value_1} ${slaac_value_2}
1309
1310 # Description of the argument(s):
1311 # slaac_value_1 SLAAC value for channel 1.
1312 # slaac_value_2 SLAAC value for channel 2.
1313
1314 Set SLAAC Configuration State And Verify ${slaac_value_1} [${HTTP_OK}] ${1}
1315 Set SLAAC Configuration State And Verify ${slaac_value_2} [${HTTP_OK}] ${2}
1316
1317 Sleep 30s
1318
1319 # Check SLAAC Settings for eth0.
1320 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}=
1321 ... Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses ${1}
1322 IF "${slaac_value_1}" == "${True}"
1323 Should Not Be Empty ${ipv6_slaac_addr} SLAAC
1324 ELSE
1325 Should Not Contain ${ipv6_addressorigin_list} SLAAC
1326 END
1327
1328 # Check SLAAC Settings for eth1.
1329 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}=
1330 ... Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses ${2}
1331 IF "${slaac_value_2}" == "${True}"
1332 Should Not Be Empty ${ipv6_slaac_addr} SLAAC
1333 ELSE
1334 Should Not Contain ${ipv6_addressorigin_list} SLAAC
1335 END
1336
1337 Verify All The Addresses Are Intact ${1}
1338 Verify All The Addresses Are Intact ${2}
1339 ... ${eth1_initial_ipv4_addressorigin_list} ${eth1_initial_ipv4_addr_list}
1340
Sweta Potthuri425713a2025-10-16 00:28:20 -05001341
1342Set And Verify DHCPv6 Property On Both Interfaces
1343 [Documentation] Set and verify DHCPv6 property on both interfaces.
1344 [Arguments] ${dhcpv6_value_1} ${dhcpv6_value_2}
1345
1346 # Description of the argument(s):
1347 # dhcpv6_value_1 DHCPv6 value for channel 1.
1348 # dhcpv6_value_2 DHCPv6 value for channel 2.
1349
1350 Set And Verify DHCPv6 Property ${dhcpv6_value_1} ${1}
1351 Set And Verify DHCPv6 Property ${dhcpv6_value_2} ${2}
1352
1353 Verify All The Addresses Are Intact ${1}
1354 Verify All The Addresses Are Intact ${2}
1355 ... ${eth1_initial_ipv4_addressorigin_list} ${eth1_initial_ipv4_addr_list}