blob: 77daa926ba6c44a31c5d6c996a236e87fe62fcef [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 Potthuri2edacd32025-07-02 01:04:43 -050019${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 Potthuri2edacd32025-07-02 01:04:43 -050024${test_prefix_length} 64
25${ipv6_gw_addr} 2002:903:15F:32:9:3:32:1
26${prefix_length_def} None
27${invalid_staticv6_gateway} 9.41.164.1
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060028
29*** Test Cases ***
30
31Get IPv6 Address And Verify
32 [Documentation] Get IPv6 Address And Verify.
33 [Tags] Get_IPv6_Address_And_Verify
34
35 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
36 Verify IPv6 On BMC ${ipv6_network_configuration['Address']}
37 END
38
39
Prashanth Katti2c73abc2021-03-17 07:42:25 -050040Get PrefixLength And Verify
41 [Documentation] Get IPv6 prefix length and verify.
42 [Tags] Get_PrefixLength_And_Verify
43
44 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
45 Verify IPv6 On BMC ${ipv6_network_configuration['PrefixLength']}
46 END
47
48
49Get IPv6 Default Gateway And Verify
George Keishing96143832021-03-23 07:55:08 -050050 [Documentation] Get IPv6 default gateway and verify.
George Keishingade6ab42022-07-19 11:41:03 -050051 [Tags] Get_IPv6_Default_Gateway_And_Verify
Prashanth Katti2c73abc2021-03-17 07:42:25 -050052
53 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
54 ${ipv6_gateway}= Get From Dictionary ${resp.dict} IPv6DefaultGateway
55 Verify IPv6 Default Gateway On BMC ${ipv6_gateway}
56
57
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050058Verify All Configured IPv6 And PrefixLength On BMC
59 [Documentation] Verify IPv6 address and its prefix length on BMC.
60 [Tags] Verify_All_Configured_IPv6_And_PrefixLength_On_BMC
61
62 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
George Keishingf02ca2b2023-04-05 22:11:03 +053063 Verify IPv6 And PrefixLength ${ipv6_network_configuration['Address']}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050064 ... ${ipv6_network_configuration['PrefixLength']}
65 END
66
67
68Configure IPv6 Address And Verify
69 [Documentation] Configure IPv6 address and verify.
70 [Tags] Configure_IPv6_Address_And_Verify
Anvesh-Kumar_Rayankula3a26c662025-04-16 01:19:26 -050071 [Teardown] Run Keywords
72 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050073 [Template] Configure IPv6 Address On BMC
74
75
76 # IPv6 address Prefix length
77 ${test_ipv6_addr} ${test_prefix_length}
78
79
Prashanth Katti12ed4b72023-05-16 05:24:00 -050080Delete IPv6 Address And Verify
81 [Documentation] Delete IPv6 address and verify.
82 [Tags] Delete_IPv6_Address_And_Verify
83
84 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
85
86 Delete IPv6 Address ${test_ipv6_addr}
87
88
Prashanth Katti5f7d2e42023-05-22 03:17:25 -050089
George Keishingcc288312024-10-22 10:13:12 +053090Modify IPv6 Address And Verify
Prashanth Katti5f7d2e42023-05-22 03:17:25 -050091 [Documentation] Modify IPv6 address and verify.
92 [Tags] Modify_IPv6_Address_And_Verify
kvishal88de8c42025-03-04 01:45:10 -060093 [Teardown] Run Keywords
George Keishingcfdd0992025-03-17 11:59:20 +053094 ... Delete IPv6 Address ${test_ipv6_addr1} AND Test Teardown Execution
Prashanth Katti5f7d2e42023-05-22 03:17:25 -050095
96 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
97
98 Modify IPv6 Address ${test_ipv6_addr} ${test_ipv6_addr1} ${test_prefix_length}
99
100
Sweta Potthuriafe858e2025-02-25 23:52:51 -0600101Verify Persistency Of IPv6 After BMC Reboot
102 [Documentation] Verify persistency of IPv6 after BMC reboot.
103 [Tags] Verify_Persistency_Of_IPv6_After_BMC_Reboot
104 [Teardown] Run Keywords
105 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution
106
107 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
108
109 Redfish OBMC Reboot (off) stack_mode=skip
110
111 # Verifying persistency of IPv6.
112 Verify IPv6 On BMC ${test_ipv6_addr}
113
114
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500115Enable SLAACv6 On BMC And Verify
116 [Documentation] Enable SLAACv6 on BMC and verify.
117 [Tags] Enable_SLAACv6_On_BMC_And_Verify
118
119 Set SLAACv6 Configuration State And Verify ${True}
120
121
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500122Enable DHCPv6 Property On BMC And Verify
123 [Documentation] Enable DHCPv6 property on BMC and verify.
124 [Tags] Enable_DHCPv6_Property_On_BMC_And_Verify
125
126 Set And Verify DHCPv6 Property Enabled
127
kvishal0d199a92025-05-29 02:35:18 -0500128Disable DHCPv6 Property On BMC And Verify
129 [Documentation] Disable DHCPv6 property on BMC and verify.
130 [Tags] Disable_DHCPv6_Property_On_BMC_And_Verify
131
132 Set And Verify DHCPv6 Property Disabled
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500133
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500134Configure Invalid Static IPv6 And Verify
135 [Documentation] Configure invalid static IPv6 and verify.
136 [Tags] Configure_Invalid_Static_IPv6_And_Verify
137 [Template] Configure IPv6 Address On BMC
138
139 #invalid_ipv6 prefix length valid_status_code
140 ${ipv4_hexword_addr} ${test_prefix_length} ${HTTP_BAD_REQUEST}
141
Sweta Potthuri565318d2025-06-09 06:13:46 -0500142
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500143Configure IPv6 Static Default Gateway And Verify
144 [Documentation] Configure IPv6 static default gateway and verify.
145 [Tags] Configure_IPv6_Static_Default_Gateway_And_Verify
146 [Template] Configure IPv6 Static Default Gateway On BMC
Sweta Potthuri565318d2025-06-09 06:13:46 -0500147
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500148 # static_def_gw prefix length valid_status_code
149 ${ipv6_gw_addr} ${prefix_length_def} ${HTTP_OK}
150 ${invalid_staticv6_gateway} ${test_prefix_length} ${HTTP_BAD_REQUEST}
Sweta Potthuri565318d2025-06-09 06:13:46 -0500151
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500152
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600153*** Keywords ***
154
Prashanth Katti3270fd02021-06-11 08:02:22 -0500155Suite Setup Execution
156 [Documentation] Do suite setup execution.
157
158 ${active_channel_config}= Get Active Channel Config
159 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
160
161 Set Suite variable ${ethernet_interface}
162
163
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600164Test Setup Execution
165 [Documentation] Test setup execution.
166
167 Redfish.Login
168
169 @{ipv6_network_configurations}= Get IPv6 Network Configuration
170 Set Test Variable @{ipv6_network_configurations}
171
172 # Get BMC IPv6 address and prefix length.
173 ${ipv6_data}= Get BMC IPv6 Info
174 Set Test Variable ${ipv6_data}
175
176
177Test Teardown Execution
178 [Documentation] Test teardown execution.
179
180 FFDC On Test Case Fail
181 Redfish.Logout
182
183
184Get IPv6 Network Configuration
185 [Documentation] Get Ipv6 network configuration.
186 # Sample output:
187 # {
ganesanb4d430282023-04-27 14:33:23 +0000188 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0",
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600189 # "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface",
190 # "DHCPv4": {
191 # "DHCPEnabled": false,
192 # "UseDNSServers": false,
193 # "UseDomainName": true,
194 # "UseNTPServers": false
195 # },
196 # "DHCPv6": {
197 # "OperatingMode": "Disabled",
198 # "UseDNSServers": false,
199 # "UseDomainName": true,
200 # "UseNTPServers": false
201 # },
202 # "Description": "Management Network Interface",
203 # "FQDN": "localhost",
204 # "HostName": "localhost",
205 # "IPv4Addresses": [
206 # {
207 # "Address": "xx.xx.xx.xx",
208 # "AddressOrigin": "Static",
209 # "Gateway": "xx.xx.xx.1",
210 # "SubnetMask": "xx.xx.xx.0"
211 # },
212 # {
213 # "Address": "169.254.xx.xx",
214 # "AddressOrigin": "IPv4LinkLocal",
215 # "Gateway": "0.0.0.0",
216 # "SubnetMask": "xx.xx.0.0"
217 # },
218 # ],
219 # "IPv4StaticAddresses": [
220 # {
221 # "Address": "xx.xx.xx.xx",
222 # "AddressOrigin": "Static",
223 # "Gateway": "xx.xx.xx.1",
224 # "SubnetMask": "xx.xx.0.0"
225 # }
226 # }
227 # ],
228 # "IPv6AddressPolicyTable": [],
229 # "IPv6Addresses": [
230 # {
231 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx",
232 # "AddressOrigin": "LinkLocal",
233 # "AddressState": null,
234 # "PrefixLength": xx
235 # }
236 # ],
237 # "IPv6DefaultGateway": "",
238 # "IPv6StaticAddresses": [
239 # { "Address": "xxxx:xxxx:xxxx:xxxx::xxxx",
240 # "AddressOrigin": "Static",
241 # "AddressState": null,
242 # "PrefixLength": xxx
243 # }
244 # ],
245 # "Id": "eth0",
246 # "InterfaceEnabled": true,
247 # "LinkStatus": "LinkUp",
248 # "MACAddress": "xx:xx:xx:xx:xx:xx",
249 # "Name": "Manager Ethernet Interface",
250 # "NameServers": [],
251 # "SpeedMbps": 0,
252 # "StaticNameServers": [],
253 # "Status": {
254 # "Health": "OK",
255 # "HealthRollup": "OK",
256 # "State": "Enabled"
257 # },
258 # "VLANs": {
ganesanb4d430282023-04-27 14:33:23 +0000259 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0/VLANs"
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600260
261
262 ${active_channel_config}= Get Active Channel Config
263 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
264
265 @{ipv6_network_configurations}= Get From Dictionary ${resp.dict} IPv6StaticAddresses
George Keishing409df052024-01-17 22:36:14 +0530266 RETURN @{ipv6_network_configurations}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500267
268
269Verify IPv6 And PrefixLength
270 [Documentation] Verify IPv6 address and prefix length on BMC.
271 [Arguments] ${ipv6_addr} ${prefix_len}
272
273 # Description of the argument(s):
274 # ipv6_addr IPv6 address to be verified.
275 # prefix_len PrefixLength value to be verified.
276
277 # Catenate IPv6 address and its prefix length.
278 ${ipv6_with_prefix}= Catenate ${ipv6_addr}/${prefix_len}
279
280 # Get IPv6 address details on BMC using IP command.
281 @{ip_data}= Get BMC IPv6 Info
282
283 # Verify if IPv6 and prefix length is configured on BMC.
284
285 Should Contain ${ip_data} ${ipv6_with_prefix}
286 ... msg=IPv6 and prefix length pair does not exist.
287
288
289Configure IPv6 Address On BMC
290 [Documentation] Add IPv6 Address on BMC.
291 [Arguments] ${ipv6_addr} ${prefix_len} ${valid_status_codes}=${HTTP_OK}
292
293 # Description of argument(s):
294 # ipv6_addr IPv6 address to be added (e.g. "2001:EEEE:2222::2022").
295 # prefix_len Prefix length for the IPv6 to be added
296 # (e.g. "64").
297 # valid_status_codes Expected return code from patch operation
298 # (e.g. "200").
299
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500300 ${prefix_length}= Convert To Integer ${prefix_len}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500301 ${empty_dict}= Create Dictionary
302 ${ipv6_data}= Create Dictionary Address=${ipv6_addr}
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500303 ... PrefixLength=${prefix_length}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500304
305 ${patch_list}= Create List
306
307 # Get existing static IPv6 configurations on BMC.
308 ${ipv6_network_configurations}= Get IPv6 Network Configuration
309 ${num_entries}= Get Length ${ipv6_network_configurations}
310
311 FOR ${INDEX} IN RANGE 0 ${num_entries}
312 Append To List ${patch_list} ${empty_dict}
313 END
314
George Keishinge6e161e2025-05-08 10:18:30 +0530315 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}'
316 ... ${HTTP_OK},${HTTP_NO_CONTENT}
317 ... ${valid_status_codes}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500318
319 # We need not check for existence of IPv6 on BMC while adding.
320 Append To List ${patch_list} ${ipv6_data}
321 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
322
323 ${active_channel_config}= Get Active Channel Config
324 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
325
326 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
327 ... valid_status_codes=[${valid_status_codes}]
328
329 Return From Keyword If '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}'
330
331 # Note: Network restart takes around 15-18s after patch request processing.
332 Sleep ${NETWORK_TIMEOUT}s
333 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
334
335 Verify IPv6 And PrefixLength ${ipv6_addr} ${prefix_len}
336
337 # Verify if existing static IPv6 addresses still exist.
338 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
339 Verify IPv6 On BMC ${ipv6_network_configuration['Address']}
340 END
341
342 Validate IPv6 Network Config On BMC
343
344
345Validate IPv6 Network Config On BMC
346 [Documentation] Check that IPv6 network info obtained via redfish matches info
347 ... obtained via CLI.
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500348 @{ipv6_network_configurations}= Get IPv6 Network Configuration
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500349 ${ipv6_data}= Get BMC IPv6 Info
350 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
351 Should Contain Match ${ipv6_data} ${ipv6_network_configuration['Address']}/*
352 ... msg=IPv6 address does not exist.
353 END
354
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500355
356Delete IPv6 Address
357 [Documentation] Delete IPv6 address of BMC.
Prashanth Kattibcb9dab2025-04-01 12:58:37 -0500358 [Arguments] ${ipv6_addr}
359 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500360
361 # Description of argument(s):
362 # ipv6_addr IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234").
363 # valid_status_codes Expected return code from patch operation
364 # (e.g. "200"). See prolog of rest_request
365 # method in redfish_plus.py for details.
366
367 ${empty_dict}= Create Dictionary
368 ${patch_list}= Create List
369
370 @{ipv6_network_configurations}= Get IPv6 Network Configuration
371 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
372 IF '${ipv6_network_configuration['Address']}' == '${ipv6_addr}'
373 Append To List ${patch_list} ${null}
374 ELSE
375 Append To List ${patch_list} ${empty_dict}
376 END
377 END
378
379 ${ip_found}= Run Keyword And Return Status List Should Contain Value
380 ... ${patch_list} ${null} msg=${ipv6_addr} does not exist on BMC
381 Pass Execution If ${ip_found} == ${False} ${ipv6_addr} does not exist on BMC
382
383 # Run patch command only if given IP is found on BMC
384 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
385
386 ${active_channel_config}= Get Active Channel Config
387 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
388
389 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
Sweta Potthuria1981612025-05-09 05:41:10 -0500390 ... valid_status_codes=${valid_status_codes}
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500391
392 # Note: Network restart takes around 15-18s after patch request processing
393 Sleep ${NETWORK_TIMEOUT}s
394 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
395
396 # IPv6 address that is deleted should not be there on BMC.
397 ${delete_status}= Run Keyword And Return Status Verify IPv6 On BMC ${ipv6_addr}
Anvesh-Kumar_Rayankula3a26c662025-04-16 01:19:26 -0500398 IF '${valid_status_codes}' == '[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]'
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500399 Should Be True '${delete_status}' == '${False}'
400 ELSE
401 Should Be True '${delete_status}' == '${True}'
402 END
403
404 Validate IPv6 Network Config On BMC
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500405
406
407Modify IPv6 Address
408 [Documentation] Modify and verify IPv6 address of BMC.
409 [Arguments] ${ipv6} ${new_ipv6} ${prefix_len}
410 ... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
411
412 # Description of argument(s):
413 # ipv6 IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
414 # new_ipv6 New IPv6 address to be configured.
415 # prefix_len Prefix length value (Range 1 to 128).
416 # valid_status_codes Expected return code from patch operation
417 # (e.g. "200", "201").
418
419 ${empty_dict}= Create Dictionary
420 ${patch_list}= Create List
421 ${prefix_length}= Convert To Integer ${prefix_len}
422 ${ipv6_data}= Create Dictionary
423 ... Address=${new_ipv6} PrefixLength=${prefix_length}
424
425 # Sample IPv6 network configurations:
426 # "IPv6AddressPolicyTable": [],
427 # "IPv6Addresses": [
428 # {
429 # "Address": "X002:db8:0:2::XX0",
430 # "AddressOrigin": "DHCPv6",
431 # "PrefixLength": 128
432 # },
433 # {
434 # "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX",
435 # "AddressOrigin": "SLAAC",
436 # "PrefixLength": 64
437 # },
438 # {
439 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
440 # "AddressOrigin": "Static",
441 # "PrefixLength": 56
442 # },
443 # {
444 # "Address": “Z002:db8:0:2:a94:efff:fe82:5000",
445 # "AddressOrigin": "Static",
446 # "PrefixLength": 56
447 # },
448 # {
449 # "Address": “Xe80::a94:efff:YYYY:XXXX",
450 # "AddressOrigin": "LinkLocal",
451 # "PrefixLength": 64
452 # },
453 # {
454 # "Address": “X002:db8:1:2:eff:233:fee:546",
455 # "AddressOrigin": "Static",
456 # "PrefixLength": 56
457 # }
458 # ],
459 # "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”,
460 # "IPv6StaticAddresses": [
461 # {
462 # "Address": “X002:db8:0:2:a94:efff:fe82:5000",
463 # "PrefixLength": 56
464 # },
465 # {
466 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
467 # "PrefixLength": 56
468 # },
469 # {
470 # "Address": “Z002:db8:1:2:eff:233:fee:546",
471 # "PrefixLength": 56
472 # }
473 # ],
474 # "IPv6StaticDefaultGateways": [],
475
476 # Find the position of IPv6 address to be modified.
477 @{ipv6_network_configurations}= Get IPv6 Network Configuration
478 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
George Keishinge6e161e2025-05-08 10:18:30 +0530479 IF '${ipv6_network_configuration['Address']}' == '${ipv6}'
480 Append To List ${patch_list} ${ipv6_data}
481 ELSE
482 Append To List ${patch_list} ${empty_dict}
483 END
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500484 END
485
486 # Modify the IPv6 address only if given IPv6 is found
487 ${ip_found}= Run Keyword And Return Status List Should Contain Value
488 ... ${patch_list} ${ipv6_data} msg=${ipv6} does not exist on BMC
489 Pass Execution If ${ip_found} == ${False} ${ipv6} does not exist on BMC
490
491 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
492
493 ${active_channel_config}= Get Active Channel Config
494 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
495
496 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
497 ... body=&{data} valid_status_codes=${valid_status_codes}
498
499 # Note: Network restart takes around 15-18s after patch request processing.
500 Sleep ${NETWORK_TIMEOUT}s
501 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
502
503 # Verify if new IPv6 address is configured on BMC.
504 Verify IPv6 On BMC ${new_ipv6}
505
506 # Verify if old IPv6 address is erased.
507 ${cmd_status}= Run Keyword And Return Status
508 ... Verify IPv6 On BMC ${ipv6}
509 Should Be Equal ${cmd_status} ${False} msg=Old IPv6 address is not deleted.
510
511 Validate IPv6 Network Config On BMC
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500512
513
514Set SLAACv6 Configuration State And Verify
515 [Documentation] Set SLAACv6 configuration state and verify.
Sweta Potthuri610f86f2025-05-30 00:47:23 -0500516 [Arguments] ${slaac_state} ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500517
518 # Description of argument(s):
519 # slaac_state SLAACv6 state('True' or 'False').
520 # valid_status_code Expected valid status codes.
521
522 ${active_channel_config}= Get Active Channel Config
523 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
524
525 ${data}= Set Variable If ${slaac_state} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC}
526 ${resp}= Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
Sweta Potthuri610f86f2025-05-30 00:47:23 -0500527 ... body=${data} valid_status_codes=${valid_status_codes}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500528
529 # Verify SLAACv6 is set correctly.
530 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
531 ${slaac_verify}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig
532
George Keishinge6e161e2025-05-08 10:18:30 +0530533 IF '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}'
534 Fail msg=SLAACv6 not set properly.
535 END
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500536
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500537
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500538Set And Verify DHCPv6 Property
539 [Documentation] Set DHCPv6 attribute and verify.
540 [Arguments] ${dhcpv6_operating_mode}=${Disabled}
541
542 # Description of argument(s):
543 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled').
544
545 ${data}= Set Variable If '${dhcpv6_operating_mode}' == 'Disabled' ${DISABLE_DHCPv6} ${ENABLE_DHCPv6}
546 ${active_channel_config}= Get Active Channel Config
547 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
548
549 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
550 ... body=${data} valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}]
551
552 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
553 ${dhcpv6_verify}= Get From Dictionary ${resp.dict} DHCPv6
554
555 Should Be Equal '${dhcpv6_verify['OperatingMode']}' '${dhcpv6_operating_mode}'
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500556
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500557
558Configure IPv6 Static Default Gateway On BMC
559 [Documentation] Configure IPv6 static default gateway on BMC.
560 [Arguments] ${ipv6_gw_addr} ${prefix_length_def}
561 ... ${valid_status_codes}=${HTTP_OK}
562
563 # Description of argument(s):
564 # ipv6_gw_addr IPv6 Static Default Gateway address to be configured.
565 # prefix_len_def Prefix length value (Range 1 to 128).
566 # valid_status_codes Expected return code from patch operation
567 # (e.g. "200", "204".)
568
569 # Prefix Length is passed as None.
570 IF '${prefix_length_def}' == '${None}'
571 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr}
572 ELSE
573 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr} Prefix Length=${prefix_length_def}
574 END
575
576 ${ipv6_static_def_gw}= Get IPv6 Static Default Gateway
577
578 ${num_entries}= Get Length ${ipv6_static_def_gw}
579
580 ${patch_list}= Create List
581 ${empty_dict}= Create Dictionary
582
583 FOR ${INDEX} IN RANGE 0 ${num_entries}
584 Append To List ${patch_list} ${empty_dict}
585 END
586
587 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}'
588 ... ${HTTP_OK},${HTTP_NO_CONTENT}
589 ... ${valid_status_codes}
590
591 Append To List ${patch_list} ${ipv6_gw}
592 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
593
594 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
595 ... body=${data} valid_status_codes=[${valid_status_codes}]
596
597 # Verify the added static default gateway is present in Redfish Get Output.
598 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway
599
600 ${ipv6_static_def_gw_list}= Create List
601 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway}
602 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
603 Append To List ${ipv6_static_def_gw_list} ${value}
604 END
605
606 IF '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}'
607 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
608 ELSE
609 Should Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
610 END
611
612
613Get IPv6 Static Default Gateway
614 [Documentation] Get IPv6 static default gateway.
615
616 ${active_channel_config}= Get Active Channel Config
617 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
618
619 @{ipv6_static_defgw_configurations}= Get From Dictionary ${resp.dict} IPv6StaticDefaultGateways
620 RETURN @{ipv6_static_defgw_configurations}