blob: 6f54b7946a215c5de300cda8f3a61f9693d75c12 [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
kvishal9c6774c2025-09-10 02:14:07 -050024${invalid_hexadec_ipv6} x:x:x:x:x:x:10.5.5.6
25${ipv6_multi_short} 2001::33::111
George Keishinge16f1582022-12-15 07:32:21 -060026# Valid prefix length is a integer ranges from 1 to 128.
Sweta Potthuri2edacd32025-07-02 01:04:43 -050027${test_prefix_length} 64
28${ipv6_gw_addr} 2002:903:15F:32:9:3:32:1
29${prefix_length_def} None
30${invalid_staticv6_gateway} 9.41.164.1
Sweta Potthuri35c503b2025-07-27 23:36:20 -050031${linklocal_addr_format} fe80::[0-9a-f:]+$
Prashanth Katti8abbb4d2021-01-29 02:17:45 -060032
33*** Test Cases ***
34
35Get IPv6 Address And Verify
36 [Documentation] Get IPv6 Address And Verify.
37 [Tags] Get_IPv6_Address_And_Verify
38
39 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
40 Verify IPv6 On BMC ${ipv6_network_configuration['Address']}
41 END
42
43
Prashanth Katti2c73abc2021-03-17 07:42:25 -050044Get PrefixLength And Verify
45 [Documentation] Get IPv6 prefix length and verify.
46 [Tags] Get_PrefixLength_And_Verify
47
48 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
49 Verify IPv6 On BMC ${ipv6_network_configuration['PrefixLength']}
50 END
51
52
53Get IPv6 Default Gateway And Verify
George Keishing96143832021-03-23 07:55:08 -050054 [Documentation] Get IPv6 default gateway and verify.
George Keishingade6ab42022-07-19 11:41:03 -050055 [Tags] Get_IPv6_Default_Gateway_And_Verify
Prashanth Katti2c73abc2021-03-17 07:42:25 -050056
57 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
58 ${ipv6_gateway}= Get From Dictionary ${resp.dict} IPv6DefaultGateway
59 Verify IPv6 Default Gateway On BMC ${ipv6_gateway}
60
61
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050062Verify All Configured IPv6 And PrefixLength On BMC
63 [Documentation] Verify IPv6 address and its prefix length on BMC.
64 [Tags] Verify_All_Configured_IPv6_And_PrefixLength_On_BMC
65
66 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
George Keishingf02ca2b2023-04-05 22:11:03 +053067 Verify IPv6 And PrefixLength ${ipv6_network_configuration['Address']}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050068 ... ${ipv6_network_configuration['PrefixLength']}
69 END
70
71
72Configure IPv6 Address And Verify
73 [Documentation] Configure IPv6 address and verify.
74 [Tags] Configure_IPv6_Address_And_Verify
Anvesh-Kumar_Rayankula3a26c662025-04-16 01:19:26 -050075 [Teardown] Run Keywords
76 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution
Prashanth Kattic1d2daa2022-07-26 03:53:06 -050077 [Template] Configure IPv6 Address On BMC
78
79
80 # IPv6 address Prefix length
81 ${test_ipv6_addr} ${test_prefix_length}
82
83
Prashanth Katti12ed4b72023-05-16 05:24:00 -050084Delete IPv6 Address And Verify
85 [Documentation] Delete IPv6 address and verify.
86 [Tags] Delete_IPv6_Address_And_Verify
87
88 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
89
90 Delete IPv6 Address ${test_ipv6_addr}
91
92
George Keishingcc288312024-10-22 10:13:12 +053093Modify IPv6 Address And Verify
Prashanth Katti5f7d2e42023-05-22 03:17:25 -050094 [Documentation] Modify IPv6 address and verify.
95 [Tags] Modify_IPv6_Address_And_Verify
kvishal88de8c42025-03-04 01:45:10 -060096 [Teardown] Run Keywords
George Keishingcfdd0992025-03-17 11:59:20 +053097 ... Delete IPv6 Address ${test_ipv6_addr1} AND Test Teardown Execution
Prashanth Katti5f7d2e42023-05-22 03:17:25 -050098
99 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
100
101 Modify IPv6 Address ${test_ipv6_addr} ${test_ipv6_addr1} ${test_prefix_length}
102
103
Sweta Potthuriafe858e2025-02-25 23:52:51 -0600104Verify Persistency Of IPv6 After BMC Reboot
105 [Documentation] Verify persistency of IPv6 after BMC reboot.
106 [Tags] Verify_Persistency_Of_IPv6_After_BMC_Reboot
107 [Teardown] Run Keywords
108 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution
109
110 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
111
112 Redfish OBMC Reboot (off) stack_mode=skip
113
114 # Verifying persistency of IPv6.
115 Verify IPv6 On BMC ${test_ipv6_addr}
116
117
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500118Enable SLAAC On BMC And Verify
119 [Documentation] Enable SLAAC on BMC and verify.
120 [Tags] Enable_SLAAC_On_BMC_And_Verify
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500121
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500122 Set SLAAC Configuration State And Verify ${True}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500123
124
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500125Enable DHCPv6 Property On BMC And Verify
126 [Documentation] Enable DHCPv6 property on BMC and verify.
127 [Tags] Enable_DHCPv6_Property_On_BMC_And_Verify
128
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500129 Set And Verify DHCPv6 Property Enabled
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500130
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500131
kvishal0d199a92025-05-29 02:35:18 -0500132Disable DHCPv6 Property On BMC And Verify
133 [Documentation] Disable DHCPv6 property on BMC and verify.
134 [Tags] Disable_DHCPv6_Property_On_BMC_And_Verify
135
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500136 Set And Verify DHCPv6 Property Disabled
kvishalbd04bd62025-08-05 03:57:53 -0500137
138
139Verify Persistency Of DHCPv6 On Reboot
140 [Documentation] Verify persistency of DHCPv6 property on reboot.
141 [Tags] Verify_Persistency_Of_DHCPv6_On_Reboot
142
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500143 Set And Verify DHCPv6 Property Enabled
144 Redfish OBMC Reboot (off) stack_mode=skip
145 Verify DHCPv6 Property Enabled
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500146
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500147
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500148Configure Invalid Static IPv6 And Verify
149 [Documentation] Configure invalid static IPv6 and verify.
150 [Tags] Configure_Invalid_Static_IPv6_And_Verify
151 [Template] Configure IPv6 Address On BMC
152
kvishal9c6774c2025-09-10 02:14:07 -0500153 #invalid_ipv6 prefix length valid_status_code
154 ${ipv4_hexword_addr} ${test_prefix_length} ${HTTP_BAD_REQUEST}
155 ${invalid_hexadec_ipv6} ${test_prefix_length} ${HTTP_BAD_REQUEST}
156 ${ipv6_multi_short} ${test_prefix_length} ${HTTP_BAD_REQUEST}
157
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500158
Sweta Potthuri565318d2025-06-09 06:13:46 -0500159
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500160Configure IPv6 Static Default Gateway And Verify
161 [Documentation] Configure IPv6 static default gateway and verify.
162 [Tags] Configure_IPv6_Static_Default_Gateway_And_Verify
163 [Template] Configure IPv6 Static Default Gateway On BMC
Sweta Potthuri565318d2025-06-09 06:13:46 -0500164
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500165 # static_def_gw prefix length valid_status_code
166 ${ipv6_gw_addr} ${prefix_length_def} ${HTTP_OK}
167 ${invalid_staticv6_gateway} ${test_prefix_length} ${HTTP_BAD_REQUEST}
Sweta Potthuri565318d2025-06-09 06:13:46 -0500168
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500169
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500170Modify Static Default Gateway And Verify
171 [Documentation] Modify static default gateway and verify.
172 [Tags] Modify_Static_Default_Gateway_And_Verify
173 [Setup] Configure IPv6 Static Default Gateway On BMC ${ipv6_gw_addr} ${prefix_length_def}
174
175 Modify IPv6 Static Default Gateway On BMC ${test_ipv6_addr1} ${prefix_length_def} ${HTTP_OK} ${ipv6_gw_addr}
176
177
Sweta Potthuri2d085732025-07-16 09:10:08 -0500178Delete IPv6 Static Default Gateway And Verify
179 [Documentation] Delete IPv6 static default gateway and verify.
180 [Tags] Delete_IPv6_Static_Default_Gateway_And_Verify
181 [Setup] Configure IPv6 Static Default Gateway On BMC ${ipv6_gw_addr} ${prefix_length_def}
182
183 Delete IPv6 Static Default Gateway ${ipv6_gw_addr}
184
185
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500186Verify Coexistence Of Linklocalv6 And Static IPv6 On BMC
187 [Documentation] Verify linklocalv6 And static IPv6 both exist.
188 [Tags] Verify_Coexistence_Of_Linklocalv6_And_Static_IPv6_On_BMC
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -0500189 [Setup] Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
190 [Teardown] Delete IPv6 Address ${test_ipv6_addr}
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500191
192 Check Coexistence Of Linklocalv6 And Static IPv6
193
194
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -0500195Verify IPv6 Linklocal Address Is In Corrrect Format
196 [Documentation] Verify linklocal address has network part as fe80 and host part as EUI64.
197 [Tags] Verify_IPv6_Linklocal_Address_Is_In_Correct_Format
198
199 Check If Linklocal Address Is In Correct Format
200
201
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500202Verify BMC Gets SLAAC Address On Enabling SLAAC
203 [Documentation] On enabling SLAAC verify SLAAC address comes up.
204 [Tags] Verify_BMC_Gets_SLAAC_Address_On_Enabling_SLAAC
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500205 [Setup] Set SLAAC Configuration State And Verify ${False}
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500206
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500207 Set SLAAC Configuration State And Verify ${True}
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500208 Sleep ${NETWORK_TIMEOUT}
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500209 Check BMC Gets SLAAC Address
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500210
211
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500212Enable And Verify DHCPv6 Property On Eth1 When DHCPv6 Property Enabled On Eth0
213 [Documentation] Verify DHCPv6 on eth1 when DHCPv6 property is enabled on eth0.
214 [Tags] Enable_And_Verify_DHCPv6_Property_On_Eth1_When_DHCPv6_Property_Enabled_On_Eth0
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500215 [Setup] Get The Initial DHCPv6 Settings
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500216 [Teardown] Run Keywords Set And Verify DHCPv6 Property ${dhcpv6_channel_1} ${1}
217 ... AND Set And Verify DHCPv6 Property ${dhcpv6_channel_2} ${2}
218
219 Set And Verify DHCPv6 Property Enabled ${1}
220 Set And Verify DHCPv6 Property Enabled ${2}
221
222
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500223Enable And Verify SLAAC Property On Eth1 When SLAAC Property Enabled On Eth0
224 [Documentation] Enable and verify SLAAC property on Eth1 when SLAAC property enabled on Eth0.
225 [Tags] Enable_And_Verify_SLAAC_Property_On_Eth1_When_SLAAC_Property_Enabled_On_Eth0
226 [Setup] Get The Initial SLAAC Settings
227 [Teardown] Run Keywords Set SLAAC Configuration State And Verify ${slaac_channel_1} [${HTTP_OK}] ${1}
228 ... AND Set SLAAC Configuration State And Verify ${slaac_channel_2} [${HTTP_OK}] ${2}
229
230 Set SLAAC Configuration State And Verify ${True} [${HTTP_OK}] ${1}
231 Set SLAAC Configuration State And Verify ${True} [${HTTP_OK}] ${2}
232
233 # Check all the addresses and address origins remain intact.
234 Verify All The Addresses Are Intact
235
236
abhijith-1213a645902025-09-08 01:12:34 -0500237Verify Autoconfig Is Present On Ethernet Interface
238 [Documentation] Verify autoconfig is present on ethernet interface.
239 [Tags] Verify_Autoconfig_Is_Present_On_Ethernet_Interface
240
241 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
242 Should Contain ${resp.dict} StatelessAddressAutoConfig
243
244
Sweta Potthurif3d188f2025-09-08 07:17:31 -0500245Verify Interface ID Of SLAAC And LinkLocal Addresses Are Same
246 [Documentation] Validate interface id of SLAAC and link-local addresses are same.
247 [Tags] Verify_Interface_ID_Of_SLAAC_And_LinkLocal_Addresses_Are_Same
248
249 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
250 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC
251
252 ${linklocal_interface_id}= Get Interface ID Of IPv6 ${ipv6_linklocal_addr}
253 ${slaac_interface_id}= Get Interface ID Of IPv6 ${ipv6_slaac_addr}
254
255 Should Be Equal ${linklocal_interface_id} ${slaac_interface_id}
256
257
abhijith-121c3e96d72025-09-09 11:35:09 -0500258Verify Persistency Of Link Local IPv6 On BMC Reboot
259 [Documentation] Verify persistency of link local on BMC reboot.
260 [Tags] Verify_Persistency_Of_Link_Local_IPv6_On_BMC_Reboot
261
262 # Capturing the linklocal before reboot.
263 @{ipv6_address_origin_list} ${linklocal_addr_before_reboot}=
264 ... Get Address Origin List And Address For Type LinkLocal
265
266 # Rebooting BMC.
267 Redfish OBMC Reboot (off) stack_mode=skip
268
269 @{ipv6_address_origin_list} ${linklocal_addr_after_reboot}=
270 ... Get Address Origin List And Address For Type LinkLocal
271
272 # Verifying the linklocal must be the same before and after reboot.
273 Should Be Equal ${linklocal_addr_before_reboot} ${linklocal_addr_after_reboot}
274 ... msg=IPv6 Linklocal address has changed after reboot.
275
276
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600277*** Keywords ***
278
Prashanth Katti3270fd02021-06-11 08:02:22 -0500279Suite Setup Execution
280 [Documentation] Do suite setup execution.
281
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -0500282 Redfish.Login
Prashanth Katti3270fd02021-06-11 08:02:22 -0500283 ${active_channel_config}= Get Active Channel Config
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -0500284 Set Suite Variable ${active_channel_config}
285
Prashanth Katti3270fd02021-06-11 08:02:22 -0500286 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
287
288 Set Suite variable ${ethernet_interface}
289
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500290 ${initial_ipv4_addressorigin_list} ${initial_ipv4_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses
291 ${initial_ipv6_addressorigin_list} ${initial_ipv6_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses
292
293 Set Suite Variable ${initial_ipv4_addressorigin_list}
294 Set Suite Variable ${initial_ipv4_addr_list}
295 Set Suite Variable ${initial_ipv6_addressorigin_list}
296 Set Suite Variable ${initial_ipv6_addr_list}
297
Prashanth Katti3270fd02021-06-11 08:02:22 -0500298
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600299Test Setup Execution
300 [Documentation] Test setup execution.
301
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600302 @{ipv6_network_configurations}= Get IPv6 Network Configuration
303 Set Test Variable @{ipv6_network_configurations}
304
305 # Get BMC IPv6 address and prefix length.
306 ${ipv6_data}= Get BMC IPv6 Info
307 Set Test Variable ${ipv6_data}
308
309
310Test Teardown Execution
311 [Documentation] Test teardown execution.
312
313 FFDC On Test Case Fail
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600314
315
316Get IPv6 Network Configuration
317 [Documentation] Get Ipv6 network configuration.
318 # Sample output:
319 # {
ganesanb4d430282023-04-27 14:33:23 +0000320 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0",
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600321 # "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface",
322 # "DHCPv4": {
323 # "DHCPEnabled": false,
324 # "UseDNSServers": false,
325 # "UseDomainName": true,
326 # "UseNTPServers": false
327 # },
328 # "DHCPv6": {
329 # "OperatingMode": "Disabled",
330 # "UseDNSServers": false,
331 # "UseDomainName": true,
332 # "UseNTPServers": false
333 # },
334 # "Description": "Management Network Interface",
335 # "FQDN": "localhost",
336 # "HostName": "localhost",
337 # "IPv4Addresses": [
338 # {
339 # "Address": "xx.xx.xx.xx",
340 # "AddressOrigin": "Static",
341 # "Gateway": "xx.xx.xx.1",
342 # "SubnetMask": "xx.xx.xx.0"
343 # },
344 # {
345 # "Address": "169.254.xx.xx",
346 # "AddressOrigin": "IPv4LinkLocal",
347 # "Gateway": "0.0.0.0",
348 # "SubnetMask": "xx.xx.0.0"
349 # },
350 # ],
351 # "IPv4StaticAddresses": [
352 # {
353 # "Address": "xx.xx.xx.xx",
354 # "AddressOrigin": "Static",
355 # "Gateway": "xx.xx.xx.1",
356 # "SubnetMask": "xx.xx.0.0"
357 # }
358 # }
359 # ],
360 # "IPv6AddressPolicyTable": [],
361 # "IPv6Addresses": [
362 # {
363 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx",
364 # "AddressOrigin": "LinkLocal",
365 # "AddressState": null,
366 # "PrefixLength": xx
367 # }
368 # ],
369 # "IPv6DefaultGateway": "",
370 # "IPv6StaticAddresses": [
371 # { "Address": "xxxx:xxxx:xxxx:xxxx::xxxx",
372 # "AddressOrigin": "Static",
373 # "AddressState": null,
374 # "PrefixLength": xxx
375 # }
376 # ],
377 # "Id": "eth0",
378 # "InterfaceEnabled": true,
379 # "LinkStatus": "LinkUp",
380 # "MACAddress": "xx:xx:xx:xx:xx:xx",
381 # "Name": "Manager Ethernet Interface",
382 # "NameServers": [],
383 # "SpeedMbps": 0,
384 # "StaticNameServers": [],
385 # "Status": {
386 # "Health": "OK",
387 # "HealthRollup": "OK",
388 # "State": "Enabled"
389 # },
390 # "VLANs": {
ganesanb4d430282023-04-27 14:33:23 +0000391 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0/VLANs"
Prashanth Katti8abbb4d2021-01-29 02:17:45 -0600392
393
394 ${active_channel_config}= Get Active Channel Config
395 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
396
397 @{ipv6_network_configurations}= Get From Dictionary ${resp.dict} IPv6StaticAddresses
George Keishing409df052024-01-17 22:36:14 +0530398 RETURN @{ipv6_network_configurations}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500399
400
401Verify IPv6 And PrefixLength
402 [Documentation] Verify IPv6 address and prefix length on BMC.
403 [Arguments] ${ipv6_addr} ${prefix_len}
404
405 # Description of the argument(s):
406 # ipv6_addr IPv6 address to be verified.
407 # prefix_len PrefixLength value to be verified.
408
409 # Catenate IPv6 address and its prefix length.
410 ${ipv6_with_prefix}= Catenate ${ipv6_addr}/${prefix_len}
411
412 # Get IPv6 address details on BMC using IP command.
413 @{ip_data}= Get BMC IPv6 Info
414
415 # Verify if IPv6 and prefix length is configured on BMC.
416
417 Should Contain ${ip_data} ${ipv6_with_prefix}
418 ... msg=IPv6 and prefix length pair does not exist.
419
420
421Configure IPv6 Address On BMC
422 [Documentation] Add IPv6 Address on BMC.
423 [Arguments] ${ipv6_addr} ${prefix_len} ${valid_status_codes}=${HTTP_OK}
424
425 # Description of argument(s):
426 # ipv6_addr IPv6 address to be added (e.g. "2001:EEEE:2222::2022").
427 # prefix_len Prefix length for the IPv6 to be added
428 # (e.g. "64").
429 # valid_status_codes Expected return code from patch operation
430 # (e.g. "200").
431
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500432 ${prefix_length}= Convert To Integer ${prefix_len}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500433 ${empty_dict}= Create Dictionary
434 ${ipv6_data}= Create Dictionary Address=${ipv6_addr}
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500435 ... PrefixLength=${prefix_length}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500436
437 ${patch_list}= Create List
438
439 # Get existing static IPv6 configurations on BMC.
440 ${ipv6_network_configurations}= Get IPv6 Network Configuration
441 ${num_entries}= Get Length ${ipv6_network_configurations}
442
443 FOR ${INDEX} IN RANGE 0 ${num_entries}
444 Append To List ${patch_list} ${empty_dict}
445 END
446
George Keishinge6e161e2025-05-08 10:18:30 +0530447 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}'
448 ... ${HTTP_OK},${HTTP_NO_CONTENT}
449 ... ${valid_status_codes}
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500450
451 # We need not check for existence of IPv6 on BMC while adding.
452 Append To List ${patch_list} ${ipv6_data}
453 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
454
455 ${active_channel_config}= Get Active Channel Config
456 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
457
458 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
459 ... valid_status_codes=[${valid_status_codes}]
460
461 Return From Keyword If '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}'
462
463 # Note: Network restart takes around 15-18s after patch request processing.
464 Sleep ${NETWORK_TIMEOUT}s
465 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
466
467 Verify IPv6 And PrefixLength ${ipv6_addr} ${prefix_len}
468
469 # Verify if existing static IPv6 addresses still exist.
470 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
471 Verify IPv6 On BMC ${ipv6_network_configuration['Address']}
472 END
473
474 Validate IPv6 Network Config On BMC
475
476
477Validate IPv6 Network Config On BMC
478 [Documentation] Check that IPv6 network info obtained via redfish matches info
479 ... obtained via CLI.
Sridevi Rameshed94c692025-09-07 23:41:10 -0500480
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500481 @{ipv6_network_configurations}= Get IPv6 Network Configuration
Prashanth Kattic1d2daa2022-07-26 03:53:06 -0500482 ${ipv6_data}= Get BMC IPv6 Info
483 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
484 Should Contain Match ${ipv6_data} ${ipv6_network_configuration['Address']}/*
485 ... msg=IPv6 address does not exist.
486 END
487
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500488
489Delete IPv6 Address
490 [Documentation] Delete IPv6 address of BMC.
Prashanth Kattibcb9dab2025-04-01 12:58:37 -0500491 [Arguments] ${ipv6_addr}
492 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500493
494 # Description of argument(s):
495 # ipv6_addr IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234").
496 # valid_status_codes Expected return code from patch operation
497 # (e.g. "200"). See prolog of rest_request
498 # method in redfish_plus.py for details.
499
500 ${empty_dict}= Create Dictionary
501 ${patch_list}= Create List
502
503 @{ipv6_network_configurations}= Get IPv6 Network Configuration
504 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
505 IF '${ipv6_network_configuration['Address']}' == '${ipv6_addr}'
506 Append To List ${patch_list} ${null}
507 ELSE
508 Append To List ${patch_list} ${empty_dict}
509 END
510 END
511
512 ${ip_found}= Run Keyword And Return Status List Should Contain Value
513 ... ${patch_list} ${null} msg=${ipv6_addr} does not exist on BMC
514 Pass Execution If ${ip_found} == ${False} ${ipv6_addr} does not exist on BMC
515
516 # Run patch command only if given IP is found on BMC
517 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
518
519 ${active_channel_config}= Get Active Channel Config
520 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
521
522 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
Sweta Potthuria1981612025-05-09 05:41:10 -0500523 ... valid_status_codes=${valid_status_codes}
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500524
525 # Note: Network restart takes around 15-18s after patch request processing
526 Sleep ${NETWORK_TIMEOUT}s
527 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
528
529 # IPv6 address that is deleted should not be there on BMC.
530 ${delete_status}= Run Keyword And Return Status Verify IPv6 On BMC ${ipv6_addr}
Anvesh-Kumar_Rayankula3a26c662025-04-16 01:19:26 -0500531 IF '${valid_status_codes}' == '[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]'
Prashanth Katti12ed4b72023-05-16 05:24:00 -0500532 Should Be True '${delete_status}' == '${False}'
533 ELSE
534 Should Be True '${delete_status}' == '${True}'
535 END
536
537 Validate IPv6 Network Config On BMC
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500538
539
540Modify IPv6 Address
541 [Documentation] Modify and verify IPv6 address of BMC.
542 [Arguments] ${ipv6} ${new_ipv6} ${prefix_len}
543 ... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
544
545 # Description of argument(s):
546 # ipv6 IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
547 # new_ipv6 New IPv6 address to be configured.
548 # prefix_len Prefix length value (Range 1 to 128).
549 # valid_status_codes Expected return code from patch operation
550 # (e.g. "200", "201").
551
552 ${empty_dict}= Create Dictionary
553 ${patch_list}= Create List
554 ${prefix_length}= Convert To Integer ${prefix_len}
555 ${ipv6_data}= Create Dictionary
556 ... Address=${new_ipv6} PrefixLength=${prefix_length}
557
558 # Sample IPv6 network configurations:
559 # "IPv6AddressPolicyTable": [],
560 # "IPv6Addresses": [
561 # {
562 # "Address": "X002:db8:0:2::XX0",
563 # "AddressOrigin": "DHCPv6",
564 # "PrefixLength": 128
565 # },
566 # {
567 # "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX",
568 # "AddressOrigin": "SLAAC",
569 # "PrefixLength": 64
570 # },
571 # {
572 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
573 # "AddressOrigin": "Static",
574 # "PrefixLength": 56
575 # },
576 # {
577 # "Address": “Z002:db8:0:2:a94:efff:fe82:5000",
578 # "AddressOrigin": "Static",
579 # "PrefixLength": 56
580 # },
581 # {
582 # "Address": “Xe80::a94:efff:YYYY:XXXX",
583 # "AddressOrigin": "LinkLocal",
584 # "PrefixLength": 64
585 # },
586 # {
587 # "Address": “X002:db8:1:2:eff:233:fee:546",
588 # "AddressOrigin": "Static",
589 # "PrefixLength": 56
590 # }
591 # ],
592 # "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”,
593 # "IPv6StaticAddresses": [
594 # {
595 # "Address": “X002:db8:0:2:a94:efff:fe82:5000",
596 # "PrefixLength": 56
597 # },
598 # {
599 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
600 # "PrefixLength": 56
601 # },
602 # {
603 # "Address": “Z002:db8:1:2:eff:233:fee:546",
604 # "PrefixLength": 56
605 # }
606 # ],
607 # "IPv6StaticDefaultGateways": [],
608
609 # Find the position of IPv6 address to be modified.
610 @{ipv6_network_configurations}= Get IPv6 Network Configuration
611 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
George Keishinge6e161e2025-05-08 10:18:30 +0530612 IF '${ipv6_network_configuration['Address']}' == '${ipv6}'
613 Append To List ${patch_list} ${ipv6_data}
614 ELSE
615 Append To List ${patch_list} ${empty_dict}
616 END
Prashanth Katti5f7d2e42023-05-22 03:17:25 -0500617 END
618
619 # Modify the IPv6 address only if given IPv6 is found
620 ${ip_found}= Run Keyword And Return Status List Should Contain Value
621 ... ${patch_list} ${ipv6_data} msg=${ipv6} does not exist on BMC
622 Pass Execution If ${ip_found} == ${False} ${ipv6} does not exist on BMC
623
624 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
625
626 ${active_channel_config}= Get Active Channel Config
627 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
628
629 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
630 ... body=&{data} valid_status_codes=${valid_status_codes}
631
632 # Note: Network restart takes around 15-18s after patch request processing.
633 Sleep ${NETWORK_TIMEOUT}s
634 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
635
636 # Verify if new IPv6 address is configured on BMC.
637 Verify IPv6 On BMC ${new_ipv6}
638
639 # Verify if old IPv6 address is erased.
640 ${cmd_status}= Run Keyword And Return Status
641 ... Verify IPv6 On BMC ${ipv6}
642 Should Be Equal ${cmd_status} ${False} msg=Old IPv6 address is not deleted.
643
644 Validate IPv6 Network Config On BMC
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500645
646
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500647Set SLAAC Configuration State And Verify
648 [Documentation] Set SLAAC configuration state and verify.
Sridevi Rameshed94c692025-09-07 23:41:10 -0500649 [Arguments] ${slaac_state} ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
650 ... ${channel_number}=${CHANNEL_NUMBER}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500651
652 # Description of argument(s):
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500653 # slaac_state SLAAC state('True' or 'False').
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500654 # valid_status_code Expected valid status codes.
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500655 # channel_number Channel number 1(eth0) or 2(eth1).
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500656
657 ${active_channel_config}= Get Active Channel Config
658 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
659
660 ${data}= Set Variable If ${slaac_state} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC}
661 ${resp}= Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
Sweta Potthuri610f86f2025-05-30 00:47:23 -0500662 ... body=${data} valid_status_codes=${valid_status_codes}
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500663
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500664 # Verify SLAAC is set correctly.
Sweta Potthuri8ba74322025-03-19 12:29:06 -0500665 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
666 ${slaac_verify}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig
667
George Keishinge6e161e2025-05-08 10:18:30 +0530668 IF '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}'
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500669 Fail msg=SLAAC not set properly.
George Keishinge6e161e2025-05-08 10:18:30 +0530670 END
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500671
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500672Set And Verify DHCPv6 Property
673 [Documentation] Set DHCPv6 property and verify.
674 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER}
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500675
676 # Description of argument(s):
677 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled').
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500678 # channel_number Channel number 1 or 2.
679
680 Set DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number}
681 Verify DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number}
682
683
684Set DHCPv6 Property
685 [Documentation] Set DHCPv6 attribute is enables or disabled.
686 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER}
687
688 # Description of argument(s):
689 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled').
690 # channel_number Channel number 1 or 2.
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500691
692 ${data}= Set Variable If '${dhcpv6_operating_mode}' == 'Disabled' ${DISABLE_DHCPv6} ${ENABLE_DHCPv6}
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500693 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
694
695 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
696 ... body=${data} valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}]
697
kvishalbd04bd62025-08-05 03:57:53 -0500698
699Verify DHCPv6 Property
700 [Documentation] Verify DHCPv6 settings is enabled or disabled.
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500701 [Arguments] ${dhcpv6_operating_mode} ${channel_number}=${CHANNEL_NUMBER}
kvishalbd04bd62025-08-05 03:57:53 -0500702
703 # Description of Argument(s):
704 # dhcpv6_operating_mode Enable/ Disable DHCPv6.
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500705 # channel_number Channel number 1 or 2.
706
707 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
kvishalbd04bd62025-08-05 03:57:53 -0500708
Sweta Potthuri0df4a862025-03-24 12:05:09 -0500709 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
710 ${dhcpv6_verify}= Get From Dictionary ${resp.dict} DHCPv6
711
712 Should Be Equal '${dhcpv6_verify['OperatingMode']}' '${dhcpv6_operating_mode}'
Sweta Potthuricb61ff02025-04-09 05:16:09 -0500713
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500714
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500715Get IPv6 Static Default Gateway
716 [Documentation] Get IPv6 static default gateway.
717
718 ${active_channel_config}= Get Active Channel Config
719 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
720
721 @{ipv6_static_defgw_configurations}= Get From Dictionary ${resp.dict} IPv6StaticDefaultGateways
722 RETURN @{ipv6_static_defgw_configurations}
723
Sweta Potthuri2d085732025-07-16 09:10:08 -0500724
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500725Configure IPv6 Static Default Gateway On BMC
726 [Documentation] Configure IPv6 static default gateway on BMC.
727 [Arguments] ${ipv6_gw_addr} ${prefix_length_def}
728 ... ${valid_status_codes}=${HTTP_OK}
Sridevi Rameshed94c692025-09-07 23:41:10 -0500729
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500730 # Description of argument(s):
731 # ipv6_gw_addr IPv6 Static Default Gateway address to be configured.
732 # prefix_len_def Prefix length value (Range 1 to 128).
733 # valid_status_codes Expected return code from patch operation
734 # (e.g. "200", "204".)
735
736 # Prefix Length is passed as None.
737 IF '${prefix_length_def}' == '${None}'
738 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr}
739 ELSE
740 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr} Prefix Length=${prefix_length_def}
741 END
742
743 ${ipv6_static_def_gw}= Get IPv6 Static Default Gateway
744
745 ${num_entries}= Get Length ${ipv6_static_def_gw}
746
747 ${patch_list}= Create List
748 ${empty_dict}= Create Dictionary
749
750 FOR ${INDEX} IN RANGE 0 ${num_entries}
751 Append To List ${patch_list} ${empty_dict}
752 END
753
754 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}'
755 ... ${HTTP_OK},${HTTP_NO_CONTENT}
756 ... ${valid_status_codes}
757
758 Append To List ${patch_list} ${ipv6_gw}
759 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
760
761 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
762 ... body=${data} valid_status_codes=[${valid_status_codes}]
763
764 # Verify the added static default gateway is present in Redfish Get Output.
765 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway
766
767 ${ipv6_static_def_gw_list}= Create List
768 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway}
769 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
770 Append To List ${ipv6_static_def_gw_list} ${value}
771 END
772
773 IF '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}'
774 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
775 ELSE
776 Should Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
777 END
778
Sweta Potthuri2d085732025-07-16 09:10:08 -0500779
Anvesh-Kumar_Rayankula019d9362025-09-03 22:55:12 -0500780Modify IPv6 Static Default Gateway On BMC
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500781 [Documentation] Modify and verify IPv6 address of BMC.
782 [Arguments] ${ipv6_gw_addr} ${new_static_def_gw} ${prefix_length}
783 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED}]
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500784
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500785 # Description of argument(s):
786 # ipv6_gw_addr IPv6 static default gateway address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
787 # new_static_def_gw New static default gateway address to be configured.
Sridevi Rameshed94c692025-09-07 23:41:10 -0500788 # prefix_length Prefix length value (Range 1 to 128).
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500789 # valid_status_codes Expected return code from patch operation
790 # (e.g. "200", "204").
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500791
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500792 ${empty_dict}= Create Dictionary
793 ${patch_list}= Create List
794 # Prefix Length is passed as None.
795 IF '${prefix_length_def}' == '${None}'
796 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw}
797 ELSE
798 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw} Prefix Length=${prefix_length_def}
799 END
Sweta Potthuri2edacd32025-07-02 01:04:43 -0500800
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500801 @{ipv6_static_def_gw_list}= Get IPv6 Static Default Gateway
802
803 FOR ${ipv6_static_def_gw} IN @{ipv6_static_def_gw_list}
804 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}'
805 Append To List ${patch_list} ${modified_ipv6_gw_addripv6_data}
806 ELSE
807 Append To List ${patch_list} ${empty_dict}
808 END
809 END
810
811 # Modify the IPv6 address only if given IPv6 static default gateway is found.
812 ${ip_static_def_gw_found}= Run Keyword And Return Status List Should Contain Value
813 ... ${patch_list} ${modified_ipv6_gw_addripv6_data} msg=${ipv6_gw_addr} does not exist on BMC
814 Pass Execution If ${ip_static_def_gw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC
815
816 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
817
818 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
819 ... body=&{data} valid_status_codes=${valid_status_codes}
820
821 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway
822
823 ${ipv6_static_def_gw_list}= Create List
824 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway}
Sweta Potthuri2d085732025-07-16 09:10:08 -0500825 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
Sweta Potthuri4b0083f2025-07-09 11:34:40 -0500826 Append To List ${ipv6_static_def_gw_list} ${value}
827 END
828
829 Should Contain ${ipv6_static_def_gw_list} ${new_static_def_gw}
830 # Verify if old static default gateway address is erased.
831 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
832
Sweta Potthuri2d085732025-07-16 09:10:08 -0500833
834Delete IPv6 Static Default Gateway
835 [Documentation] Delete IPv6 static default gateway on BMC.
836 [Arguments] ${ipv6_gw_addr}
837 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
838
839 # Description of argument(s):
840 # ipv6_gw_addr IPv6 Static Default Gateway address to be deleted.
841 # valid_status_codes Expected return code from patch operation
842 # (e.g. "200").
843
844 ${patch_list}= Create List
845 ${empty_dict}= Create Dictionary
846
847 ${ipv6_static_def_gw_list}= Create List
848 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway
849
850 FOR ${ipv6_staticdef_gateway} IN @{ipv6_static_defgw_configurations}
851 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
852 Append To List ${ipv6_static_def_gw_list} ${value}
853 END
854
855 ${defgw_found}= Run Keyword And Return Status List Should Contain Value
856 ... ${ipv6_static_def_gw_list} ${ipv6_gw_addr} msg=${ipv6_gw_addr} does not exist on BMC
857 Skip If ${defgw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC
858
859 FOR ${ipv6_static_def_gw} IN @{ipv6_static_defgw_configurations}
860 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}'
861 Append To List ${patch_list} ${null}
862 ELSE
863 Append To List ${patch_list} ${empty_dict}
864 END
865 END
866
867 # Run patch command only if given IP is found on BMC.
868 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
869
870 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
871 ... valid_status_codes=${valid_status_codes}
872
873 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
874
875 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway
876 Should Not Contain Match ${ipv6_static_defgw_configurations} ${ipv6_gw_addr}
877 ... msg=IPv6 Static default gateway does not exist.
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500878
879
880Check Coexistence Of Linklocalv6 And Static IPv6
881 [Documentation] Verify both linklocalv6 and static IPv6 exist.
882
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500883 # Verify the address origin contains static and linklocal.
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500884 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500885
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500886 Should Match Regexp ${ipv6_linklocal_addr} ${linklocal_addr_format}
Sweta Potthuri35c503b2025-07-27 23:36:20 -0500887 Should Contain ${ipv6_addressorigin_list} Static
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -0500888
889
890Check If Linklocal Address Is In Correct Format
891 [Documentation] Linklocal address has network part fe80 and host part EUI64.
892
893 # Fetch the linklocal address.
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500894 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
Sweta Potthuri3c6f97d2025-08-06 00:30:19 -0500895
896 # Follow EUI64 from MAC.
897 ${system_mac}= Get BMC MAC Address
898 ${split_octets}= Split String ${system_mac} :
899 ${first_octet}= Evaluate int('${split_octets[0]}', 16)
900 ${flipped_hex}= Evaluate format(${first_octet} ^ 2, '02x')
901 ${grp1}= Evaluate re.sub(r'^0+', '', '${flipped_hex}${split_octets[1]}') modules=re
902 ${grp2}= Evaluate re.sub(r'^0+', '', '${split_octets[2]}ff') modules=re
903 ${grp3}= Evaluate re.sub(r'^0+', '', '${split_octets[4]}${split_octets[5]}') modules=re
904 ${linklocal}= Set Variable fe80::${grp1}:${grp2}:fe${split_octets[3]}:${grp3}
905
906 # Verify the linklocal obtained is the same as on the machine.
907 Should Be Equal ${linklocal} ${ipv6_linklocal_addr}
908
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500909
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500910Check BMC Gets SLAAC Address
911 [Documentation] Check BMC gets slaac address.
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500912
913 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC
914
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500915
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500916Get The Initial DHCPv6 Setting On Each Interface
917 [Documentation] Get the initial DHCPv6 setting of each interface.
918 [Arguments] ${channel_number}
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500919
920 # Description of the argument(s):
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500921 # channel_number Channel number 1 or 2.
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500922
923 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']}
924 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
925 ${initial_dhcpv6_iface}= Get From Dictionary ${resp.dict} DHCPv6
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500926 IF ${channel_number}==${1}
927 Set Test Variable ${dhcpv6_channel_1} ${initial_dhcpv6_iface['OperatingMode']}
928 ELSE
929 Set Test Variable ${dhcpv6_channel_2} ${initial_dhcpv6_iface['OperatingMode']}
930 END
931
932
933Get The Initial DHCPv6 Settings
934 [Documentation] Get the initial DHCPv6 settings of both the interfaces.
935
936 Get The Initial DHCPv6 Setting On Each Interface ${1}
937 Get The Initial DHCPv6 Setting On Each Interface ${2}
938
939
940Get The Initial SLAAC Settings
941 [Documentation] Get the initial SLAAC settings of both the interfaces.
942
943 Get The Initial SLAAC Setting On Each Interface ${1}
944 Get The Initial SLAAC Setting On Each Interface ${2}
945
946
947Get The Initial SLAAC Setting On Each Interface
948 [Documentation] Get the initial SLAAC setting of the interface.
949 [Arguments] ${channel_number}
950
951 # Description of the argument(s):
952 # channel_number Channel number 1 or 2.
953
954 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']}
955 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
956 ${initial_slaac_iface}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig
957 IF ${channel_number}==${1}
958 Set Test Variable ${slaac_channel_1} ${initial_slaac_iface['IPv6AutoConfigEnabled']}
959 ELSE
960 Set Test Variable ${slaac_channel_2} ${initial_slaac_iface['IPv6AutoConfigEnabled']}
961 END
Sweta Potthuridb4a6d62025-08-18 11:29:16 -0500962
963
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500964Get Address Origin List And Address For Type
965 [Documentation] Get address origin list and address for type.
966 [Arguments] ${ipv6_address_type}
967
968 # Description of the argument(s):
969 # ipv6_address_type Type of IPv6 address to be checked.
970
971 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
972 @{ipv6_addresses}= Get From Dictionary ${resp.dict} IPv6Addresses
973
974 ${ipv6_addressorigin_list}= Create List
975 ${ipv6_slaac_addr}= Set Variable ${None}
976 FOR ${ipv6_address} IN @{ipv6_addresses}
977 ${ipv6_addressorigin}= Get From Dictionary ${ipv6_address} AddressOrigin
978 Append To List ${ipv6_addressorigin_list} ${ipv6_addressorigin}
979 IF '${ipv6_addressorigin}' == '${ipv6_address_type}'
980 Set Test Variable ${ipv6_type_addr} ${ipv6_address['Address']}
981 END
982 END
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500983 Should Contain ${ipv6_addressorigin_list} ${ipv6_address_type}
984 Should Not Be Empty ${ipv6_type_addr} msg=${ipv6_address_type} address is not present
Sweta Potthuri71f7bdc2025-08-10 03:08:10 -0500985 RETURN @{ipv6_addressorigin_list} ${ipv6_type_addr}
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500986
987
988Get Address Origin List And IPv4 or IPv6 Address
989 [Documentation] Get address origin list and address for type.
990 [Arguments] ${ip_address_type}
991
992 # Description of the argument(s):
Sridevi Rameshed94c692025-09-07 23:41:10 -0500993 # ip_address_type Type of IPv4 or IPv6 address to be checked.
Sweta Potthuriabbbeae2025-08-21 00:06:26 -0500994
995 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
996 @{ip_addresses}= Get From Dictionary ${resp.dict} ${ip_address_type}
997
998 ${ip_addressorigin_list}= Create List
999 ${ip_addr_list}= Create List
1000 FOR ${ip_address} IN @{ip_addresses}
1001 ${ip_addressorigin}= Get From Dictionary ${ip_address} AddressOrigin
1002 Append To List ${ip_addressorigin_list} ${ip_addressorigin}
1003 Append To List ${ip_addr_list} ${ip_address['Address']}
1004 END
1005 RETURN ${ip_addressorigin_list} ${ip_addr_list}
1006
1007
1008Verify All The Addresses Are Intact
1009 [Documentation] Verify all the addresses and address origins remain intact.
1010
1011 # Verify that it will not impact the IPv4 configuration.
1012 Sleep ${NETWORK_TIMEOUT}
1013 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
1014
1015 # IPv6 address must be present.
1016 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC
1017 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal
1018
1019 # IPv4 and IPv6 addresses must remain intact.
1020 ${ipv4_addressorigin_list} ${ipv4_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses
1021 ${ipv6_addressorigin_list} ${ipv6_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses
1022
1023 ${ipv6_is_subset}= Evaluate set(${initial_ipv6_addr_list}).issubset(set(${ipv6_addr_list}))
1024 Should Be True ${ipv6_is_subset}
1025
1026 Should be Equal ${initial_ipv4_addressorigin_list} ${ipv4_addressorigin_list}
1027 Should be Equal ${initial_ipv4_addr_list} ${ipv4_addr_list}
Sweta Potthurif3d188f2025-09-08 07:17:31 -05001028
1029
1030Get Interface ID Of IPv6
1031 [Documentation] Get interface id of IPv6 address.
1032 [Arguments] ${ipv6_address}
1033
1034 # Description of the argument(s):
1035 # ${ipv6_address} IPv6 Address to extract the last 4 hextets.
1036
1037 # Last 64 bits of SLAAC and Linklocal must be the same.
1038 # Sample IPv6 network configurations.
1039 #"IPv6AddressPolicyTable": [],
1040 # "IPv6Addresses": [
1041 # {
1042 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx",
1043 # "AddressOrigin": "LinkLocal",
1044 # "AddressState": null,
1045 # "PrefixLength": xx
1046 # }
1047 # ],
1048 # {
1049 # "Address": "2002:xxxx:xxxx:xxxx:xxxx",
1050 # "AddressOrigin": "SLAAC",
1051 # "PrefixLength": 64
1052 # }
1053 # ],
1054
1055 ${split_ip_address}= Split String ${ipv6_address} :
1056 ${missing_ip}= Evaluate 8 - len(${split_ip_address}) + 1
1057 ${expanded_ip}= Create List
1058
1059 FOR ${hextet} IN @{split_ip_address}
1060 IF '${hextet}' == ''
1061 FOR ${i} IN RANGE ${missing_ip}
1062 Append To List ${expanded_ip} 0000
1063 END
1064 ELSE
1065 Append To List ${expanded_ip} ${hextet}
1066 END
1067 END
1068 ${interface_id}= Evaluate ':'.join(${expanded_ip}[-4:])
1069 RETURN ${interface_id}