xref: /openbmc/openbmc-test-automation/redfish/managers/test_bmc_ipv6.robot (revision e05a8ddffc52fd07c06090ba8cba5f89d7e59bf5)
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
482*** Keywords ***
483
484Suite Setup Execution
485    [Documentation]  Do suite setup execution.
486
487    Redfish.Login
488    ${active_channel_config}=  Get Active Channel Config
489    Set Suite Variable  ${active_channel_config}
490
491    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
492
493    Set Suite variable  ${ethernet_interface}
494
495    # Get initial IPv4 and IPv6 addresses and address origins for eth0.
496    ${initial_ipv4_addressorigin_list}  ${initial_ipv4_addr_list}=  Get Address Origin List And IPv4 or IPv6 Address  IPv4Addresses
497    ${initial_ipv6_addressorigin_list}  ${initial_ipv6_addr_list}=  Get Address Origin List And IPv4 or IPv6 Address  IPv6Addresses
498
499    Set Suite Variable   ${initial_ipv4_addressorigin_list}
500    Set Suite Variable   ${initial_ipv4_addr_list}
501    Set Suite Variable   ${initial_ipv6_addressorigin_list}
502    Set Suite Variable   ${initial_ipv6_addr_list}
503
504    # Get initial IPv4 and IPv6 addresses and address origins for eth1.
505    ${eth1_initial_ipv4_addressorigin_list}  ${eth1_initial_ipv4_addr_list}=
506    ...  Get Address Origin List And IPv4 or IPv6 Address  IPv4Addresses  ${2}
507    ${eth1_initial_ipv6_addressorigin_list}  ${eth1_initial_ipv6_addr_list}=
508    ...  Get Address Origin List And IPv4 or IPv6 Address  IPv6Addresses  ${2}
509    Set Suite Variable   ${eth1_initial_ipv4_addressorigin_list}
510    Set Suite Variable   ${eth1_initial_ipv4_addr_list}
511    Set Suite Variable   ${eth1_initial_ipv6_addressorigin_list}
512    Set Suite Variable   ${eth1_initial_ipv6_addr_list}
513
514
515Test Setup Execution
516    [Documentation]  Test setup execution.
517
518    @{ipv6_network_configurations}=  Get IPv6 Network Configuration
519    Set Test Variable  @{ipv6_network_configurations}
520
521    # Get BMC IPv6 address and prefix length.
522    ${ipv6_data}=  Get BMC IPv6 Info
523    Set Test Variable  ${ipv6_data}
524
525
526Test Teardown Execution
527    [Documentation]  Test teardown execution.
528
529    FFDC On Test Case Fail
530
531
532Get IPv6 Network Configuration
533    [Documentation]  Get Ipv6 network configuration.
534    [Arguments]  ${channel_number}=${CHANNEL_NUMBER}
535
536    # Description of argument(s):
537    # channel_number  Channel number (1 - eth0 and 2 - eth1).
538
539    # Sample output:
540    # {
541    #  "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0",
542    #  "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface",
543    #   "DHCPv4": {
544    #    "DHCPEnabled": false,
545    #    "UseDNSServers": false,
546    #    "UseDomainName": true,
547    #    "UseNTPServers": false
548    #  },
549    #  "DHCPv6": {
550    #    "OperatingMode": "Disabled",
551    #    "UseDNSServers": false,
552    #    "UseDomainName": true,
553    #    "UseNTPServers": false
554    #  },
555    #  "Description": "Management Network Interface",
556    #  "FQDN": "localhost",
557    #  "HostName": "localhost",
558    #  "IPv4Addresses": [
559    #    {
560    #      "Address": "xx.xx.xx.xx",
561    #      "AddressOrigin": "Static",
562    #      "Gateway": "xx.xx.xx.1",
563    #      "SubnetMask": "xx.xx.xx.0"
564    #    },
565    #    {
566    #      "Address": "169.254.xx.xx",
567    #      "AddressOrigin": "IPv4LinkLocal",
568    #      "Gateway": "0.0.0.0",
569    #      "SubnetMask": "xx.xx.0.0"
570    #    },
571    #  ],
572    #  "IPv4StaticAddresses": [
573    #    {
574    #      "Address": "xx.xx.xx.xx",
575    #      "AddressOrigin": "Static",
576    #      "Gateway": "xx.xx.xx.1",
577    #      "SubnetMask": "xx.xx.0.0"
578    #    }
579    # }
580    #  ],
581    #  "IPv6AddressPolicyTable": [],
582    #  "IPv6Addresses": [
583    #    {
584    #      "Address": "fe80::xxxx:xxxx:xxxx:xxxx",
585    #      "AddressOrigin": "LinkLocal",
586    #      "AddressState": null,
587    #      "PrefixLength": xx
588    #    }
589    #  ],
590    #  "IPv6DefaultGateway": "",
591    #  "IPv6StaticAddresses": [
592    #    { "Address": "xxxx:xxxx:xxxx:xxxx::xxxx",
593    #      "AddressOrigin": "Static",
594    #      "AddressState": null,
595    #      "PrefixLength": xxx
596    #    }
597    #  ],
598    #  "Id": "eth0",
599    #  "InterfaceEnabled": true,
600    #  "LinkStatus": "LinkUp",
601    #  "MACAddress": "xx:xx:xx:xx:xx:xx",
602    #  "Name": "Manager Ethernet Interface",
603    #  "NameServers": [],
604    #  "SpeedMbps": 0,
605    #  "StaticNameServers": [],
606    #  "Status": {
607    #    "Health": "OK",
608    #    "HealthRollup": "OK",
609    #    "State": "Enabled"
610    #  },
611    #  "VLANs": {
612    #    "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0/VLANs"
613
614
615    ${active_channel_config}=  Get Active Channel Config
616    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']}
617
618    @{ipv6_network_configurations}=  Get From Dictionary  ${resp.dict}  IPv6StaticAddresses
619    RETURN  @{ipv6_network_configurations}
620
621
622Verify IPv6 And PrefixLength
623    [Documentation]  Verify IPv6 address and prefix length on BMC.
624    [Arguments]  ${ipv6_addr}  ${prefix_len}
625
626    # Description of the argument(s):
627    # ipv6_addr   IPv6 address to be verified.
628    # prefix_len  PrefixLength value to be verified.
629
630    # Catenate IPv6 address and its prefix length.
631    ${ipv6_with_prefix}=  Catenate  ${ipv6_addr}/${prefix_len}
632
633    # Get IPv6 address details on BMC using IP command.
634    @{ip_data}=  Get BMC IPv6 Info
635
636    # Verify if IPv6 and prefix length is configured on BMC.
637
638    Should Contain  ${ip_data}  ${ipv6_with_prefix}
639    ...  msg=IPv6 and prefix length pair does not exist.
640
641Configure IPv6 Address On BMC
642    [Documentation]  Add IPv6 Address on BMC.
643    [Arguments]  ${ipv6_addr1}  ${prefix_len}  ${ipv6_addr2}=${None}
644    ...  ${channel_number}=${CHANNEL_NUMBER}
645    ...  ${valid_status_codes}=[${HTTP_OK},${HTTP_NO_CONTENT}]
646
647    # Description of argument(s):
648    # ipv6_addr1          IPv6 address to be added (e.g. "2001:0022:0033::0111").
649    # ipv6_addr2          IPv6 address to be Verified (e.g. "2001:22:33::111").
650    # prefix_len          Prefix length for the IPv6 to be added
651    #                     (e.g. "64").
652    # channel_number      Channel number (1 - eth0 and 2 - eth1).
653    # valid_status_codes  Expected return code from patch operation
654    #                     (e.g. "200").
655
656    ${prefix_length}=  Convert To Integer  ${prefix_len}
657    ${empty_dict}=  Create Dictionary
658    ${ipv6_data}=  Create Dictionary  Address=${ipv6_addr1}
659    ...  PrefixLength=${prefix_length}
660
661    ${patch_list}=  Create List
662
663    # Get existing static IPv6 configurations on BMC.
664    ${ipv6_network_configurations}=  Get IPv6 Network Configuration  ${channel_number}
665    ${num_entries}=  Get Length  ${ipv6_network_configurations}
666
667    FOR  ${INDEX}  IN RANGE  0  ${num_entries}
668      Append To List  ${patch_list}  ${empty_dict}
669    END
670
671    # We need not check for existence of IPv6 on BMC while adding.
672    Append To List  ${patch_list}  ${ipv6_data}
673    ${data}=  Create Dictionary  IPv6StaticAddresses=${patch_list}
674
675    ${active_channel_config}=  Get Active Channel Config
676    ${ethernet_interface}=  Set Variable  ${active_channel_config['${channel_number}']['name']}
677
678    Redfish.patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}  body=&{data}
679    ...  valid_status_codes=${valid_status_codes}
680
681    IF  ${valid_status_codes} != [${HTTP_OK}, ${HTTP_NO_CONTENT}]
682        Fail  msg=Static address not added correctly
683    END
684
685    # Note: Network restart takes around 15-18s after patch request processing.
686    Sleep  ${NETWORK_TIMEOUT}s
687    Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT}
688
689    # Verify ip address on CLI.
690    IF  '${ipv6_addr2}' != '${None}'
691        Verify IPv6 And PrefixLength  ${ipv6_addr2}  ${prefix_len}
692    ELSE
693        Verify IPv6 And PrefixLength  ${ipv6_addr1}  ${prefix_len}
694    END
695
696    # Verify if existing static IPv6 addresses still exist.
697    FOR  ${ipv6_network_configuration}  IN  @{ipv6_network_configurations}
698      Verify IPv6 On BMC  ${ipv6_network_configuration['Address']}
699    END
700
701    #Verify redfish and CLI data matches.
702    Validate IPv6 Network Config On BMC
703
704
705Configure Multiple IPv6 Address on BMC
706    [Documentation]  Add multiple IPv6 address on BMC.
707    [Arguments]  ${prefix_len}
708    ...          ${valid_status_codes}=[${HTTP_OK},${HTTP_NO_CONTENT}]
709
710    # Description of argument(s):
711    # prefix_len          Prefix length for the IPv6 to be added
712    #                     (e.g. "64").
713    # valid_status_codes  Expected return code from patch operation
714    #                     (e.g. "200").
715
716    ${ipv6_list}=  Create List  ${test_ipv6_addr}  ${test_ipv6_addr1}
717    ${prefix_length}=  Convert To Integer  ${prefix_len}
718    ${empty_dict}=  Create Dictionary
719    ${patch_list}=  Create List
720
721    # Get existing static IPv6 configurations on BMC.
722    ${ipv6_network_configurations}=  Get IPv6 Network Configuration
723    ${num_entries}=  Get Length  ${ipv6_network_configurations}
724
725    FOR  ${INDEX}  IN RANGE  0  ${num_entries}
726      Append To List  ${patch_list}  ${empty_dict}
727    END
728
729    # We need not check for existence of IPv6 on BMC while adding.
730    FOR  ${ipv6_addr}  IN  @{ipv6_list}
731      ${ipv6_data}=  Create Dictionary  Address=${ipv6_addr}  PrefixLength=${prefix_length}
732      Append To List  ${patch_list}  ${ipv6_data}
733    END
734    ${data}=  Create Dictionary  IPv6StaticAddresses=${patch_list}
735
736    ${active_channel_config}=  Get Active Channel Config
737    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
738
739    Redfish.patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}  body=&{data}
740    ...  valid_status_codes=${valid_status_codes}
741
742    IF  ${valid_status_codes} != [${HTTP_OK}, ${HTTP_NO_CONTENT}]
743        Fail  msg=Static address not added correctly
744    END
745
746    # Note: Network restart takes around 15-18s after patch request processing.
747    Sleep  ${NETWORK_TIMEOUT}s
748    Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT}
749
750    # Verify newly added ip address on CLI.
751    FOR  ${ipv6_addr}  IN  @{ipv6_list}
752      Verify IPv6 And PrefixLength  ${ipv6_addr}  ${prefix_len}
753    END
754
755    # Verify if existing static IPv6 addresses still exist.
756    FOR  ${ipv6_network_configuration}  IN  @{ipv6_network_configurations}
757      Verify IPv6 On BMC  ${ipv6_network_configuration['Address']}
758    END
759
760    # Get the latest ipv6 network configurations.
761    @{ipv6_network_configurations}=  Get IPv6 Network Configuration
762
763    # Verify newly added ip address on BMC.
764    FOR  ${ipv6_network_configuration}  IN  @{ipv6_network_configurations}
765      Should Contain Match  ${ipv6_list}  ${ipv6_network_configuration['Address']}
766    END
767
768    Validate IPv6 Network Config On BMC
769
770
771Validate IPv6 Network Config On BMC
772    [Documentation]  Check that IPv6 network info obtained via redfish matches info
773    ...              obtained via CLI.
774
775    @{ipv6_network_configurations}=  Get IPv6 Network Configuration
776    ${ipv6_data}=  Get BMC IPv6 Info
777    FOR  ${ipv6_network_configuration}  IN  @{ipv6_network_configurations}
778      Should Contain Match  ${ipv6_data}  ${ipv6_network_configuration['Address']}/*
779      ...  msg=IPv6 address does not exist.
780    END
781
782
783Delete IPv6 Address
784    [Documentation]  Delete IPv6 address of BMC.
785    [Arguments]  ${ipv6_addr}
786    ...    ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
787    ...    ${channel_number}=${CHANNEL_NUMBER}
788
789    # Description of argument(s):
790    # ipv6_addr           IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234").
791    # channel_number     Channel number (1 - eth0 and 2 - eth1).
792    # valid_status_codes  Expected return code from patch operation
793    #                     (e.g. "200").  See prolog of rest_request
794    #                     method in redfish_plus.py for details.
795
796    ${empty_dict}=  Create Dictionary
797    ${patch_list}=  Create List
798
799    @{ipv6_network_configurations}=  Get IPv6 Network Configuration  ${channel_number}
800    FOR  ${ipv6_network_configuration}  IN  @{ipv6_network_configurations}
801        IF  '${ipv6_network_configuration['Address']}' == '${ipv6_addr}'
802            Append To List  ${patch_list}  ${null}
803        ELSE
804            Append To List  ${patch_list}  ${empty_dict}
805        END
806    END
807
808    ${ip_found}=  Run Keyword And Return Status  List Should Contain Value
809    ...  ${patch_list}  ${null}  msg=${ipv6_addr} does not exist on BMC
810    Pass Execution If  ${ip_found} == ${False}  ${ipv6_addr} does not exist on BMC
811
812    # Run patch command only if given IP is found on BMC
813    ${data}=  Create Dictionary  IPv6StaticAddresses=${patch_list}
814
815    ${active_channel_config}=  Get Active Channel Config
816    ${ethernet_interface}=  Set Variable  ${active_channel_config['${channel_number}']['name']}
817
818    Redfish.patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}  body=&{data}
819    ...  valid_status_codes=${valid_status_codes}
820
821    # Note: Network restart takes around 15-18s after patch request processing
822    Sleep  ${NETWORK_TIMEOUT}s
823    Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT}
824
825    # IPv6 address that is deleted should not be there on BMC.
826    ${delete_status}=  Run Keyword And Return Status  Verify IPv6 On BMC  ${ipv6_addr}
827    IF  '${valid_status_codes}' == '[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]'
828        Should Be True  '${delete_status}' == '${False}'
829    ELSE
830        Should Be True  '${delete_status}' == '${True}'
831    END
832
833    Validate IPv6 Network Config On BMC
834
835
836Modify IPv6 Address
837    [Documentation]  Modify and verify IPv6 address of BMC.
838    [Arguments]  ${ipv6}  ${new_ipv6}  ${prefix_len}
839    ...  ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
840
841    # Description of argument(s):
842    # ipv6                  IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
843    # new_ipv6              New IPv6 address to be configured.
844    # prefix_len            Prefix length value (Range 1 to 128).
845    # valid_status_codes    Expected return code from patch operation
846    #                       (e.g. "200", "201").
847
848    ${empty_dict}=  Create Dictionary
849    ${patch_list}=  Create List
850    ${prefix_length}=  Convert To Integer  ${prefix_len}
851    ${ipv6_data}=  Create Dictionary
852    ...  Address=${new_ipv6}  PrefixLength=${prefix_length}
853
854    # Sample IPv6 network configurations:
855    #  "IPv6AddressPolicyTable": [],
856    #  "IPv6Addresses": [
857    #    {
858    #      "Address": "X002:db8:0:2::XX0",
859    #      "AddressOrigin": "DHCPv6",
860    #      "PrefixLength": 128
861    #    },
862    #    {
863    #      "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX",
864    #      "AddressOrigin": "SLAAC",
865    #      "PrefixLength": 64
866    #    },
867    #    {
868    #      "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
869    #      "AddressOrigin": "Static",
870    #      "PrefixLength": 56
871    #    },
872    #    {
873    #      "Address": “Z002:db8:0:2:a94:efff:fe82:5000",
874    #      "AddressOrigin": "Static",
875    #      "PrefixLength": 56
876    #    },
877    #    {
878    #      "Address": “Xe80::a94:efff:YYYY:XXXX",
879    #      "AddressOrigin": "LinkLocal",
880    #      "PrefixLength": 64
881    #    },
882    #    {
883    #     "Address": “X002:db8:1:2:eff:233:fee:546",
884    #      "AddressOrigin": "Static",
885    #      "PrefixLength": 56
886    #    }
887    #  ],
888    #  "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”,
889    #  "IPv6StaticAddresses": [
890    #    {
891    #      "Address": “X002:db8:0:2:a94:efff:fe82:5000",
892    #      "PrefixLength": 56
893    #    },
894    #    {
895    #      "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
896    #      "PrefixLength": 56
897    #    },
898    #    {
899    #      "Address": “Z002:db8:1:2:eff:233:fee:546",
900    #      "PrefixLength": 56
901    #    }
902    #  ],
903    #  "IPv6StaticDefaultGateways": [],
904
905    # Find the position of IPv6 address to be modified.
906    @{ipv6_network_configurations}=  Get IPv6 Network Configuration
907    FOR  ${ipv6_network_configuration}  IN  @{ipv6_network_configurations}
908      IF  '${ipv6_network_configuration['Address']}' == '${ipv6}'
909          Append To List  ${patch_list}  ${ipv6_data}
910      ELSE
911          Append To List  ${patch_list}  ${empty_dict}
912      END
913    END
914
915    # Modify the IPv6 address only if given IPv6 is found
916    ${ip_found}=  Run Keyword And Return Status  List Should Contain Value
917    ...  ${patch_list}  ${ipv6_data}  msg=${ipv6} does not exist on BMC
918    Pass Execution If  ${ip_found} == ${False}  ${ipv6} does not exist on BMC
919
920    ${data}=  Create Dictionary  IPv6StaticAddresses=${patch_list}
921
922    ${active_channel_config}=  Get Active Channel Config
923    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
924
925    Redfish.patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
926    ...  body=&{data}  valid_status_codes=${valid_status_codes}
927
928    # Note: Network restart takes around 15-18s after patch request processing.
929    Sleep  ${NETWORK_TIMEOUT}s
930    Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT}
931
932    # Verify if new IPv6 address is configured on BMC.
933    Verify IPv6 On BMC  ${new_ipv6}
934
935    # Verify if old IPv6 address is erased.
936    ${cmd_status}=  Run Keyword And Return Status
937    ...  Verify IPv6 On BMC  ${ipv6}
938    Should Be Equal  ${cmd_status}  ${False}  msg=Old IPv6 address is not deleted.
939
940    Validate IPv6 Network Config On BMC
941
942
943Set SLAAC Configuration State And Verify
944    [Documentation]  Set SLAAC configuration state.
945    [Arguments]  ${slaac_state}  ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
946    ...  ${channel_number}=${CHANNEL_NUMBER}  ${is_slaac_verify_state}=${True}
947
948    # Description of argument(s):
949    # slaac_state             SLAAC state('True' or 'False').
950    # valid_status_code       Expected valid status codes.
951    # channel_number          Channel number 1(eth0) or 2(eth1).
952    # is_slaac_verify_state   Flag to check verification is required.
953
954    ${active_channel_config}=  Get Active Channel Config
955    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
956
957    ${data}=  Set Variable If  ${slaac_state} == ${False}  ${DISABLE_SLAAC}  ${ENABLE_SLAAC}
958    ${resp}=  Redfish.Patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
959    ...  body=${data}  valid_status_codes=${valid_status_codes}
960    IF  ${is_slaac_verify_state}
961        Verify SLAAC Property  ${slaac_state}  ${channel_number}
962    END
963
964
965Verify SLAAC Property
966    [Documentation]  Verify SLAAC property.
967    [Arguments]  ${slaac_state}  ${channel_number}=${CHANNEL_NUMBER}
968
969    # Description of argument(s):
970    # slaac_state     SLAAC state('True' or 'False').
971    # channel_number  Channel number 1(eth0) or 2(eth1).
972
973    # Verify SLAAC is set correctly.
974    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
975    ${slaac_verify}=  Get From Dictionary  ${resp.dict}  StatelessAddressAutoConfig
976
977    IF  '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}'
978        Fail  msg=SLAAC not set properly.
979    END
980
981
982Set And Verify DHCPv6 Property
983    [Documentation]  Set DHCPv6 property and verify.
984    [Arguments]  ${dhcpv6_operating_mode}=${Disabled}  ${channel_number}=${CHANNEL_NUMBER}
985
986    # Description of argument(s):
987    # dhcpv6_operating_mode    Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled').
988    # channel_number           Channel number 1 or 2.
989
990    Set DHCPv6 Property  ${dhcpv6_operating_mode}  ${channel_number}
991    Verify DHCPv6 Property  ${dhcpv6_operating_mode}  ${channel_number}
992
993
994Set DHCPv6 Property
995    [Documentation]  Set DHCPv6 attribute is enables or disabled.
996    [Arguments]  ${dhcpv6_operating_mode}=${Disabled}  ${channel_number}=${CHANNEL_NUMBER}
997
998    # Description of argument(s):
999    # dhcpv6_operating_mode    Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled').
1000    # channel_number           Channel number 1 or 2.
1001
1002    ${data}=  Set Variable If  '${dhcpv6_operating_mode}' == 'Disabled'  ${DISABLE_DHCPv6}  ${ENABLE_DHCPv6}
1003    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
1004
1005    Redfish.Patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1006    ...  body=${data}  valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}]
1007
1008
1009Verify DHCPv6 Property
1010    [Documentation]  Verify DHCPv6 settings is enabled or disabled.
1011    [Arguments]  ${dhcpv6_operating_mode}  ${channel_number}=${CHANNEL_NUMBER}
1012
1013    # Description of Argument(s):
1014    # dhcpv6_operating_mode  Enable/ Disable DHCPv6.
1015    # channel_number         Channel number 1 or 2.
1016
1017    ${ethernet_interface}=  Set Variable  ${active_channel_config['${channel_number}']['name']}
1018
1019    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1020    ${dhcpv6_verify}=  Get From Dictionary  ${resp.dict}  DHCPv6
1021
1022    Should Be Equal  '${dhcpv6_verify['OperatingMode']}'  '${dhcpv6_operating_mode}'
1023
1024    Sleep  30s
1025
1026    @{ipv6_addressorigin_list}  ${ipv6_dhcpv6_addr}=
1027    ...  Get Address Origin List And IPv4 or IPv6 Address  IPv6Addresses  ${channel_number}
1028
1029    IF  "${dhcpv6_operating_mode}" == "Enabled"
1030        @{ipv6_addressorigin_list}  ${ipv6_dhcpv6_addr}=
1031        ...  Get Address Origin List And Address For Type  DHCPv6  ${channel_number}
1032        Should Not Be Empty  ${ipv6_dhcpv6_addr}  msg=DHCPv6 must be present.
1033    ELSE
1034        Should Not Contain  ${ipv6_addressorigin_list}  DHCPv6
1035    END
1036
1037
1038
1039Get IPv6 Static Default Gateway
1040    [Documentation]  Get IPv6 static default gateway.
1041
1042    ${active_channel_config}=  Get Active Channel Config
1043    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
1044
1045    @{ipv6_static_defgw_configurations}=  Get From Dictionary  ${resp.dict}  IPv6StaticDefaultGateways
1046    RETURN  @{ipv6_static_defgw_configurations}
1047
1048
1049Configure IPv6 Static Default Gateway On BMC
1050    [Documentation]  Configure IPv6 static default gateway on BMC.
1051    [Arguments]  ${ipv6_gw_addr}  ${prefix_length_def}
1052    ...  ${valid_status_codes}=${HTTP_OK}
1053
1054    # Description of argument(s):
1055    # ipv6_gw_addr          IPv6 Static Default Gateway address to be configured.
1056    # prefix_len_def        Prefix length value (Range 1 to 128).
1057    # valid_status_codes    Expected return code from patch operation
1058    #                       (e.g. "200", "204".)
1059
1060    # Prefix Length is passed as None.
1061    IF   '${prefix_length_def}' == '${None}'
1062        ${ipv6_gw}=  Create Dictionary  Address=${ipv6_gw_addr}
1063    ELSE
1064        ${ipv6_gw}=  Create Dictionary  Address=${ipv6_gw_addr}  Prefix Length=${prefix_length_def}
1065    END
1066
1067    ${ipv6_static_def_gw}=  Get IPv6 Static Default Gateway
1068
1069    ${num_entries}=  Get Length  ${ipv6_static_def_gw}
1070
1071    ${patch_list}=  Create List
1072    ${empty_dict}=  Create Dictionary
1073
1074    FOR  ${INDEX}  IN RANGE  0  ${num_entries}
1075      Append To List  ${patch_list}  ${empty_dict}
1076    END
1077
1078    ${valid_status_codes}=  Set Variable If  '${valid_status_codes}' == '${HTTP_OK}'
1079    ...  ${HTTP_OK},${HTTP_NO_CONTENT}
1080    ...  ${valid_status_codes}
1081
1082    Append To List  ${patch_list}  ${ipv6_gw}
1083    ${data}=  Create Dictionary  IPv6StaticDefaultGateways=${patch_list}
1084
1085    Redfish.Patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1086    ...  body=${data}  valid_status_codes=[${valid_status_codes}]
1087
1088    # Verify the added static default gateway is present in Redfish Get Output.
1089    ${ipv6_staticdef_gateway}=  Get IPv6 Static Default Gateway
1090
1091    ${ipv6_static_def_gw_list}=  Create List
1092    FOR  ${ipv6_staticdef_gateway}  IN  @{ipv6_staticdef_gateway}
1093        ${value}=    Get From Dictionary    ${ipv6_staticdef_gateway}    Address
1094        Append To List  ${ipv6_static_def_gw_list}  ${value}
1095    END
1096
1097    IF  '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}'
1098        Should Not Contain  ${ipv6_static_def_gw_list}  ${ipv6_gw_addr}
1099    ELSE
1100        Should Contain  ${ipv6_static_def_gw_list}  ${ipv6_gw_addr}
1101    END
1102
1103
1104Modify IPv6 Static Default Gateway On BMC
1105    [Documentation]  Modify and verify IPv6 address of BMC.
1106    [Arguments]  ${ipv6_gw_addr}  ${new_static_def_gw}  ${prefix_length}
1107    ...  ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED}]
1108
1109    # Description of argument(s):
1110    # ipv6_gw_addr          IPv6 static default gateway address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
1111    # new_static_def_gw     New static default gateway address to be configured.
1112    # prefix_length         Prefix length value (Range 1 to 128).
1113    # valid_status_codes    Expected return code from patch operation
1114    #                       (e.g. "200", "204").
1115
1116    ${empty_dict}=  Create Dictionary
1117    ${patch_list}=  Create List
1118    # Prefix Length is passed as None.
1119    IF   '${prefix_length_def}' == '${None}'
1120        ${modified_ipv6_gw_addripv6_data}=  Create Dictionary  Address=${new_static_def_gw}
1121    ELSE
1122        ${modified_ipv6_gw_addripv6_data}=  Create Dictionary  Address=${new_static_def_gw}  Prefix Length=${prefix_length_def}
1123    END
1124
1125    @{ipv6_static_def_gw_list}=  Get IPv6 Static Default Gateway
1126
1127    FOR  ${ipv6_static_def_gw}  IN  @{ipv6_static_def_gw_list}
1128      IF  '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}'
1129          Append To List  ${patch_list}  ${modified_ipv6_gw_addripv6_data}
1130      ELSE
1131          Append To List  ${patch_list}  ${empty_dict}
1132      END
1133    END
1134
1135    # Modify the IPv6 address only if given IPv6 static default gateway is found.
1136    ${ip_static_def_gw_found}=  Run Keyword And Return Status  List Should Contain Value
1137    ...  ${patch_list}  ${modified_ipv6_gw_addripv6_data}  msg=${ipv6_gw_addr} does not exist on BMC
1138    Pass Execution If  ${ip_static_def_gw_found} == ${False}  ${ipv6_gw_addr} does not exist on BMC
1139
1140    ${data}=  Create Dictionary  IPv6StaticDefaultGateways=${patch_list}
1141
1142    Redfish.Patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1143    ...  body=&{data}  valid_status_codes=${valid_status_codes}
1144
1145    ${ipv6_staticdef_gateway}=  Get IPv6 Static Default Gateway
1146
1147    ${ipv6_static_def_gw_list}=  Create List
1148    FOR  ${ipv6_staticdef_gateway}  IN  @{ipv6_staticdef_gateway}
1149        ${value}=  Get From Dictionary  ${ipv6_staticdef_gateway}  Address
1150        Append To List  ${ipv6_static_def_gw_list}  ${value}
1151    END
1152
1153    Should Contain  ${ipv6_static_def_gw_list}  ${new_static_def_gw}
1154    # Verify if old static default gateway address is erased.
1155    Should Not Contain  ${ipv6_static_def_gw_list}  ${ipv6_gw_addr}
1156
1157
1158Delete IPv6 Static Default Gateway
1159    [Documentation]  Delete IPv6 static default gateway on BMC.
1160    [Arguments]  ${ipv6_gw_addr}
1161    ...          ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]
1162
1163    # Description of argument(s):
1164    # ipv6_gw_addr          IPv6 Static Default Gateway address to be deleted.
1165    # valid_status_codes    Expected return code from patch operation
1166    #                       (e.g. "200").
1167
1168    ${patch_list}=  Create List
1169    ${empty_dict}=  Create Dictionary
1170
1171    ${ipv6_static_def_gw_list}=  Create List
1172    @{ipv6_static_defgw_configurations}=  Get IPv6 Static Default Gateway
1173
1174    FOR  ${ipv6_staticdef_gateway}  IN  @{ipv6_static_defgw_configurations}
1175        ${value}=  Get From Dictionary  ${ipv6_staticdef_gateway}  Address
1176        Append To List  ${ipv6_static_def_gw_list}  ${value}
1177    END
1178
1179    ${defgw_found}=  Run Keyword And Return Status  List Should Contain Value
1180    ...  ${ipv6_static_def_gw_list}  ${ipv6_gw_addr}  msg=${ipv6_gw_addr} does not exist on BMC
1181    Skip If  ${defgw_found} == ${False}  ${ipv6_gw_addr} does not exist on BMC
1182
1183    FOR  ${ipv6_static_def_gw}  IN  @{ipv6_static_defgw_configurations}
1184        IF  '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}'
1185            Append To List  ${patch_list}  ${null}
1186        ELSE
1187            Append To List  ${patch_list}  ${empty_dict}
1188      END
1189    END
1190
1191    # Run patch command only if given IP is found on BMC.
1192    ${data}=  Create Dictionary  IPv6StaticDefaultGateways=${patch_list}
1193
1194    Redfish.Patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}  body=&{data}
1195    ...  valid_status_codes=${valid_status_codes}
1196
1197    ${data}=  Create Dictionary  IPv6StaticDefaultGateways=${patch_list}
1198
1199    @{ipv6_static_defgw_configurations}=  Get IPv6 Static Default Gateway
1200    Should Not Contain Match  ${ipv6_static_defgw_configurations}  ${ipv6_gw_addr}
1201    ...  msg=IPv6 Static default gateway does not exist.
1202
1203
1204Check Coexistence Of Linklocalv6 And Static IPv6
1205    [Documentation]  Verify both linklocalv6 and static IPv6 exist.
1206
1207    # Verify the address origin contains static and linklocal.
1208    @{ipv6_addressorigin_list}  ${ipv6_linklocal_addr}=  Get Address Origin List And Address For Type  LinkLocal
1209
1210    Should Match Regexp  ${ipv6_linklocal_addr}        ${linklocal_addr_format}
1211    Should Contain       ${ipv6_addressorigin_list}    Static
1212
1213
1214Check Coexistence Of Static IPv6 And SLAAC
1215    [Documentation]  Verify both static IPv6 and SLAAC coexist.
1216
1217    # Verify the address origin contains static and slaac.
1218    @{ipv6_addressorigin_list}  ${ipv6_static_addr}=
1219    ...    Get Address Origin List And Address For Type  Static
1220
1221    @{ipv6_addressorigin_list}  ${ipv6_slaac_addr}=
1222    ...    Get Address Origin List And Address For Type  SLAAC
1223
1224
1225Check Coexistence Of Link Local And SLAAC
1226    [Documentation]  Verify both link local and SLAAC coexist.
1227
1228    # Verify the address origin contains SLAAC and link local.
1229    @{ipv6_addressorigin_list}  ${ipv6_link_local_addr}=
1230    ...    Get Address Origin List And Address For Type  LinkLocal
1231
1232    @{ipv6_addressorigin_list}  ${ipv6_slaac_addr}=
1233    ...    Get Address Origin List And Address For Type  SLAAC
1234
1235    Should Match Regexp    ${ipv6_link_local_addr}    ${linklocal_addr_format}
1236
1237
1238Check Coexistence Of Link Local And DHCPv6
1239    [Documentation]  Verify both link local and dhcpv6 coexist.
1240
1241    # Verify the address origin contains dhcpv6 and link local.
1242    @{ipv6_address_origin_list}  ${ipv6_link_local_addr}=
1243    ...    Get Address Origin List And Address For Type  LinkLocal
1244
1245    @{ipv6_address_origin_list}  ${ipv6_dhcpv6_addr}=
1246    ...    Get Address Origin List And Address For Type  DHCPv6
1247
1248    Should Match Regexp    ${ipv6_link_local_addr}    ${linklocal_addr_format}
1249
1250
1251Check If Linklocal Address Is In Correct Format
1252    [Documentation]  Linklocal address has network part fe80 and host part EUI64.
1253
1254    # Fetch the linklocal address.
1255    @{ipv6_addressorigin_list}  ${ipv6_linklocal_addr}=  Get Address Origin List And Address For Type  LinkLocal
1256
1257    # Follow EUI64 from MAC.
1258    ${system_mac}=  Get BMC MAC Address
1259    ${split_octets}=  Split String  ${system_mac}  :
1260    ${first_octet}=  Evaluate  int('${split_octets[0]}', 16)
1261    ${flipped_hex}=  Evaluate  format(${first_octet} ^ 2, '02x')
1262    ${grp1}=  Evaluate  re.sub(r'^0+', '', '${flipped_hex}${split_octets[1]}')  modules=re
1263    ${grp2}=  Evaluate  re.sub(r'^0+', '', '${split_octets[2]}ff')  modules=re
1264    ${grp3}=  Evaluate  re.sub(r'^0+', '', '${split_octets[4]}${split_octets[5]}')  modules=re
1265    ${linklocal}=  Set Variable  fe80::${grp1}:${grp2}:fe${split_octets[3]}:${grp3}
1266
1267    # Verify the linklocal obtained is the same as on the machine.
1268    Should Be Equal  ${linklocal}  ${ipv6_linklocal_addr}
1269
1270
1271Check BMC Gets SLAAC Address
1272    [Documentation]  Check BMC gets slaac address.
1273
1274    @{ipv6_addressorigin_list}  ${ipv6_slaac_addr}=  Get Address Origin List And Address For Type  SLAAC
1275
1276
1277Get The Initial DHCPv6 Setting On Each Interface
1278    [Documentation]  Get the initial DHCPv6 setting of each interface.
1279    [Arguments]  ${channel_number}
1280
1281    # Description of the argument(s):
1282    # channel_number    Channel number 1 or 2.
1283
1284    ${ethernet_interface}=  Set Variable  ${active_channel_config['${channel_number}']['name']}
1285    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1286    ${initial_dhcpv6_iface}=  Get From Dictionary  ${resp.dict}  DHCPv6
1287    IF  ${channel_number}==${1}
1288        Set Test Variable  ${dhcpv6_channel_1}  ${initial_dhcpv6_iface['OperatingMode']}
1289    ELSE
1290        Set Test Variable  ${dhcpv6_channel_2}  ${initial_dhcpv6_iface['OperatingMode']}
1291    END
1292
1293
1294Get The Initial DHCPv6 Settings
1295    [Documentation]  Get the initial DHCPv6 settings of both the interfaces.
1296
1297    Get The Initial DHCPv6 Setting On Each Interface  ${1}
1298    Get The Initial DHCPv6 Setting On Each Interface  ${2}
1299
1300
1301Get The Initial SLAAC Settings
1302    [Documentation]  Get the initial SLAAC settings of both the interfaces.
1303
1304    Get The Initial SLAAC Setting On Each Interface   ${1}
1305    Get The Initial SLAAC Setting On Each Interface   ${2}
1306
1307
1308Get The Initial SLAAC Setting On Each Interface
1309    [Documentation]  Get the initial SLAAC setting of the interface.
1310    [Arguments]  ${channel_number}
1311
1312    # Description of the argument(s):
1313    # channel_number     Channel number 1 or 2.
1314
1315    ${ethernet_interface}=  Set Variable  ${active_channel_config['${channel_number}']['name']}
1316    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1317    ${initial_slaac_iface}=  Get From Dictionary  ${resp.dict}  StatelessAddressAutoConfig
1318    IF  ${channel_number}==${1}
1319        Set Test Variable  ${slaac_channel_1}  ${initial_slaac_iface['IPv6AutoConfigEnabled']}
1320    ELSE
1321        Set Test Variable  ${slaac_channel_2}  ${initial_slaac_iface['IPv6AutoConfigEnabled']}
1322    END
1323
1324
1325Get Address Origin List And IPv4 or IPv6 Address
1326    [Documentation]  Get address origin list and address for type.
1327    [Arguments]  ${ip_address_type}  ${channel_number}=${CHANNEL_NUMBER}
1328
1329    # Description of the argument(s):
1330    # ip_address_type  Type of IPv4 or IPv6 address to be checked.
1331    # channel_number   Channel number 1(eth0) or 2(eth1).
1332
1333    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']}
1334    @{ip_addresses}=  Get From Dictionary  ${resp.dict}  ${ip_address_type}
1335
1336    ${ip_addressorigin_list}=  Create List
1337    ${ip_addr_list}=  Create List
1338    FOR  ${ip_address}  IN  @{ip_addresses}
1339        ${ip_addressorigin}=  Get From Dictionary  ${ip_address}  AddressOrigin
1340        Append To List  ${ip_addressorigin_list}  ${ip_addressorigin}
1341        Append To List  ${ip_addr_list}  ${ip_address['Address']}
1342    END
1343    RETURN  ${ip_addressorigin_list}  ${ip_addr_list}
1344
1345
1346Verify All The Addresses Are Intact
1347    [Documentation]  Verify all the addresses and address origins remain intact.
1348    [Arguments]    ${channel_number}=${CHANNEL_NUMBER}
1349    ...  ${initial_ipv4_addressorigin_list}=${initial_ipv4_addressorigin_list}
1350    ...  ${initial_ipv4_addr_list}=${initial_ipv4_addr_list}
1351
1352    # Description of argument(s):
1353    # channel_number                   Channel number 1(eth0) or 2(eth1).
1354    # initial_ipv4_addressorigin_list  Initial IPv4 address origin list.
1355    # initial_ipv4_addr_list           Initial IPv4 address list.
1356
1357    # Verify that it will not impact the IPv4 configuration.
1358    Sleep  ${NETWORK_TIMEOUT}
1359    Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT}
1360
1361    # IPv6 Linklocal address must be present.
1362    @{ipv6_addressorigin_list}  ${ipv6_linklocal_addr}=
1363    ...  Get Address Origin List And Address For Type  LinkLocal  ${channel_number}
1364
1365    # IPv4 addresses must remain intact.
1366    ${ipv4_addressorigin_list}  ${ipv4_addr_list}=
1367    ...  Get Address Origin List And IPv4 or IPv6 Address  IPv4Addresses  ${channel_number}
1368
1369    Should be Equal  ${initial_ipv4_addressorigin_list}  ${ipv4_addressorigin_list}
1370    Should be Equal  ${initial_ipv4_addr_list}  ${ipv4_addr_list}
1371
1372
1373Get Interface ID Of IPv6
1374    [Documentation]  Get interface id of IPv6 address.
1375    [Arguments]    ${ipv6_address}
1376
1377    # Description of the argument(s):
1378    # ${ipv6_address}  IPv6 Address to extract the last 4 hextets.
1379
1380    # Last 64 bits of SLAAC and Linklocal must be the same.
1381    # Sample IPv6 network configurations.
1382    #"IPv6AddressPolicyTable": [],
1383    #  "IPv6Addresses": [
1384    #    {
1385    #      "Address": "fe80::xxxx:xxxx:xxxx:xxxx",
1386    #      "AddressOrigin": "LinkLocal",
1387    #      "AddressState": null,
1388    #      "PrefixLength": xx
1389    #    }
1390    #  ],
1391    #    {
1392    #      "Address": "2002:xxxx:xxxx:xxxx:xxxx",
1393    #      "AddressOrigin": "SLAAC",
1394    #      "PrefixLength": 64
1395    #    }
1396    #  ],
1397
1398    ${split_ip_address}=  Split String  ${ipv6_address}  :
1399    ${missing_ip}=  Evaluate  8 - len(${split_ip_address}) + 1
1400    ${expanded_ip}=  Create List
1401
1402    FOR  ${hextet}  IN  @{split_ip_address}
1403       IF  '${hextet}' == ''
1404           FOR  ${i}  IN RANGE  ${missing_ip}
1405               Append To List  ${expanded_ip}  0000
1406           END
1407       ELSE
1408           Append To List  ${expanded_ip}  ${hextet}
1409       END
1410    END
1411    ${interface_id}=  Evaluate  ':'.join(${expanded_ip}[-4:])
1412    RETURN  ${interface_id}
1413
1414
1415Set And Verify SLAAC Property On Both Interfaces
1416    [Documentation]  Set and verify SLAAC property on both interfaces.
1417    [Arguments]  ${slaac_value_1}  ${slaac_value_2}
1418
1419    # Description of the argument(s):
1420    # slaac_value_1  SLAAC value for channel 1.
1421    # slaac_value_2  SLAAC value for channel 2.
1422
1423    Set SLAAC Configuration State And Verify  ${slaac_value_1}  [${HTTP_OK}]  ${1}
1424    Set SLAAC Configuration State And Verify  ${slaac_value_2}  [${HTTP_OK}]  ${2}
1425
1426    Sleep  30s
1427
1428    # Check SLAAC Settings for eth0.
1429    @{ipv6_addressorigin_list}  ${ipv6_slaac_addr}=
1430    ...  Get Address Origin List And IPv4 or IPv6 Address  IPv6Addresses  ${1}
1431    IF  "${slaac_value_1}" == "${True}"
1432         Should Not Be Empty  ${ipv6_slaac_addr}  SLAAC
1433    ELSE
1434        Should Not Contain  ${ipv6_addressorigin_list}  SLAAC
1435    END
1436
1437    # Check SLAAC Settings for eth1.
1438    @{ipv6_addressorigin_list}  ${ipv6_slaac_addr}=
1439    ...  Get Address Origin List And IPv4 or IPv6 Address  IPv6Addresses  ${2}
1440    IF  "${slaac_value_2}" == "${True}"
1441         Should Not Be Empty  ${ipv6_slaac_addr}  SLAAC
1442    ELSE
1443        Should Not Contain  ${ipv6_addressorigin_list}  SLAAC
1444    END
1445
1446    Verify All The Addresses Are Intact  ${1}
1447    Verify All The Addresses Are Intact  ${2}
1448    ...    ${eth1_initial_ipv4_addressorigin_list}  ${eth1_initial_ipv4_addr_list}
1449
1450
1451Set And Verify DHCPv6 Property On Both Interfaces
1452    [Documentation]  Set and verify DHCPv6 property on both interfaces.
1453    [Arguments]  ${dhcpv6_value_1}  ${dhcpv6_value_2}
1454
1455    # Description of the argument(s):
1456    # dhcpv6_value_1  DHCPv6 value for channel 1.
1457    # dhcpv6_value_2  DHCPv6 value for channel 2.
1458
1459    Set And Verify DHCPv6 Property  ${dhcpv6_value_1}  ${1}
1460    Set And Verify DHCPv6 Property  ${dhcpv6_value_2}  ${2}
1461
1462    Verify All The Addresses Are Intact  ${1}
1463    Verify All The Addresses Are Intact  ${2}
1464    ...    ${eth1_initial_ipv4_addressorigin_list}  ${eth1_initial_ipv4_addr_list}
1465
1466
1467Verify IPv6 Addresses Coexist
1468    [Documentation]  Verify IPv6 address type coexist.
1469    [Arguments]   ${ipv6_address_type1}  ${ipv6_address_type2}
1470
1471    # Description of the argument(s):
1472    # ipv6_address_type1  IPv6 address type.
1473    # ipv6_address_type2  IPv6 address type.
1474    # Valid IPv6 address type (Static, DHCPv6, SLAAC).
1475
1476    IF  '${ipv6_address_type1}' == 'Static' and '${ipv6_address_type2}' == 'DHCPv6'
1477        Configure IPv6 Address On BMC  ${test_ipv6_addr}  ${test_prefix_length}
1478        Set And Verify DHCPv6 Property  Enabled
1479    ELSE IF  '${ipv6_address_type1}' == 'DHCPv6' and '${ipv6_address_type2}' == 'SLAAC'
1480        Set And Verify DHCPv6 Property  Enabled
1481        Set SLAAC Configuration State And Verify  ${True}
1482    ELSE IF  '${ipv6_address_type1}' == 'SLAAC' and '${ipv6_address_type2}' == 'Static'
1483        Configure IPv6 Address On BMC  ${test_ipv6_addr}  ${test_prefix_length}
1484        Set SLAAC Configuration State And Verify  ${True}
1485    ELSE IF  '${ipv6_address_type1}' == 'Static' and '${ipv6_address_type2}' == 'Static'
1486        Configure IPv6 Address On BMC  ${test_ipv6_addr}  ${test_prefix_length}
1487        Configure IPv6 Address On BMC  ${test_ipv6_addr1}  ${test_prefix_length}
1488    END
1489
1490    Sleep  ${NETWORK_TIMEOUT}s
1491
1492    # Verify coexistence.
1493    Verify The Coexistence Of The Address Type  ${ipv6_address_type1}  ${ipv6_address_type2}
1494
1495    IF  '${ipv6_address_type1}' == 'Static' or '${ipv6_address_type2}' == 'Static'
1496        Delete IPv6 Address  ${test_ipv6_addr}
1497    END
1498    IF  '${ipv6_address_type1}' == 'Static' and '${ipv6_address_type2}' == 'Static'
1499        Delete IPv6 Address  ${test_ipv6_addr1}
1500    END
1501
1502    Set And Verify DHCPv6 Property  Disabled
1503    Set SLAAC Configuration State And Verify  ${False}
1504