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