blob: ce17a9a6b64c24fa7bfc348ccfd2fe2ffb43cb52 [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 Potthuri35c503b2025-07-27 23:36:20 -050032${linklocal_addr_format} fe80::[0-9a-f:]+$
Sweta Potthuri2f3fbb52025-09-19 00:50:47 -050033${new_mac_addr} AA:E2:84:14:28:79
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060034
35*** Test Cases ***
36
37Get IPv6 Address And Verify
38 [Documentation] Get IPv6 Address And Verify.
39 [Tags] Get_IPv6_Address_And_Verify
40
41 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
42 Verify IPv6 On BMC ${ipv6_network_configuration['Address']}
43 END
44
45
Prashanth Katti2c73abc2021-03-17 07:42:25 -050046Get PrefixLength And Verify
47 [Documentation] Get IPv6 prefix length and verify.
48 [Tags] Get_PrefixLength_And_Verify
49
50 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
51 Verify IPv6 On BMC ${ipv6_network_configuration['PrefixLength']}
52 END
53
54
55Get IPv6 Default Gateway And Verify
George Keishing96143832021-03-23 07:55:08 -050056 [Documentation] Get IPv6 default gateway and verify.
George Keishingade6ab42022-07-19 11:41:03 -050057 [Tags] Get_IPv6_Default_Gateway_And_Verify
Prashanth Katti2c73abc2021-03-17 07:42:25 -050058
59 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
60 ${ipv6_gateway}= Get From Dictionary ${resp.dict} IPv6DefaultGateway
61 Verify IPv6 Default Gateway On BMC ${ipv6_gateway}
62
63
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050064Verify All Configured IPv6 And PrefixLength On BMC
65 [Documentation] Verify IPv6 address and its prefix length on BMC.
66 [Tags] Verify_All_Configured_IPv6_And_PrefixLength_On_BMC
67
68 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
George Keishingf02ca2b2023-04-05 22:11:03 +053069 Verify IPv6 And PrefixLength ${ipv6_network_configuration['Address']}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050070 ... ${ipv6_network_configuration['PrefixLength']}
71 END
72
73
74Configure IPv6 Address And Verify
75 [Documentation] Configure IPv6 address and verify.
76 [Tags] Configure_IPv6_Address_And_Verify
Anvesh-Kumar_Rayankula3a26c662025-04-16 01:19:26 -050077 [Teardown] Run Keywords
78 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050079 [Template] Configure IPv6 Address On BMC
80
81
82 # IPv6 address Prefix length
83 ${test_ipv6_addr} ${test_prefix_length}
84
85
Prashanth Katti12ed4b72023-05-16 05:24:00 -050086Delete IPv6 Address And Verify
87 [Documentation] Delete IPv6 address and verify.
88 [Tags] Delete_IPv6_Address_And_Verify
89
90 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
91
92 Delete IPv6 Address ${test_ipv6_addr}
93
94
George Keishingcc288312024-10-22 10:13:12 +053095Modify IPv6 Address And Verify
Prashanth Katti5f7d2e42023-05-22 03:17:25 -050096 [Documentation] Modify IPv6 address and verify.
97 [Tags] Modify_IPv6_Address_And_Verify
kvishal88de8c42025-03-04 01:45:10 -060098 [Teardown] Run Keywords
George Keishingcfdd0992025-03-17 11:59:20 +053099 ... Delete IPv6 Address ${test_ipv6_addr1} AND Test Teardown Execution
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500100
101 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
102
103 Modify IPv6 Address ${test_ipv6_addr} ${test_ipv6_addr1} ${test_prefix_length}
104
105
Sweta Potthuriafe858e2025-02-25 23:52:51 -0600106Verify Persistency Of IPv6 After BMC Reboot
107 [Documentation] Verify persistency of IPv6 after BMC reboot.
108 [Tags] Verify_Persistency_Of_IPv6_After_BMC_Reboot
109 [Teardown] Run Keywords
110 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution
111
112 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
113
114 Redfish OBMC Reboot (off) stack_mode=skip
115
116 # Verifying persistency of IPv6.
117 Verify IPv6 On BMC ${test_ipv6_addr}
118
119
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500120Enable SLAAC On BMC And Verify
121 [Documentation] Enable SLAAC on BMC and verify.
122 [Tags] Enable_SLAAC_On_BMC_And_Verify
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500123
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500124 Set SLAAC Configuration State And Verify ${True}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500125
126
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500127Enable DHCPv6 Property On BMC And Verify
128 [Documentation] Enable DHCPv6 property on BMC and verify.
129 [Tags] Enable_DHCPv6_Property_On_BMC_And_Verify
130
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500131 Set And Verify DHCPv6 Property Enabled
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500132
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500133
kvishal0d199a92025-05-29 02:35:18 -0500134Disable DHCPv6 Property On BMC And Verify
135 [Documentation] Disable DHCPv6 property on BMC and verify.
136 [Tags] Disable_DHCPv6_Property_On_BMC_And_Verify
137
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500138 Set And Verify DHCPv6 Property Disabled
kvishalbd04bd62025-08-05 03:57:53 -0500139
140
141Verify Persistency Of DHCPv6 On Reboot
142 [Documentation] Verify persistency of DHCPv6 property on reboot.
143 [Tags] Verify_Persistency_Of_DHCPv6_On_Reboot
144
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500145 Set And Verify DHCPv6 Property Enabled
146 Redfish OBMC Reboot (off) stack_mode=skip
147 Verify DHCPv6 Property Enabled
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500148
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500149
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500150Configure Invalid Static IPv6 And Verify
151 [Documentation] Configure invalid static IPv6 and verify.
152 [Tags] Configure_Invalid_Static_IPv6_And_Verify
153 [Template] Configure IPv6 Address On BMC
154
kvishal9c6774c2025-09-10 02:14:07 -0500155 #invalid_ipv6 prefix length valid_status_code
156 ${ipv4_hexword_addr} ${test_prefix_length} ${HTTP_BAD_REQUEST}
157 ${invalid_hexadec_ipv6} ${test_prefix_length} ${HTTP_BAD_REQUEST}
158 ${ipv6_multi_short} ${test_prefix_length} ${HTTP_BAD_REQUEST}
159
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500160
Sweta Potthuri565318d2025-06-09 06:13:46 -0500161
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500162Configure IPv6 Static Default Gateway And Verify
163 [Documentation] Configure IPv6 static default gateway and verify.
164 [Tags] Configure_IPv6_Static_Default_Gateway_And_Verify
165 [Template] Configure IPv6 Static Default Gateway On BMC
Sweta Potthuri565318d2025-06-09 06:13:46 -0500166
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500167 # static_def_gw prefix length valid_status_code
168 ${ipv6_gw_addr} ${prefix_length_def} ${HTTP_OK}
169 ${invalid_staticv6_gateway} ${test_prefix_length} ${HTTP_BAD_REQUEST}
Sweta Potthuri565318d2025-06-09 06:13:46 -0500170
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500171
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500172Modify Static Default Gateway And Verify
173 [Documentation] Modify static default gateway and verify.
174 [Tags] Modify_Static_Default_Gateway_And_Verify
175 [Setup] Configure IPv6 Static Default Gateway On BMC ${ipv6_gw_addr} ${prefix_length_def}
176
177 Modify IPv6 Static Default Gateway On BMC ${test_ipv6_addr1} ${prefix_length_def} ${HTTP_OK} ${ipv6_gw_addr}
178
179
Sweta Potthuri2d085732025-07-16 09:10:08 -0500180Delete IPv6 Static Default Gateway And Verify
181 [Documentation] Delete IPv6 static default gateway and verify.
182 [Tags] Delete_IPv6_Static_Default_Gateway_And_Verify
183 [Setup] Configure IPv6 Static Default Gateway On BMC ${ipv6_gw_addr} ${prefix_length_def}
184
185 Delete IPv6 Static Default Gateway ${ipv6_gw_addr}
186
187
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500188Verify Coexistence Of Linklocalv6 And Static IPv6 On BMC
189 [Documentation] Verify linklocalv6 And static IPv6 both exist.
190 [Tags] Verify_Coexistence_Of_Linklocalv6_And_Static_IPv6_On_BMC
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -0500191 [Setup] Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
192 [Teardown] Delete IPv6 Address ${test_ipv6_addr}
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500193
194 Check Coexistence Of Linklocalv6 And Static IPv6
195
196
George Keishingbadb4c62025-09-18 16:14:12 +0530197Verify IPv6 Linklocal Address Is In Correct Format
198 [Documentation] Verify linklocal address has network part as fe80 and
199 ... host part as EUI64.
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -0500200 [Tags] Verify_IPv6_Linklocal_Address_Is_In_Correct_Format
201
202 Check If Linklocal Address Is In Correct Format
203
204
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500205Verify BMC Gets SLAAC Address On Enabling SLAAC
206 [Documentation] On enabling SLAAC verify SLAAC address comes up.
207 [Tags] Verify_BMC_Gets_SLAAC_Address_On_Enabling_SLAAC
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500208 [Setup] Set SLAAC Configuration State And Verify ${False}
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500209
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500210 Set SLAAC Configuration State And Verify ${True}
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500211 Sleep ${NETWORK_TIMEOUT}
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500212 Check BMC Gets SLAAC Address
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500213
214
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500215Enable And Verify DHCPv6 Property On Eth1 When DHCPv6 Property Enabled On Eth0
216 [Documentation] Verify DHCPv6 on eth1 when DHCPv6 property is enabled on eth0.
217 [Tags] Enable_And_Verify_DHCPv6_Property_On_Eth1_When_DHCPv6_Property_Enabled_On_Eth0
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500218 [Setup] Get The Initial DHCPv6 Settings
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500219 [Teardown] Run Keywords Set And Verify DHCPv6 Property ${dhcpv6_channel_1} ${1}
220 ... AND Set And Verify DHCPv6 Property ${dhcpv6_channel_2} ${2}
221
222 Set And Verify DHCPv6 Property Enabled ${1}
223 Set And Verify DHCPv6 Property Enabled ${2}
224
225
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500226Enable And Verify SLAAC Property On Eth1 When SLAAC Property Enabled On Eth0
227 [Documentation] Enable and verify SLAAC property on Eth1 when SLAAC property enabled on Eth0.
228 [Tags] Enable_And_Verify_SLAAC_Property_On_Eth1_When_SLAAC_Property_Enabled_On_Eth0
229 [Setup] Get The Initial SLAAC Settings
230 [Teardown] Run Keywords Set SLAAC Configuration State And Verify ${slaac_channel_1} [${HTTP_OK}] ${1}
231 ... AND Set SLAAC Configuration State And Verify ${slaac_channel_2} [${HTTP_OK}] ${2}
232
233 Set SLAAC Configuration State And Verify ${True} [${HTTP_OK}] ${1}
234 Set SLAAC Configuration State And Verify ${True} [${HTTP_OK}] ${2}
235
236 # Check all the addresses and address origins remain intact.
237 Verify All The Addresses Are Intact
238
239
abhijith-1213a645902025-09-08 01:12:34 -0500240Verify Autoconfig Is Present On Ethernet Interface
241 [Documentation] Verify autoconfig is present on ethernet interface.
242 [Tags] Verify_Autoconfig_Is_Present_On_Ethernet_Interface
243
244 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
245 Should Contain ${resp.dict} StatelessAddressAutoConfig
246
247
Sweta Potthurif3d188f2025-09-08 07:17:31 -0500248Verify Interface ID Of SLAAC And LinkLocal Addresses Are Same
249 [Documentation] Validate interface id of SLAAC and link-local addresses are same.
250 [Tags] Verify_Interface_ID_Of_SLAAC_And_LinkLocal_Addresses_Are_Same
251
252 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
253 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC
254
255 ${linklocal_interface_id}= Get Interface ID Of IPv6 ${ipv6_linklocal_addr}
256 ${slaac_interface_id}= Get Interface ID Of IPv6 ${ipv6_slaac_addr}
257
258 Should Be Equal ${linklocal_interface_id} ${slaac_interface_id}
259
260
abhijith-121c3e96d72025-09-09 11:35:09 -0500261Verify Persistency Of Link Local IPv6 On BMC Reboot
262 [Documentation] Verify persistency of link local on BMC reboot.
263 [Tags] Verify_Persistency_Of_Link_Local_IPv6_On_BMC_Reboot
264
265 # Capturing the linklocal before reboot.
266 @{ipv6_address_origin_list} ${linklocal_addr_before_reboot}=
267 ... Get Address Origin List And Address For Type LinkLocal
268
269 # Rebooting BMC.
270 Redfish OBMC Reboot (off) stack_mode=skip
271
272 @{ipv6_address_origin_list} ${linklocal_addr_after_reboot}=
273 ... Get Address Origin List And Address For Type LinkLocal
274
275 # Verifying the linklocal must be the same before and after reboot.
276 Should Be Equal ${linklocal_addr_before_reboot} ${linklocal_addr_after_reboot}
277 ... msg=IPv6 Linklocal address has changed after reboot.
278
279
Sweta Potthuri2f3fbb52025-09-19 00:50:47 -0500280Modify MAC and Verify BMC Reinitializing Linklocal
281 [Documentation] Modify MAC and verify BMC reinitializing linklocal.
282 [Tags] Modify_MAC_and_Verify_BMC_Reinitializing_Linklocal
283 [Teardown] Configure MAC Settings ${original_address}
284
285 ${original_address}= Get BMC MAC Address
286 @{ipv6_addressorigin_list} ${ipv6_before_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
287
288 # Modify MAC Address Of Ethernet Interface.
289 Configure MAC Settings ${new_mac_addr}
290 Sleep 30s
291 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
292 @{ipv6_addressorigin_list} ${ipv6_linklocal_after_addr}= Get Address Origin List And Address For Type LinkLocal
293
294 # Verify whether the linklocal has changed and is in the the correct format.
295 Check If Linklocal Address Is In Correct Format
296 Should Not Be Equal ${ipv6_before_linklocal_addr} ${ipv6_linklocal_after_addr}
297
298
abhijith-121bfbd03a2025-09-15 01:40:35 -0500299Add Multiple IPv6 Address And Verify
300 [Documentation] Add multiple IPv6 address and verify.
301 [Tags] Add_Multiple_IPv6_Address_And_Verify
302 [Teardown] Run Keywords
303 ... Delete IPv6 Address ${test_ipv6_addr} AND Delete IPv6 Address ${test_ipv6_addr1}
304 ... AND Test Teardown Execution
305
306 Configure Multiple IPv6 Address on BMC ${test_prefix_length}
307
308
abhijith-12197078c52025-09-25 01:13:00 -0500309Verify Coexistence Of Static IPv6 And SLAAC On BMC
abhijith-1214dc01a02025-09-24 11:29:55 -0500310 [Documentation] Verify static IPv6 And SLAAC both coexist.
abhijith-12197078c52025-09-25 01:13:00 -0500311 [Tags] Verify_Coexistence_Of_Static_IPv6_And_SLAAC_On_BMC
312 [Setup] Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
313 Set SLAAC Configuration State And Verify ${True}
314 [Teardown] Delete IPv6 Address ${test_ipv6_addr}
315
316 Sleep ${NETWORK_TIMEOUT}s
317
318 Check Coexistence Of Static IPv6 And SLAAC
319
320
abhijith-1218ff5db42025-09-24 06:24:03 -0500321Verify Coexistence Of Link Local And DHCPv6 On BMC
322 [Documentation] Verify link local And dhcpv6 both coexist.
323 [Tags] Verify_Coexistence_Of_Link_Local_And_DHCPv6_On_BMC
324 [Setup] Set DHCPv6 Property Enabled ${2}
325
326 Sleep ${NETWORK_TIMEOUT}s
327
328 Check Coexistence Of Link Local And DHCPv6
329
330
abhijith-1214dc01a02025-09-24 11:29:55 -0500331Verify Coexistence Of Link Local And SLAAC On BMC
332 [Documentation] Verify link local And SLAAC both coexist.
333 [Tags] Verify_Coexistence_Of_Link_Local_And_SLAAC_On_BMC
334 [Setup] Set SLAAC Configuration State And Verify ${True}
335
336 Sleep ${NETWORK_TIMEOUT}s
337
338 Check Coexistence Of Link Local And SLAAC
339
340
abhijith-121ffea1912025-10-06 02:39:22 -0500341Verify Coexistence Of All IPv6 Type Addresses On BMC
342 [Documentation] Verify coexistence of link local, static, DHCPv6 and SLAAC ipv6 addresses.
343 [Tags] Verify_Coexistence_Of_All_IPv6_Type_Addresses_On_BMC
344 [Setup] Run Keywords Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
345 ... AND Get The Initial DHCPv6 Setting On Each Interface ${1}
346 ... AND Set And Verify DHCPv6 Property Enabled
347 ... AND Get The Initial SLAAC Setting On Each Interface ${1}
348 ... AND Set SLAAC Configuration State And Verify ${True}
349 [Teardown] Run Keywords Delete IPv6 Address ${test_ipv6_addr}
350 ... AND Set And Verify DHCPv6 Property ${dhcpv6_channel_1} ${1}
351 ... AND Set SLAAC Configuration State And Verify ${slaac_channel_1} [${HTTP_OK}] ${1}
352
353 Sleep ${NETWORK_TIMEOUT}s
354
355 # Verify link local, static, DHCPv6 and SLAAC ipv6 addresses coexist.
356 Verify The Coexistence Of The Address Type LinkLocal Static DHCPv6 SLAAC
357
358
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600359*** Keywords ***
360
Prashanth Katti3270fd02021-06-11 08:02:22 -0500361Suite Setup Execution
362 [Documentation] Do suite setup execution.
363
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -0500364 Redfish.Login
Prashanth Katti3270fd02021-06-11 08:02:22 -0500365 ${active_channel_config}= Get Active Channel Config
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -0500366 Set Suite Variable ${active_channel_config}
367
Prashanth Katti3270fd02021-06-11 08:02:22 -0500368 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
369
370 Set Suite variable ${ethernet_interface}
371
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500372 ${initial_ipv4_addressorigin_list} ${initial_ipv4_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses
373 ${initial_ipv6_addressorigin_list} ${initial_ipv6_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses
374
375 Set Suite Variable ${initial_ipv4_addressorigin_list}
376 Set Suite Variable ${initial_ipv4_addr_list}
377 Set Suite Variable ${initial_ipv6_addressorigin_list}
378 Set Suite Variable ${initial_ipv6_addr_list}
379
Prashanth Katti3270fd02021-06-11 08:02:22 -0500380
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600381Test Setup Execution
382 [Documentation] Test setup execution.
383
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600384 @{ipv6_network_configurations}= Get IPv6 Network Configuration
385 Set Test Variable @{ipv6_network_configurations}
386
387 # Get BMC IPv6 address and prefix length.
388 ${ipv6_data}= Get BMC IPv6 Info
389 Set Test Variable ${ipv6_data}
390
391
392Test Teardown Execution
393 [Documentation] Test teardown execution.
394
395 FFDC On Test Case Fail
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600396
397
398Get IPv6 Network Configuration
399 [Documentation] Get Ipv6 network configuration.
400 # Sample output:
401 # {
ganesanb4d430282023-04-27 14:33:23 +0000402 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0",
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600403 # "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface",
404 # "DHCPv4": {
405 # "DHCPEnabled": false,
406 # "UseDNSServers": false,
407 # "UseDomainName": true,
408 # "UseNTPServers": false
409 # },
410 # "DHCPv6": {
411 # "OperatingMode": "Disabled",
412 # "UseDNSServers": false,
413 # "UseDomainName": true,
414 # "UseNTPServers": false
415 # },
416 # "Description": "Management Network Interface",
417 # "FQDN": "localhost",
418 # "HostName": "localhost",
419 # "IPv4Addresses": [
420 # {
421 # "Address": "xx.xx.xx.xx",
422 # "AddressOrigin": "Static",
423 # "Gateway": "xx.xx.xx.1",
424 # "SubnetMask": "xx.xx.xx.0"
425 # },
426 # {
427 # "Address": "169.254.xx.xx",
428 # "AddressOrigin": "IPv4LinkLocal",
429 # "Gateway": "0.0.0.0",
430 # "SubnetMask": "xx.xx.0.0"
431 # },
432 # ],
433 # "IPv4StaticAddresses": [
434 # {
435 # "Address": "xx.xx.xx.xx",
436 # "AddressOrigin": "Static",
437 # "Gateway": "xx.xx.xx.1",
438 # "SubnetMask": "xx.xx.0.0"
439 # }
440 # }
441 # ],
442 # "IPv6AddressPolicyTable": [],
443 # "IPv6Addresses": [
444 # {
445 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx",
446 # "AddressOrigin": "LinkLocal",
447 # "AddressState": null,
448 # "PrefixLength": xx
449 # }
450 # ],
451 # "IPv6DefaultGateway": "",
452 # "IPv6StaticAddresses": [
453 # { "Address": "xxxx:xxxx:xxxx:xxxx::xxxx",
454 # "AddressOrigin": "Static",
455 # "AddressState": null,
456 # "PrefixLength": xxx
457 # }
458 # ],
459 # "Id": "eth0",
460 # "InterfaceEnabled": true,
461 # "LinkStatus": "LinkUp",
462 # "MACAddress": "xx:xx:xx:xx:xx:xx",
463 # "Name": "Manager Ethernet Interface",
464 # "NameServers": [],
465 # "SpeedMbps": 0,
466 # "StaticNameServers": [],
467 # "Status": {
468 # "Health": "OK",
469 # "HealthRollup": "OK",
470 # "State": "Enabled"
471 # },
472 # "VLANs": {
ganesanb4d430282023-04-27 14:33:23 +0000473 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0/VLANs"
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600474
475
476 ${active_channel_config}= Get Active Channel Config
477 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
478
479 @{ipv6_network_configurations}= Get From Dictionary ${resp.dict} IPv6StaticAddresses
George Keishing409df052024-01-17 22:36:14 +0530480 RETURN @{ipv6_network_configurations}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500481
482
483Verify IPv6 And PrefixLength
484 [Documentation] Verify IPv6 address and prefix length on BMC.
485 [Arguments] ${ipv6_addr} ${prefix_len}
486
487 # Description of the argument(s):
488 # ipv6_addr IPv6 address to be verified.
489 # prefix_len PrefixLength value to be verified.
490
491 # Catenate IPv6 address and its prefix length.
492 ${ipv6_with_prefix}= Catenate ${ipv6_addr}/${prefix_len}
493
494 # Get IPv6 address details on BMC using IP command.
495 @{ip_data}= Get BMC IPv6 Info
496
497 # Verify if IPv6 and prefix length is configured on BMC.
498
499 Should Contain ${ip_data} ${ipv6_with_prefix}
500 ... msg=IPv6 and prefix length pair does not exist.
501
502
503Configure IPv6 Address On BMC
504 [Documentation] Add IPv6 Address on BMC.
505 [Arguments] ${ipv6_addr} ${prefix_len} ${valid_status_codes}=${HTTP_OK}
506
507 # Description of argument(s):
508 # ipv6_addr IPv6 address to be added (e.g. "2001:EEEE:2222::2022").
509 # prefix_len Prefix length for the IPv6 to be added
510 # (e.g. "64").
511 # valid_status_codes Expected return code from patch operation
512 # (e.g. "200").
513
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500514 ${prefix_length}= Convert To Integer ${prefix_len}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500515 ${empty_dict}= Create Dictionary
516 ${ipv6_data}= Create Dictionary Address=${ipv6_addr}
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500517 ... PrefixLength=${prefix_length}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500518
519 ${patch_list}= Create List
520
521 # Get existing static IPv6 configurations on BMC.
522 ${ipv6_network_configurations}= Get IPv6 Network Configuration
523 ${num_entries}= Get Length ${ipv6_network_configurations}
524
525 FOR ${INDEX} IN RANGE 0 ${num_entries}
526 Append To List ${patch_list} ${empty_dict}
527 END
528
George Keishinge6e161e2025-05-08 10:18:30 +0530529 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}'
530 ... ${HTTP_OK},${HTTP_NO_CONTENT}
531 ... ${valid_status_codes}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500532
533 # We need not check for existence of IPv6 on BMC while adding.
534 Append To List ${patch_list} ${ipv6_data}
535 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
536
537 ${active_channel_config}= Get Active Channel Config
538 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
539
540 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
541 ... valid_status_codes=[${valid_status_codes}]
542
543 Return From Keyword If '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}'
544
545 # Note: Network restart takes around 15-18s after patch request processing.
546 Sleep ${NETWORK_TIMEOUT}s
547 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
548
549 Verify IPv6 And PrefixLength ${ipv6_addr} ${prefix_len}
550
551 # Verify if existing static IPv6 addresses still exist.
552 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
553 Verify IPv6 On BMC ${ipv6_network_configuration['Address']}
554 END
555
556 Validate IPv6 Network Config On BMC
557
558
abhijith-121bfbd03a2025-09-15 01:40:35 -0500559Configure Multiple IPv6 Address on BMC
560 [Documentation] Add multiple IPv6 address on BMC.
561 [Arguments] ${prefix_len}
562 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_NO_CONTENT}]
563
564 # Description of argument(s):
565 # prefix_len Prefix length for the IPv6 to be added
566 # (e.g. "64").
567 # valid_status_codes Expected return code from patch operation
568 # (e.g. "200").
569
570 ${ipv6_list}= Create List ${test_ipv6_addr} ${test_ipv6_addr1}
571 ${prefix_length}= Convert To Integer ${prefix_len}
572 ${empty_dict}= Create Dictionary
573 ${patch_list}= Create List
574
575 # Get existing static IPv6 configurations on BMC.
576 ${ipv6_network_configurations}= Get IPv6 Network Configuration
577 ${num_entries}= Get Length ${ipv6_network_configurations}
578
579 FOR ${INDEX} IN RANGE 0 ${num_entries}
580 Append To List ${patch_list} ${empty_dict}
581 END
582
583 # We need not check for existence of IPv6 on BMC while adding.
584 FOR ${ipv6_addr} IN @{ipv6_list}
585 ${ipv6_data}= Create Dictionary Address=${ipv6_addr} PrefixLength=${prefix_length}
586 Append To List ${patch_list} ${ipv6_data}
587 END
588 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
589
590 ${active_channel_config}= Get Active Channel Config
591 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
592
593 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
594 ... valid_status_codes=${valid_status_codes}
595
596 IF ${valid_status_codes} != [${HTTP_OK}, ${HTTP_NO_CONTENT}]
597 Fail msg=Static address not added correctly
598 END
599
600 # Note: Network restart takes around 15-18s after patch request processing.
601 Sleep ${NETWORK_TIMEOUT}s
602 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
603
604 # Verify newly added ip address on CLI.
605 FOR ${ipv6_addr} IN @{ipv6_list}
606 Verify IPv6 And PrefixLength ${ipv6_addr} ${prefix_len}
607 END
608
609 # Verify if existing static IPv6 addresses still exist.
610 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
611 Verify IPv6 On BMC ${ipv6_network_configuration['Address']}
612 END
613
614 # Get the latest ipv6 network configurations.
615 @{ipv6_network_configurations}= Get IPv6 Network Configuration
616
617 # Verify newly added ip address on BMC.
618 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
619 Should Contain Match ${ipv6_list} ${ipv6_network_configuration['Address']}
620 END
621
622 Validate IPv6 Network Config On BMC
623
624
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500625Validate IPv6 Network Config On BMC
626 [Documentation] Check that IPv6 network info obtained via redfish matches info
627 ... obtained via CLI.
Sridevi Rameshed94c692025-09-07 23:41:10 -0500628
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500629 @{ipv6_network_configurations}= Get IPv6 Network Configuration
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500630 ${ipv6_data}= Get BMC IPv6 Info
631 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
632 Should Contain Match ${ipv6_data} ${ipv6_network_configuration['Address']}/*
633 ... msg=IPv6 address does not exist.
634 END
635
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500636
637Delete IPv6 Address
638 [Documentation] Delete IPv6 address of BMC.
Prashanth Kattibcb9dab2025-04-01 12:58:37 -0500639 [Arguments] ${ipv6_addr}
640 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500641
642 # Description of argument(s):
643 # ipv6_addr IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234").
644 # valid_status_codes Expected return code from patch operation
645 # (e.g. "200"). See prolog of rest_request
646 # method in redfish_plus.py for details.
647
648 ${empty_dict}= Create Dictionary
649 ${patch_list}= Create List
650
651 @{ipv6_network_configurations}= Get IPv6 Network Configuration
652 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
653 IF '${ipv6_network_configuration['Address']}' == '${ipv6_addr}'
654 Append To List ${patch_list} ${null}
655 ELSE
656 Append To List ${patch_list} ${empty_dict}
657 END
658 END
659
660 ${ip_found}= Run Keyword And Return Status List Should Contain Value
661 ... ${patch_list} ${null} msg=${ipv6_addr} does not exist on BMC
662 Pass Execution If ${ip_found} == ${False} ${ipv6_addr} does not exist on BMC
663
664 # Run patch command only if given IP is found on BMC
665 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
666
667 ${active_channel_config}= Get Active Channel Config
668 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
669
670 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
Sweta Potthuria1981612025-05-09 05:41:10 -0500671 ... valid_status_codes=${valid_status_codes}
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500672
673 # Note: Network restart takes around 15-18s after patch request processing
674 Sleep ${NETWORK_TIMEOUT}s
675 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
676
677 # IPv6 address that is deleted should not be there on BMC.
678 ${delete_status}= Run Keyword And Return Status Verify IPv6 On BMC ${ipv6_addr}
Anvesh-Kumar_Rayankula3a26c662025-04-16 01:19:26 -0500679 IF '${valid_status_codes}' == '[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]'
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500680 Should Be True '${delete_status}' == '${False}'
681 ELSE
682 Should Be True '${delete_status}' == '${True}'
683 END
684
685 Validate IPv6 Network Config On BMC
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500686
687
688Modify IPv6 Address
689 [Documentation] Modify and verify IPv6 address of BMC.
690 [Arguments] ${ipv6} ${new_ipv6} ${prefix_len}
691 ... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
692
693 # Description of argument(s):
694 # ipv6 IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
695 # new_ipv6 New IPv6 address to be configured.
696 # prefix_len Prefix length value (Range 1 to 128).
697 # valid_status_codes Expected return code from patch operation
698 # (e.g. "200", "201").
699
700 ${empty_dict}= Create Dictionary
701 ${patch_list}= Create List
702 ${prefix_length}= Convert To Integer ${prefix_len}
703 ${ipv6_data}= Create Dictionary
704 ... Address=${new_ipv6} PrefixLength=${prefix_length}
705
706 # Sample IPv6 network configurations:
707 # "IPv6AddressPolicyTable": [],
708 # "IPv6Addresses": [
709 # {
710 # "Address": "X002:db8:0:2::XX0",
711 # "AddressOrigin": "DHCPv6",
712 # "PrefixLength": 128
713 # },
714 # {
715 # "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX",
716 # "AddressOrigin": "SLAAC",
717 # "PrefixLength": 64
718 # },
719 # {
720 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
721 # "AddressOrigin": "Static",
722 # "PrefixLength": 56
723 # },
724 # {
725 # "Address": “Z002:db8:0:2:a94:efff:fe82:5000",
726 # "AddressOrigin": "Static",
727 # "PrefixLength": 56
728 # },
729 # {
730 # "Address": “Xe80::a94:efff:YYYY:XXXX",
731 # "AddressOrigin": "LinkLocal",
732 # "PrefixLength": 64
733 # },
734 # {
735 # "Address": “X002:db8:1:2:eff:233:fee:546",
736 # "AddressOrigin": "Static",
737 # "PrefixLength": 56
738 # }
739 # ],
740 # "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”,
741 # "IPv6StaticAddresses": [
742 # {
743 # "Address": “X002:db8:0:2:a94:efff:fe82:5000",
744 # "PrefixLength": 56
745 # },
746 # {
747 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
748 # "PrefixLength": 56
749 # },
750 # {
751 # "Address": “Z002:db8:1:2:eff:233:fee:546",
752 # "PrefixLength": 56
753 # }
754 # ],
755 # "IPv6StaticDefaultGateways": [],
756
757 # Find the position of IPv6 address to be modified.
758 @{ipv6_network_configurations}= Get IPv6 Network Configuration
759 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
George Keishinge6e161e2025-05-08 10:18:30 +0530760 IF '${ipv6_network_configuration['Address']}' == '${ipv6}'
761 Append To List ${patch_list} ${ipv6_data}
762 ELSE
763 Append To List ${patch_list} ${empty_dict}
764 END
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500765 END
766
767 # Modify the IPv6 address only if given IPv6 is found
768 ${ip_found}= Run Keyword And Return Status List Should Contain Value
769 ... ${patch_list} ${ipv6_data} msg=${ipv6} does not exist on BMC
770 Pass Execution If ${ip_found} == ${False} ${ipv6} does not exist on BMC
771
772 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
773
774 ${active_channel_config}= Get Active Channel Config
775 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
776
777 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
778 ... body=&{data} valid_status_codes=${valid_status_codes}
779
780 # Note: Network restart takes around 15-18s after patch request processing.
781 Sleep ${NETWORK_TIMEOUT}s
782 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
783
784 # Verify if new IPv6 address is configured on BMC.
785 Verify IPv6 On BMC ${new_ipv6}
786
787 # Verify if old IPv6 address is erased.
788 ${cmd_status}= Run Keyword And Return Status
789 ... Verify IPv6 On BMC ${ipv6}
790 Should Be Equal ${cmd_status} ${False} msg=Old IPv6 address is not deleted.
791
792 Validate IPv6 Network Config On BMC
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500793
794
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500795Set SLAAC Configuration State And Verify
796 [Documentation] Set SLAAC configuration state and verify.
Sridevi Rameshed94c692025-09-07 23:41:10 -0500797 [Arguments] ${slaac_state} ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
798 ... ${channel_number}=${CHANNEL_NUMBER}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500799
800 # Description of argument(s):
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500801 # slaac_state SLAAC state('True' or 'False').
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500802 # valid_status_code Expected valid status codes.
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500803 # channel_number Channel number 1(eth0) or 2(eth1).
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500804
805 ${active_channel_config}= Get Active Channel Config
806 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
807
808 ${data}= Set Variable If ${slaac_state} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC}
809 ${resp}= Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
Sweta Potthuri610f86f2025-05-30 00:47:23 -0500810 ... body=${data} valid_status_codes=${valid_status_codes}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500811
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500812 # Verify SLAAC is set correctly.
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500813 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
814 ${slaac_verify}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig
815
George Keishinge6e161e2025-05-08 10:18:30 +0530816 IF '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}'
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500817 Fail msg=SLAAC not set properly.
George Keishinge6e161e2025-05-08 10:18:30 +0530818 END
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500819
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500820Set And Verify DHCPv6 Property
821 [Documentation] Set DHCPv6 property and verify.
822 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER}
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500823
824 # Description of argument(s):
825 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled').
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500826 # channel_number Channel number 1 or 2.
827
828 Set DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number}
829 Verify DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number}
830
831
832Set DHCPv6 Property
833 [Documentation] Set DHCPv6 attribute is enables or disabled.
834 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER}
835
836 # Description of argument(s):
837 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled').
838 # channel_number Channel number 1 or 2.
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500839
840 ${data}= Set Variable If '${dhcpv6_operating_mode}' == 'Disabled' ${DISABLE_DHCPv6} ${ENABLE_DHCPv6}
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500841 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
842
843 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
844 ... body=${data} valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}]
845
kvishalbd04bd62025-08-05 03:57:53 -0500846
847Verify DHCPv6 Property
848 [Documentation] Verify DHCPv6 settings is enabled or disabled.
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500849 [Arguments] ${dhcpv6_operating_mode} ${channel_number}=${CHANNEL_NUMBER}
kvishalbd04bd62025-08-05 03:57:53 -0500850
851 # Description of Argument(s):
852 # dhcpv6_operating_mode Enable/ Disable DHCPv6.
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500853 # channel_number Channel number 1 or 2.
854
855 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
kvishalbd04bd62025-08-05 03:57:53 -0500856
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500857 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
858 ${dhcpv6_verify}= Get From Dictionary ${resp.dict} DHCPv6
859
860 Should Be Equal '${dhcpv6_verify['OperatingMode']}' '${dhcpv6_operating_mode}'
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500861
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500862
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500863Get IPv6 Static Default Gateway
864 [Documentation] Get IPv6 static default gateway.
865
866 ${active_channel_config}= Get Active Channel Config
867 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
868
869 @{ipv6_static_defgw_configurations}= Get From Dictionary ${resp.dict} IPv6StaticDefaultGateways
870 RETURN @{ipv6_static_defgw_configurations}
871
Sweta Potthuri2d085732025-07-16 09:10:08 -0500872
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500873Configure IPv6 Static Default Gateway On BMC
874 [Documentation] Configure IPv6 static default gateway on BMC.
875 [Arguments] ${ipv6_gw_addr} ${prefix_length_def}
876 ... ${valid_status_codes}=${HTTP_OK}
Sridevi Rameshed94c692025-09-07 23:41:10 -0500877
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500878 # Description of argument(s):
879 # ipv6_gw_addr IPv6 Static Default Gateway address to be configured.
880 # prefix_len_def Prefix length value (Range 1 to 128).
881 # valid_status_codes Expected return code from patch operation
882 # (e.g. "200", "204".)
883
884 # Prefix Length is passed as None.
885 IF '${prefix_length_def}' == '${None}'
886 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr}
887 ELSE
888 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr} Prefix Length=${prefix_length_def}
889 END
890
891 ${ipv6_static_def_gw}= Get IPv6 Static Default Gateway
892
893 ${num_entries}= Get Length ${ipv6_static_def_gw}
894
895 ${patch_list}= Create List
896 ${empty_dict}= Create Dictionary
897
898 FOR ${INDEX} IN RANGE 0 ${num_entries}
899 Append To List ${patch_list} ${empty_dict}
900 END
901
902 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}'
903 ... ${HTTP_OK},${HTTP_NO_CONTENT}
904 ... ${valid_status_codes}
905
906 Append To List ${patch_list} ${ipv6_gw}
907 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
908
909 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
910 ... body=${data} valid_status_codes=[${valid_status_codes}]
911
912 # Verify the added static default gateway is present in Redfish Get Output.
913 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway
914
915 ${ipv6_static_def_gw_list}= Create List
916 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway}
917 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
918 Append To List ${ipv6_static_def_gw_list} ${value}
919 END
920
921 IF '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}'
922 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
923 ELSE
924 Should Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
925 END
926
Sweta Potthuri2d085732025-07-16 09:10:08 -0500927
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -0500928Modify IPv6 Static Default Gateway On BMC
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500929 [Documentation] Modify and verify IPv6 address of BMC.
930 [Arguments] ${ipv6_gw_addr} ${new_static_def_gw} ${prefix_length}
931 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED}]
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500932
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500933 # Description of argument(s):
934 # ipv6_gw_addr IPv6 static default gateway address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
935 # new_static_def_gw New static default gateway address to be configured.
Sridevi Rameshed94c692025-09-07 23:41:10 -0500936 # prefix_length Prefix length value (Range 1 to 128).
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500937 # valid_status_codes Expected return code from patch operation
938 # (e.g. "200", "204").
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500939
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500940 ${empty_dict}= Create Dictionary
941 ${patch_list}= Create List
942 # Prefix Length is passed as None.
943 IF '${prefix_length_def}' == '${None}'
944 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw}
945 ELSE
946 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw} Prefix Length=${prefix_length_def}
947 END
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500948
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500949 @{ipv6_static_def_gw_list}= Get IPv6 Static Default Gateway
950
951 FOR ${ipv6_static_def_gw} IN @{ipv6_static_def_gw_list}
952 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}'
953 Append To List ${patch_list} ${modified_ipv6_gw_addripv6_data}
954 ELSE
955 Append To List ${patch_list} ${empty_dict}
956 END
957 END
958
959 # Modify the IPv6 address only if given IPv6 static default gateway is found.
960 ${ip_static_def_gw_found}= Run Keyword And Return Status List Should Contain Value
961 ... ${patch_list} ${modified_ipv6_gw_addripv6_data} msg=${ipv6_gw_addr} does not exist on BMC
962 Pass Execution If ${ip_static_def_gw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC
963
964 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
965
966 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
967 ... body=&{data} valid_status_codes=${valid_status_codes}
968
969 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway
970
971 ${ipv6_static_def_gw_list}= Create List
972 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway}
Sweta Potthuri2d085732025-07-16 09:10:08 -0500973 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500974 Append To List ${ipv6_static_def_gw_list} ${value}
975 END
976
977 Should Contain ${ipv6_static_def_gw_list} ${new_static_def_gw}
978 # Verify if old static default gateway address is erased.
979 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
980
Sweta Potthuri2d085732025-07-16 09:10:08 -0500981
982Delete IPv6 Static Default Gateway
983 [Documentation] Delete IPv6 static default gateway on BMC.
984 [Arguments] ${ipv6_gw_addr}
985 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
986
987 # Description of argument(s):
988 # ipv6_gw_addr IPv6 Static Default Gateway address to be deleted.
989 # valid_status_codes Expected return code from patch operation
990 # (e.g. "200").
991
992 ${patch_list}= Create List
993 ${empty_dict}= Create Dictionary
994
995 ${ipv6_static_def_gw_list}= Create List
996 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway
997
998 FOR ${ipv6_staticdef_gateway} IN @{ipv6_static_defgw_configurations}
999 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
1000 Append To List ${ipv6_static_def_gw_list} ${value}
1001 END
1002
1003 ${defgw_found}= Run Keyword And Return Status List Should Contain Value
1004 ... ${ipv6_static_def_gw_list} ${ipv6_gw_addr} msg=${ipv6_gw_addr} does not exist on BMC
1005 Skip If ${defgw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC
1006
1007 FOR ${ipv6_static_def_gw} IN @{ipv6_static_defgw_configurations}
1008 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}'
1009 Append To List ${patch_list} ${null}
1010 ELSE
1011 Append To List ${patch_list} ${empty_dict}
1012 END
1013 END
1014
1015 # Run patch command only if given IP is found on BMC.
1016 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
1017
1018 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
1019 ... valid_status_codes=${valid_status_codes}
1020
1021 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
1022
1023 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway
1024 Should Not Contain Match ${ipv6_static_defgw_configurations} ${ipv6_gw_addr}
1025 ... msg=IPv6 Static default gateway does not exist.
Sweta Potthuri35c503b2025-07-27 23:36:20 -05001026
1027
1028Check Coexistence Of Linklocalv6 And Static IPv6
1029 [Documentation] Verify both linklocalv6 and static IPv6 exist.
1030
Sweta Potthuri35c503b2025-07-27 23:36:20 -05001031 # Verify the address origin contains static and linklocal.
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -05001032 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
Sweta Potthuri35c503b2025-07-27 23:36:20 -05001033
Sweta Potthuri35c503b2025-07-27 23:36:20 -05001034 Should Match Regexp ${ipv6_linklocal_addr} ${linklocal_addr_format}
Sweta Potthuri35c503b2025-07-27 23:36:20 -05001035 Should Contain ${ipv6_addressorigin_list} Static
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -05001036
1037
abhijith-12197078c52025-09-25 01:13:00 -05001038Check Coexistence Of Static IPv6 And SLAAC
abhijith-1214dc01a02025-09-24 11:29:55 -05001039 [Documentation] Verify both static IPv6 and SLAAC coexist.
abhijith-12197078c52025-09-25 01:13:00 -05001040
1041 # Verify the address origin contains static and slaac.
1042 @{ipv6_addressorigin_list} ${ipv6_static_addr}=
1043 ... Get Address Origin List And Address For Type Static
1044
1045 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}=
1046 ... Get Address Origin List And Address For Type SLAAC
1047
1048
abhijith-1214dc01a02025-09-24 11:29:55 -05001049Check Coexistence Of Link Local And SLAAC
1050 [Documentation] Verify both link local and SLAAC coexist.
1051
1052 # Verify the address origin contains SLAAC and link local.
1053 @{ipv6_addressorigin_list} ${ipv6_link_local_addr}=
1054 ... Get Address Origin List And Address For Type LinkLocal
1055
1056 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}=
1057 ... Get Address Origin List And Address For Type SLAAC
1058
1059 Should Match Regexp ${ipv6_link_local_addr} ${linklocal_addr_format}
1060
1061
abhijith-1218ff5db42025-09-24 06:24:03 -05001062Check Coexistence Of Link Local And DHCPv6
1063 [Documentation] Verify both link local and dhcpv6 coexist.
1064
1065 # Verify the address origin contains dhcpv6 and link local.
1066 @{ipv6_address_origin_list} ${ipv6_link_local_addr}=
1067 ... Get Address Origin List And Address For Type LinkLocal
1068
1069 @{ipv6_address_origin_list} ${ipv6_dhcpv6_addr}=
1070 ... Get Address Origin List And Address For Type DHCPv6
1071
1072 Should Match Regexp ${ipv6_link_local_addr} ${linklocal_addr_format}
1073
1074
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -05001075Check If Linklocal Address Is In Correct Format
1076 [Documentation] Linklocal address has network part fe80 and host part EUI64.
1077
1078 # Fetch the linklocal address.
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -05001079 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -05001080
1081 # Follow EUI64 from MAC.
1082 ${system_mac}= Get BMC MAC Address
1083 ${split_octets}= Split String ${system_mac} :
1084 ${first_octet}= Evaluate int('${split_octets[0]}', 16)
1085 ${flipped_hex}= Evaluate format(${first_octet} ^ 2, '02x')
1086 ${grp1}= Evaluate re.sub(r'^0+', '', '${flipped_hex}${split_octets[1]}') modules=re
1087 ${grp2}= Evaluate re.sub(r'^0+', '', '${split_octets[2]}ff') modules=re
1088 ${grp3}= Evaluate re.sub(r'^0+', '', '${split_octets[4]}${split_octets[5]}') modules=re
1089 ${linklocal}= Set Variable fe80::${grp1}:${grp2}:fe${split_octets[3]}:${grp3}
1090
1091 # Verify the linklocal obtained is the same as on the machine.
1092 Should Be Equal ${linklocal} ${ipv6_linklocal_addr}
1093
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -05001094
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001095Check BMC Gets SLAAC Address
1096 [Documentation] Check BMC gets slaac address.
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -05001097
1098 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC
1099
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -05001100
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001101Get The Initial DHCPv6 Setting On Each Interface
1102 [Documentation] Get the initial DHCPv6 setting of each interface.
1103 [Arguments] ${channel_number}
Sweta Potthuridb4a6d62025-08-18 11:29:16 -05001104
1105 # Description of the argument(s):
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001106 # channel_number Channel number 1 or 2.
Sweta Potthuridb4a6d62025-08-18 11:29:16 -05001107
1108 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']}
1109 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1110 ${initial_dhcpv6_iface}= Get From Dictionary ${resp.dict} DHCPv6
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001111 IF ${channel_number}==${1}
1112 Set Test Variable ${dhcpv6_channel_1} ${initial_dhcpv6_iface['OperatingMode']}
1113 ELSE
1114 Set Test Variable ${dhcpv6_channel_2} ${initial_dhcpv6_iface['OperatingMode']}
1115 END
1116
1117
1118Get The Initial DHCPv6 Settings
1119 [Documentation] Get the initial DHCPv6 settings of both the interfaces.
1120
1121 Get The Initial DHCPv6 Setting On Each Interface ${1}
1122 Get The Initial DHCPv6 Setting On Each Interface ${2}
1123
1124
1125Get The Initial SLAAC Settings
1126 [Documentation] Get the initial SLAAC settings of both the interfaces.
1127
1128 Get The Initial SLAAC Setting On Each Interface ${1}
1129 Get The Initial SLAAC Setting On Each Interface ${2}
1130
1131
1132Get The Initial SLAAC Setting On Each Interface
1133 [Documentation] Get the initial SLAAC setting of the interface.
1134 [Arguments] ${channel_number}
1135
1136 # Description of the argument(s):
1137 # channel_number Channel number 1 or 2.
1138
1139 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']}
1140 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1141 ${initial_slaac_iface}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig
1142 IF ${channel_number}==${1}
1143 Set Test Variable ${slaac_channel_1} ${initial_slaac_iface['IPv6AutoConfigEnabled']}
1144 ELSE
1145 Set Test Variable ${slaac_channel_2} ${initial_slaac_iface['IPv6AutoConfigEnabled']}
1146 END
Sweta Potthuridb4a6d62025-08-18 11:29:16 -05001147
1148
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001149Get Address Origin List And IPv4 or IPv6 Address
1150 [Documentation] Get address origin list and address for type.
1151 [Arguments] ${ip_address_type}
1152
1153 # Description of the argument(s):
Sridevi Rameshed94c692025-09-07 23:41:10 -05001154 # ip_address_type Type of IPv4 or IPv6 address to be checked.
Sweta Potthuriabbbeae2025-08-21 00:06:26 -05001155
1156 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
1157 @{ip_addresses}= Get From Dictionary ${resp.dict} ${ip_address_type}
1158
1159 ${ip_addressorigin_list}= Create List
1160 ${ip_addr_list}= Create List
1161 FOR ${ip_address} IN @{ip_addresses}
1162 ${ip_addressorigin}= Get From Dictionary ${ip_address} AddressOrigin
1163 Append To List ${ip_addressorigin_list} ${ip_addressorigin}
1164 Append To List ${ip_addr_list} ${ip_address['Address']}
1165 END
1166 RETURN ${ip_addressorigin_list} ${ip_addr_list}
1167
1168
1169Verify All The Addresses Are Intact
1170 [Documentation] Verify all the addresses and address origins remain intact.
1171
1172 # Verify that it will not impact the IPv4 configuration.
1173 Sleep ${NETWORK_TIMEOUT}
1174 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
1175
1176 # IPv6 address must be present.
1177 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC
1178 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
1179
1180 # IPv4 and IPv6 addresses must remain intact.
1181 ${ipv4_addressorigin_list} ${ipv4_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses
1182 ${ipv6_addressorigin_list} ${ipv6_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses
1183
1184 ${ipv6_is_subset}= Evaluate set(${initial_ipv6_addr_list}).issubset(set(${ipv6_addr_list}))
1185 Should Be True ${ipv6_is_subset}
1186
1187 Should be Equal ${initial_ipv4_addressorigin_list} ${ipv4_addressorigin_list}
1188 Should be Equal ${initial_ipv4_addr_list} ${ipv4_addr_list}
Sweta Potthurif3d188f2025-09-08 07:17:31 -05001189
1190
1191Get Interface ID Of IPv6
1192 [Documentation] Get interface id of IPv6 address.
1193 [Arguments] ${ipv6_address}
1194
1195 # Description of the argument(s):
1196 # ${ipv6_address} IPv6 Address to extract the last 4 hextets.
1197
1198 # Last 64 bits of SLAAC and Linklocal must be the same.
1199 # Sample IPv6 network configurations.
1200 #"IPv6AddressPolicyTable": [],
1201 # "IPv6Addresses": [
1202 # {
1203 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx",
1204 # "AddressOrigin": "LinkLocal",
1205 # "AddressState": null,
1206 # "PrefixLength": xx
1207 # }
1208 # ],
1209 # {
1210 # "Address": "2002:xxxx:xxxx:xxxx:xxxx",
1211 # "AddressOrigin": "SLAAC",
1212 # "PrefixLength": 64
1213 # }
1214 # ],
1215
1216 ${split_ip_address}= Split String ${ipv6_address} :
1217 ${missing_ip}= Evaluate 8 - len(${split_ip_address}) + 1
1218 ${expanded_ip}= Create List
1219
1220 FOR ${hextet} IN @{split_ip_address}
1221 IF '${hextet}' == ''
1222 FOR ${i} IN RANGE ${missing_ip}
1223 Append To List ${expanded_ip} 0000
1224 END
1225 ELSE
1226 Append To List ${expanded_ip} ${hextet}
1227 END
1228 END
1229 ${interface_id}= Evaluate ':'.join(${expanded_ip}[-4:])
1230 RETURN ${interface_id}