blob: 5eb19b0165c3c328e1b6d3fa5d2eb87685f6a041 [file] [log] [blame]
Prashanth Katti8abbb4d2021-01-29 02:17:45 -06001*** Settings ***
2Documentation Network interface IPv6 configuration and verification
3 ... tests.
4
5Resource ../../lib/bmc_redfish_resource.robot
6Resource ../../lib/openbmc_ffdc.robot
7Resource ../../lib/bmc_ipv6_utils.robot
Sweta Potthuri8ba74322025-03-19 12:29:06 -05008Resource ../../lib/external_intf/vmi_utils.robot
Prashanth Katti8abbb4d2021-01-29 02:17:45 -06009Library ../../lib/bmc_network_utils.py
10Library Collections
Sweta Potthuri35c503b2025-07-27 23:36:20 -050011Library Process
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060012
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -050013Test Setup Test Setup Execution
14Test Teardown Test Teardown Execution
15Suite Setup Suite Setup Execution
16Suite Teardown Redfish.Logout
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060017
Matt Fischer6fb70d92023-10-24 19:06:33 -060018Test Tags BMC_IPv6
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060019
20*** Variables ***
Sweta Potthuri2edacd32025-07-02 01:04:43 -050021${test_ipv6_addr} 2001:db8:3333:4444:5555:6666:7777:8888
22${test_ipv6_invalid_addr} 2001:db8:3333:4444:5555:6666:7777:JJKK
23${test_ipv6_addr1} 2001:db8:3333:4444:5555:6666:7777:9999
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060024
George Keishinge16f1582022-12-15 07:32:21 -060025# Valid prefix length is a integer ranges from 1 to 128.
Sweta Potthuri2edacd32025-07-02 01:04:43 -050026${test_prefix_length} 64
27${ipv6_gw_addr} 2002:903:15F:32:9:3:32:1
28${prefix_length_def} None
29${invalid_staticv6_gateway} 9.41.164.1
Sweta Potthuri35c503b2025-07-27 23:36:20 -050030${linklocal_addr_format} fe80::[0-9a-f:]+$
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060031
32*** Test Cases ***
33
34Get IPv6 Address And Verify
35 [Documentation] Get IPv6 Address And Verify.
36 [Tags] Get_IPv6_Address_And_Verify
37
38 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
39 Verify IPv6 On BMC ${ipv6_network_configuration['Address']}
40 END
41
42
Prashanth Katti2c73abc2021-03-17 07:42:25 -050043Get PrefixLength And Verify
44 [Documentation] Get IPv6 prefix length and verify.
45 [Tags] Get_PrefixLength_And_Verify
46
47 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
48 Verify IPv6 On BMC ${ipv6_network_configuration['PrefixLength']}
49 END
50
51
52Get IPv6 Default Gateway And Verify
George Keishing96143832021-03-23 07:55:08 -050053 [Documentation] Get IPv6 default gateway and verify.
George Keishingade6ab42022-07-19 11:41:03 -050054 [Tags] Get_IPv6_Default_Gateway_And_Verify
Prashanth Katti2c73abc2021-03-17 07:42:25 -050055
56 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
57 ${ipv6_gateway}= Get From Dictionary ${resp.dict} IPv6DefaultGateway
58 Verify IPv6 Default Gateway On BMC ${ipv6_gateway}
59
60
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050061Verify All Configured IPv6 And PrefixLength On BMC
62 [Documentation] Verify IPv6 address and its prefix length on BMC.
63 [Tags] Verify_All_Configured_IPv6_And_PrefixLength_On_BMC
64
65 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
George Keishingf02ca2b2023-04-05 22:11:03 +053066 Verify IPv6 And PrefixLength ${ipv6_network_configuration['Address']}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050067 ... ${ipv6_network_configuration['PrefixLength']}
68 END
69
70
71Configure IPv6 Address And Verify
72 [Documentation] Configure IPv6 address and verify.
73 [Tags] Configure_IPv6_Address_And_Verify
Anvesh-Kumar_Rayankula3a26c662025-04-16 01:19:26 -050074 [Teardown] Run Keywords
75 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050076 [Template] Configure IPv6 Address On BMC
77
78
79 # IPv6 address Prefix length
80 ${test_ipv6_addr} ${test_prefix_length}
81
82
Prashanth Katti12ed4b72023-05-16 05:24:00 -050083Delete IPv6 Address And Verify
84 [Documentation] Delete IPv6 address and verify.
85 [Tags] Delete_IPv6_Address_And_Verify
86
87 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
88
89 Delete IPv6 Address ${test_ipv6_addr}
90
91
George Keishingcc288312024-10-22 10:13:12 +053092Modify IPv6 Address And Verify
Prashanth Katti5f7d2e42023-05-22 03:17:25 -050093 [Documentation] Modify IPv6 address and verify.
94 [Tags] Modify_IPv6_Address_And_Verify
kvishal88de8c42025-03-04 01:45:10 -060095 [Teardown] Run Keywords
George Keishingcfdd0992025-03-17 11:59:20 +053096 ... Delete IPv6 Address ${test_ipv6_addr1} AND Test Teardown Execution
Prashanth Katti5f7d2e42023-05-22 03:17:25 -050097
98 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
99
100 Modify IPv6 Address ${test_ipv6_addr} ${test_ipv6_addr1} ${test_prefix_length}
101
102
Sweta Potthuriafe858e2025-02-25 23:52:51 -0600103Verify Persistency Of IPv6 After BMC Reboot
104 [Documentation] Verify persistency of IPv6 after BMC reboot.
105 [Tags] Verify_Persistency_Of_IPv6_After_BMC_Reboot
106 [Teardown] Run Keywords
107 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution
108
109 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
110
111 Redfish OBMC Reboot (off) stack_mode=skip
112
113 # Verifying persistency of IPv6.
114 Verify IPv6 On BMC ${test_ipv6_addr}
115
116
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500117Enable SLAAC On BMC And Verify
118 [Documentation] Enable SLAAC on BMC and verify.
119 [Tags] Enable_SLAAC_On_BMC_And_Verify
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500120
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500121 Set SLAAC Configuration State And Verify ${True}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500122
123
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500124Enable DHCPv6 Property On BMC And Verify
125 [Documentation] Enable DHCPv6 property on BMC and verify.
126 [Tags] Enable_DHCPv6_Property_On_BMC_And_Verify
127
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500128 Set And Verify DHCPv6 Property Enabled
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500129
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500130
kvishal0d199a92025-05-29 02:35:18 -0500131Disable DHCPv6 Property On BMC And Verify
132 [Documentation] Disable DHCPv6 property on BMC and verify.
133 [Tags] Disable_DHCPv6_Property_On_BMC_And_Verify
134
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500135 Set And Verify DHCPv6 Property Disabled
kvishalbd04bd62025-08-05 03:57:53 -0500136
137
138Verify Persistency Of DHCPv6 On Reboot
139 [Documentation] Verify persistency of DHCPv6 property on reboot.
140 [Tags] Verify_Persistency_Of_DHCPv6_On_Reboot
141
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500142 Set And Verify DHCPv6 Property Enabled
143 Redfish OBMC Reboot (off) stack_mode=skip
144 Verify DHCPv6 Property Enabled
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500145
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500146
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500147Configure Invalid Static IPv6 And Verify
148 [Documentation] Configure invalid static IPv6 and verify.
149 [Tags] Configure_Invalid_Static_IPv6_And_Verify
150 [Template] Configure IPv6 Address On BMC
151
152 #invalid_ipv6 prefix length valid_status_code
153 ${ipv4_hexword_addr} ${test_prefix_length} ${HTTP_BAD_REQUEST}
154
Sweta Potthuri565318d2025-06-09 06:13:46 -0500155
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500156Configure IPv6 Static Default Gateway And Verify
157 [Documentation] Configure IPv6 static default gateway and verify.
158 [Tags] Configure_IPv6_Static_Default_Gateway_And_Verify
159 [Template] Configure IPv6 Static Default Gateway On BMC
Sweta Potthuri565318d2025-06-09 06:13:46 -0500160
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500161 # static_def_gw prefix length valid_status_code
162 ${ipv6_gw_addr} ${prefix_length_def} ${HTTP_OK}
163 ${invalid_staticv6_gateway} ${test_prefix_length} ${HTTP_BAD_REQUEST}
Sweta Potthuri565318d2025-06-09 06:13:46 -0500164
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500165
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500166Modify Static Default Gateway And Verify
167 [Documentation] Modify static default gateway and verify.
168 [Tags] Modify_Static_Default_Gateway_And_Verify
169 [Setup] Configure IPv6 Static Default Gateway On BMC ${ipv6_gw_addr} ${prefix_length_def}
170
171 Modify IPv6 Static Default Gateway On BMC ${test_ipv6_addr1} ${prefix_length_def} ${HTTP_OK} ${ipv6_gw_addr}
172
173
Sweta Potthuri2d085732025-07-16 09:10:08 -0500174Delete IPv6 Static Default Gateway And Verify
175 [Documentation] Delete IPv6 static default gateway and verify.
176 [Tags] Delete_IPv6_Static_Default_Gateway_And_Verify
177 [Setup] Configure IPv6 Static Default Gateway On BMC ${ipv6_gw_addr} ${prefix_length_def}
178
179 Delete IPv6 Static Default Gateway ${ipv6_gw_addr}
180
181
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500182Verify Coexistence Of Linklocalv6 And Static IPv6 On BMC
183 [Documentation] Verify linklocalv6 And static IPv6 both exist.
184 [Tags] Verify_Coexistence_Of_Linklocalv6_And_Static_IPv6_On_BMC
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -0500185 [Setup] Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
186 [Teardown] Delete IPv6 Address ${test_ipv6_addr}
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500187
188 Check Coexistence Of Linklocalv6 And Static IPv6
189
190
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -0500191Verify IPv6 Linklocal Address Is In Corrrect Format
192 [Documentation] Verify linklocal address has network part as fe80 and host part as EUI64.
193 [Tags] Verify_IPv6_Linklocal_Address_Is_In_Correct_Format
194
195 Check If Linklocal Address Is In Correct Format
196
197
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500198Verify BMC Gets SLAAC Address On Enabling SLAAC
199 [Documentation] On enabling SLAAC verify SLAAC address comes up.
200 [Tags] Verify_BMC_Gets_SLAAC_Address_On_Enabling_SLAAC
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500201 [Setup] Set SLAAC Configuration State And Verify ${False}
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500202
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500203 Set SLAAC Configuration State And Verify ${True}
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500204 Sleep ${NETWORK_TIMEOUT}
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500205 Check BMC Gets SLAAC Address
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500206
207
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500208Enable And Verify DHCPv6 Property On Eth1 When DHCPv6 Property Enabled On Eth0
209 [Documentation] Verify DHCPv6 on eth1 when DHCPv6 property is enabled on eth0.
210 [Tags] Enable_And_Verify_DHCPv6_Property_On_Eth1_When_DHCPv6_Property_Enabled_On_Eth0
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500211 [Setup] Get The Initial DHCPv6 Settings
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500212 [Teardown] Run Keywords Set And Verify DHCPv6 Property ${dhcpv6_channel_1} ${1}
213 ... AND Set And Verify DHCPv6 Property ${dhcpv6_channel_2} ${2}
214
215 Set And Verify DHCPv6 Property Enabled ${1}
216 Set And Verify DHCPv6 Property Enabled ${2}
217
218
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500219Enable And Verify SLAAC Property On Eth1 When SLAAC Property Enabled On Eth0
220 [Documentation] Enable and verify SLAAC property on Eth1 when SLAAC property enabled on Eth0.
221 [Tags] Enable_And_Verify_SLAAC_Property_On_Eth1_When_SLAAC_Property_Enabled_On_Eth0
222 [Setup] Get The Initial SLAAC Settings
223 [Teardown] Run Keywords Set SLAAC Configuration State And Verify ${slaac_channel_1} [${HTTP_OK}] ${1}
224 ... AND Set SLAAC Configuration State And Verify ${slaac_channel_2} [${HTTP_OK}] ${2}
225
226 Set SLAAC Configuration State And Verify ${True} [${HTTP_OK}] ${1}
227 Set SLAAC Configuration State And Verify ${True} [${HTTP_OK}] ${2}
228
229 # Check all the addresses and address origins remain intact.
230 Verify All The Addresses Are Intact
231
232
abhijith-1213a645902025-09-08 01:12:34 -0500233Verify Autoconfig Is Present On Ethernet Interface
234 [Documentation] Verify autoconfig is present on ethernet interface.
235 [Tags] Verify_Autoconfig_Is_Present_On_Ethernet_Interface
236
237 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
238 Should Contain ${resp.dict} StatelessAddressAutoConfig
239
240
Sweta Potthurif3d188f2025-09-08 07:17:31 -0500241Verify Interface ID Of SLAAC And LinkLocal Addresses Are Same
242 [Documentation] Validate interface id of SLAAC and link-local addresses are same.
243 [Tags] Verify_Interface_ID_Of_SLAAC_And_LinkLocal_Addresses_Are_Same
244
245 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
246 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC
247
248 ${linklocal_interface_id}= Get Interface ID Of IPv6 ${ipv6_linklocal_addr}
249 ${slaac_interface_id}= Get Interface ID Of IPv6 ${ipv6_slaac_addr}
250
251 Should Be Equal ${linklocal_interface_id} ${slaac_interface_id}
252
253
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600254*** Keywords ***
255
Prashanth Katti3270fd02021-06-11 08:02:22 -0500256Suite Setup Execution
257 [Documentation] Do suite setup execution.
258
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -0500259 Redfish.Login
Prashanth Katti3270fd02021-06-11 08:02:22 -0500260 ${active_channel_config}= Get Active Channel Config
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -0500261 Set Suite Variable ${active_channel_config}
262
Prashanth Katti3270fd02021-06-11 08:02:22 -0500263 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
264
265 Set Suite variable ${ethernet_interface}
266
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500267 ${initial_ipv4_addressorigin_list} ${initial_ipv4_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses
268 ${initial_ipv6_addressorigin_list} ${initial_ipv6_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses
269
270 Set Suite Variable ${initial_ipv4_addressorigin_list}
271 Set Suite Variable ${initial_ipv4_addr_list}
272 Set Suite Variable ${initial_ipv6_addressorigin_list}
273 Set Suite Variable ${initial_ipv6_addr_list}
274
Prashanth Katti3270fd02021-06-11 08:02:22 -0500275
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600276Test Setup Execution
277 [Documentation] Test setup execution.
278
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600279 @{ipv6_network_configurations}= Get IPv6 Network Configuration
280 Set Test Variable @{ipv6_network_configurations}
281
282 # Get BMC IPv6 address and prefix length.
283 ${ipv6_data}= Get BMC IPv6 Info
284 Set Test Variable ${ipv6_data}
285
286
287Test Teardown Execution
288 [Documentation] Test teardown execution.
289
290 FFDC On Test Case Fail
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600291
292
293Get IPv6 Network Configuration
294 [Documentation] Get Ipv6 network configuration.
295 # Sample output:
296 # {
ganesanb4d430282023-04-27 14:33:23 +0000297 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0",
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600298 # "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface",
299 # "DHCPv4": {
300 # "DHCPEnabled": false,
301 # "UseDNSServers": false,
302 # "UseDomainName": true,
303 # "UseNTPServers": false
304 # },
305 # "DHCPv6": {
306 # "OperatingMode": "Disabled",
307 # "UseDNSServers": false,
308 # "UseDomainName": true,
309 # "UseNTPServers": false
310 # },
311 # "Description": "Management Network Interface",
312 # "FQDN": "localhost",
313 # "HostName": "localhost",
314 # "IPv4Addresses": [
315 # {
316 # "Address": "xx.xx.xx.xx",
317 # "AddressOrigin": "Static",
318 # "Gateway": "xx.xx.xx.1",
319 # "SubnetMask": "xx.xx.xx.0"
320 # },
321 # {
322 # "Address": "169.254.xx.xx",
323 # "AddressOrigin": "IPv4LinkLocal",
324 # "Gateway": "0.0.0.0",
325 # "SubnetMask": "xx.xx.0.0"
326 # },
327 # ],
328 # "IPv4StaticAddresses": [
329 # {
330 # "Address": "xx.xx.xx.xx",
331 # "AddressOrigin": "Static",
332 # "Gateway": "xx.xx.xx.1",
333 # "SubnetMask": "xx.xx.0.0"
334 # }
335 # }
336 # ],
337 # "IPv6AddressPolicyTable": [],
338 # "IPv6Addresses": [
339 # {
340 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx",
341 # "AddressOrigin": "LinkLocal",
342 # "AddressState": null,
343 # "PrefixLength": xx
344 # }
345 # ],
346 # "IPv6DefaultGateway": "",
347 # "IPv6StaticAddresses": [
348 # { "Address": "xxxx:xxxx:xxxx:xxxx::xxxx",
349 # "AddressOrigin": "Static",
350 # "AddressState": null,
351 # "PrefixLength": xxx
352 # }
353 # ],
354 # "Id": "eth0",
355 # "InterfaceEnabled": true,
356 # "LinkStatus": "LinkUp",
357 # "MACAddress": "xx:xx:xx:xx:xx:xx",
358 # "Name": "Manager Ethernet Interface",
359 # "NameServers": [],
360 # "SpeedMbps": 0,
361 # "StaticNameServers": [],
362 # "Status": {
363 # "Health": "OK",
364 # "HealthRollup": "OK",
365 # "State": "Enabled"
366 # },
367 # "VLANs": {
ganesanb4d430282023-04-27 14:33:23 +0000368 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0/VLANs"
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600369
370
371 ${active_channel_config}= Get Active Channel Config
372 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
373
374 @{ipv6_network_configurations}= Get From Dictionary ${resp.dict} IPv6StaticAddresses
George Keishing409df052024-01-17 22:36:14 +0530375 RETURN @{ipv6_network_configurations}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500376
377
378Verify IPv6 And PrefixLength
379 [Documentation] Verify IPv6 address and prefix length on BMC.
380 [Arguments] ${ipv6_addr} ${prefix_len}
381
382 # Description of the argument(s):
383 # ipv6_addr IPv6 address to be verified.
384 # prefix_len PrefixLength value to be verified.
385
386 # Catenate IPv6 address and its prefix length.
387 ${ipv6_with_prefix}= Catenate ${ipv6_addr}/${prefix_len}
388
389 # Get IPv6 address details on BMC using IP command.
390 @{ip_data}= Get BMC IPv6 Info
391
392 # Verify if IPv6 and prefix length is configured on BMC.
393
394 Should Contain ${ip_data} ${ipv6_with_prefix}
395 ... msg=IPv6 and prefix length pair does not exist.
396
397
398Configure IPv6 Address On BMC
399 [Documentation] Add IPv6 Address on BMC.
400 [Arguments] ${ipv6_addr} ${prefix_len} ${valid_status_codes}=${HTTP_OK}
401
402 # Description of argument(s):
403 # ipv6_addr IPv6 address to be added (e.g. "2001:EEEE:2222::2022").
404 # prefix_len Prefix length for the IPv6 to be added
405 # (e.g. "64").
406 # valid_status_codes Expected return code from patch operation
407 # (e.g. "200").
408
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500409 ${prefix_length}= Convert To Integer ${prefix_len}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500410 ${empty_dict}= Create Dictionary
411 ${ipv6_data}= Create Dictionary Address=${ipv6_addr}
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500412 ... PrefixLength=${prefix_length}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500413
414 ${patch_list}= Create List
415
416 # Get existing static IPv6 configurations on BMC.
417 ${ipv6_network_configurations}= Get IPv6 Network Configuration
418 ${num_entries}= Get Length ${ipv6_network_configurations}
419
420 FOR ${INDEX} IN RANGE 0 ${num_entries}
421 Append To List ${patch_list} ${empty_dict}
422 END
423
George Keishinge6e161e2025-05-08 10:18:30 +0530424 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}'
425 ... ${HTTP_OK},${HTTP_NO_CONTENT}
426 ... ${valid_status_codes}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500427
428 # We need not check for existence of IPv6 on BMC while adding.
429 Append To List ${patch_list} ${ipv6_data}
430 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
431
432 ${active_channel_config}= Get Active Channel Config
433 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
434
435 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
436 ... valid_status_codes=[${valid_status_codes}]
437
438 Return From Keyword If '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}'
439
440 # Note: Network restart takes around 15-18s after patch request processing.
441 Sleep ${NETWORK_TIMEOUT}s
442 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
443
444 Verify IPv6 And PrefixLength ${ipv6_addr} ${prefix_len}
445
446 # Verify if existing static IPv6 addresses still exist.
447 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
448 Verify IPv6 On BMC ${ipv6_network_configuration['Address']}
449 END
450
451 Validate IPv6 Network Config On BMC
452
453
454Validate IPv6 Network Config On BMC
455 [Documentation] Check that IPv6 network info obtained via redfish matches info
456 ... obtained via CLI.
Sridevi Rameshed94c692025-09-07 23:41:10 -0500457
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500458 @{ipv6_network_configurations}= Get IPv6 Network Configuration
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500459 ${ipv6_data}= Get BMC IPv6 Info
460 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
461 Should Contain Match ${ipv6_data} ${ipv6_network_configuration['Address']}/*
462 ... msg=IPv6 address does not exist.
463 END
464
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500465
466Delete IPv6 Address
467 [Documentation] Delete IPv6 address of BMC.
Prashanth Kattibcb9dab2025-04-01 12:58:37 -0500468 [Arguments] ${ipv6_addr}
469 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500470
471 # Description of argument(s):
472 # ipv6_addr IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234").
473 # valid_status_codes Expected return code from patch operation
474 # (e.g. "200"). See prolog of rest_request
475 # method in redfish_plus.py for details.
476
477 ${empty_dict}= Create Dictionary
478 ${patch_list}= Create List
479
480 @{ipv6_network_configurations}= Get IPv6 Network Configuration
481 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
482 IF '${ipv6_network_configuration['Address']}' == '${ipv6_addr}'
483 Append To List ${patch_list} ${null}
484 ELSE
485 Append To List ${patch_list} ${empty_dict}
486 END
487 END
488
489 ${ip_found}= Run Keyword And Return Status List Should Contain Value
490 ... ${patch_list} ${null} msg=${ipv6_addr} does not exist on BMC
491 Pass Execution If ${ip_found} == ${False} ${ipv6_addr} does not exist on BMC
492
493 # Run patch command only if given IP is found on BMC
494 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
495
496 ${active_channel_config}= Get Active Channel Config
497 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
498
499 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
Sweta Potthuria1981612025-05-09 05:41:10 -0500500 ... valid_status_codes=${valid_status_codes}
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500501
502 # Note: Network restart takes around 15-18s after patch request processing
503 Sleep ${NETWORK_TIMEOUT}s
504 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
505
506 # IPv6 address that is deleted should not be there on BMC.
507 ${delete_status}= Run Keyword And Return Status Verify IPv6 On BMC ${ipv6_addr}
Anvesh-Kumar_Rayankula3a26c662025-04-16 01:19:26 -0500508 IF '${valid_status_codes}' == '[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]'
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500509 Should Be True '${delete_status}' == '${False}'
510 ELSE
511 Should Be True '${delete_status}' == '${True}'
512 END
513
514 Validate IPv6 Network Config On BMC
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500515
516
517Modify IPv6 Address
518 [Documentation] Modify and verify IPv6 address of BMC.
519 [Arguments] ${ipv6} ${new_ipv6} ${prefix_len}
520 ... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
521
522 # Description of argument(s):
523 # ipv6 IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
524 # new_ipv6 New IPv6 address to be configured.
525 # prefix_len Prefix length value (Range 1 to 128).
526 # valid_status_codes Expected return code from patch operation
527 # (e.g. "200", "201").
528
529 ${empty_dict}= Create Dictionary
530 ${patch_list}= Create List
531 ${prefix_length}= Convert To Integer ${prefix_len}
532 ${ipv6_data}= Create Dictionary
533 ... Address=${new_ipv6} PrefixLength=${prefix_length}
534
535 # Sample IPv6 network configurations:
536 # "IPv6AddressPolicyTable": [],
537 # "IPv6Addresses": [
538 # {
539 # "Address": "X002:db8:0:2::XX0",
540 # "AddressOrigin": "DHCPv6",
541 # "PrefixLength": 128
542 # },
543 # {
544 # "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX",
545 # "AddressOrigin": "SLAAC",
546 # "PrefixLength": 64
547 # },
548 # {
549 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
550 # "AddressOrigin": "Static",
551 # "PrefixLength": 56
552 # },
553 # {
554 # "Address": “Z002:db8:0:2:a94:efff:fe82:5000",
555 # "AddressOrigin": "Static",
556 # "PrefixLength": 56
557 # },
558 # {
559 # "Address": “Xe80::a94:efff:YYYY:XXXX",
560 # "AddressOrigin": "LinkLocal",
561 # "PrefixLength": 64
562 # },
563 # {
564 # "Address": “X002:db8:1:2:eff:233:fee:546",
565 # "AddressOrigin": "Static",
566 # "PrefixLength": 56
567 # }
568 # ],
569 # "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”,
570 # "IPv6StaticAddresses": [
571 # {
572 # "Address": “X002:db8:0:2:a94:efff:fe82:5000",
573 # "PrefixLength": 56
574 # },
575 # {
576 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
577 # "PrefixLength": 56
578 # },
579 # {
580 # "Address": “Z002:db8:1:2:eff:233:fee:546",
581 # "PrefixLength": 56
582 # }
583 # ],
584 # "IPv6StaticDefaultGateways": [],
585
586 # Find the position of IPv6 address to be modified.
587 @{ipv6_network_configurations}= Get IPv6 Network Configuration
588 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
George Keishinge6e161e2025-05-08 10:18:30 +0530589 IF '${ipv6_network_configuration['Address']}' == '${ipv6}'
590 Append To List ${patch_list} ${ipv6_data}
591 ELSE
592 Append To List ${patch_list} ${empty_dict}
593 END
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500594 END
595
596 # Modify the IPv6 address only if given IPv6 is found
597 ${ip_found}= Run Keyword And Return Status List Should Contain Value
598 ... ${patch_list} ${ipv6_data} msg=${ipv6} does not exist on BMC
599 Pass Execution If ${ip_found} == ${False} ${ipv6} does not exist on BMC
600
601 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
602
603 ${active_channel_config}= Get Active Channel Config
604 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
605
606 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
607 ... body=&{data} valid_status_codes=${valid_status_codes}
608
609 # Note: Network restart takes around 15-18s after patch request processing.
610 Sleep ${NETWORK_TIMEOUT}s
611 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
612
613 # Verify if new IPv6 address is configured on BMC.
614 Verify IPv6 On BMC ${new_ipv6}
615
616 # Verify if old IPv6 address is erased.
617 ${cmd_status}= Run Keyword And Return Status
618 ... Verify IPv6 On BMC ${ipv6}
619 Should Be Equal ${cmd_status} ${False} msg=Old IPv6 address is not deleted.
620
621 Validate IPv6 Network Config On BMC
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500622
623
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500624Set SLAAC Configuration State And Verify
625 [Documentation] Set SLAAC configuration state and verify.
Sridevi Rameshed94c692025-09-07 23:41:10 -0500626 [Arguments] ${slaac_state} ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
627 ... ${channel_number}=${CHANNEL_NUMBER}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500628
629 # Description of argument(s):
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500630 # slaac_state SLAAC state('True' or 'False').
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500631 # valid_status_code Expected valid status codes.
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500632 # channel_number Channel number 1(eth0) or 2(eth1).
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500633
634 ${active_channel_config}= Get Active Channel Config
635 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
636
637 ${data}= Set Variable If ${slaac_state} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC}
638 ${resp}= Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
Sweta Potthuri610f86f2025-05-30 00:47:23 -0500639 ... body=${data} valid_status_codes=${valid_status_codes}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500640
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500641 # Verify SLAAC is set correctly.
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500642 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
643 ${slaac_verify}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig
644
George Keishinge6e161e2025-05-08 10:18:30 +0530645 IF '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}'
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500646 Fail msg=SLAAC not set properly.
George Keishinge6e161e2025-05-08 10:18:30 +0530647 END
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500648
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500649Set And Verify DHCPv6 Property
650 [Documentation] Set DHCPv6 property and verify.
651 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER}
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500652
653 # Description of argument(s):
654 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled').
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500655 # channel_number Channel number 1 or 2.
656
657 Set DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number}
658 Verify DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number}
659
660
661Set DHCPv6 Property
662 [Documentation] Set DHCPv6 attribute is enables or disabled.
663 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER}
664
665 # Description of argument(s):
666 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled').
667 # channel_number Channel number 1 or 2.
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500668
669 ${data}= Set Variable If '${dhcpv6_operating_mode}' == 'Disabled' ${DISABLE_DHCPv6} ${ENABLE_DHCPv6}
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500670 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
671
672 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
673 ... body=${data} valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}]
674
kvishalbd04bd62025-08-05 03:57:53 -0500675
676Verify DHCPv6 Property
677 [Documentation] Verify DHCPv6 settings is enabled or disabled.
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500678 [Arguments] ${dhcpv6_operating_mode} ${channel_number}=${CHANNEL_NUMBER}
kvishalbd04bd62025-08-05 03:57:53 -0500679
680 # Description of Argument(s):
681 # dhcpv6_operating_mode Enable/ Disable DHCPv6.
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500682 # channel_number Channel number 1 or 2.
683
684 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
kvishalbd04bd62025-08-05 03:57:53 -0500685
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500686 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
687 ${dhcpv6_verify}= Get From Dictionary ${resp.dict} DHCPv6
688
689 Should Be Equal '${dhcpv6_verify['OperatingMode']}' '${dhcpv6_operating_mode}'
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500690
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500691
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500692Get IPv6 Static Default Gateway
693 [Documentation] Get IPv6 static default gateway.
694
695 ${active_channel_config}= Get Active Channel Config
696 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
697
698 @{ipv6_static_defgw_configurations}= Get From Dictionary ${resp.dict} IPv6StaticDefaultGateways
699 RETURN @{ipv6_static_defgw_configurations}
700
Sweta Potthuri2d085732025-07-16 09:10:08 -0500701
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500702Configure IPv6 Static Default Gateway On BMC
703 [Documentation] Configure IPv6 static default gateway on BMC.
704 [Arguments] ${ipv6_gw_addr} ${prefix_length_def}
705 ... ${valid_status_codes}=${HTTP_OK}
Sridevi Rameshed94c692025-09-07 23:41:10 -0500706
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500707 # Description of argument(s):
708 # ipv6_gw_addr IPv6 Static Default Gateway address to be configured.
709 # prefix_len_def Prefix length value (Range 1 to 128).
710 # valid_status_codes Expected return code from patch operation
711 # (e.g. "200", "204".)
712
713 # Prefix Length is passed as None.
714 IF '${prefix_length_def}' == '${None}'
715 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr}
716 ELSE
717 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr} Prefix Length=${prefix_length_def}
718 END
719
720 ${ipv6_static_def_gw}= Get IPv6 Static Default Gateway
721
722 ${num_entries}= Get Length ${ipv6_static_def_gw}
723
724 ${patch_list}= Create List
725 ${empty_dict}= Create Dictionary
726
727 FOR ${INDEX} IN RANGE 0 ${num_entries}
728 Append To List ${patch_list} ${empty_dict}
729 END
730
731 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}'
732 ... ${HTTP_OK},${HTTP_NO_CONTENT}
733 ... ${valid_status_codes}
734
735 Append To List ${patch_list} ${ipv6_gw}
736 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
737
738 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
739 ... body=${data} valid_status_codes=[${valid_status_codes}]
740
741 # Verify the added static default gateway is present in Redfish Get Output.
742 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway
743
744 ${ipv6_static_def_gw_list}= Create List
745 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway}
746 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
747 Append To List ${ipv6_static_def_gw_list} ${value}
748 END
749
750 IF '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}'
751 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
752 ELSE
753 Should Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
754 END
755
Sweta Potthuri2d085732025-07-16 09:10:08 -0500756
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -0500757Modify IPv6 Static Default Gateway On BMC
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500758 [Documentation] Modify and verify IPv6 address of BMC.
759 [Arguments] ${ipv6_gw_addr} ${new_static_def_gw} ${prefix_length}
760 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED}]
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500761
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500762 # Description of argument(s):
763 # ipv6_gw_addr IPv6 static default gateway address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
764 # new_static_def_gw New static default gateway address to be configured.
Sridevi Rameshed94c692025-09-07 23:41:10 -0500765 # prefix_length Prefix length value (Range 1 to 128).
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500766 # valid_status_codes Expected return code from patch operation
767 # (e.g. "200", "204").
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500768
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500769 ${empty_dict}= Create Dictionary
770 ${patch_list}= Create List
771 # Prefix Length is passed as None.
772 IF '${prefix_length_def}' == '${None}'
773 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw}
774 ELSE
775 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw} Prefix Length=${prefix_length_def}
776 END
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500777
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500778 @{ipv6_static_def_gw_list}= Get IPv6 Static Default Gateway
779
780 FOR ${ipv6_static_def_gw} IN @{ipv6_static_def_gw_list}
781 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}'
782 Append To List ${patch_list} ${modified_ipv6_gw_addripv6_data}
783 ELSE
784 Append To List ${patch_list} ${empty_dict}
785 END
786 END
787
788 # Modify the IPv6 address only if given IPv6 static default gateway is found.
789 ${ip_static_def_gw_found}= Run Keyword And Return Status List Should Contain Value
790 ... ${patch_list} ${modified_ipv6_gw_addripv6_data} msg=${ipv6_gw_addr} does not exist on BMC
791 Pass Execution If ${ip_static_def_gw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC
792
793 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
794
795 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
796 ... body=&{data} valid_status_codes=${valid_status_codes}
797
798 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway
799
800 ${ipv6_static_def_gw_list}= Create List
801 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway}
Sweta Potthuri2d085732025-07-16 09:10:08 -0500802 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500803 Append To List ${ipv6_static_def_gw_list} ${value}
804 END
805
806 Should Contain ${ipv6_static_def_gw_list} ${new_static_def_gw}
807 # Verify if old static default gateway address is erased.
808 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
809
Sweta Potthuri2d085732025-07-16 09:10:08 -0500810
811Delete IPv6 Static Default Gateway
812 [Documentation] Delete IPv6 static default gateway on BMC.
813 [Arguments] ${ipv6_gw_addr}
814 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
815
816 # Description of argument(s):
817 # ipv6_gw_addr IPv6 Static Default Gateway address to be deleted.
818 # valid_status_codes Expected return code from patch operation
819 # (e.g. "200").
820
821 ${patch_list}= Create List
822 ${empty_dict}= Create Dictionary
823
824 ${ipv6_static_def_gw_list}= Create List
825 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway
826
827 FOR ${ipv6_staticdef_gateway} IN @{ipv6_static_defgw_configurations}
828 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
829 Append To List ${ipv6_static_def_gw_list} ${value}
830 END
831
832 ${defgw_found}= Run Keyword And Return Status List Should Contain Value
833 ... ${ipv6_static_def_gw_list} ${ipv6_gw_addr} msg=${ipv6_gw_addr} does not exist on BMC
834 Skip If ${defgw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC
835
836 FOR ${ipv6_static_def_gw} IN @{ipv6_static_defgw_configurations}
837 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}'
838 Append To List ${patch_list} ${null}
839 ELSE
840 Append To List ${patch_list} ${empty_dict}
841 END
842 END
843
844 # Run patch command only if given IP is found on BMC.
845 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
846
847 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
848 ... valid_status_codes=${valid_status_codes}
849
850 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
851
852 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway
853 Should Not Contain Match ${ipv6_static_defgw_configurations} ${ipv6_gw_addr}
854 ... msg=IPv6 Static default gateway does not exist.
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500855
856
857Check Coexistence Of Linklocalv6 And Static IPv6
858 [Documentation] Verify both linklocalv6 and static IPv6 exist.
859
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500860 # Verify the address origin contains static and linklocal.
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500861 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500862
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500863 Should Match Regexp ${ipv6_linklocal_addr} ${linklocal_addr_format}
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500864 Should Contain ${ipv6_addressorigin_list} Static
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -0500865
866
867Check If Linklocal Address Is In Correct Format
868 [Documentation] Linklocal address has network part fe80 and host part EUI64.
869
870 # Fetch the linklocal address.
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500871 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -0500872
873 # Follow EUI64 from MAC.
874 ${system_mac}= Get BMC MAC Address
875 ${split_octets}= Split String ${system_mac} :
876 ${first_octet}= Evaluate int('${split_octets[0]}', 16)
877 ${flipped_hex}= Evaluate format(${first_octet} ^ 2, '02x')
878 ${grp1}= Evaluate re.sub(r'^0+', '', '${flipped_hex}${split_octets[1]}') modules=re
879 ${grp2}= Evaluate re.sub(r'^0+', '', '${split_octets[2]}ff') modules=re
880 ${grp3}= Evaluate re.sub(r'^0+', '', '${split_octets[4]}${split_octets[5]}') modules=re
881 ${linklocal}= Set Variable fe80::${grp1}:${grp2}:fe${split_octets[3]}:${grp3}
882
883 # Verify the linklocal obtained is the same as on the machine.
884 Should Be Equal ${linklocal} ${ipv6_linklocal_addr}
885
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500886
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500887Check BMC Gets SLAAC Address
888 [Documentation] Check BMC gets slaac address.
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500889
890 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC
891
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500892
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500893Get The Initial DHCPv6 Setting On Each Interface
894 [Documentation] Get the initial DHCPv6 setting of each interface.
895 [Arguments] ${channel_number}
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500896
897 # Description of the argument(s):
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500898 # channel_number Channel number 1 or 2.
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500899
900 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']}
901 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
902 ${initial_dhcpv6_iface}= Get From Dictionary ${resp.dict} DHCPv6
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500903 IF ${channel_number}==${1}
904 Set Test Variable ${dhcpv6_channel_1} ${initial_dhcpv6_iface['OperatingMode']}
905 ELSE
906 Set Test Variable ${dhcpv6_channel_2} ${initial_dhcpv6_iface['OperatingMode']}
907 END
908
909
910Get The Initial DHCPv6 Settings
911 [Documentation] Get the initial DHCPv6 settings of both the interfaces.
912
913 Get The Initial DHCPv6 Setting On Each Interface ${1}
914 Get The Initial DHCPv6 Setting On Each Interface ${2}
915
916
917Get The Initial SLAAC Settings
918 [Documentation] Get the initial SLAAC settings of both the interfaces.
919
920 Get The Initial SLAAC Setting On Each Interface ${1}
921 Get The Initial SLAAC Setting On Each Interface ${2}
922
923
924Get The Initial SLAAC Setting On Each Interface
925 [Documentation] Get the initial SLAAC setting of the interface.
926 [Arguments] ${channel_number}
927
928 # Description of the argument(s):
929 # channel_number Channel number 1 or 2.
930
931 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']}
932 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
933 ${initial_slaac_iface}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig
934 IF ${channel_number}==${1}
935 Set Test Variable ${slaac_channel_1} ${initial_slaac_iface['IPv6AutoConfigEnabled']}
936 ELSE
937 Set Test Variable ${slaac_channel_2} ${initial_slaac_iface['IPv6AutoConfigEnabled']}
938 END
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500939
940
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500941Get Address Origin List And Address For Type
942 [Documentation] Get address origin list and address for type.
943 [Arguments] ${ipv6_address_type}
944
945 # Description of the argument(s):
946 # ipv6_address_type Type of IPv6 address to be checked.
947
948 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
949 @{ipv6_addresses}= Get From Dictionary ${resp.dict} IPv6Addresses
950
951 ${ipv6_addressorigin_list}= Create List
952 ${ipv6_slaac_addr}= Set Variable ${None}
953 FOR ${ipv6_address} IN @{ipv6_addresses}
954 ${ipv6_addressorigin}= Get From Dictionary ${ipv6_address} AddressOrigin
955 Append To List ${ipv6_addressorigin_list} ${ipv6_addressorigin}
956 IF '${ipv6_addressorigin}' == '${ipv6_address_type}'
957 Set Test Variable ${ipv6_type_addr} ${ipv6_address['Address']}
958 END
959 END
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500960 Should Contain ${ipv6_addressorigin_list} ${ipv6_address_type}
961 Should Not Be Empty ${ipv6_type_addr} msg=${ipv6_address_type} address is not present
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500962 RETURN @{ipv6_addressorigin_list} ${ipv6_type_addr}
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500963
964
965Get Address Origin List And IPv4 or IPv6 Address
966 [Documentation] Get address origin list and address for type.
967 [Arguments] ${ip_address_type}
968
969 # Description of the argument(s):
Sridevi Rameshed94c692025-09-07 23:41:10 -0500970 # ip_address_type Type of IPv4 or IPv6 address to be checked.
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500971
972 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
973 @{ip_addresses}= Get From Dictionary ${resp.dict} ${ip_address_type}
974
975 ${ip_addressorigin_list}= Create List
976 ${ip_addr_list}= Create List
977 FOR ${ip_address} IN @{ip_addresses}
978 ${ip_addressorigin}= Get From Dictionary ${ip_address} AddressOrigin
979 Append To List ${ip_addressorigin_list} ${ip_addressorigin}
980 Append To List ${ip_addr_list} ${ip_address['Address']}
981 END
982 RETURN ${ip_addressorigin_list} ${ip_addr_list}
983
984
985Verify All The Addresses Are Intact
986 [Documentation] Verify all the addresses and address origins remain intact.
987
988 # Verify that it will not impact the IPv4 configuration.
989 Sleep ${NETWORK_TIMEOUT}
990 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
991
992 # IPv6 address must be present.
993 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC
994 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
995
996 # IPv4 and IPv6 addresses must remain intact.
997 ${ipv4_addressorigin_list} ${ipv4_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses
998 ${ipv6_addressorigin_list} ${ipv6_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses
999
1000 ${ipv6_is_subset}= Evaluate set(${initial_ipv6_addr_list}).issubset(set(${ipv6_addr_list}))
1001 Should Be True ${ipv6_is_subset}
1002
1003 Should be Equal ${initial_ipv4_addressorigin_list} ${ipv4_addressorigin_list}
1004 Should be Equal ${initial_ipv4_addr_list} ${ipv4_addr_list}
Sweta Potthurif3d188f2025-09-08 07:17:31 -05001005
1006
1007Get Interface ID Of IPv6
1008 [Documentation] Get interface id of IPv6 address.
1009 [Arguments] ${ipv6_address}
1010
1011 # Description of the argument(s):
1012 # ${ipv6_address} IPv6 Address to extract the last 4 hextets.
1013
1014 # Last 64 bits of SLAAC and Linklocal must be the same.
1015 # Sample IPv6 network configurations.
1016 #"IPv6AddressPolicyTable": [],
1017 # "IPv6Addresses": [
1018 # {
1019 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx",
1020 # "AddressOrigin": "LinkLocal",
1021 # "AddressState": null,
1022 # "PrefixLength": xx
1023 # }
1024 # ],
1025 # {
1026 # "Address": "2002:xxxx:xxxx:xxxx:xxxx",
1027 # "AddressOrigin": "SLAAC",
1028 # "PrefixLength": 64
1029 # }
1030 # ],
1031
1032 ${split_ip_address}= Split String ${ipv6_address} :
1033 ${missing_ip}= Evaluate 8 - len(${split_ip_address}) + 1
1034 ${expanded_ip}= Create List
1035
1036 FOR ${hextet} IN @{split_ip_address}
1037 IF '${hextet}' == ''
1038 FOR ${i} IN RANGE ${missing_ip}
1039 Append To List ${expanded_ip} 0000
1040 END
1041 ELSE
1042 Append To List ${expanded_ip} ${hextet}
1043 END
1044 END
1045 ${interface_id}= Evaluate ':'.join(${expanded_ip}[-4:])
1046 RETURN ${interface_id}