blob: 4d64b0f1850aa2d7a933fd275bbabd3e438204d5 [file] [log] [blame]
Prashanth Katti8abbb4d2021-01-29 02:17:45 -06001*** Settings ***
2Documentation Network interface IPv6 configuration and verification
3 ... tests.
4
5Resource ../../lib/bmc_redfish_resource.robot
6Resource ../../lib/openbmc_ffdc.robot
7Resource ../../lib/bmc_ipv6_utils.robot
Sweta Potthuri8ba74322025-03-19 12:29:06 -05008Resource ../../lib/external_intf/vmi_utils.robot
Prashanth Katti8abbb4d2021-01-29 02:17:45 -06009Library ../../lib/bmc_network_utils.py
10Library Collections
11
12Test Setup Test Setup Execution
13Test Teardown Test Teardown Execution
Prashanth Katti3270fd02021-06-11 08:02:22 -050014Suite Setup Suite Setup Execution
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060015
Matt Fischer6fb70d92023-10-24 19:06:33 -060016Test Tags BMC_IPv6
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060017
18*** Variables ***
Sweta Potthuriafe858e2025-02-25 23:52:51 -060019${test_ipv6_addr} 2001:db8:3333:4444:5555:6666:7777:8888
20${test_ipv6_invalid_addr} 2001:db8:3333:4444:5555:6666:7777:JJKK
21${test_ipv6_addr1} 2001:db8:3333:4444:5555:6666:7777:9999
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060022
George Keishinge16f1582022-12-15 07:32:21 -060023# Valid prefix length is a integer ranges from 1 to 128.
Sweta Potthuriafe858e2025-02-25 23:52:51 -060024${test_prefix_length} 64
Sweta Potthuri565318d2025-06-09 06:13:46 -050025${ipv6_gw_addr} 2002:903:15F:32:9:3:32:1
26${prefix_length_def} None
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060027
28*** Test Cases ***
29
30Get IPv6 Address And Verify
31 [Documentation] Get IPv6 Address And Verify.
32 [Tags] Get_IPv6_Address_And_Verify
33
34 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
35 Verify IPv6 On BMC ${ipv6_network_configuration['Address']}
36 END
37
38
Prashanth Katti2c73abc2021-03-17 07:42:25 -050039Get PrefixLength And Verify
40 [Documentation] Get IPv6 prefix length and verify.
41 [Tags] Get_PrefixLength_And_Verify
42
43 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
44 Verify IPv6 On BMC ${ipv6_network_configuration['PrefixLength']}
45 END
46
47
48Get IPv6 Default Gateway And Verify
George Keishing96143832021-03-23 07:55:08 -050049 [Documentation] Get IPv6 default gateway and verify.
George Keishingade6ab42022-07-19 11:41:03 -050050 [Tags] Get_IPv6_Default_Gateway_And_Verify
Prashanth Katti2c73abc2021-03-17 07:42:25 -050051
52 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
53 ${ipv6_gateway}= Get From Dictionary ${resp.dict} IPv6DefaultGateway
54 Verify IPv6 Default Gateway On BMC ${ipv6_gateway}
55
56
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050057Verify All Configured IPv6 And PrefixLength On BMC
58 [Documentation] Verify IPv6 address and its prefix length on BMC.
59 [Tags] Verify_All_Configured_IPv6_And_PrefixLength_On_BMC
60
61 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
George Keishingf02ca2b2023-04-05 22:11:03 +053062 Verify IPv6 And PrefixLength ${ipv6_network_configuration['Address']}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050063 ... ${ipv6_network_configuration['PrefixLength']}
64 END
65
66
67Configure IPv6 Address And Verify
68 [Documentation] Configure IPv6 address and verify.
69 [Tags] Configure_IPv6_Address_And_Verify
Anvesh-Kumar_Rayankula3a26c662025-04-16 01:19:26 -050070 [Teardown] Run Keywords
71 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050072 [Template] Configure IPv6 Address On BMC
73
74
75 # IPv6 address Prefix length
76 ${test_ipv6_addr} ${test_prefix_length}
77
78
Prashanth Katti12ed4b72023-05-16 05:24:00 -050079Delete IPv6 Address And Verify
80 [Documentation] Delete IPv6 address and verify.
81 [Tags] Delete_IPv6_Address_And_Verify
82
83 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
84
85 Delete IPv6 Address ${test_ipv6_addr}
86
87
Prashanth Katti5f7d2e42023-05-22 03:17:25 -050088
George Keishingcc288312024-10-22 10:13:12 +053089Modify IPv6 Address And Verify
Prashanth Katti5f7d2e42023-05-22 03:17:25 -050090 [Documentation] Modify IPv6 address and verify.
91 [Tags] Modify_IPv6_Address_And_Verify
kvishal88de8c42025-03-04 01:45:10 -060092 [Teardown] Run Keywords
George Keishingcfdd0992025-03-17 11:59:20 +053093 ... Delete IPv6 Address ${test_ipv6_addr1} AND Test Teardown Execution
Prashanth Katti5f7d2e42023-05-22 03:17:25 -050094
95 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
96
97 Modify IPv6 Address ${test_ipv6_addr} ${test_ipv6_addr1} ${test_prefix_length}
98
99
Sweta Potthuriafe858e2025-02-25 23:52:51 -0600100Verify Persistency Of IPv6 After BMC Reboot
101 [Documentation] Verify persistency of IPv6 after BMC reboot.
102 [Tags] Verify_Persistency_Of_IPv6_After_BMC_Reboot
103 [Teardown] Run Keywords
104 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution
105
106 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
107
108 Redfish OBMC Reboot (off) stack_mode=skip
109
110 # Verifying persistency of IPv6.
111 Verify IPv6 On BMC ${test_ipv6_addr}
112
113
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500114Enable SLAACv6 On BMC And Verify
115 [Documentation] Enable SLAACv6 on BMC and verify.
116 [Tags] Enable_SLAACv6_On_BMC_And_Verify
117
118 Set SLAACv6 Configuration State And Verify ${True}
119
120
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500121Enable DHCPv6 Property On BMC And Verify
122 [Documentation] Enable DHCPv6 property on BMC and verify.
123 [Tags] Enable_DHCPv6_Property_On_BMC_And_Verify
124
125 Set And Verify DHCPv6 Property Enabled
126
kvishal0d199a92025-05-29 02:35:18 -0500127Disable DHCPv6 Property On BMC And Verify
128 [Documentation] Disable DHCPv6 property on BMC and verify.
129 [Tags] Disable_DHCPv6_Property_On_BMC_And_Verify
130
131 Set And Verify DHCPv6 Property Disabled
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500132
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500133Configure Invalid Static IPv6 And Verify
134 [Documentation] Configure invalid static IPv6 and verify.
135 [Tags] Configure_Invalid_Static_IPv6_And_Verify
136 [Template] Configure IPv6 Address On BMC
137
138 #invalid_ipv6 prefix length valid_status_code
139 ${ipv4_hexword_addr} ${test_prefix_length} ${HTTP_BAD_REQUEST}
140
Sweta Potthuri565318d2025-06-09 06:13:46 -0500141Configure Static Default Gateway And Verify
142 [Documentation] Configure static default gateway and verify.
143 [Tags] Configure_Static_Default_Gateway_And_Verify
144
145 # Prefix Length is passed as None.
146 IF '${prefix_length_def}' == 'None'
147 ${ipv6address}= Create Dictionary Address=${ipv6_gw_addr}
148 ELSE
149 ${ipv6address}= Create Dictionary Address=${ipv6_gw_addr} Prefix Length=${prefix_length_def}
150 END
151 ${patch_list}= Create List ${ipv6address}
152 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
153
154 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
155 ... body=${data} valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}]
156
157 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
158 ${ipv6_staticdef_gateway}= Get From Dictionary ${resp.dict} IPv6StaticDefaultGateways
159
160 Should Be Equal ${ipv6_staticdef_gateway[0]['Address']} ${ipv6_gw_addr}
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500161
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600162*** Keywords ***
163
Prashanth Katti3270fd02021-06-11 08:02:22 -0500164Suite Setup Execution
165 [Documentation] Do suite setup execution.
166
167 ${active_channel_config}= Get Active Channel Config
168 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
169
170 Set Suite variable ${ethernet_interface}
171
172
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600173Test Setup Execution
174 [Documentation] Test setup execution.
175
176 Redfish.Login
177
178 @{ipv6_network_configurations}= Get IPv6 Network Configuration
179 Set Test Variable @{ipv6_network_configurations}
180
181 # Get BMC IPv6 address and prefix length.
182 ${ipv6_data}= Get BMC IPv6 Info
183 Set Test Variable ${ipv6_data}
184
185
186Test Teardown Execution
187 [Documentation] Test teardown execution.
188
189 FFDC On Test Case Fail
190 Redfish.Logout
191
192
193Get IPv6 Network Configuration
194 [Documentation] Get Ipv6 network configuration.
195 # Sample output:
196 # {
ganesanb4d430282023-04-27 14:33:23 +0000197 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0",
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600198 # "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface",
199 # "DHCPv4": {
200 # "DHCPEnabled": false,
201 # "UseDNSServers": false,
202 # "UseDomainName": true,
203 # "UseNTPServers": false
204 # },
205 # "DHCPv6": {
206 # "OperatingMode": "Disabled",
207 # "UseDNSServers": false,
208 # "UseDomainName": true,
209 # "UseNTPServers": false
210 # },
211 # "Description": "Management Network Interface",
212 # "FQDN": "localhost",
213 # "HostName": "localhost",
214 # "IPv4Addresses": [
215 # {
216 # "Address": "xx.xx.xx.xx",
217 # "AddressOrigin": "Static",
218 # "Gateway": "xx.xx.xx.1",
219 # "SubnetMask": "xx.xx.xx.0"
220 # },
221 # {
222 # "Address": "169.254.xx.xx",
223 # "AddressOrigin": "IPv4LinkLocal",
224 # "Gateway": "0.0.0.0",
225 # "SubnetMask": "xx.xx.0.0"
226 # },
227 # ],
228 # "IPv4StaticAddresses": [
229 # {
230 # "Address": "xx.xx.xx.xx",
231 # "AddressOrigin": "Static",
232 # "Gateway": "xx.xx.xx.1",
233 # "SubnetMask": "xx.xx.0.0"
234 # }
235 # }
236 # ],
237 # "IPv6AddressPolicyTable": [],
238 # "IPv6Addresses": [
239 # {
240 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx",
241 # "AddressOrigin": "LinkLocal",
242 # "AddressState": null,
243 # "PrefixLength": xx
244 # }
245 # ],
246 # "IPv6DefaultGateway": "",
247 # "IPv6StaticAddresses": [
248 # { "Address": "xxxx:xxxx:xxxx:xxxx::xxxx",
249 # "AddressOrigin": "Static",
250 # "AddressState": null,
251 # "PrefixLength": xxx
252 # }
253 # ],
254 # "Id": "eth0",
255 # "InterfaceEnabled": true,
256 # "LinkStatus": "LinkUp",
257 # "MACAddress": "xx:xx:xx:xx:xx:xx",
258 # "Name": "Manager Ethernet Interface",
259 # "NameServers": [],
260 # "SpeedMbps": 0,
261 # "StaticNameServers": [],
262 # "Status": {
263 # "Health": "OK",
264 # "HealthRollup": "OK",
265 # "State": "Enabled"
266 # },
267 # "VLANs": {
ganesanb4d430282023-04-27 14:33:23 +0000268 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0/VLANs"
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600269
270
271 ${active_channel_config}= Get Active Channel Config
272 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
273
274 @{ipv6_network_configurations}= Get From Dictionary ${resp.dict} IPv6StaticAddresses
George Keishing409df052024-01-17 22:36:14 +0530275 RETURN @{ipv6_network_configurations}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500276
277
278Verify IPv6 And PrefixLength
279 [Documentation] Verify IPv6 address and prefix length on BMC.
280 [Arguments] ${ipv6_addr} ${prefix_len}
281
282 # Description of the argument(s):
283 # ipv6_addr IPv6 address to be verified.
284 # prefix_len PrefixLength value to be verified.
285
286 # Catenate IPv6 address and its prefix length.
287 ${ipv6_with_prefix}= Catenate ${ipv6_addr}/${prefix_len}
288
289 # Get IPv6 address details on BMC using IP command.
290 @{ip_data}= Get BMC IPv6 Info
291
292 # Verify if IPv6 and prefix length is configured on BMC.
293
294 Should Contain ${ip_data} ${ipv6_with_prefix}
295 ... msg=IPv6 and prefix length pair does not exist.
296
297
298Configure IPv6 Address On BMC
299 [Documentation] Add IPv6 Address on BMC.
300 [Arguments] ${ipv6_addr} ${prefix_len} ${valid_status_codes}=${HTTP_OK}
301
302 # Description of argument(s):
303 # ipv6_addr IPv6 address to be added (e.g. "2001:EEEE:2222::2022").
304 # prefix_len Prefix length for the IPv6 to be added
305 # (e.g. "64").
306 # valid_status_codes Expected return code from patch operation
307 # (e.g. "200").
308
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500309 ${prefix_length}= Convert To Integer ${prefix_len}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500310 ${empty_dict}= Create Dictionary
311 ${ipv6_data}= Create Dictionary Address=${ipv6_addr}
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500312 ... PrefixLength=${prefix_length}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500313
314 ${patch_list}= Create List
315
316 # Get existing static IPv6 configurations on BMC.
317 ${ipv6_network_configurations}= Get IPv6 Network Configuration
318 ${num_entries}= Get Length ${ipv6_network_configurations}
319
320 FOR ${INDEX} IN RANGE 0 ${num_entries}
321 Append To List ${patch_list} ${empty_dict}
322 END
323
George Keishinge6e161e2025-05-08 10:18:30 +0530324 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}'
325 ... ${HTTP_OK},${HTTP_NO_CONTENT}
326 ... ${valid_status_codes}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500327
328 # We need not check for existence of IPv6 on BMC while adding.
329 Append To List ${patch_list} ${ipv6_data}
330 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
331
332 ${active_channel_config}= Get Active Channel Config
333 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
334
335 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
336 ... valid_status_codes=[${valid_status_codes}]
337
338 Return From Keyword If '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}'
339
340 # Note: Network restart takes around 15-18s after patch request processing.
341 Sleep ${NETWORK_TIMEOUT}s
342 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
343
344 Verify IPv6 And PrefixLength ${ipv6_addr} ${prefix_len}
345
346 # Verify if existing static IPv6 addresses still exist.
347 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
348 Verify IPv6 On BMC ${ipv6_network_configuration['Address']}
349 END
350
351 Validate IPv6 Network Config On BMC
352
353
354Validate IPv6 Network Config On BMC
355 [Documentation] Check that IPv6 network info obtained via redfish matches info
356 ... obtained via CLI.
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500357 @{ipv6_network_configurations}= Get IPv6 Network Configuration
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500358 ${ipv6_data}= Get BMC IPv6 Info
359 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
360 Should Contain Match ${ipv6_data} ${ipv6_network_configuration['Address']}/*
361 ... msg=IPv6 address does not exist.
362 END
363
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500364
365Delete IPv6 Address
366 [Documentation] Delete IPv6 address of BMC.
Prashanth Kattibcb9dab2025-04-01 12:58:37 -0500367 [Arguments] ${ipv6_addr}
368 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500369
370 # Description of argument(s):
371 # ipv6_addr IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234").
372 # valid_status_codes Expected return code from patch operation
373 # (e.g. "200"). See prolog of rest_request
374 # method in redfish_plus.py for details.
375
376 ${empty_dict}= Create Dictionary
377 ${patch_list}= Create List
378
379 @{ipv6_network_configurations}= Get IPv6 Network Configuration
380 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
381 IF '${ipv6_network_configuration['Address']}' == '${ipv6_addr}'
382 Append To List ${patch_list} ${null}
383 ELSE
384 Append To List ${patch_list} ${empty_dict}
385 END
386 END
387
388 ${ip_found}= Run Keyword And Return Status List Should Contain Value
389 ... ${patch_list} ${null} msg=${ipv6_addr} does not exist on BMC
390 Pass Execution If ${ip_found} == ${False} ${ipv6_addr} does not exist on BMC
391
392 # Run patch command only if given IP is found on BMC
393 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
394
395 ${active_channel_config}= Get Active Channel Config
396 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
397
398 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
Sweta Potthuria1981612025-05-09 05:41:10 -0500399 ... valid_status_codes=${valid_status_codes}
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500400
401 # Note: Network restart takes around 15-18s after patch request processing
402 Sleep ${NETWORK_TIMEOUT}s
403 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
404
405 # IPv6 address that is deleted should not be there on BMC.
406 ${delete_status}= Run Keyword And Return Status Verify IPv6 On BMC ${ipv6_addr}
Anvesh-Kumar_Rayankula3a26c662025-04-16 01:19:26 -0500407 IF '${valid_status_codes}' == '[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]'
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500408 Should Be True '${delete_status}' == '${False}'
409 ELSE
410 Should Be True '${delete_status}' == '${True}'
411 END
412
413 Validate IPv6 Network Config On BMC
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500414
415
416Modify IPv6 Address
417 [Documentation] Modify and verify IPv6 address of BMC.
418 [Arguments] ${ipv6} ${new_ipv6} ${prefix_len}
419 ... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
420
421 # Description of argument(s):
422 # ipv6 IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
423 # new_ipv6 New IPv6 address to be configured.
424 # prefix_len Prefix length value (Range 1 to 128).
425 # valid_status_codes Expected return code from patch operation
426 # (e.g. "200", "201").
427
428 ${empty_dict}= Create Dictionary
429 ${patch_list}= Create List
430 ${prefix_length}= Convert To Integer ${prefix_len}
431 ${ipv6_data}= Create Dictionary
432 ... Address=${new_ipv6} PrefixLength=${prefix_length}
433
434 # Sample IPv6 network configurations:
435 # "IPv6AddressPolicyTable": [],
436 # "IPv6Addresses": [
437 # {
438 # "Address": "X002:db8:0:2::XX0",
439 # "AddressOrigin": "DHCPv6",
440 # "PrefixLength": 128
441 # },
442 # {
443 # "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX",
444 # "AddressOrigin": "SLAAC",
445 # "PrefixLength": 64
446 # },
447 # {
448 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
449 # "AddressOrigin": "Static",
450 # "PrefixLength": 56
451 # },
452 # {
453 # "Address": “Z002:db8:0:2:a94:efff:fe82:5000",
454 # "AddressOrigin": "Static",
455 # "PrefixLength": 56
456 # },
457 # {
458 # "Address": “Xe80::a94:efff:YYYY:XXXX",
459 # "AddressOrigin": "LinkLocal",
460 # "PrefixLength": 64
461 # },
462 # {
463 # "Address": “X002:db8:1:2:eff:233:fee:546",
464 # "AddressOrigin": "Static",
465 # "PrefixLength": 56
466 # }
467 # ],
468 # "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”,
469 # "IPv6StaticAddresses": [
470 # {
471 # "Address": “X002:db8:0:2:a94:efff:fe82:5000",
472 # "PrefixLength": 56
473 # },
474 # {
475 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
476 # "PrefixLength": 56
477 # },
478 # {
479 # "Address": “Z002:db8:1:2:eff:233:fee:546",
480 # "PrefixLength": 56
481 # }
482 # ],
483 # "IPv6StaticDefaultGateways": [],
484
485 # Find the position of IPv6 address to be modified.
486 @{ipv6_network_configurations}= Get IPv6 Network Configuration
487 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
George Keishinge6e161e2025-05-08 10:18:30 +0530488 IF '${ipv6_network_configuration['Address']}' == '${ipv6}'
489 Append To List ${patch_list} ${ipv6_data}
490 ELSE
491 Append To List ${patch_list} ${empty_dict}
492 END
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500493 END
494
495 # Modify the IPv6 address only if given IPv6 is found
496 ${ip_found}= Run Keyword And Return Status List Should Contain Value
497 ... ${patch_list} ${ipv6_data} msg=${ipv6} does not exist on BMC
498 Pass Execution If ${ip_found} == ${False} ${ipv6} does not exist on BMC
499
500 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
501
502 ${active_channel_config}= Get Active Channel Config
503 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
504
505 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
506 ... body=&{data} valid_status_codes=${valid_status_codes}
507
508 # Note: Network restart takes around 15-18s after patch request processing.
509 Sleep ${NETWORK_TIMEOUT}s
510 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
511
512 # Verify if new IPv6 address is configured on BMC.
513 Verify IPv6 On BMC ${new_ipv6}
514
515 # Verify if old IPv6 address is erased.
516 ${cmd_status}= Run Keyword And Return Status
517 ... Verify IPv6 On BMC ${ipv6}
518 Should Be Equal ${cmd_status} ${False} msg=Old IPv6 address is not deleted.
519
520 Validate IPv6 Network Config On BMC
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500521
522
523Set SLAACv6 Configuration State And Verify
524 [Documentation] Set SLAACv6 configuration state and verify.
Sweta Potthuri610f86f2025-05-30 00:47:23 -0500525 [Arguments] ${slaac_state} ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500526
527 # Description of argument(s):
528 # slaac_state SLAACv6 state('True' or 'False').
529 # valid_status_code Expected valid status codes.
530
531 ${active_channel_config}= Get Active Channel Config
532 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
533
534 ${data}= Set Variable If ${slaac_state} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC}
535 ${resp}= Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
Sweta Potthuri610f86f2025-05-30 00:47:23 -0500536 ... body=${data} valid_status_codes=${valid_status_codes}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500537
538 # Verify SLAACv6 is set correctly.
539 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
540 ${slaac_verify}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig
541
George Keishinge6e161e2025-05-08 10:18:30 +0530542 IF '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}'
543 Fail msg=SLAACv6 not set properly.
544 END
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500545
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500546
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500547Set And Verify DHCPv6 Property
548 [Documentation] Set DHCPv6 attribute and verify.
549 [Arguments] ${dhcpv6_operating_mode}=${Disabled}
550
551 # Description of argument(s):
552 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled').
553
554 ${data}= Set Variable If '${dhcpv6_operating_mode}' == 'Disabled' ${DISABLE_DHCPv6} ${ENABLE_DHCPv6}
555 ${active_channel_config}= Get Active Channel Config
556 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
557
558 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
559 ... body=${data} valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}]
560
561 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
562 ${dhcpv6_verify}= Get From Dictionary ${resp.dict} DHCPv6
563
564 Should Be Equal '${dhcpv6_verify['OperatingMode']}' '${dhcpv6_operating_mode}'
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500565