xref: /openbmc/openbmc-test-automation/redfish/managers/test_bmc_ipv6.robot (revision 82ae33bf26b3a76eb8204eae44303bf5d2ae87e0)
1*** 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
8Resource       ../../lib/external_intf/vmi_utils.robot
9Resource       ../../lib/bmc_network_utils.robot
10Library        ../../lib/bmc_network_utils.py
11Library        Collections
12Library        Process
13
14Test Setup      Test Setup Execution
15Test Teardown   Test Teardown Execution
16Suite Setup     Suite Setup Execution
17Suite Teardown  Redfish.Logout
18
19Test Tags     BMC_IPv6
20
21*** Variables ***
22${test_ipv6_addr}            2001:db8:3333:4444:5555:6666:7777:8888
23${test_ipv6_invalid_addr}    2001:db8:3333:4444:5555:6666:7777:JJKK
24${test_ipv6_addr1}           2001:db8:3333:4444:5555:6666:7777:9999
25${invalid_hexadec_ipv6}      x:x:x:x:x:x:10.5.5.6
26${ipv6_multi_short}          2001::33::111
27# Valid prefix length is a integer ranges from 1 to 128.
28${test_prefix_length}        64
29${ipv6_gw_addr}              2002:903:15F:32:9:3:32:1
30${prefix_length_def}         None
31${invalid_staticv6_gateway}  9.41.164.1
32${new_mac_addr}              AA:E2:84:14:28:79
33${linklocal_addr_format}     fe80::[0-9a-f:]+$
34${link_local_addr}           fe80::
35${link_local_prefix_len}     10
36${ipv6_leading_zero}         2001:0022:0033::0111
37${ipv6_firsthextet_zero}    2001:0022:1133::1111
38${ipv6_eliminate_zero}       2001:22:33::111
39${ipv6_eliminate_zero1}      2001:22:1133::1111
40${ipv6_contigeous_zero}      2001:0022:0000:0000:1:2:3:8
41${ipv6_zero_compression}     2001:22::1:2:3:8
42
43*** Test Cases ***
44
45Get IPv6 Address And Verify
46    [Documentation]  Get IPv6 Address And Verify.
47    [Tags]  Get_IPv6_Address_And_Verify
48
49    FOR  ${ipv6_network_configuration}  IN  @{ipv6_network_configurations}
50      Verify IPv6 On BMC  ${ipv6_network_configuration['Address']}
51    END
52
53
54Get PrefixLength And Verify
55    [Documentation]  Get IPv6 prefix length and verify.
56    [Tags]  Get_PrefixLength_And_Verify
57
58    FOR  ${ipv6_network_configuration}  IN  @{ipv6_network_configurations}
59      Verify IPv6 On BMC  ${ipv6_network_configuration['PrefixLength']}
60    END
61
62
63Get IPv6 Default Gateway And Verify
64    [Documentation]  Get IPv6 default gateway and verify.
65    [Tags]  Get_IPv6_Default_Gateway_And_Verify
66
67    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
68    ${ipv6_gateway}=  Get From Dictionary  ${resp.dict}  IPv6DefaultGateway
69    Verify IPv6 Default Gateway On BMC  ${ipv6_gateway}
70
71
72Verify All Configured IPv6 And PrefixLength On BMC
73    [Documentation]  Verify IPv6 address and its prefix length on BMC.
74    [Tags]  Verify_All_Configured_IPv6_And_PrefixLength_On_BMC
75
76    FOR  ${ipv6_network_configuration}  IN  @{ipv6_network_configurations}
77      Verify IPv6 And PrefixLength  ${ipv6_network_configuration['Address']}
78      ...  ${ipv6_network_configuration['PrefixLength']}
79    END
80
81
82Configure IPv6 Address And Verify
83    [Documentation]  Configure IPv6 address and verify.
84    [Tags]  Configure_IPv6_Address_And_Verify
85    [Teardown]  Run Keywords
86    ...  Delete IPv6 Address  ${test_ipv6_addr}  AND  Test Teardown Execution
87    [Template]  Configure IPv6 Address On BMC
88
89
90    # IPv6 address     Prefix length
91    ${test_ipv6_addr}  ${test_prefix_length}
92
93
94Configure IPv6 Address On BMC And Verify On Both Interfaces
95    [Documentation]  Configure IPv6 address on both interfaces and verify.
96    [Tags]  Configure_IPv6_Address_On_BMC_And_Verify_On_Both_Interfaces
97    [Teardown]  Run Keywords
98    ...  Delete IPv6 Address  ${test_ipv6_addr}  ${1}
99    ...  AND  Delete IPv6 Address  ${test_ipv6_addr1}  ${2}
100    ...  AND  Test Teardown Execution
101
102    Configure IPv6 Address On BMC  ${test_ipv6_addr}  ${test_prefix_length}  ${None}  ${1}
103    Configure IPv6 Address On BMC  ${test_ipv6_addr1}  ${test_prefix_length}  ${None}  ${2}
104
105    Verify All The Addresses Are Intact  ${1}
106    Verify All The Addresses Are Intact  ${2}
107    ...    ${eth1_initial_ipv4_addressorigin_list}  ${eth1_initial_ipv4_addr_list}
108
109    # Verify Static IPv6 on eth0
110    @{ipv6_addressorigin_list}  ${ipv6_static_addr}=
111    ...  Get Address Origin List And Address For Type  Static  ${1}
112    Should Contain  ${ipv6_addressorigin_list}  Static
113    Should Not Be Empty  ${ipv6_static_addr}  msg=${ipv6_static_addr} address is not present
114
115    # Verify Static IPv6 on eth1
116    @{ipv6_addressorigin_list}  ${ipv6_static_addr}=
117    ...  Get Address Origin List And Address For Type  Static  ${2}
118    Should Contain  ${ipv6_addressorigin_list}  Static
119    Should Not Be Empty  ${ipv6_static_addr}  msg=${ipv6_static_addr} address is not present
120
121
122Delete IPv6 Address And Verify
123    [Documentation]  Delete IPv6 address and verify.
124    [Tags]  Delete_IPv6_Address_And_Verify
125
126    Configure IPv6 Address On BMC  ${test_ipv6_addr}  ${test_prefix_length}
127
128    Delete IPv6 Address  ${test_ipv6_addr}
129
130
131Modify IPv6 Address And Verify
132    [Documentation]  Modify IPv6 address and verify.
133    [Tags]  Modify_IPv6_Address_And_Verify
134    [Teardown]  Run Keywords
135    ...  Delete IPv6 Address  ${test_ipv6_addr1}  AND  Test Teardown Execution
136
137    Configure IPv6 Address On BMC  ${test_ipv6_addr}  ${test_prefix_length}
138
139    Modify IPv6 Address  ${test_ipv6_addr}  ${test_ipv6_addr1}  ${test_prefix_length}
140
141
142Verify Persistency Of IPv6 After BMC Reboot
143    [Documentation]  Verify persistency of IPv6 after BMC reboot.
144    [Tags]  Verify_Persistency_Of_IPv6_After_BMC_Reboot
145    [Teardown]  Run Keywords
146    ...  Delete IPv6 Address  ${test_ipv6_addr}  AND  Test Teardown Execution
147
148    Configure IPv6 Address On BMC  ${test_ipv6_addr}  ${test_prefix_length}
149
150    Redfish OBMC Reboot (off)  stack_mode=skip
151
152    # Verifying persistency of IPv6.
153    Verify IPv6 On BMC  ${test_ipv6_addr}
154
155
156Enable SLAAC On BMC And Verify
157    [Documentation]  Enable SLAAC on BMC and verify.
158    [Tags]  Enable_SLAAC_On_BMC_And_Verify
159
160    Set SLAAC Configuration State And Verify  ${True}
161
162
163Enable DHCPv6 Property On BMC And Verify
164    [Documentation]  Enable DHCPv6 property on BMC and verify.
165    [Tags]  Enable_DHCPv6_Property_On_BMC_And_Verify
166
167    Set And Verify DHCPv6 Property  Enabled
168
169
170Disable DHCPv6 Property On BMC And Verify
171    [Documentation]  Disable DHCPv6 property on BMC and verify.
172    [Tags]  Disable_DHCPv6_Property_On_BMC_And_Verify
173
174    Set And Verify DHCPv6 Property  Disabled
175
176
177Verify Persistency Of DHCPv6 On Reboot
178    [Documentation]  Verify persistency of DHCPv6 property on reboot.
179    [Tags]  Verify_Persistency_Of_DHCPv6_On_Reboot
180
181    Set And Verify DHCPv6 Property  Enabled
182    Redfish OBMC Reboot (off)       stack_mode=skip
183    Verify DHCPv6 Property          Enabled
184
185
186Verify Persistency Of DHCPv6 On BMC Reboot On Eth1
187    [Documentation]  Verify persistency of DHCPv6 property and
188    ...    all existing n/w configurations on BMC reboot on eth1.
189    [Tags]  Verify_Persistency_Of_DHCPv6_On_BMC_Reboot_On_Eth1
190    [Setup]  Set And Verify DHCPv6 Property  Enabled  ${2}
191
192    Redfish OBMC Reboot (off)  stack_mode=skip
193
194    Verify DHCPv6 Property  Enabled  ${2}
195
196    Verify All The Addresses Are Intact  ${1}
197    Verify All The Addresses Are Intact  ${2}
198    ...    ${eth1_initial_ipv4_addressorigin_list}  ${eth1_initial_ipv4_addr_list}
199
200
201Verify Persistency Of SLAAC On BMC Reboot On Eth0
202    [Documentation]  Verify persistency of SLAAC property on reboot on eth0.
203    [Tags]  Verify_Persistency_Of_SLAAC_On_BMC_Reboot_On_Eth0
204
205    Set SLAAC Configuration State And Verify  ${True}  [${HTTP_OK}]  ${1}  ${False}
206    Redfish OBMC Reboot (off)      stack_mode=skip
207    Verify SLAAC Property          ${True}
208
209
210Verify Persistency Of SLAAC On BMC Reboot On Eth1
211    [Documentation]  Verify persistency of SLAAC property on reboot on eth1.
212    [Tags]  Verify_Persistency_Of_SLAAC_On_BMC_Reboot_On_Eth1
213
214    Set SLAAC Configuration State And Verify  ${True}  [${HTTP_OK}]  ${2}  ${False}
215    Redfish OBMC Reboot (off)      stack_mode=skip
216    Verify SLAAC Property          ${True}  ${2}
217
218
219Configure Invalid Static IPv6 And Verify
220    [Documentation]  Configure invalid static IPv6 and verify.
221    [Tags]  Configure_Invalid_Static_IPv6_And_Verify
222    [Template]  Configure IPv6 Address On BMC
223
224    #invalid_ipv6            prefix length           valid_status_code
225    ${ipv4_hexword_addr}     ${test_prefix_length}   ${HTTP_BAD_REQUEST}
226    ${invalid_hexadec_ipv6}  ${test_prefix_length}   ${HTTP_BAD_REQUEST}
227    ${ipv6_multi_short}      ${test_prefix_length}   ${HTTP_BAD_REQUEST}
228
229
230Configure IPv6 Static Default Gateway And Verify
231    [Documentation]  Configure IPv6 static default gateway and verify.
232    [Tags]  Configure_IPv6_Static_Default_Gateway_And_Verify
233    [Template]  Configure IPv6 Static Default Gateway On BMC
234
235    # static_def_gw              prefix length           valid_status_code
236    ${ipv6_gw_addr}              ${prefix_length_def}    ${HTTP_OK}
237    ${invalid_staticv6_gateway}  ${test_prefix_length}   ${HTTP_BAD_REQUEST}
238
239
240Modify Static Default Gateway And Verify
241    [Documentation]  Modify static default gateway and verify.
242    [Tags]  Modify_Static_Default_Gateway_And_Verify
243    [Setup]  Configure IPv6 Static Default Gateway On BMC  ${ipv6_gw_addr}  ${prefix_length_def}
244
245    Modify IPv6 Static Default Gateway On BMC  ${test_ipv6_addr1}  ${prefix_length_def}  ${HTTP_OK}  ${ipv6_gw_addr}
246
247
248Delete IPv6 Static Default Gateway And Verify
249    [Documentation]  Delete IPv6 static default gateway and verify.
250    [Tags]  Delete_IPv6_Static_Default_Gateway_And_Verify
251    [Setup]  Configure IPv6 Static Default Gateway On BMC  ${ipv6_gw_addr}  ${prefix_length_def}
252
253    Delete IPv6 Static Default Gateway  ${ipv6_gw_addr}
254
255
256Verify Coexistence Of Linklocalv6 And Static IPv6 On BMC
257    [Documentation]  Verify linklocalv6 And static IPv6 both exist.
258    [Tags]  Verify_Coexistence_Of_Linklocalv6_And_Static_IPv6_On_BMC
259    [Setup]  Configure IPv6 Address On BMC  ${test_ipv6_addr}  ${test_prefix_length}
260    [Teardown]  Delete IPv6 Address  ${test_ipv6_addr}
261
262    Check Coexistence Of Linklocalv6 And Static IPv6
263
264
265Verify IPv6 Linklocal Address Is In Correct Format
266    [Documentation]  Verify linklocal address has network part as fe80 and
267    ...  host part as EUI64.
268    [Tags]  Verify_IPv6_Linklocal_Address_Is_In_Correct_Format
269
270    Check If Linklocal Address Is In Correct Format
271
272
273Verify BMC Gets SLAAC Address On Enabling SLAAC
274    [Documentation]  On enabling SLAAC verify SLAAC address comes up.
275    [Tags]  Verify_BMC_Gets_SLAAC_Address_On_Enabling_SLAAC
276    [Setup]  Set SLAAC Configuration State And Verify  ${False}
277
278    Set SLAAC Configuration State And Verify  ${True}
279    Sleep  ${NETWORK_TIMEOUT}
280    Check BMC Gets SLAAC Address
281
282
283Verify Enable And Disable SLAAC On Both Interfaces
284    [Documentation]  Verify enable and disable SLAAC on both the interfaces.
285    [Tags]  Verify_Enable_And_Disable_SLAAC_On_Both_Interfaces
286    [Setup]  Get The Initial SLAAC Settings
287    [Template]  Set And Verify SLAAC Property On Both Interfaces
288    [Teardown]  Run Keywords  Set SLAAC Configuration State And Verify  ${slaac_channel_1}  [${HTTP_OK}]  ${1}
289    ...  AND  Set SLAAC Configuration State And Verify  ${slaac_channel_2}  [${HTTP_OK}]  ${2}
290
291    # slaac_eth0       slaac_eth1
292    ${True}            ${True}
293    ${True}            ${False}
294    ${False}           ${True}
295    ${False}           ${False}
296
297
298Configure And Validate DHCPv6 Settings On Both Network Interfaces
299    [Documentation]  Configure and validate the DHCPv6 enable/disable settings
300    ...  on both network interfaces.
301    [Tags]  Configure_And_Validate_DHCPv6_Settings_On_Both_Network_Interfaces
302    [Setup]  Get The Initial DHCPv6 Settings
303    [Template]  Set And Verify DHCPv6 Property On Both Interfaces
304    [Teardown]  Run Keywords  Set And Verify DHCPv6 Property  ${dhcpv6_channel_1}  ${1}  AND
305    ...  Set And Verify DHCPv6 Property  ${dhcpv6_channel_2}  ${2}
306
307    # DHCPv6_eth0      DHCPv6_eth1
308    Enabled            Enabled
309    Enabled            Disabled
310    Disabled           Enabled
311    Disabled           Disabled
312
313
314Verify Autoconfig Is Present On Ethernet Interface
315    [Documentation]  Verify autoconfig is present on ethernet interface.
316    [Tags]  Verify_Autoconfig_Is_Present_On_Ethernet_Interface
317
318    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
319    Should Contain  ${resp.dict}  StatelessAddressAutoConfig
320
321
322Verify Interface ID Of SLAAC And LinkLocal Addresses Are Same
323    [Documentation]  Validate interface id of SLAAC and link-local addresses are same.
324    [Tags]  Verify_Interface_ID_Of_SLAAC_And_LinkLocal_Addresses_Are_Same
325
326    @{ipv6_addressorigin_list}  ${ipv6_linklocal_addr}=  Get Address Origin List And Address For Type  LinkLocal
327    @{ipv6_addressorigin_list}  ${ipv6_slaac_addr}=  Get Address Origin List And Address For Type  SLAAC
328
329    ${linklocal_interface_id}=  Get Interface ID Of IPv6  ${ipv6_linklocal_addr}
330    ${slaac_interface_id}=  Get Interface ID Of IPv6  ${ipv6_slaac_addr}
331
332    Should Be Equal    ${linklocal_interface_id}    ${slaac_interface_id}
333
334
335Verify Persistency Of Link Local IPv6 On BMC Reboot
336    [Documentation]  Verify persistency of link local on BMC reboot.
337    [Tags]  Verify_Persistency_Of_Link_Local_IPv6_On_BMC_Reboot
338
339    # Capturing the linklocal before reboot.
340    @{ipv6_address_origin_list}  ${linklocal_addr_before_reboot}=
341    ...  Get Address Origin List And Address For Type  LinkLocal
342
343    # Rebooting BMC.
344    Redfish OBMC Reboot (off)  stack_mode=skip
345
346    @{ipv6_address_origin_list}  ${linklocal_addr_after_reboot}=
347    ...  Get Address Origin List And Address For Type  LinkLocal
348
349    # Verifying the linklocal must be the same before and after reboot.
350    Should Be Equal    ${linklocal_addr_before_reboot}    ${linklocal_addr_after_reboot}
351    ...    msg=IPv6 Linklocal address has changed after reboot.
352
353
354Modify MAC and Verify BMC Reinitializing Linklocal
355    [Documentation]  Modify MAC and verify BMC reinitializing linklocal.
356    [Tags]  Modify_MAC_and_Verify_BMC_Reinitializing_Linklocal
357    [Teardown]  Configure MAC Settings  ${original_address}
358
359    ${original_address}=  Get BMC MAC Address
360    @{ipv6_addressorigin_list}  ${ipv6_before_linklocal_addr}=  Get Address Origin List And Address For Type  LinkLocal
361
362    # Modify MAC Address Of Ethernet Interface.
363    Configure MAC Settings  ${new_mac_addr}
364    Sleep  30s
365    Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT}
366    @{ipv6_addressorigin_list}  ${ipv6_linklocal_after_addr}=  Get Address Origin List And Address For Type  LinkLocal
367
368    # Verify whether the linklocal has changed and is in the the correct format.
369    Check If Linklocal Address Is In Correct Format
370    Should Not Be Equal    ${ipv6_before_linklocal_addr}    ${ipv6_linklocal_after_addr}
371
372
373Add Multiple IPv6 Address And Verify
374    [Documentation]  Add multiple IPv6 address and verify.
375    [Tags]  Add_Multiple_IPv6_Address_And_Verify
376    [Teardown]  Run Keywords
377    ...  Delete IPv6 Address  ${test_ipv6_addr}  AND  Delete IPv6 Address  ${test_ipv6_addr1}
378    ...  AND  Test Teardown Execution
379
380    Configure Multiple IPv6 Address on BMC  ${test_prefix_length}
381
382
383Verify Coexistence Of Static IPv6 And SLAAC On BMC
384    [Documentation]  Verify static IPv6 And SLAAC both coexist.
385    [Tags]  Verify_Coexistence_Of_Static_IPv6_And_SLAAC_On_BMC
386    [Setup]  Configure IPv6 Address On BMC  ${test_ipv6_addr}  ${test_prefix_length}
387             Set SLAAC Configuration State And Verify  ${True}
388    [Teardown]  Delete IPv6 Address  ${test_ipv6_addr}
389
390    Sleep  ${NETWORK_TIMEOUT}s
391
392    Check Coexistence Of Static IPv6 And SLAAC
393
394
395Verify Coexistence Of Link Local And DHCPv6 On BMC
396    [Documentation]  Verify link local And dhcpv6 both coexist.
397    [Tags]  Verify_Coexistence_Of_Link_Local_And_DHCPv6_On_BMC
398    [Setup]  Set DHCPv6 Property  Enabled  ${2}
399
400    Sleep  ${NETWORK_TIMEOUT}s
401
402    Check Coexistence Of Link Local And DHCPv6
403
404
405Verify Coexistence Of Link Local And SLAAC On BMC
406    [Documentation]  Verify link local And SLAAC both coexist.
407    [Tags]  Verify_Coexistence_Of_Link_Local_And_SLAAC_On_BMC
408    [Setup]  Set SLAAC Configuration State And Verify  ${True}
409
410    Sleep  ${NETWORK_TIMEOUT}s
411
412    Check Coexistence Of Link Local And SLAAC
413
414
415Verify Coexistence Of All IPv6 Type Addresses On BMC
416    [Documentation]  Verify coexistence of link local, static, DHCPv6 and SLAAC ipv6 addresses.
417    [Tags]  Verify_Coexistence_Of_All_IPv6_Type_Addresses_On_BMC
418    [Setup]  Run Keywords  Configure IPv6 Address On BMC  ${test_ipv6_addr}  ${test_prefix_length}
419    ...      AND  Get The Initial DHCPv6 Setting On Each Interface  ${1}
420    ...      AND  Set And Verify DHCPv6 Property  Enabled
421    ...      AND  Get The Initial SLAAC Setting On Each Interface  ${1}
422    ...      AND  Set SLAAC Configuration State And Verify  ${True}
423    [Teardown]  Run Keywords  Delete IPv6 Address  ${test_ipv6_addr}
424    ...         AND  Set And Verify DHCPv6 Property  ${dhcpv6_channel_1}  ${1}
425    ...         AND  Set SLAAC Configuration State And Verify  ${slaac_channel_1}  [${HTTP_OK}]  ${1}
426
427    Sleep  ${NETWORK_TIMEOUT}s
428
429    # Verify link local, static, DHCPv6 and SLAAC ipv6 addresses coexist.
430    Verify The Coexistence Of The Address Type  LinkLocal  Static  DHCPv6  SLAAC
431
432
433Configure Link Local IPv6 Address And Verify
434    [Documentation]  Configure link local IPv6 address and verify.
435    [Tags]  Configure_Link_Local_IPv6_Address_And_Verify
436
437    Configure IPv6 Address On BMC  ${link_local_addr}  ${link_local_prefix_len}
438
439    # Verify the address origin contains link local.
440    @{ipv6_address_origin_list}  ${ipv6_link_local_addr}=
441    ...    Get Address Origin List And Address For Type  LinkLocal
442
443    ${count}=  Evaluate  ${ipv6_address_origin_list}.count("LinkLocal")
444
445    Should Be Equal As Integers  ${count}  2
446
447
448Configure Valid IPv6 Address And Verify
449    [Documentation]  Configure valid IPv6 address and verify it is getting added as expected format.
450    [Tags]  Configure_Valid_IPv6_Address_And_Verify
451    [Teardown]  Run Keywords
452    ...  Delete IPv6 Address  ${ipv6_zero_compression}
453    ...    AND  Delete IPv6 Address  ${ipv6_eliminate_zero}
454    ...    AND  Delete IPv6 Address  ${ipv6_eliminate_zero1}
455    ...    AND  Test Teardown Execution
456    [Template]  Configure IPv6 Address On BMC
457
458    # IPv6 address            prefix length          IPv6 address verified.
459    ${ipv6_contigeous_zero}   ${test_prefix_length}  ${ipv6_zero_compression}
460    ${ipv6_firsthextet_zero}  ${test_prefix_length}  ${ipv6_eliminate_zero1}
461    ${ipv6_leading_zero}      ${test_prefix_length}  ${ipv6_eliminate_zero}
462
463
464Verify Coexistence Of IPv6 Addresses Type Combination On BMC
465    [Documentation]  Verify coexistence of IPv6 addresses type combination on BMC.
466    [Tags]  Verify_Coexistence_Of_IPv6_Addresses_Type_Combination_On_BMC
467    [Setup]  Run Keywords
468    ...    Get The Initial DHCPv6 Setting On Each Interface  ${1}
469    ...    AND  Get The Initial SLAAC Setting On Each Interface  ${1}
470    [Teardown]  Run Keywords
471    ...    Set And Verify DHCPv6 Property  ${dhcpv6_channel_1}  ${1}
472    ...    AND  Set SLAAC Configuration State And Verify  ${slaac_channel_1}  [${HTTP_OK}]  ${1}
473    [Template]  Verify IPv6 Addresses Coexist
474
475   # type1  type2.
476    Static  DHCPv6
477    DHCPv6  SLAAC
478    SLAAC   Static
479    Static  Static
480
481
482Verify Eth0 Static IPv4 Functions Properly In The Presence Of DHCPv6
483    [Documentation]  Verify eth0 static IPv4 functions properly in the presence of DHCPv6.
484    [Tags]  Verify_Eth0_Static_IPv4_Functions_Properly_In_The_Presence_Of_DHCPv6
485    [Setup]  Set And Verify DHCPv6 Property  Enabled
486
487    # Verify that on enabling DHCPv6 other configurations are not impacted.
488    Sleep  ${NETWORK_TIMEOUT}
489    Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT}
490
491    Verify All The Addresses Are Intact  ${1}
492    Verify All The Addresses Are Intact  ${2}
493    ...    ${eth1_initial_ipv4_addressorigin_list}  ${eth1_initial_ipv4_addr_list}
494
495
496Disable And Verify AutoConfig On Both Interfaces When AutoConfig Enabled
497    [Documentation]  Enable and then disable both eth0 & eth1 with auto-config and
498    ...    check both interfaces gets disabled with SLAAC.
499    [Tags]  Disable_And_Verify_AutoConfig_On_Both_Interfaces_When_AutoConfig_Enabled
500    [Setup]  Set And Verify SLAAC Property On Both Interfaces  ${True}  ${True}
501    [Template]  Set And Verify SLAAC Property On Both Interfaces
502
503    # slaac_eth0       slaac_eth1.
504    ${False}           ${False}
505
506
507Verify Eth1 DHCPv4 Functionality In The Presence Of Static IPv6
508    [Documentation]  Verify eth1 dhcpv4 functionality in the presence of Static IPv6
509    ...    and verify link local IPv6 and SLAAC.
510    ...    Run on setup with DHCPv4 available on eth1.
511    [Tags]  Verify_Eth1_DHCPv4_Functionality_In_The_Presence_Of_Static_IPv6
512    [Setup]  Run Keywords
513    ...  Set DHCPEnabled To Enable Or Disable  True  eth1
514    ...  AND  Configure IPv6 Address On BMC  ${test_ipv6_addr}  ${test_prefix_length}  ${None}  ${2}
515    ...  AND  Set SLAAC Configuration State And Verify  ${True}  [${HTTP_OK}]  ${2}
516
517    # Verify presence of static IPv6 address and origin.
518    @{ipv6_address_origin_list}  ${static_ipv6_addr}=
519    ...  Get Address Origin List And Address For Type  Static  ${2}
520    Should Contain  ${ipv6_address_origin_list}  Static
521    Should Not Be Empty  ${static_ipv6_addr}  msg=${test_ipv6_addr} address is not present
522
523    # Verify presence of link local IPv6 address and origin.
524    @{ipv6_address_origin_list}  ${link_local_ipv6_addr}=
525    ...  Get Address Origin List And Address For Type  LinkLocal  ${2}
526    Should Contain  ${ipv6_address_origin_list}  LinkLocal
527    Should Match Regexp  ${link_local_ipv6_addr}  ${linklocal_addr_format}
528    Should Not Be Empty  ${link_local_ipv6_addr}  msg=link local IPv6 address is not present
529
530    # Verify presence of SLAAC address and origin.
531    Sleep  ${NETWORK_TIMEOUT}s
532    @{ipv6_address_origin_list}  ${slaac_addr}=
533    ...  Get Address Origin List And Address For Type  SLAAC  ${2}
534    Should Contain  ${ipv6_address_origin_list}  SLAAC
535    Should Not Be Empty  ${slaac_addr}  msg=SLAAC address is not present
536
537    Verify DHCPv4 Functionality On Eth1
538
539
540Verify Eth1 DHCPv4 Functionality In The Presence Of DHCPv6
541    [Documentation]  Verify eth1 dhcpv4 functionality in the presence of dhcpv6.
542    ...    Run on setup with DHCPv4 available on eth1.
543    [Tags]  Verify_Eth1_DHCPv4_Functionality_In_The_Presence_Of_DHCPv6
544    [Setup]  Run Keywords
545    ...  Set DHCPEnabled To Enable Or Disable  True  eth1
546    ...  AND  Set And Verify DHCPv6 Property  Enabled  ${2}
547
548    # Verify presence of DHCPv6 address and origin.
549    @{ipv6_address_origin_list}  ${dhcpv6_addr}=
550    ...  Get Address Origin List And Address For Type  DHCPv6  ${2}
551    Should Contain  ${ipv6_address_origin_list}  DHCPv6
552    Should Not Be Empty  ${dhcpv6_addr}  msg=dhcpv6 address is not present
553
554    Verify DHCPv4 Functionality On Eth1
555
556
557Verify Static IPv4 Functionality In Presence Of Static IPv6
558    [Documentation]  Verify static IPv4 functionality in presence of static IPv6.
559    [Tags]  Verify_Static_IPv4_Functionality_In_Presence_Of_Static_IPv6
560    [Setup]  Run Keywords
561    ...  Configure IPv6 Address On BMC  ${test_ipv6_addr}  ${test_prefix_length}  ${None}  ${1}
562    ...  AND  Configure IPv6 Address On BMC  ${test_ipv6_addr1}  ${test_prefix_length}  ${None}  ${2}
563    [Template]  Verify Static IPv4 Functionality
564
565    # Channel_number
566    ${1}
567    ${2}
568
569
570*** Keywords ***
571
572Suite Setup Execution
573    [Documentation]  Do suite setup execution.
574
575    Redfish.Login
576    ${active_channel_config}=  Get Active Channel Config
577    Set Suite Variable  ${active_channel_config}
578
579    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
580
581    Set Suite variable  ${ethernet_interface}
582
583    # Get initial IPv4 and IPv6 addresses and address origins for eth0.
584    ${initial_ipv4_addressorigin_list}  ${initial_ipv4_addr_list}=  Get Address Origin List And IPv4 or IPv6 Address  IPv4Addresses
585    ${initial_ipv6_addressorigin_list}  ${initial_ipv6_addr_list}=  Get Address Origin List And IPv4 or IPv6 Address  IPv6Addresses
586
587    Set Suite Variable   ${initial_ipv4_addressorigin_list}
588    Set Suite Variable   ${initial_ipv4_addr_list}
589    Set Suite Variable   ${initial_ipv6_addressorigin_list}
590    Set Suite Variable   ${initial_ipv6_addr_list}
591
592    # Get initial IPv4 and IPv6 addresses and address origins for eth1.
593    ${eth1_initial_ipv4_addressorigin_list}  ${eth1_initial_ipv4_addr_list}=
594    ...  Get Address Origin List And IPv4 or IPv6 Address  IPv4Addresses  ${2}
595    ${eth1_initial_ipv6_addressorigin_list}  ${eth1_initial_ipv6_addr_list}=
596    ...  Get Address Origin List And IPv4 or IPv6 Address  IPv6Addresses  ${2}
597    Set Suite Variable   ${eth1_initial_ipv4_addressorigin_list}
598    Set Suite Variable   ${eth1_initial_ipv4_addr_list}
599    Set Suite Variable   ${eth1_initial_ipv6_addressorigin_list}
600    Set Suite Variable   ${eth1_initial_ipv6_addr_list}
601
602
603Test Setup Execution
604    [Documentation]  Test setup execution.
605
606    @{ipv6_network_configurations}=  Get IPv6 Network Configuration
607    Set Test Variable  @{ipv6_network_configurations}
608
609    # Get BMC IPv6 address and prefix length.
610    ${ipv6_data}=  Get BMC IPv6 Info
611    Set Test Variable  ${ipv6_data}
612
613
614Test Teardown Execution
615    [Documentation]  Test teardown execution.
616
617    FFDC On Test Case Fail
618
619
620Get IPv6 Network Configuration
621    [Documentation]  Get Ipv6 network configuration.
622    [Arguments]  ${channel_number}=${CHANNEL_NUMBER}
623
624    # Description of argument(s):
625    # channel_number  Channel number (1 - eth0 and 2 - eth1).
626
627    # Sample output:
628    # {
629    #  "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0",
630    #  "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface",
631    #   "DHCPv4": {
632    #    "DHCPEnabled": false,
633    #    "UseDNSServers": false,
634    #    "UseDomainName": true,
635    #    "UseNTPServers": false
636    #  },
637    #  "DHCPv6": {
638    #    "OperatingMode": "Disabled",
639    #    "UseDNSServers": false,
640    #    "UseDomainName": true,
641    #    "UseNTPServers": false
642    #  },
643    #  "Description": "Management Network Interface",
644    #  "FQDN": "localhost",
645    #  "HostName": "localhost",
646    #  "IPv4Addresses": [
647    #    {
648    #      "Address": "xx.xx.xx.xx",
649    #      "AddressOrigin": "Static",
650    #      "Gateway": "xx.xx.xx.1",
651    #      "SubnetMask": "xx.xx.xx.0"
652    #    },
653    #    {
654    #      "Address": "169.254.xx.xx",
655    #      "AddressOrigin": "IPv4LinkLocal",
656    #      "Gateway": "0.0.0.0",
657    #      "SubnetMask": "xx.xx.0.0"
658    #    },
659    #  ],
660    #  "IPv4StaticAddresses": [
661    #    {
662    #      "Address": "xx.xx.xx.xx",
663    #      "AddressOrigin": "Static",
664    #      "Gateway": "xx.xx.xx.1",
665    #      "SubnetMask": "xx.xx.0.0"
666    #    }
667    # }
668    #  ],
669    #  "IPv6AddressPolicyTable": [],
670    #  "IPv6Addresses": [
671    #    {
672    #      "Address": "fe80::xxxx:xxxx:xxxx:xxxx",
673    #      "AddressOrigin": "LinkLocal",
674    #      "AddressState": null,
675    #      "PrefixLength": xx
676    #    }
677    #  ],
678    #  "IPv6DefaultGateway": "",
679    #  "IPv6StaticAddresses": [
680    #    { "Address": "xxxx:xxxx:xxxx:xxxx::xxxx",
681    #      "AddressOrigin": "Static",
682    #      "AddressState": null,
683    #      "PrefixLength": xxx
684    #    }
685    #  ],
686    #  "Id": "eth0",
687    #  "InterfaceEnabled": true,
688    #  "LinkStatus": "LinkUp",
689    #  "MACAddress": "xx:xx:xx:xx:xx:xx",
690    #  "Name": "Manager Ethernet Interface",
691    #  "NameServers": [],
692    #  "SpeedMbps": 0,
693    #  "StaticNameServers": [],
694    #  "Status": {
695    #    "Health": "OK",
696    #    "HealthRollup": "OK",
697    #    "State": "Enabled"
698    #  },
699    #  "VLANs": {
700    #    "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0/VLANs"
701
702
703    ${active_channel_config}=  Get Active Channel Config
704    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']}
705
706    @{ipv6_network_configurations}=  Get From Dictionary  ${resp.dict}  IPv6StaticAddresses
707    RETURN  @{ipv6_network_configurations}
708
709
710Verify IPv6 And PrefixLength
711    [Documentation]  Verify IPv6 address and prefix length on BMC.
712    [Arguments]  ${ipv6_addr}  ${prefix_len}
713
714    # Description of the argument(s):
715    # ipv6_addr   IPv6 address to be verified.
716    # prefix_len  PrefixLength value to be verified.
717
718    # Catenate IPv6 address and its prefix length.
719    ${ipv6_with_prefix}=  Catenate  ${ipv6_addr}/${prefix_len}
720
721    # Get IPv6 address details on BMC using IP command.
722    @{ip_data}=  Get BMC IPv6 Info
723
724    # Verify if IPv6 and prefix length is configured on BMC.
725
726    Should Contain  ${ip_data}  ${ipv6_with_prefix}
727    ...  msg=IPv6 and prefix length pair does not exist.
728
729Configure IPv6 Address On BMC
730    [Documentation]  Add IPv6 Address on BMC.
731    [Arguments]  ${ipv6_addr1}  ${prefix_len}  ${ipv6_addr2}=${None}
732    ...  ${channel_number}=${CHANNEL_NUMBER}
733    ...  ${valid_status_codes}=[${HTTP_OK},${HTTP_NO_CONTENT}]
734
735    # Description of argument(s):
736    # ipv6_addr1          IPv6 address to be added (e.g. "2001:0022:0033::0111").
737    # ipv6_addr2          IPv6 address to be Verified (e.g. "2001:22:33::111").
738    # prefix_len          Prefix length for the IPv6 to be added
739    #                     (e.g. "64").
740    # channel_number      Channel number (1 - eth0 and 2 - eth1).
741    # valid_status_codes  Expected return code from patch operation
742    #                     (e.g. "200").
743
744    ${prefix_length}=  Convert To Integer  ${prefix_len}
745    ${empty_dict}=  Create Dictionary
746    ${ipv6_data}=  Create Dictionary  Address=${ipv6_addr1}
747    ...  PrefixLength=${prefix_length}
748
749    ${patch_list}=  Create List
750
751    # Get existing static IPv6 configurations on BMC.
752    ${ipv6_network_configurations}=  Get IPv6 Network Configuration  ${channel_number}
753    ${num_entries}=  Get Length  ${ipv6_network_configurations}
754
755    FOR  ${INDEX}  IN RANGE  0  ${num_entries}
756      Append To List  ${patch_list}  ${empty_dict}
757    END
758
759    # We need not check for existence of IPv6 on BMC while adding.
760    Append To List  ${patch_list}  ${ipv6_data}
761    ${data}=  Create Dictionary  IPv6StaticAddresses=${patch_list}
762
763    ${active_channel_config}=  Get Active Channel Config
764    ${ethernet_interface}=  Set Variable  ${active_channel_config['${channel_number}']['name']}
765
766    Redfish.patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}  body=&{data}
767    ...  valid_status_codes=${valid_status_codes}
768
769    IF  ${valid_status_codes} != [${HTTP_OK}, ${HTTP_NO_CONTENT}]
770        Fail  msg=Static address not added correctly
771    END
772
773    # Note: Network restart takes around 15-18s after patch request processing.
774    Sleep  ${NETWORK_TIMEOUT}s
775    Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT}
776
777    # Verify ip address on CLI.
778    IF  '${ipv6_addr2}' != '${None}'
779        Verify IPv6 And PrefixLength  ${ipv6_addr2}  ${prefix_len}
780    ELSE
781        Verify IPv6 And PrefixLength  ${ipv6_addr1}  ${prefix_len}
782    END
783
784    # Verify if existing static IPv6 addresses still exist.
785    FOR  ${ipv6_network_configuration}  IN  @{ipv6_network_configurations}
786      Verify IPv6 On BMC  ${ipv6_network_configuration['Address']}
787    END
788
789    #Verify redfish and CLI data matches.
790    Validate IPv6 Network Config On BMC
791
792
793Configure Multiple IPv6 Address on BMC
794    [Documentation]  Add multiple IPv6 address on BMC.
795    [Arguments]  ${prefix_len}
796    ...          ${valid_status_codes}=[${HTTP_OK},${HTTP_NO_CONTENT}]
797
798    # Description of argument(s):
799    # prefix_len          Prefix length for the IPv6 to be added
800    #                     (e.g. "64").
801    # valid_status_codes  Expected return code from patch operation
802    #                     (e.g. "200").
803
804    ${ipv6_list}=  Create List  ${test_ipv6_addr}  ${test_ipv6_addr1}
805    ${prefix_length}=  Convert To Integer  ${prefix_len}
806    ${empty_dict}=  Create Dictionary
807    ${patch_list}=  Create List
808
809    # Get existing static IPv6 configurations on BMC.
810    ${ipv6_network_configurations}=  Get IPv6 Network Configuration
811    ${num_entries}=  Get Length  ${ipv6_network_configurations}
812
813    FOR  ${INDEX}  IN RANGE  0  ${num_entries}
814      Append To List  ${patch_list}  ${empty_dict}
815    END
816
817    # We need not check for existence of IPv6 on BMC while adding.
818    FOR  ${ipv6_addr}  IN  @{ipv6_list}
819      ${ipv6_data}=  Create Dictionary  Address=${ipv6_addr}  PrefixLength=${prefix_length}
820      Append To List  ${patch_list}  ${ipv6_data}
821    END
822    ${data}=  Create Dictionary  IPv6StaticAddresses=${patch_list}
823
824    ${active_channel_config}=  Get Active Channel Config
825    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
826
827    Redfish.patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}  body=&{data}
828    ...  valid_status_codes=${valid_status_codes}
829
830    IF  ${valid_status_codes} != [${HTTP_OK}, ${HTTP_NO_CONTENT}]
831        Fail  msg=Static address not added correctly
832    END
833
834    # Note: Network restart takes around 15-18s after patch request processing.
835    Sleep  ${NETWORK_TIMEOUT}s
836    Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT}
837
838    # Verify newly added ip address on CLI.
839    FOR  ${ipv6_addr}  IN  @{ipv6_list}
840      Verify IPv6 And PrefixLength  ${ipv6_addr}  ${prefix_len}
841    END
842
843    # Verify if existing static IPv6 addresses still exist.
844    FOR  ${ipv6_network_configuration}  IN  @{ipv6_network_configurations}
845      Verify IPv6 On BMC  ${ipv6_network_configuration['Address']}
846    END
847
848    # Get the latest ipv6 network configurations.
849    @{ipv6_network_configurations}=  Get IPv6 Network Configuration
850
851    # Verify newly added ip address on BMC.
852    FOR  ${ipv6_network_configuration}  IN  @{ipv6_network_configurations}
853      Should Contain Match  ${ipv6_list}  ${ipv6_network_configuration['Address']}
854    END
855
856    Validate IPv6 Network Config On BMC
857
858
859Validate IPv6 Network Config On BMC
860    [Documentation]  Check that IPv6 network info obtained via redfish matches info
861    ...              obtained via CLI.
862
863    @{ipv6_network_configurations}=  Get IPv6 Network Configuration
864    ${ipv6_data}=  Get BMC IPv6 Info
865    FOR  ${ipv6_network_configuration}  IN  @{ipv6_network_configurations}
866      Should Contain Match  ${ipv6_data}  ${ipv6_network_configuration['Address']}/*
867      ...  msg=IPv6 address does not exist.
868    END
869
870
871Delete IPv6 Address
872    [Documentation]  Delete IPv6 address of BMC.
873    [Arguments]  ${ipv6_addr}
874    ...    ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
875    ...    ${channel_number}=${CHANNEL_NUMBER}
876
877    # Description of argument(s):
878    # ipv6_addr           IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234").
879    # channel_number     Channel number (1 - eth0 and 2 - eth1).
880    # valid_status_codes  Expected return code from patch operation
881    #                     (e.g. "200").  See prolog of rest_request
882    #                     method in redfish_plus.py for details.
883
884    ${empty_dict}=  Create Dictionary
885    ${patch_list}=  Create List
886
887    @{ipv6_network_configurations}=  Get IPv6 Network Configuration  ${channel_number}
888    FOR  ${ipv6_network_configuration}  IN  @{ipv6_network_configurations}
889        IF  '${ipv6_network_configuration['Address']}' == '${ipv6_addr}'
890            Append To List  ${patch_list}  ${null}
891        ELSE
892            Append To List  ${patch_list}  ${empty_dict}
893        END
894    END
895
896    ${ip_found}=  Run Keyword And Return Status  List Should Contain Value
897    ...  ${patch_list}  ${null}  msg=${ipv6_addr} does not exist on BMC
898    Pass Execution If  ${ip_found} == ${False}  ${ipv6_addr} does not exist on BMC
899
900    # Run patch command only if given IP is found on BMC
901    ${data}=  Create Dictionary  IPv6StaticAddresses=${patch_list}
902
903    ${active_channel_config}=  Get Active Channel Config
904    ${ethernet_interface}=  Set Variable  ${active_channel_config['${channel_number}']['name']}
905
906    Redfish.patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}  body=&{data}
907    ...  valid_status_codes=${valid_status_codes}
908
909    # Note: Network restart takes around 15-18s after patch request processing
910    Sleep  ${NETWORK_TIMEOUT}s
911    Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT}
912
913    # IPv6 address that is deleted should not be there on BMC.
914    ${delete_status}=  Run Keyword And Return Status  Verify IPv6 On BMC  ${ipv6_addr}
915    IF  '${valid_status_codes}' == '[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]'
916        Should Be True  '${delete_status}' == '${False}'
917    ELSE
918        Should Be True  '${delete_status}' == '${True}'
919    END
920
921    Validate IPv6 Network Config On BMC
922
923
924Modify IPv6 Address
925    [Documentation]  Modify and verify IPv6 address of BMC.
926    [Arguments]  ${ipv6}  ${new_ipv6}  ${prefix_len}
927    ...  ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
928
929    # Description of argument(s):
930    # ipv6                  IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
931    # new_ipv6              New IPv6 address to be configured.
932    # prefix_len            Prefix length value (Range 1 to 128).
933    # valid_status_codes    Expected return code from patch operation
934    #                       (e.g. "200", "201").
935
936    ${empty_dict}=  Create Dictionary
937    ${patch_list}=  Create List
938    ${prefix_length}=  Convert To Integer  ${prefix_len}
939    ${ipv6_data}=  Create Dictionary
940    ...  Address=${new_ipv6}  PrefixLength=${prefix_length}
941
942    # Sample IPv6 network configurations:
943    #  "IPv6AddressPolicyTable": [],
944    #  "IPv6Addresses": [
945    #    {
946    #      "Address": "X002:db8:0:2::XX0",
947    #      "AddressOrigin": "DHCPv6",
948    #      "PrefixLength": 128
949    #    },
950    #    {
951    #      "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX",
952    #      "AddressOrigin": "SLAAC",
953    #      "PrefixLength": 64
954    #    },
955    #    {
956    #      "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
957    #      "AddressOrigin": "Static",
958    #      "PrefixLength": 56
959    #    },
960    #    {
961    #      "Address": “Z002:db8:0:2:a94:efff:fe82:5000",
962    #      "AddressOrigin": "Static",
963    #      "PrefixLength": 56
964    #    },
965    #    {
966    #      "Address": “Xe80::a94:efff:YYYY:XXXX",
967    #      "AddressOrigin": "LinkLocal",
968    #      "PrefixLength": 64
969    #    },
970    #    {
971    #     "Address": “X002:db8:1:2:eff:233:fee:546",
972    #      "AddressOrigin": "Static",
973    #      "PrefixLength": 56
974    #    }
975    #  ],
976    #  "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”,
977    #  "IPv6StaticAddresses": [
978    #    {
979    #      "Address": “X002:db8:0:2:a94:efff:fe82:5000",
980    #      "PrefixLength": 56
981    #    },
982    #    {
983    #      "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
984    #      "PrefixLength": 56
985    #    },
986    #    {
987    #      "Address": “Z002:db8:1:2:eff:233:fee:546",
988    #      "PrefixLength": 56
989    #    }
990    #  ],
991    #  "IPv6StaticDefaultGateways": [],
992
993    # Find the position of IPv6 address to be modified.
994    @{ipv6_network_configurations}=  Get IPv6 Network Configuration
995    FOR  ${ipv6_network_configuration}  IN  @{ipv6_network_configurations}
996      IF  '${ipv6_network_configuration['Address']}' == '${ipv6}'
997          Append To List  ${patch_list}  ${ipv6_data}
998      ELSE
999          Append To List  ${patch_list}  ${empty_dict}
1000      END
1001    END
1002
1003    # Modify the IPv6 address only if given IPv6 is found
1004    ${ip_found}=  Run Keyword And Return Status  List Should Contain Value
1005    ...  ${patch_list}  ${ipv6_data}  msg=${ipv6} does not exist on BMC
1006    Pass Execution If  ${ip_found} == ${False}  ${ipv6} does not exist on BMC
1007
1008    ${data}=  Create Dictionary  IPv6StaticAddresses=${patch_list}
1009
1010    ${active_channel_config}=  Get Active Channel Config
1011    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
1012
1013    Redfish.patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1014    ...  body=&{data}  valid_status_codes=${valid_status_codes}
1015
1016    # Note: Network restart takes around 15-18s after patch request processing.
1017    Sleep  ${NETWORK_TIMEOUT}s
1018    Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT}
1019
1020    # Verify if new IPv6 address is configured on BMC.
1021    Verify IPv6 On BMC  ${new_ipv6}
1022
1023    # Verify if old IPv6 address is erased.
1024    ${cmd_status}=  Run Keyword And Return Status
1025    ...  Verify IPv6 On BMC  ${ipv6}
1026    Should Be Equal  ${cmd_status}  ${False}  msg=Old IPv6 address is not deleted.
1027
1028    Validate IPv6 Network Config On BMC
1029
1030
1031Set SLAAC Configuration State And Verify
1032    [Documentation]  Set SLAAC configuration state.
1033    [Arguments]  ${slaac_state}  ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
1034    ...  ${channel_number}=${CHANNEL_NUMBER}  ${is_slaac_verify_state}=${True}
1035
1036    # Description of argument(s):
1037    # slaac_state             SLAAC state('True' or 'False').
1038    # valid_status_code       Expected valid status codes.
1039    # channel_number          Channel number 1(eth0) or 2(eth1).
1040    # is_slaac_verify_state   Flag to check verification is required.
1041
1042    ${active_channel_config}=  Get Active Channel Config
1043    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
1044
1045    ${data}=  Set Variable If  ${slaac_state} == ${False}  ${DISABLE_SLAAC}  ${ENABLE_SLAAC}
1046    ${resp}=  Redfish.Patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1047    ...  body=${data}  valid_status_codes=${valid_status_codes}
1048    IF  ${is_slaac_verify_state}
1049        Verify SLAAC Property  ${slaac_state}  ${channel_number}
1050    END
1051
1052
1053Verify SLAAC Property
1054    [Documentation]  Verify SLAAC property.
1055    [Arguments]  ${slaac_state}  ${channel_number}=${CHANNEL_NUMBER}
1056
1057    # Description of argument(s):
1058    # slaac_state     SLAAC state('True' or 'False').
1059    # channel_number  Channel number 1(eth0) or 2(eth1).
1060
1061    # Verify SLAAC is set correctly.
1062    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1063    ${slaac_verify}=  Get From Dictionary  ${resp.dict}  StatelessAddressAutoConfig
1064
1065    IF  '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}'
1066        Fail  msg=SLAAC not set properly.
1067    END
1068
1069
1070Set And Verify DHCPv6 Property
1071    [Documentation]  Set DHCPv6 property and verify.
1072    [Arguments]  ${dhcpv6_operating_mode}=${Disabled}  ${channel_number}=${CHANNEL_NUMBER}
1073
1074    # Description of argument(s):
1075    # dhcpv6_operating_mode    Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled').
1076    # channel_number           Channel number 1 or 2.
1077
1078    Set DHCPv6 Property  ${dhcpv6_operating_mode}  ${channel_number}
1079    Verify DHCPv6 Property  ${dhcpv6_operating_mode}  ${channel_number}
1080
1081
1082Set DHCPv6 Property
1083    [Documentation]  Set DHCPv6 attribute is enables or disabled.
1084    [Arguments]  ${dhcpv6_operating_mode}=${Disabled}  ${channel_number}=${CHANNEL_NUMBER}
1085
1086    # Description of argument(s):
1087    # dhcpv6_operating_mode    Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled').
1088    # channel_number           Channel number 1 or 2.
1089
1090    ${data}=  Set Variable If  '${dhcpv6_operating_mode}' == 'Disabled'  ${DISABLE_DHCPv6}  ${ENABLE_DHCPv6}
1091    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
1092
1093    Redfish.Patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1094    ...  body=${data}  valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}]
1095
1096
1097Verify DHCPv6 Property
1098    [Documentation]  Verify DHCPv6 settings is enabled or disabled.
1099    [Arguments]  ${dhcpv6_operating_mode}  ${channel_number}=${CHANNEL_NUMBER}
1100
1101    # Description of Argument(s):
1102    # dhcpv6_operating_mode  Enable/ Disable DHCPv6.
1103    # channel_number         Channel number 1 or 2.
1104
1105    ${ethernet_interface}=  Set Variable  ${active_channel_config['${channel_number}']['name']}
1106
1107    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1108    ${dhcpv6_verify}=  Get From Dictionary  ${resp.dict}  DHCPv6
1109
1110    Should Be Equal  '${dhcpv6_verify['OperatingMode']}'  '${dhcpv6_operating_mode}'
1111
1112    Sleep  30s
1113
1114    @{ipv6_addressorigin_list}  ${ipv6_dhcpv6_addr}=
1115    ...  Get Address Origin List And IPv4 or IPv6 Address  IPv6Addresses  ${channel_number}
1116
1117    IF  "${dhcpv6_operating_mode}" == "Enabled"
1118        @{ipv6_addressorigin_list}  ${ipv6_dhcpv6_addr}=
1119        ...  Get Address Origin List And Address For Type  DHCPv6  ${channel_number}
1120        Should Not Be Empty  ${ipv6_dhcpv6_addr}  msg=DHCPv6 must be present.
1121    ELSE
1122        Should Not Contain  ${ipv6_addressorigin_list}  DHCPv6
1123    END
1124
1125
1126
1127Get IPv6 Static Default Gateway
1128    [Documentation]  Get IPv6 static default gateway.
1129
1130    ${active_channel_config}=  Get Active Channel Config
1131    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
1132
1133    @{ipv6_static_defgw_configurations}=  Get From Dictionary  ${resp.dict}  IPv6StaticDefaultGateways
1134    RETURN  @{ipv6_static_defgw_configurations}
1135
1136
1137Configure IPv6 Static Default Gateway On BMC
1138    [Documentation]  Configure IPv6 static default gateway on BMC.
1139    [Arguments]  ${ipv6_gw_addr}  ${prefix_length_def}
1140    ...  ${valid_status_codes}=${HTTP_OK}
1141
1142    # Description of argument(s):
1143    # ipv6_gw_addr          IPv6 Static Default Gateway address to be configured.
1144    # prefix_len_def        Prefix length value (Range 1 to 128).
1145    # valid_status_codes    Expected return code from patch operation
1146    #                       (e.g. "200", "204".)
1147
1148    # Prefix Length is passed as None.
1149    IF   '${prefix_length_def}' == '${None}'
1150        ${ipv6_gw}=  Create Dictionary  Address=${ipv6_gw_addr}
1151    ELSE
1152        ${ipv6_gw}=  Create Dictionary  Address=${ipv6_gw_addr}  Prefix Length=${prefix_length_def}
1153    END
1154
1155    ${ipv6_static_def_gw}=  Get IPv6 Static Default Gateway
1156
1157    ${num_entries}=  Get Length  ${ipv6_static_def_gw}
1158
1159    ${patch_list}=  Create List
1160    ${empty_dict}=  Create Dictionary
1161
1162    FOR  ${INDEX}  IN RANGE  0  ${num_entries}
1163      Append To List  ${patch_list}  ${empty_dict}
1164    END
1165
1166    ${valid_status_codes}=  Set Variable If  '${valid_status_codes}' == '${HTTP_OK}'
1167    ...  ${HTTP_OK},${HTTP_NO_CONTENT}
1168    ...  ${valid_status_codes}
1169
1170    Append To List  ${patch_list}  ${ipv6_gw}
1171    ${data}=  Create Dictionary  IPv6StaticDefaultGateways=${patch_list}
1172
1173    Redfish.Patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1174    ...  body=${data}  valid_status_codes=[${valid_status_codes}]
1175
1176    # Verify the added static default gateway is present in Redfish Get Output.
1177    ${ipv6_staticdef_gateway}=  Get IPv6 Static Default Gateway
1178
1179    ${ipv6_static_def_gw_list}=  Create List
1180    FOR  ${ipv6_staticdef_gateway}  IN  @{ipv6_staticdef_gateway}
1181        ${value}=    Get From Dictionary    ${ipv6_staticdef_gateway}    Address
1182        Append To List  ${ipv6_static_def_gw_list}  ${value}
1183    END
1184
1185    IF  '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}'
1186        Should Not Contain  ${ipv6_static_def_gw_list}  ${ipv6_gw_addr}
1187    ELSE
1188        Should Contain  ${ipv6_static_def_gw_list}  ${ipv6_gw_addr}
1189    END
1190
1191
1192Modify IPv6 Static Default Gateway On BMC
1193    [Documentation]  Modify and verify IPv6 address of BMC.
1194    [Arguments]  ${ipv6_gw_addr}  ${new_static_def_gw}  ${prefix_length}
1195    ...  ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED}]
1196
1197    # Description of argument(s):
1198    # ipv6_gw_addr          IPv6 static default gateway address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
1199    # new_static_def_gw     New static default gateway address to be configured.
1200    # prefix_length         Prefix length value (Range 1 to 128).
1201    # valid_status_codes    Expected return code from patch operation
1202    #                       (e.g. "200", "204").
1203
1204    ${empty_dict}=  Create Dictionary
1205    ${patch_list}=  Create List
1206    # Prefix Length is passed as None.
1207    IF   '${prefix_length_def}' == '${None}'
1208        ${modified_ipv6_gw_addripv6_data}=  Create Dictionary  Address=${new_static_def_gw}
1209    ELSE
1210        ${modified_ipv6_gw_addripv6_data}=  Create Dictionary  Address=${new_static_def_gw}  Prefix Length=${prefix_length_def}
1211    END
1212
1213    @{ipv6_static_def_gw_list}=  Get IPv6 Static Default Gateway
1214
1215    FOR  ${ipv6_static_def_gw}  IN  @{ipv6_static_def_gw_list}
1216      IF  '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}'
1217          Append To List  ${patch_list}  ${modified_ipv6_gw_addripv6_data}
1218      ELSE
1219          Append To List  ${patch_list}  ${empty_dict}
1220      END
1221    END
1222
1223    # Modify the IPv6 address only if given IPv6 static default gateway is found.
1224    ${ip_static_def_gw_found}=  Run Keyword And Return Status  List Should Contain Value
1225    ...  ${patch_list}  ${modified_ipv6_gw_addripv6_data}  msg=${ipv6_gw_addr} does not exist on BMC
1226    Pass Execution If  ${ip_static_def_gw_found} == ${False}  ${ipv6_gw_addr} does not exist on BMC
1227
1228    ${data}=  Create Dictionary  IPv6StaticDefaultGateways=${patch_list}
1229
1230    Redfish.Patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1231    ...  body=&{data}  valid_status_codes=${valid_status_codes}
1232
1233    ${ipv6_staticdef_gateway}=  Get IPv6 Static Default Gateway
1234
1235    ${ipv6_static_def_gw_list}=  Create List
1236    FOR  ${ipv6_staticdef_gateway}  IN  @{ipv6_staticdef_gateway}
1237        ${value}=  Get From Dictionary  ${ipv6_staticdef_gateway}  Address
1238        Append To List  ${ipv6_static_def_gw_list}  ${value}
1239    END
1240
1241    Should Contain  ${ipv6_static_def_gw_list}  ${new_static_def_gw}
1242    # Verify if old static default gateway address is erased.
1243    Should Not Contain  ${ipv6_static_def_gw_list}  ${ipv6_gw_addr}
1244
1245
1246Delete IPv6 Static Default Gateway
1247    [Documentation]  Delete IPv6 static default gateway on BMC.
1248    [Arguments]  ${ipv6_gw_addr}
1249    ...          ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
1250
1251    # Description of argument(s):
1252    # ipv6_gw_addr          IPv6 Static Default Gateway address to be deleted.
1253    # valid_status_codes    Expected return code from patch operation
1254    #                       (e.g. "200").
1255
1256    ${patch_list}=  Create List
1257    ${empty_dict}=  Create Dictionary
1258
1259    ${ipv6_static_def_gw_list}=  Create List
1260    @{ipv6_static_defgw_configurations}=  Get IPv6 Static Default Gateway
1261
1262    FOR  ${ipv6_staticdef_gateway}  IN  @{ipv6_static_defgw_configurations}
1263        ${value}=  Get From Dictionary  ${ipv6_staticdef_gateway}  Address
1264        Append To List  ${ipv6_static_def_gw_list}  ${value}
1265    END
1266
1267    ${defgw_found}=  Run Keyword And Return Status  List Should Contain Value
1268    ...  ${ipv6_static_def_gw_list}  ${ipv6_gw_addr}  msg=${ipv6_gw_addr} does not exist on BMC
1269    Skip If  ${defgw_found} == ${False}  ${ipv6_gw_addr} does not exist on BMC
1270
1271    FOR  ${ipv6_static_def_gw}  IN  @{ipv6_static_defgw_configurations}
1272        IF  '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}'
1273            Append To List  ${patch_list}  ${null}
1274        ELSE
1275            Append To List  ${patch_list}  ${empty_dict}
1276      END
1277    END
1278
1279    # Run patch command only if given IP is found on BMC.
1280    ${data}=  Create Dictionary  IPv6StaticDefaultGateways=${patch_list}
1281
1282    Redfish.Patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}  body=&{data}
1283    ...  valid_status_codes=${valid_status_codes}
1284
1285    ${data}=  Create Dictionary  IPv6StaticDefaultGateways=${patch_list}
1286
1287    @{ipv6_static_defgw_configurations}=  Get IPv6 Static Default Gateway
1288    Should Not Contain Match  ${ipv6_static_defgw_configurations}  ${ipv6_gw_addr}
1289    ...  msg=IPv6 Static default gateway does not exist.
1290
1291
1292Check Coexistence Of Linklocalv6 And Static IPv6
1293    [Documentation]  Verify both linklocalv6 and static IPv6 exist.
1294
1295    # Verify the address origin contains static and linklocal.
1296    @{ipv6_addressorigin_list}  ${ipv6_linklocal_addr}=  Get Address Origin List And Address For Type  LinkLocal
1297
1298    Should Match Regexp  ${ipv6_linklocal_addr}        ${linklocal_addr_format}
1299    Should Contain       ${ipv6_addressorigin_list}    Static
1300
1301
1302Check Coexistence Of Static IPv6 And SLAAC
1303    [Documentation]  Verify both static IPv6 and SLAAC coexist.
1304
1305    # Verify the address origin contains static and slaac.
1306    @{ipv6_addressorigin_list}  ${ipv6_static_addr}=
1307    ...    Get Address Origin List And Address For Type  Static
1308
1309    @{ipv6_addressorigin_list}  ${ipv6_slaac_addr}=
1310    ...    Get Address Origin List And Address For Type  SLAAC
1311
1312
1313Check Coexistence Of Link Local And SLAAC
1314    [Documentation]  Verify both link local and SLAAC coexist.
1315
1316    # Verify the address origin contains SLAAC and link local.
1317    @{ipv6_addressorigin_list}  ${ipv6_link_local_addr}=
1318    ...    Get Address Origin List And Address For Type  LinkLocal
1319
1320    @{ipv6_addressorigin_list}  ${ipv6_slaac_addr}=
1321    ...    Get Address Origin List And Address For Type  SLAAC
1322
1323    Should Match Regexp    ${ipv6_link_local_addr}    ${linklocal_addr_format}
1324
1325
1326Check Coexistence Of Link Local And DHCPv6
1327    [Documentation]  Verify both link local and dhcpv6 coexist.
1328
1329    # Verify the address origin contains dhcpv6 and link local.
1330    @{ipv6_address_origin_list}  ${ipv6_link_local_addr}=
1331    ...    Get Address Origin List And Address For Type  LinkLocal
1332
1333    @{ipv6_address_origin_list}  ${ipv6_dhcpv6_addr}=
1334    ...    Get Address Origin List And Address For Type  DHCPv6
1335
1336    Should Match Regexp    ${ipv6_link_local_addr}    ${linklocal_addr_format}
1337
1338
1339Check If Linklocal Address Is In Correct Format
1340    [Documentation]  Linklocal address has network part fe80 and host part EUI64.
1341
1342    # Fetch the linklocal address.
1343    @{ipv6_addressorigin_list}  ${ipv6_linklocal_addr}=  Get Address Origin List And Address For Type  LinkLocal
1344
1345    # Follow EUI64 from MAC.
1346    ${system_mac}=  Get BMC MAC Address
1347    ${split_octets}=  Split String  ${system_mac}  :
1348    ${first_octet}=  Evaluate  int('${split_octets[0]}', 16)
1349    ${flipped_hex}=  Evaluate  format(${first_octet} ^ 2, '02x')
1350    ${grp1}=  Evaluate  re.sub(r'^0+', '', '${flipped_hex}${split_octets[1]}')  modules=re
1351    ${grp2}=  Evaluate  re.sub(r'^0+', '', '${split_octets[2]}ff')  modules=re
1352    ${grp3}=  Evaluate  re.sub(r'^0+', '', '${split_octets[4]}${split_octets[5]}')  modules=re
1353    ${linklocal}=  Set Variable  fe80::${grp1}:${grp2}:fe${split_octets[3]}:${grp3}
1354
1355    # Verify the linklocal obtained is the same as on the machine.
1356    Should Be Equal  ${linklocal}  ${ipv6_linklocal_addr}
1357
1358
1359Check BMC Gets SLAAC Address
1360    [Documentation]  Check BMC gets slaac address.
1361
1362    @{ipv6_addressorigin_list}  ${ipv6_slaac_addr}=  Get Address Origin List And Address For Type  SLAAC
1363
1364
1365Get The Initial DHCPv6 Setting On Each Interface
1366    [Documentation]  Get the initial DHCPv6 setting of each interface.
1367    [Arguments]  ${channel_number}
1368
1369    # Description of the argument(s):
1370    # channel_number    Channel number 1 or 2.
1371
1372    ${ethernet_interface}=  Set Variable  ${active_channel_config['${channel_number}']['name']}
1373    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1374    ${initial_dhcpv6_iface}=  Get From Dictionary  ${resp.dict}  DHCPv6
1375    IF  ${channel_number}==${1}
1376        Set Test Variable  ${dhcpv6_channel_1}  ${initial_dhcpv6_iface['OperatingMode']}
1377    ELSE
1378        Set Test Variable  ${dhcpv6_channel_2}  ${initial_dhcpv6_iface['OperatingMode']}
1379    END
1380
1381
1382Get The Initial DHCPv6 Settings
1383    [Documentation]  Get the initial DHCPv6 settings of both the interfaces.
1384
1385    Get The Initial DHCPv6 Setting On Each Interface  ${1}
1386    Get The Initial DHCPv6 Setting On Each Interface  ${2}
1387
1388
1389Get The Initial SLAAC Settings
1390    [Documentation]  Get the initial SLAAC settings of both the interfaces.
1391
1392    Get The Initial SLAAC Setting On Each Interface   ${1}
1393    Get The Initial SLAAC Setting On Each Interface   ${2}
1394
1395
1396Get The Initial SLAAC Setting On Each Interface
1397    [Documentation]  Get the initial SLAAC setting of the interface.
1398    [Arguments]  ${channel_number}
1399
1400    # Description of the argument(s):
1401    # channel_number     Channel number 1 or 2.
1402
1403    ${ethernet_interface}=  Set Variable  ${active_channel_config['${channel_number}']['name']}
1404    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1405    ${initial_slaac_iface}=  Get From Dictionary  ${resp.dict}  StatelessAddressAutoConfig
1406    IF  ${channel_number}==${1}
1407        Set Test Variable  ${slaac_channel_1}  ${initial_slaac_iface['IPv6AutoConfigEnabled']}
1408    ELSE
1409        Set Test Variable  ${slaac_channel_2}  ${initial_slaac_iface['IPv6AutoConfigEnabled']}
1410    END
1411
1412
1413Verify All The Addresses Are Intact
1414    [Documentation]  Verify all the addresses and address origins remain intact.
1415    [Arguments]    ${channel_number}=${CHANNEL_NUMBER}
1416    ...  ${initial_ipv4_addressorigin_list}=${initial_ipv4_addressorigin_list}
1417    ...  ${initial_ipv4_addr_list}=${initial_ipv4_addr_list}
1418
1419    # Description of argument(s):
1420    # channel_number                   Channel number 1(eth0) or 2(eth1).
1421    # initial_ipv4_addressorigin_list  Initial IPv4 address origin list.
1422    # initial_ipv4_addr_list           Initial IPv4 address list.
1423
1424    # Verify that it will not impact the IPv4 configuration.
1425    Sleep  ${NETWORK_TIMEOUT}
1426    Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT}
1427
1428    # IPv6 Linklocal address must be present.
1429    @{ipv6_addressorigin_list}  ${ipv6_linklocal_addr}=
1430    ...  Get Address Origin List And Address For Type  LinkLocal  ${channel_number}
1431
1432    # IPv4 addresses must remain intact.
1433    ${ipv4_addressorigin_list}  ${ipv4_addr_list}=
1434    ...  Get Address Origin List And IPv4 or IPv6 Address  IPv4Addresses  ${channel_number}
1435
1436    Should be Equal  ${initial_ipv4_addressorigin_list}  ${ipv4_addressorigin_list}
1437    Should be Equal  ${initial_ipv4_addr_list}  ${ipv4_addr_list}
1438
1439
1440Get Interface ID Of IPv6
1441    [Documentation]  Get interface id of IPv6 address.
1442    [Arguments]    ${ipv6_address}
1443
1444    # Description of the argument(s):
1445    # ${ipv6_address}  IPv6 Address to extract the last 4 hextets.
1446
1447    # Last 64 bits of SLAAC and Linklocal must be the same.
1448    # Sample IPv6 network configurations.
1449    #"IPv6AddressPolicyTable": [],
1450    #  "IPv6Addresses": [
1451    #    {
1452    #      "Address": "fe80::xxxx:xxxx:xxxx:xxxx",
1453    #      "AddressOrigin": "LinkLocal",
1454    #      "AddressState": null,
1455    #      "PrefixLength": xx
1456    #    }
1457    #  ],
1458    #    {
1459    #      "Address": "2002:xxxx:xxxx:xxxx:xxxx",
1460    #      "AddressOrigin": "SLAAC",
1461    #      "PrefixLength": 64
1462    #    }
1463    #  ],
1464
1465    ${split_ip_address}=  Split String  ${ipv6_address}  :
1466    ${missing_ip}=  Evaluate  8 - len(${split_ip_address}) + 1
1467    ${expanded_ip}=  Create List
1468
1469    FOR  ${hextet}  IN  @{split_ip_address}
1470       IF  '${hextet}' == ''
1471           FOR  ${i}  IN RANGE  ${missing_ip}
1472               Append To List  ${expanded_ip}  0000
1473           END
1474       ELSE
1475           Append To List  ${expanded_ip}  ${hextet}
1476       END
1477    END
1478    ${interface_id}=  Evaluate  ':'.join(${expanded_ip}[-4:])
1479    RETURN  ${interface_id}
1480
1481
1482Set And Verify SLAAC Property On Both Interfaces
1483    [Documentation]  Set and verify SLAAC property on both interfaces.
1484    [Arguments]  ${slaac_value_1}  ${slaac_value_2}
1485
1486    # Description of the argument(s):
1487    # slaac_value_1  SLAAC value for channel 1.
1488    # slaac_value_2  SLAAC value for channel 2.
1489
1490    Set SLAAC Configuration State And Verify  ${slaac_value_1}  [${HTTP_OK}]  ${1}
1491    Set SLAAC Configuration State And Verify  ${slaac_value_2}  [${HTTP_OK}]  ${2}
1492
1493    Sleep  30s
1494
1495    # Check SLAAC Settings for eth0.
1496    @{ipv6_addressorigin_list}  ${ipv6_slaac_addr}=
1497    ...  Get Address Origin List And IPv4 or IPv6 Address  IPv6Addresses  ${1}
1498    IF  "${slaac_value_1}" == "${True}"
1499         Should Not Be Empty  ${ipv6_slaac_addr}  SLAAC
1500    ELSE
1501        Should Not Contain  ${ipv6_addressorigin_list}  SLAAC
1502    END
1503
1504    # Check SLAAC Settings for eth1.
1505    @{ipv6_addressorigin_list}  ${ipv6_slaac_addr}=
1506    ...  Get Address Origin List And IPv4 or IPv6 Address  IPv6Addresses  ${2}
1507    IF  "${slaac_value_2}" == "${True}"
1508         Should Not Be Empty  ${ipv6_slaac_addr}  SLAAC
1509    ELSE
1510        Should Not Contain  ${ipv6_addressorigin_list}  SLAAC
1511    END
1512
1513    Verify All The Addresses Are Intact  ${1}
1514    Verify All The Addresses Are Intact  ${2}
1515    ...    ${eth1_initial_ipv4_addressorigin_list}  ${eth1_initial_ipv4_addr_list}
1516
1517
1518Set And Verify DHCPv6 Property On Both Interfaces
1519    [Documentation]  Set and verify DHCPv6 property on both interfaces.
1520    [Arguments]  ${dhcpv6_value_1}  ${dhcpv6_value_2}
1521
1522    # Description of the argument(s):
1523    # dhcpv6_value_1  DHCPv6 value for channel 1.
1524    # dhcpv6_value_2  DHCPv6 value for channel 2.
1525
1526    Set And Verify DHCPv6 Property  ${dhcpv6_value_1}  ${1}
1527    Set And Verify DHCPv6 Property  ${dhcpv6_value_2}  ${2}
1528
1529    Verify All The Addresses Are Intact  ${1}
1530    Verify All The Addresses Are Intact  ${2}
1531    ...    ${eth1_initial_ipv4_addressorigin_list}  ${eth1_initial_ipv4_addr_list}
1532
1533
1534Verify IPv6 Addresses Coexist
1535    [Documentation]  Verify IPv6 address type coexist.
1536    [Arguments]   ${ipv6_address_type1}  ${ipv6_address_type2}
1537
1538    # Description of the argument(s):
1539    # ipv6_address_type1  IPv6 address type.
1540    # ipv6_address_type2  IPv6 address type.
1541    # Valid IPv6 address type (Static, DHCPv6, SLAAC).
1542
1543    IF  '${ipv6_address_type1}' == 'Static' and '${ipv6_address_type2}' == 'DHCPv6'
1544        Configure IPv6 Address On BMC  ${test_ipv6_addr}  ${test_prefix_length}
1545        Set And Verify DHCPv6 Property  Enabled
1546    ELSE IF  '${ipv6_address_type1}' == 'DHCPv6' and '${ipv6_address_type2}' == 'SLAAC'
1547        Set And Verify DHCPv6 Property  Enabled
1548        Set SLAAC Configuration State And Verify  ${True}
1549    ELSE IF  '${ipv6_address_type1}' == 'SLAAC' and '${ipv6_address_type2}' == 'Static'
1550        Configure IPv6 Address On BMC  ${test_ipv6_addr}  ${test_prefix_length}
1551        Set SLAAC Configuration State And Verify  ${True}
1552    ELSE IF  '${ipv6_address_type1}' == 'Static' and '${ipv6_address_type2}' == 'Static'
1553        Configure IPv6 Address On BMC  ${test_ipv6_addr}  ${test_prefix_length}
1554        Configure IPv6 Address On BMC  ${test_ipv6_addr1}  ${test_prefix_length}
1555    END
1556
1557    Sleep  ${NETWORK_TIMEOUT}s
1558
1559    # Verify coexistence.
1560    Verify The Coexistence Of The Address Type  ${ipv6_address_type1}  ${ipv6_address_type2}
1561
1562    IF  '${ipv6_address_type1}' == 'Static' or '${ipv6_address_type2}' == 'Static'
1563        Delete IPv6 Address  ${test_ipv6_addr}
1564    END
1565    IF  '${ipv6_address_type1}' == 'Static' and '${ipv6_address_type2}' == 'Static'
1566        Delete IPv6 Address  ${test_ipv6_addr1}
1567    END
1568
1569    Set And Verify DHCPv6 Property  Disabled
1570    Set SLAAC Configuration State And Verify  ${False}
1571
1572
1573Verify DHCPv4 Functionality On Eth1
1574    [Documentation]  Verify DHCPv4 functions are present as expected on eth1.
1575
1576    # Verify eth1 DHCPv4 is enabled.
1577    ${DHCPEnabled}=  Get IPv4 DHCP Enabled Status  ${2}
1578    Should Be Equal  ${DHCPEnabled}  ${True}
1579
1580    # Verify presence of DHCPv4 address origin.
1581    @{ipv4_addressorigin_list}  ${ipv4_addr_list}=
1582    ...  Get Address Origin List And IPv4 or IPv6 Address  IPv4Addresses  ${2}
1583    ${ipv4_addressorigin_list}=  Combine Lists  @{ipv4_addressorigin_list}
1584    Should Contain  ${ipv4_addressorigin_list}  DHCP
1585
1586    # Verify static is not present in address origin when DHPCv4 enabled.
1587    List Should Not Contain Value  ${ipv4_addressorigin_list}  Static
1588
1589
1590Verify Static IPv4 Functionality
1591    [Documentation]  Verify static IPv4 functionality.
1592    [Arguments]    ${channel_number}=${CHANNEL_NUMBER}
1593
1594    # Description of argument(s):
1595    # channel_number             Channel number 1(eth0) or 2(eth1).
1596
1597    # Verify presence of Static IPv4 address origin.
1598    @{ipv4_addressorigin_list}  ${ipv4_addr_list}=
1599    ...  Get Address Origin List And IPv4 or IPv6 Address  IPv4Addresses  ${channel_number}
1600    ${ipv4_addressorigin_list}=  Combine Lists  @{ipv4_addressorigin_list}
1601    Should Contain  ${ipv4_addressorigin_list}  Static
1602
1603    # Verify dhcpv4 is not present in address origin when static IPv4 enabled.
1604    List Should Not Contain Value  ${ipv4_addressorigin_list}  DHCP
1605
1606    # Verify Static IPv4 address is pingable.
1607    FOR  ${ip}  IN  @{ipv4_addr_list}
1608        Wait For Host To Ping  ${ip}  ${NETWORK_TIMEOUT}
1609    END
1610