xref: /openbmc/openbmc-test-automation/gui/gui_test/settings_menu/test_network_sub_menu.robot (revision a05a3655cf366d47cd6ac8b3a765e5277860bbb9)
1*** Settings ***
2
3Documentation   Test OpenBMC GUI "Network" sub-menu of "Settings".
4
5Resource        ../../lib/gui_resource.robot
6Resource        ../../../lib/bmc_network_utils.robot
7Resource        ../../../lib/bmc_ipv6_utils.robot
8
9Suite Setup     Suite Setup Execution
10Suite Teardown  Close Browser
11
12Test Tags      Network_Sub_Menu
13
14*** Variables ***
15
16${xpath_network_heading}                 //h1[text()="Network"]
17${xpath_interface_settings}              //h2[text()="Interface settings"]
18${xpath_network_settings}                //h2[text()="Network settings"]
19${xpath_network_button}                  //a[normalize-space()='Network'][1]
20${xpath_static_ipv4}                     //h2[text()="IPv4"]
21${xpath_static_ipv6}                     //h2[text()="IPv6"]
22${xpath_static_ipv6_default_gateway}     //h2[text()="IPv6 static default gateways"]
23${xpath_domain_name_toggle}              //*[@data-test-id="networkSettings-switch-useDomainName"]
24${xpath_ntp_servers_toggle}              //*[@data-test-id="networkSettings-switch-useNtp"]
25${xpath_add_static_ipv4_addr_btn_eth0}   (//button[contains(text(),"Add static IPv4 address")])[1]
26${xpath_add_static_ipv4_addr_btn_eth1}   (//button[contains(text(),"Add static IPv4 address")])[2]
27${xpath_add_static_ipv6_addr_btn_eth0}   (//button[contains(text(),"Add static IPv6 address")])[1]
28${xpath_add_static_ipv6_addr_btn_eth1}   (//button[contains(text(),"Add static IPv6 address")])[2]
29${xpath_add_static_def_gateway_button}   //button[contains(text(),"Add IPv6 static default gateway address")]
30${xpath_hostname}                        //*[@title="Edit hostname"]
31${xpath_hostname_input}                  //*[@id="hostname"]
32${xpath_input_ip_address}                //*[@id="ipAddress"]
33${xpath_input_gateway}                   //*[@id="gateway"]
34${xpath_input_subnetmask}                //*[@id="subnetMask"]
35${xpath_input_ipv6address}               //*[@id="ipAddress"]
36${xpath_input_prefix_length}             //*[@id="prefixLength"]
37${xpath_input_addressorigin}             //*[@id="Address Origin"]
38${xpath_cancel_button}                   //button[contains(text(),'Cancel')]
39${xpath_delete_dns_server}               //*[@title="Delete DNS address"]
40${xpath_save_button}                     //button[contains(text(),'Save')]
41${xpath_dhcp_toggle_switch}              //*[@id='dhcpSwitch']
42${xpath_dhcpv6_toggle_switch}            //*[@id='dhcpIpv6Switch']
43${xpath_slaac_toggle_switch}             //*[@id='ipv6AutoConfigSwitch']
44${xpath_lldp_toggle_switch}              //*[@id='useLLDPSwitch']
45${xpath_ntp_switch_button}               //*[@id="useNtpSwitch"]/following-sibling::label
46${xpath_dns_switch_button}               //*[@id="useDnsSwitch"]/following-sibling::label
47${xpath_domainname_switch_button}        //*[@id="useDomainNameSwitch"]/following-sibling::label
48${xpath_success_popup}                   //*[contains(text(),'Success')]/following-sibling::button
49${ipv4_elements}                         //h2[contains(., "IPv4")]/following::table[1]/tbody/tr/td[1]
50${ipv6_elements}                         //h2[contains(., "IPv6")]/following::table[1]/tbody/tr/td[1]
51${ipv4_addr_origin_elements}             //h2[contains(text(),'IPv4')]//following::table[1]
52...                                      //td[@aria-colindex='4']
53${ipv6_addr_origin_elements}             //h2[contains(text(),'IPv6')]//following::table[1]
54...                                      //td[@aria-colindex='3']
55${xpath_delete_ipv4_addres}              //*[text()='${test_ipv4_addr_2}']/following::td[4]
56...                                      //*[@title="Delete IPv4 address"]
57${xpath_delete_ipv6_addres}              //*[text()='${test_ipv6_addr_2}']/following::td[3]
58...                                      //*[@title="Delete IPv6 address"]
59${xpath_edit_ipv4_addres}                //*[text()='${test_ipv4_addr}']/following::td[4]
60...                                      //*[@title="Edit static IPv4 address"]
61${xpath_edit_ipv6_addres}                //*[text()='${test_ipv6_addr}']/following::td[3]
62...                                      //*[@title="Edit static IPv6 address"]
63${xpath_delete_ipv6_def_gateway_addr}    //*[text()='${test_ipv6_addr_1}']/following::td[1]
64...                                      //*[@title="Delete IPv6 static default gateway address"]
65${xpath_edit_ipv6_def_gateway_addr}      //*[text()='${test_ipv6_addr}']/following::td[1]
66...                                      //*[@title="Edit IPv6 static default gateway address"]
67${xpath_edit_ipv6_def_gateway_addr_1}    //*[text()='${test_ipv6_addr_1}']/following::td[1]
68...                                      //*[@title="Edit IPv6 static default gateway address"]
69${xpath_ipv6_addr_edit_button}           //*[text()='{}']/following::td[3]
70...                                      //*[@title="Edit static IPv6 address"]
71${xpath_ipv6_addr_delete_button}         //*[text()='{}']/following::td[3]
72...                                      //*[@title="Delete IPv6 address"]
73${xpath_delete_button}                   //*[text()="Delete"]
74${xpath_eth0_interface}                  //*[text()="eth0"]
75${xpath_eth1_interface}                  //*[text()="eth1"]
76${xpath_linklocalv6}                     //*[text()="LinkLocal"]
77${xpath_eth0_autoconfig_button}          (//*[@id="ipv6AutoConfigSwitch"]/following-sibling::label)[1]
78${xpath_eth1_autoconfig_button}          (//*[@id="ipv6AutoConfigSwitch"]/following-sibling::label)[2]
79${xpath_eth0_dhcpv6_button}              (//*[@id="dhcpIpv6Switch"]/following-sibling::label)[1]
80${xpath_eth1_dhcpv6_button}              (//*[@id="dhcpIpv6Switch"]/following-sibling::label)[2]
81${xpath_eth0_dhcpv4_button}              (//*[@id="dhcpSwitch"]/following-sibling::label)[1]
82${xpath_eth1_dhcpv4_button}              (//*[@id="dhcpSwitch"]/following-sibling::label)[2]
83${xpath_dhcpv4_alert}                    //button[normalize-space()='Enable' or normalize-space()='Disable']
84${dns_server}                            10.10.10.10
85${test_ipv4_addr}                        10.7.7.7
86${test_ipv4_addr_1}                      10.7.7.8
87${test_ipv4_addr_2}                      10.7.6.5
88${test_ipv6_addr}                        2001:db8:3333:4444:5555:6666:7777:8888
89${test_ipv6_addr_1}                      2001:db8:3333:4444:5555:6666:7777:8889
90${test_ipv6_addr_2}                      2001:db8:3333:4444:5555:6666:7777:8890
91${ipv6_multi_block}                      2001:0022:0000:0000:1:2:3:8
92${ipv6_multi_block_addr}                 2001:22::1:2:3:8
93${ipv4_hexword_addr}                     10.5.5.6:1A:1B:1C:1D:1E:1F
94${invalid_hexadec_ipv6}                  x:x:x:x:x:x:10.5.5.6
95${ipv6_multi_short}                      2001::33::111
96${ipv6_with_leadingzeroes_addr}          2001:0022:0033::0111
97${ipv6_without_leadingzeroes_addr}       2001:22:33::111
98${ipv6_onehextet_zero}                   2001:0022:1133::1111
99${ipv6_eliminate_onehextet_zero}         2001:22:1133::1111
100${compressed_ipv4}                       ::10.5.5.6
101${compressed_ipv6}                       ::a05:506
102${link_local_addr}                       fe80::
103${link_local_prefix_len}                 10
104${test_prefix_length}                    64
105${out_of_range_ip}                       10.7.7.256
106${string_ip}                             aa.bb.cc.dd
107${negative_ip}                           10.-7.-7.-7
108${less_octet_ip}                         10.3.36
109${hex_ip}                                0xa.0xb.0xc.0xd
110${spl_char_ip}                           @@@.%%.44.11
111${test_subnet_mask}                      255.255.255.0
112${alpha_netmask}                         ff.ff.ff.ff
113${out_of_range_netmask}                  255.256.255.0
114${more_byte_netmask}                     255.255.255.0.0
115${lowest_netmask}                        128.0.0.0
116${test_hostname}                         openbmc
117
118*** Test Cases ***
119
120Verify Navigation To Network Page
121    [Documentation]  Login to GUI and navigate to the settings sub-menu network page.
122    [Tags]  Verify_Navigation_To_Network_Page
123
124    Page Should Contain Element  ${xpath_network_heading}
125
126Verify Existence Of All Sections In Network Page
127    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
128    ...  and confirm the page contains sections that should be accessible.
129    [Tags]  Verify_Existence_Of_All_Sections_In_Network_Page
130
131    Wait Until Page Contains Element  ${xpath_network_settings}  timeout=1min
132    Page Should Contain Element  ${xpath_interface_settings}
133    Page Should Contain Element  ${xpath_static_ipv4}
134    Page Should Contain Element  ${xpath_static_ipv6}
135    Page Should Contain Element  ${xpath_static_ipv6_default_gateway}
136    Page Should Contain Element  ${xpath_static_dns}
137
138
139Verify Existence Of All Buttons In Network Page
140    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
141    ...  and confirm the page contains basic features button that should be accessible.
142    [Tags]  Verify_Existence_Of_All_Buttons_In_Network_Page
143
144    Page Should Contain Button  ${xpath_add_static_ipv4_addr_btn_eth0}
145    Page Should Contain Button  ${xpath_add_static_ipv6_addr_btn_eth0}
146    Page Should Contain Button  ${xpath_add_dns_ip_address_button}
147    Page Should Contain Button  ${xpath_domain_name_toggle}
148    Page Should Contain Button  ${xpath_dns_servers_toggle}
149    Page Should Contain Button  ${xpath_ntp_servers_toggle}
150    Page Should Contain Button  ${xpath_dhcp_toggle_switch}
151    Page Should Contain Button  ${xpath_dhcpv6_toggle_switch}
152    Page Should Contain Button  ${xpath_slaac_toggle_switch}
153    Page Should Contain Button  ${xpath_lldp_toggle_switch}
154
155
156Verify Existence Of All Fields In Hostname
157    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
158    ...  and confirm hostname contains all the fields.
159    [Tags]  Verify_Existence_Of_All_Fields_In_Hostname
160    [Teardown]  Cancel And Verify Network Heading
161
162    Click Element  ${xpath_hostname}
163    Wait Until Page Contains  Edit hostname  timeout=1min
164    Page Should Contain Textfield  ${xpath_hostname_input}
165    Page Should Contain Button  ${xpath_cancel_button}
166    Page Should Contain Button  ${xpath_save_button}
167
168
169Verify Existence Of All Fields In Static IP Address
170    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
171    ...  and confirm section static IPv4 contains all the fields.
172    [Tags]  Verify_Existence_Of_All_Fields_In_Static_IP_Address
173    [Teardown]  Cancel And Verify Network Heading
174
175    Wait Until Keyword Succeeds  30 sec  10 sec  Click Element  ${xpath_add_static_ipv4_addr_btn_eth0}
176    Wait Until Page Contains  Add static IPv4 address  timeout=15s
177    Page Should Contain Textfield  ${xpath_input_ip_address}
178    Page Should Contain Textfield  ${xpath_input_gateway}
179    Page Should Contain Textfield  ${xpath_input_subnetmask}
180    Page Should Contain Button  ${xpath_cancel_button}
181    Page Should Contain Button  ${xpath_add_button}
182
183
184Verify Existence Of All Fields In Static IPv6 Address
185    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
186    ...  and confirm section static IPv6 contains all the fields.
187    [Tags]  Verify_Existence_Of_All_Fields_In_Static_IPv6_Address
188    [Teardown]  Cancel And Verify Network Heading
189
190    Wait Until Keyword Succeeds  30 sec  10 sec  Click Element  ${xpath_add_static_ipv6_addr_btn_eth0}
191    Wait Until Page Contains  Add static IPv6 address  timeout=15s
192    Page Should Contain Textfield  ${xpath_input_ipv6_address}
193    Page Should Contain Textfield  ${xpath_input_prefix_length}
194    Page Should Contain Button  ${xpath_cancel_button}
195    Page Should Contain Button  ${xpath_add_button}
196
197
198Verify Existence Of All Fields In IPv6 Static Default Gateway
199    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
200    ...  and confirm section IPv6 static default gateway contains all the fields.
201    [Tags]  Verify_Existence_Of_All_Fields_In_IPv6_Static_Default_Gateway
202    [Teardown]  Run Keywords  Click Button  ${xpath_cancel_button}  AND
203    ...  Wait Until Keyword Succeeds  10 sec  5 sec
204    ...  Refresh GUI And Verify Element Value  ${xpath_network_heading}  Network
205
206    Wait Until Keyword Succeeds  30 sec  10 sec  Click Element  ${xpath_add_static_def_gateway_button}
207    Wait Until Page Contains  Add IPv6 static default gateway address  timeout=11s
208    Page Should Contain Textfield  ${xpath_input_ip_address}
209    Page Should Contain Button  ${xpath_cancel_button}
210    Page Should Contain Button  ${xpath_add_button}
211
212
213Verify Existence Of All Fields In Static DNS
214    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
215    ...  and confirm section static DNS contains all the fields.
216    [Tags]  Verify_Existence_Of_All_Fields_In_Static_DNS
217    [Teardown]  Cancel And Verify Network Heading
218
219    Wait Until Keyword Succeeds  30 sec  10 sec  Click Element  ${xpath_add_dns_ip_address_button}
220    Wait Until Page Contains  Add IP address  timeout=11s
221    Page Should Contain Textfield  ${xpath_input_static_dns}
222    Page Should Contain Button  ${xpath_cancel_button}
223    Page Should Contain Button  ${xpath_add_button}
224
225
226Configure And Verify DNS Server Via GUI
227    [Documentation]  Login to GUI Network page, add DNS server IP
228    ...  and verify that the page reflects server IP.
229    [Tags]  Configure_And_Verify_DNS_Server_Via_GUI
230    [Setup]  DNS Test Setup Execution
231    [Teardown]  Run Keywords  Delete Static Name Servers  AND
232    ...  Configure Static Name Servers
233
234    Add DNS Servers And Verify  ${dns_server}
235
236
237Configure Static IPv4 Netmask Via GUI And Verify
238    [Documentation]  Login to GUI Network page, configure static IPv4 netmask and verify.
239    [Tags]  Configure_Static_IPv4_Netmask_Via_GUI_And_Verify
240    [Template]  Add Static IP Address And Verify
241
242    # ip_addresses      subnet_masks             gateway          expected_status
243    ${test_ipv4_addr}   ${lowest_netmask}        ${default_gateway}  Success
244    ${test_ipv4_addr}   ${more_byte_netmask}     ${default_gateway}  Invalid format
245    ${test_ipv4_addr}   ${alpha_netmask}         ${default_gateway}  Invalid format
246    ${test_ipv4_addr}   ${out_of_range_netmask}  ${default_gateway}  Invalid format
247    ${test_ipv4_addr}   ${test_subnet_mask}      ${default_gateway}  Success
248
249
250Configure And Verify Static IP Address
251    [Documentation]  Login to GUI Network page, configure static ip address and verify.
252    [Tags]  Configure_And_Verify_Static_IP_Address
253
254    Add Static IP Address And Verify  ${test_ipv4_addr}  ${test_subnet_mask}  ${default_gateway}  Success
255
256
257Configure And Verify Multiple Static IP Address
258    [Documentation]  Login to GUI Network page, configure multiple static IP address and verify.
259    [Tags]  Configure_And_Verify_Multiple_Static_IP_Address
260
261    Add Static IP Address And Verify  ${test_ipv4_addr}  ${test_subnet_mask}  ${default_gateway}  Success
262    Add Static IP Address And Verify  ${test_ipv4_addr_1}  ${test_subnet_mask}  ${default_gateway}  Success
263
264
265Configure And Verify Invalid Static IP Address
266    [Documentation]  Login to GUI Network page, configure invalid static IP address and verify.
267    [Tags]  Configure_And_Verify_Invalid_Static_IP_Address
268    [Template]  Add Static IP Address And Verify
269
270    # ip                 subnet_mask          gateway             status
271    ${out_of_range_ip}   ${test_subnet_mask}  ${default_gateway}  Invalid format
272    ${less_octet_ip}     ${test_subnet_mask}  ${default_gateway}  Invalid format
273    ${string_ip}         ${test_subnet_mask}  ${default_gateway}  Invalid format
274    ${negative_ip}       ${test_subnet_mask}  ${default_gateway}  Invalid format
275    ${hex_ip}            ${test_subnet_mask}  ${default_gateway}  Invalid format
276    ${spl_char_ip}       ${test_subnet_mask}  ${default_gateway}  Invalid format
277
278
279Configure And Verify Multiple Static IPv6 Address
280    [Documentation]  Login to GUI Network page, configure multiple static IPv6 address and verify.
281    [Tags]  Configure_And_Verify_Multiple_Static_IPv6_Address
282
283    Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr}    ${test_prefix_length}  Success
284    Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr_1}  ${test_prefix_length}  Success
285
286
287Configure And Verify Static IPv6 Address
288    [Documentation]  Login to GUI Network page, configure static IPv6 address and verify.
289    [Tags]  Configure_And_Verify_Static_IPv6_Address
290    [Template]  Add Static IPv6 Address And Verify Via GUI
291
292    # ipv6                           prefix_length          status         expected_ipv6
293    ${ipv6_with_leadingzeroes_addr}  ${test_prefix_length}  Success        ${ipv6_without_leadingzeroes_addr}
294    ${ipv6_onehextet_zero}           ${test_prefix_length}  Success        ${ipv6_eliminate_onehextet_zero}
295    ${ipv6_multi_block}              ${test_prefix_length}  Success        ${ipv6_multi_block_addr}
296    ${compressed_ipv4}               ${test_prefix_length}  Success        ${compressed_ipv6}
297    ${test_ipv6_addr}                ${test_prefix_length}  Success
298    ${ipv4_hexword_addr}             ${test_prefix_length}  Invalid format
299    ${invalid_hexadec_ipv6}          ${test_prefix_length}  Invalid format
300    ${ipv6_multi_short}              ${test_prefix_length}  Invalid format
301
302
303Configure And Verify Static Default Gateway
304    [Documentation]  Login to GUI Network page, configure invalid static IPv6 default gateway and verify.
305    [Tags]  Configure_And_Verify_Static_Default_Gateway
306    [Template]  Add IPv6 Static Default Gateway And Verify
307
308    # ipv6 static default gateway  status
309    ${test_ipv6_addr}              Success
310
311
312Verify Coexistence of Staticv6 and Linklocal
313    [Documentation]  Verify coexistence of staticv6 and linklocal.
314    [Tags]  Verify_Coexistence_of_Staticv6_and_Linklocal
315
316    Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr}  ${test_prefix_length}  Success
317    @{ipv6_address_origin_list}  ${ipv6_linklocal_ipv6_addr}=
318    ...    Get Address Origin List And Address For Type  LinkLocal
319    Page Should Contain Element  ${xpath_linklocalv6}
320    Page Should Contain  ${ipv6_linklocal_ipv6_addr}
321    Page Should Contain  ${test_ipv6_addr}
322
323
324Modify DHCP Properties By Toggling And Verify
325    [Documentation]  Modify DHCP properties by toggling and verify.
326    [Tags]  Modify_DHCP_Properties_By_Toggling_And_Verify
327    [Template]  Toggle DHCPv4 property And Verify
328
329    # property                 xpath_property
330
331    UseNTPServers              ${xpath_ntp_switch_button}
332    UseDNSServers              ${xpath_dns_switch_button}
333    UseDomainName              ${xpath_domainname_switch_button}
334
335
336Delete IPv4 Address Via GUI And Verify
337   [Documentation]  Delete IPv4 Address via GUI and verify.
338   [Tags]  Delete_IPv4_Address_Via_GUI_And_Verify
339   [Setup]  Add Static IP Address And Verify  ${test_ipv4_addr_2}  ${test_subnet_mask}
340   ...  ${default_gateway}  Success
341
342   Delete IP Address And Verify  ipv4  ${test_ipv4_addr_2}
343
344
345Delete IPv6 Address Via GUI And Verify
346   [Documentation]  Delete IPv6 Address via GUI and verify.
347   [Tags]  Delete_IPv6_Address_Via_GUI_And_Verify
348   [Setup]  Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr_2}
349   ...  ${test_prefix_length}  Success
350
351   Delete IP Address And Verify  ipv6  ${test_ipv6_addr_2}
352
353
354Modify IPv4 Address Via GUI And Verify
355    [Documentation]  Edit IPv4 address via GUI and verify.
356    [Tags]  Modify_IPv4_Address_Via_GUI_And_Verify
357    [Setup]  Add Static IP Address And Verify  ${test_ipv4_addr}  ${test_subnet_mask}
358    ...  ${default_gateway}  Success
359
360    Modify IP Address And Verify  ipv4  ${test_ipv4_addr}  ${test_ipv4_addr_1}
361
362
363Modify IPv6 Address Via GUI And Verify
364    [Documentation]  Edit IPv6 address via GUI and verify.
365    [Tags]  Modify_IPv6_Address_Via_GUI_And_Verify
366    [Setup]  Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr}
367    ...  ${test_prefix_length}  Success
368
369    Modify IP Address And Verify  ipv6  ${test_ipv6_addr}  ${test_ipv6_addr_1}
370
371
372Verify MAC Address Is Displayed
373   [Documentation]  Verify MAC address is displayed.
374   [Tags]  Verify_MAC_Address_Is_Displayed
375
376   ${network_details}=  Get Network Interface Details  ${CHANNEL_NUMBER}
377
378   # Verify the MAC address on GUI.
379   Page Should Contain  ${network_details['MACAddress']}
380
381
382Verify MAC Address On Eth1 Interface
383    [Documentation]  Verify MAC address on eth1 interface.
384    [Tags]  Verify_MAC_Address_On_Eth1_Interface
385
386    Click Element  ${xpath_eth1_interface}
387
388    ${network_details}=  Get Network Interface Details  ${SECONDARY_CHANNEL_NUMBER}
389
390    # Verify eth1 interface MAC address on GUI.
391    Page Should Contain  ${network_details['MACAddress']}
392
393
394Configure Hostname Via GUI And Verify
395    [Documentation]  Login to GUI Network page, configure hostname and verify.
396    [Tags]  Configure_Hostname_Via_GUI_And_Verify
397    [Teardown]  Configure the Hostname Back And Verify
398
399    ${hostname}=  Get BMC Hostname
400    Set Suite Variable  ${hostname}
401    Configure And Verify Network Settings Via GUI  ${xpath_hostname}
402    ...  ${xpath_hostname_input}  ${test_hostname}
403
404    ${bmc_hostname}=  Get BMC Hostname
405    Should Be Equal As Strings  ${bmc_hostname}  ${test_hostname}
406
407
408Enable AutoConfig On Eth0 And Verify
409    [Documentation]  Enable SLAAC on eth0 via GUI & check it is set to enable state.
410    [Tags]  Enable_AutoConfig_On_Eth0_And_Verify
411
412    Set IPv6 AutoConfig State  Enabled  1
413
414
415Disable AutoConfig On Eth0 And Verify
416    [Documentation]  Disable SLAAC on eth0 via GUI & check it is set to disable state.
417    [Tags]  Disable_AutoConfig_On_Eth0_And_Verify
418
419    Set IPv6 AutoConfig State  Disabled  1
420
421
422Enable AutoConfig On Eth1 And Verify
423    [Documentation]  Enable SLAAC on eth1 via GUI & check it is set to enable state.
424    [Tags]  Enable_AutoConfig_On_Eth1_And_Verify
425
426    Set IPv6 AutoConfig State  Enabled  2
427
428
429Disable AutoConfig On Eth1 And Verify
430    [Documentation]  Disable SLAAC on eth1 via GUI & check it is set to disable state.
431    [Tags]  Disable_AutoConfig_On_Eth1_And_Verify
432
433    Set IPv6 AutoConfig State  Disabled  2
434
435
436Enable SLAAC On Both Interfaces And Verify Eth0
437    [Documentation]  Enable SLAAC on eth0, then on eth1, verify eth0 is not impacted.
438    [Tags]  Enable_SLAAC_On_Both_Interfaces_And_Verify_Eth0
439
440    Set SLAAC Property On Eth0 And Eth1
441    Click Element  ${xpath_eth0_interface}
442
443    # Verify SLAAC on eth0
444    Set Suite Variable  ${CHANNEL_NUMBER}  1
445    Verify SLAAC Address On Autoconfig Enable
446
447
448Enable SLAAC On Both Interfaces Disable It On Eth0 And Verify Eth1
449    [Documentation]  Enable and verify SLAAC property on eth0 and eth1,
450    ...  disable it on eth0 and verify eth1 is not impacted.
451    [Tags]  Enable_SLAAC_On_Both_Interfaces_Disable_It_On_Eth0_And_Verify_Eth1
452
453    Set SLAAC Property On Eth0 And Eth1
454    Set IPv6 AutoConfig State  Disabled  1
455    Click Element  ${xpath_eth1_interface}
456
457    # Verify SLAAC on eth1 after disabling eth0
458    Set Suite Variable  ${CHANNEL_NUMBER}  2
459    Verify SLAAC Address On Autoconfig Enable
460
461
462Enable SLAAC On Both Interfaces Disable It On Eth1 And Verify Eth0
463    [Documentation]  Enable and verify SLAAC property on eth0 and eth1,
464    ...  disable it on eth1 and verify eth0 is not impacted.
465    [Tags]  Enable_SLAAC_On_Both_Interfaces_Disable_It_On_Eth1_And_Verify_Eth0
466
467    Set SLAAC Property On Eth0 And Eth1
468    Set IPv6 AutoConfig State  Disabled  2
469
470    # Verify SLAAC on eth0 after disabling eth1
471    Set Suite Variable  ${CHANNEL_NUMBER}  1
472    Verify SLAAC Address On Autoconfig Enable
473
474
475Enable SLAAC On Both Interfaces Disable It On Both And Verify
476    [Documentation]  Enable and verify SLAAC property on eth0 and eth1,
477    ...  disable it on eth0,eth1 and verify.
478    [Tags]  Enable_SLAAC_On_Both_Interfaces_Disable_It_On_Both_And_Verify
479
480    Set SLAAC Property On Eth0 And Eth1
481
482    # Verify SLAAC is disconfigured on both eth0 and eth1 after disabling
483    Set IPv6 AutoConfig State  Disabled  1
484    Set IPv6 AutoConfig State  Disabled  2
485
486
487Add Static IPv6 Address Via GUI And Check Persistency
488    [Documentation]  Add static IPv6 address and verify persistency of static IPv6 on BMC reboot.
489    [Tags]  Add_Static_IPv6_Address_Via_GUI_And_Check_Persistency
490
491    Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr}  ${test_prefix_length}  Success
492    Verify Persistency Of IPv6 On BMC Reboot  Static  1
493
494
495Verify Persistency Of LinkLocal IPv6 On BMC Reboot For Both Interfaces
496    [Documentation]  Verify persistency of linklocal IPv6 on BMC reboot for both interfaces.
497    [Tags]  Verify_Persistency_Of_LinkLocal_IPv6_On_BMC_Reboot_For_Both_Interfaces
498
499    Verify Persistency Of IPv6 On BMC Reboot  LinkLocal  1
500    Verify Persistency Of IPv6 On BMC Reboot  LinkLocal  2
501
502
503Verify Persistency Of SLAAC On BMC Reboot For Both Interfaces
504    [Documentation]  Verify persistency of slaac on BMC reboot for both interfaces.
505    [Tags]  Verify_Persistency_Of_SLAAC_On_BMC_Reboot_For_Both_Interfaces
506    [Setup]  Set SLAAC Property On Eth0 And Eth1  Enabled
507
508    Verify Persistency Of IPv6 On BMC Reboot  SLAAC  1
509    Verify Persistency Of IPv6 On BMC Reboot  SLAAC  2
510
511
512Verify Persistency Of DHCPv6 On BMC Reboot For Both Interfaces
513    [Documentation]  Verify persistency of DHCPv6 on BMC reboot for both interfaces
514    ...  DHCPv6 setup should be in place for this testcase to pass.
515    [Tags]  Verify_Persistency_Of_DHCPv6_On_BMC_Reboot_For_Both_Interfaces
516    [Setup]  Set And Verify DHCPv6 States  Enabled  Enabled
517
518    Verify Persistency Of IPv6 On BMC Reboot  DHCPv6  1
519    Verify Persistency Of IPv6 On BMC Reboot  DHCPv6  2
520
521
522Verify DHCPv6 Enable And Disable On Both Interfaces Via GUI
523    [Documentation]  Verify DHCPv6 toggle on both interfaces via GUI.
524    [Tags]  Verify_DHCPv6_Enable_And_Disable_On_Both_Interfaces_Via_GUI
525    [Template]  Set And Verify DHCPv6 States
526
527    # eth0_state    eth1_state
528
529    Disabled        Enabled
530    Disabled        Disabled
531    Enabled         Disabled
532    Enabled         Enabled
533
534
535Delete Default IPv6 Static Gateway Address And Verify
536    [Documentation]  Delete default IPv6 static gateway address and verify.
537    [Tags]  Delete_Default_IPv6_Static_Gateway_Address_And_Verify
538    [Setup]  Add IPv6 Static Default Gateway And Verify  ${test_ipv6_addr_1}  Success
539
540    Delete Default IPv6 Gateway And Verify  ${test_ipv6_addr_1}
541
542
543Modify Default IPv6 Static Gateway Address And Verify
544    [Documentation]  Modify default IPv6 static gateway address and verify.
545    [Tags]  Modify_Default_IPv6_Static_Gateway_Address_And_Verify
546    [Setup]  Add IPv6 Static Default Gateway And Verify  ${test_ipv6_addr}  Success
547    [Teardown]  Delete Default IPv6 Gateway And Verify  ${test_ipv6_addr_1}
548
549    Modify Default IPv6 Gateway And Verify  ${test_ipv6_addr}  ${test_ipv6_addr_1}
550
551
552Verify Enable Or Disable DHCPv6 Does Not Impact IPv4 Settings
553    [Documentation]  Verify enable or disable DHCPv6 and it does not have impact on IPv4 settings
554    ...  Note: Enable testcase need DHCPv6 setup.
555    [Tags]  Verify_Enable_Or_Disable_DHCPv6_Does_Not_Impact_IPv4_Settings
556    [Template]  Enable Or Disable DHCPv6 And Verify Impact On IPv4 Settings
557
558    # ip_version   channel_number  desired_status
559    ipv4           1               Disabled
560    ipv4           1               Enabled
561    ipv4           2               Disabled
562    ipv4           2               Enabled
563
564
565Verify DHCPv4 Enable And Disable On Eth1 Via GUI
566    [Documentation]  Verify DHCPv4 toggle on eth1 via GUI, Note: Enable testcase need DHCP setup.
567    [Tags]  Verify_DHCPv4_Enable_And_Disable_On_Eth1_Via_GUI
568    [Template]  Toggle DHCPv4 State And Verify
569    [Teardown]  Assign Static IP Address on Eth1
570
571    # desired_dhcpv4_state
572    Enabled
573    Disabled
574
575
576Verify Coexistence Of IPv6 All Types Via GUI
577    [Documentation]  Verify coexistence of IPv6 all types on both interfaces.
578    [Tags]   Verify_Coexistence_Of_IPv6_All_Types_Via_GUI
579    [Setup]  Run Keywords  Add Static IPv6 Address And Verify Via GUI
580    ...      ${test_ipv6_addr}  ${test_prefix_length}  Success
581    ...      AND  Set And Verify DHCPv6 States  Enabled  Enabled
582    ...      AND  Set SLAAC Property On Eth0 And Eth1
583    ...      AND  Add Static IPv6 Address And Verify Via GUI
584    ...      ${test_ipv6_addr}  ${test_prefix_length}  Success  None  2
585    [Template]  Coexistence Of IP Addresses
586
587    # Note: DHCPv6 and SLAAC setup must be present.
588    # Channel_number   ipv6_type1      ipv6_type2       ipv6_type3      ipv6_type4
589    1                  Staticv6        LinkLocalv6      SLAACv6         DHCPv6
590    2                  LinkLocalv6     SLAACv6          Staticv6        DHCPv6
591
592
593Verify Independent SLAAC Configuration On Separate DHCPv6 Enabled Interfaces
594    [Documentation]  Verify when both interfaces are connected to DHCPv6, enabling/disabling
595    ...              SLAAC on one interface will not impact existing settings.
596    [Tags]  Verify_Independent_SLAAC_Configuration_On_Separate_DHCPv6_Enabled_Interfaces
597    [Setup]  Set And Verify DHCPv6 States  Enabled  Disabled
598    [Template]  Enable Or Disable SLAAC And Verify Impact On Existing Settings
599
600    # ip_version   channel_number  desired_status
601    ipv4           1               Disabled
602    ipv4           1               Enabled
603    ipv4           2               Disabled
604    ipv4           2               Enabled
605
606
607Verify Coexistence Of LinkLocalv6 DHCPv6 Staticv6 And SLAACv6 On Both Interfaces
608    [Documentation]  Verify coexistence of LinkLocalv6,DHCPv6,Staticv6 and SLAACv6 on both interfaces.
609    [Tags]   Verify_Coexistence_Of_LinkLocalv6_DHCPv6_Staticv6_And_SLAACv6_On_Both_Interfaces
610    [Setup]  Run Keywords  Set And Verify DHCPv6 States  Enabled  Enabled
611    ...      AND  Add Static IPv6 Address And Verify Via GUI
612    ...      ${test_ipv6_addr_2}  ${test_prefix_length}  Success
613    ...      AND  Set SLAAC Property On Eth0 And Eth1
614    ...      AND  Add Static IPv6 Address And Verify Via GUI
615    ...      ${test_ipv6_addr}  ${test_prefix_length}  Success  None  2
616    [Template]  Coexistence Of IP Addresses
617    [Teardown]  Run Keywords  Click Element  ${xpath_refresh_button}
618    ...         AND  Delete IP Address And Verify  ipv6  ${test_ipv6_addr_2}
619
620    # Note: DHCPv6 and SLAAC setup must be present.
621    # Channel_number   ipv6_type1    ipv6_type2   ipv6_type3     ipv6_type4
622    1                  LinkLocalv6   DHCPv6       Staticv6       SLAACv6
623    2                  LinkLocalv6   DHCPv6       Staticv6       SLAACv6
624
625
626Verify Coexistence Of LinkLocalv6 DHCPv6 And SLAACv6 On Both Interfaces
627    [Documentation]  Verify coexistence of LinkLocalv6,DHCPv6 and SLAACv6 on both interfaces.
628    [Tags]   Verify_Coexistence_Of_LinkLocalv6_DHCPv6_And_SLAACv6_On_Both_Interfaces
629    [Setup]  Run Keywords  Set And Verify DHCPv6 States  Enabled  Enabled
630    ...      AND  Set SLAAC Property On Eth0 And Eth1
631    [Template]  Coexistence Of IP Addresses
632
633    # Note: DHCPv6 and SLAAC setup must be present.
634    # Channel_number   ipv6_type1     ipv6_type2   ipv6_type3
635    1                  LinkLocalv6    DHCPv6       SLAACv6
636    2                  LinkLocalv6    DHCPv6       SLAACv6
637
638
639Verify Coexistence Of DHCPv6 Staticv6 And LinkLocalv6 On Both Interfaces
640    [Documentation]  Verify coexistence of DHCPv6, Staticv6 and LinkLocalv6 on both interfaces.
641    [Tags]   Verify_Coexistence_Of_DHCPv6_Staticv6_And_LinkLocalv6_On_Both_Interfaces
642    [Setup]  Run Keywords  Set And Verify DHCPv6 States  Enabled  Enabled
643    ...      AND  Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr_2}
644    ...      ${test_prefix_length}  Success
645    ...      AND  Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr}
646    ...      ${test_prefix_length}  Success  None  2
647    [Template]  Coexistence Of IP Addresses
648    [Teardown]  Run Keywords  Click Element  ${xpath_refresh_button}
649    ...         AND  Delete IP Address And Verify  ipv6  ${test_ipv6_addr_2}
650
651    # Note: DHCPv6 setup must be present.
652    # Channel_number   ipv6_type1   ipv6_type2     ipv6_type3
653    1                  DHCPv6       Staticv6       LinkLocalv6
654    2                  DHCPv6       Staticv6       LinkLocalv6
655
656
657Configure DHCPv6 On Eth0 And Verify Existing Network Configurations On BMC Reboot
658   [Documentation]  Configure DHCPv6 on eth0 and verify existing network configurations
659    ...    on BMC reboot.
660    [Tags]  Configure_DHCPv6_On_Eth0_And_Verify_Existing_Network_Configurations_On_BMC_Reboot
661    [Setup]  Set And Verify DHCPv6 States  Enabled  Disabled
662
663    # Capture IPv4 addresses before BMC reboot.
664    ${ipv4_before}=  Collect All IP Addresses On Both Interfaces  ipv4  1
665
666    # Capture IPv6 addresses before BMC reboot.
667    ${ipv6_before}=  Collect All IP Addresses On Both Interfaces  ipv6  1
668
669    Reboot BMC via GUI
670    Click Element  ${xpath_network_button}
671
672    # Capture IPv4 addresses after BMC reboot.
673    ${ipv4_after}=  Collect All IP Addresses On Both Interfaces  ipv4  1
674    Lists Should Be Equal  ${ipv4_before}  ${ipv4_after}  ignore_order=True
675
676    ${ipv6_after}=  Collect All IP Addresses On Both Interfaces  ipv6  1
677    Lists Should Be Equal  ${ipv6_before}  ${ipv6_after}  ignore_order=True
678
679
680Verify Coexistence Of Staticv4 SLAACv6 And LinkLocalv6 On Both Interfaces
681    [Documentation]  Verify coexistence of Staticv4 SLAACv6 and LinkLocalv6 on both interfaces.
682    [Tags]   Verify_Coexistence_Of_Staticv4_SLAACv6_And_LinkLocalv6_On_Both_Interfaces
683    [Setup]  Run Keywords  Add Static IP Address And Verify  ${test_ipv4_addr}
684    ...      ${test_subnet_mask}  ${default_gateway}  Success
685    ...      AND  Add Static IP Address And Verify  ${test_ipv4_addr_1}
686    ...      ${test_subnet_mask}  ${default_gateway_2}  Success  2
687    ...      AND  Set SLAAC Property On Eth0 And Eth1
688    [Template]  Coexistence Of IP Addresses
689
690    # Channel_number   ip_type1       ip_type2
691    1                  Staticv4       SLAACv6
692    2                  Staticv4       SLAACv6
693    1                  Staticv4       LinkLocalv6
694    2                  Staticv4       LinkLocalv6
695
696
697Verify Coexistence Of Staticv4 Staticv6 And SLAACv6 On Both Interfaces
698    [Documentation]  Verify coexistence of Staticv4 Staticv6 and SLAACv6 on both interfaces.
699    [Tags]   Verify_Coexistence_Of_Staticv4_Staticv6_And_SLAACv6_On_Both_Interfaces
700    [Setup]  Run Keywords  Configure IPv4 And IPv6 On Both Interfaces
701    ...      AND  Set SLAAC Property On Eth0 And Eth1
702    [Template]  Coexistence Of IP Addresses
703
704    # Channel_number   ip_type1       ip_type2      ip_type3
705    1                  Staticv4       Staticv6
706    2                  Staticv4       Staticv6
707    1                  Staticv4       Staticv6       SLAACv6
708
709
710Verify Coexistence Of Staticv4 Staticv6 And DHCPv6 On Both Interfaces
711    [Documentation]  Verify coexistence of Staticv4 Staticv6 and DHCPv6 on both interfaces.
712    [Tags]   Verify_Coexistence_Of_Staticv4_Staticv6_And_DHCPv6_On_Both_Interfaces
713    [Setup]  Run Keywords  Configure IPv4 And IPv6 On Both Interfaces
714    ...      AND  Set And Verify DHCPv6 States  Enabled  Enabled
715    [Template]  Coexistence Of IP Addresses
716
717    # Note: DHCPv6 setup must be present.
718    # Channel_number   ip_type1       ip_type2      ip_type3
719    1                  Staticv4       Staticv6      DHCPv6
720    2                  Staticv4       Staticv6      DHCPv6
721
722
723Verify Coexistence Of LinkLocalv4 Staticv6 SLAACv6 And DHCPv6 On Both Interfaces
724    [Documentation]  Verify coexistence of LinkLocalv4 Staticv6 SLAACv6 and DHCPv6 on both interfaces.
725    [Tags]  Verify_Coexistence_Of_LinkLocalv4_Staticv6_SLAACv6_And_DHCPv6_On_Both_Interfaces
726    [Setup]  Run Keywords  Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr_2}
727    ...      ${test_prefix_length}  Success
728    ...      AND  Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr}
729    ...      ${test_prefix_length}  Success  None  2
730    ...      AND  Set SLAAC Property On Eth0 And Eth1
731    ...      AND  Set And Verify DHCPv6 States  Enabled  Enabled
732    [Template]  Coexistence Of IP Addresses
733
734    # Note: DHCPv6 and SLAACv6 setup must be present.
735    # Channel_number   ip_type1       ip_type2      ip_type3   ip_type4
736    1                  LinkLocalv4    Staticv6      SLAACv6    DHCPv6
737    2                  LinkLocalv4    Staticv6      SLAACv6    DHCPv6
738
739
740Verify Coexistence Of Multiple IPs On Both Interfaces
741    [Documentation]  Verify coexistence of staticv4,staticv6,dhcpv6,slaacv6,dhcpv4,
742    ...  linklocalv4 on both interfaces.
743    [Tags]   Verify_Coexistence_Of_Multiple_IPs_On_Both_Interfaces
744    [Setup]  Run Keywords  Configure IPv4 And IPv6 On Both Interfaces
745    ...      AND  Set And Verify DHCPv6 States  Enabled  Enabled
746    ...      AND  Set SLAAC Property On Eth0 And Eth1
747    ...      AND  Toggle DHCPv4 State And Verify  Enabled  2
748    [Template]  Coexistence Of IP Addresses
749    [Teardown]  Run Keywords  Add Static IP Address And Verify  ${test_ipv4_addr_1}
750    ...      ${test_subnet_mask}  ${default_gateway_2}  Success  2
751    ...      AND  Click Element  ${xpath_refresh_button}
752    ...      AND  Delete IP Address And Verify  ipv6  ${test_ipv6_addr_2}
753
754    # Note: DHCPv6 DHCPv4 and SLAACv6 setup must be present.
755    # Channel_number   ip_type1       ip_type2      ip_type3   ip_type4
756    1                  Staticv4       Staticv6      DHCPv6     SLAACv4
757    2                  DHCPv4         Staticv6      DHCPv6     SLAACv6
758    1                  LinkLocalv4    Staticv6      DHCPv6     SLAACv4
759
760
761Verify Coexistence Of DHCPv4 LinkLocalv6 On Eth1
762    [Documentation]  Verify coexistence of DHCPv4 and Linklocalv6 on eth1 via GUI.
763    [Tags]   Verify_Coexistence_Of_DHCPv4_LinkLocalv6_On_Eth1
764    [Setup]  Toggle DHCPv4 State And Verify  Enabled
765    [Template]  Coexistence Of IP Addresses
766    [Teardown]  Add Static IP Address And Verify  ${test_ipv4_addr_1}
767    ...         ${test_subnet_mask}  ${default_gateway_2}  Success  2
768
769    # Note: DHCPv4 setup must be present.
770    # Channel_number   ip_type1       ip_type2
771    2                  DHCPv4         LinkLocalv6
772
773
774Verify Eth1 DHCPv4 Functionality In The Presence Of DHCPv6 Via GUI
775    [Documentation]  Verify eth1 DHCPv4 functionality in the presence of DHCPv6 via GUI.
776    ...    Run on setup with DHCPv4 available on eth1.
777    [Tags]  Verify_Eth1_DHCPv4_Functionality_In_The_Presence_Of_DHCPv6_Via_GUI
778    [Setup]  Run Keywords  Set And Verify DHCPv6 States  Disabled  Enabled
779    ...  AND  Toggle DHCPv4 State And Verify  Enabled  2
780
781    # Verify presence of DHCPv6 address and origin.
782    Sleep  ${NETWORK_TIMEOUT}s
783    @{ipv6_address_origin_list}  ${dhcpv6_addr}=
784    ...  Get Address Origin List And Address For Type  DHCPv6  2
785    Should Contain  ${ipv6_address_origin_list}  DHCPv6
786    Should Not Be Empty  ${dhcpv6_addr}  msg=DHCPv6 address is not present.
787
788    # Verify DHCPv6 button status in GUI.
789    ${dhcpv6_status}=  Get Text  ${xpath_eth1_dhcpv6_button}
790    Should Be Equal  ${dhcpv6_status}  Enabled
791
792    Verify Functionality Of IPv4 Address  DHCP  2
793
794
795Verify Eth0 Static IPv4 Functionality In The Presence Of DHCPv6 Via GUI
796    [Documentation]  Verify eth0 static IPv4 functionality in the presence of DHCPv6 via GUI.
797    [Tags]  Verify_Eth0_Static_IPv4_Functionality_In_The_Presence_Of_DHCPv6_Via_GUI
798    [Setup]  Set And Verify DHCPv6 States  Enabled  Disabled
799
800    # Verify presence of DHCPv6 address and origin.
801    Sleep  ${NETWORK_TIMEOUT}s
802    @{ipv6_address_origin_list}  ${dhcpv6_addr}=
803    ...  Get Address Origin List And Address For Type  DHCPv6  1
804    Should Contain  ${ipv6_address_origin_list}  DHCPv6
805    Should Not Be Empty  ${dhcpv6_addr}  msg=DHCPv6 address is not present.
806
807    # Verify DHCPv6 button status in GUI.
808    ${dhcpv6_status}=  Get Text  ${xpath_eth0_dhcpv6_button}
809    Should Be Equal  ${dhcpv6_status}  Enabled
810
811    Verify Functionality Of IPv4 Address  Static  1
812
813
814Verify Eth0 Static IPv4 Functionality In The Presence Of Staticv6 Via GUI
815    [Documentation]  Verify eth0 static IPv4 functionality in the presence of Staticv6 via GUI.
816    [Tags]   Verify_Eth0_Static_IPv4_Functionality_In_The_Presence_Of_Staticv6_Via_GUI
817    [Setup]  Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr_2}
818    ...      ${test_prefix_length}  Success
819    [Teardown]  Delete IP Address And Verify  ipv6  ${test_ipv6_addr_2}
820
821    # Verify Presence of Staticv6 address and origin.
822    @{ipv6_address_origin_list}  ${staticv6_addr}=
823    ...  Get Address Origin List And Address For Type  Static  1
824    Should Contain  ${ipv6_address_origin_list}  Static
825    Should Not Be Empty  ${staticv6_addr}  msg=Staticv6 address is not present.
826
827    Verify Functionality Of IPv4 Address  Static  1
828
829
830Verify Eth1 Static IPv4 Functionality In The Presence Of Staticv6 Via GUI
831    [Documentation]  Verify eth1 static IPv4 functionality in the presence of Staticv6 via GUI.
832    [Tags]   Verify_Eth1_Static_IPv4_Functionality_In_The_Presence_Of_Staticv6_Via_GUI
833    [Setup]  Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr_2}
834    ...      ${test_prefix_length}  Success  None  2
835    [Teardown]  Run Keyword And Ignore Error
836    ...         Delete IP Address And Verify  ipv6  ${test_ipv6_addr_2}
837
838    # Verify Presence of Staticv6 address and origin.
839    @{ipv6_address_origin_list}  ${staticv6_addr}=
840    ...  Get Address Origin List And Address For Type  Static  2
841    Should Contain  ${ipv6_address_origin_list}  Static
842    Should Not Be Empty  ${staticv6_addr}  msg=Staticv6 address is not present.
843
844    Verify Functionality Of IPv4 Address  Static  2
845
846
847Verify IPv4 Configuration Remains Intact When SLAAC Is Enabled
848    [Documentation]  Enable SLAAC and verify there is no change in IPv4 configuration.
849    [Tags]  Verify_IPv4_Configuration_Remains_Intact_When_SLAAC_Is_Enabled
850
851    # Enabling SLAAC on Eth1
852    Set IPv6 AutoConfig State  Enabled  2
853
854    ${ipv4_after}=  Get IPv4 Values From Eth1
855    Should Be Equal  ${ipv4_eth1}  ${ipv4_after}
856
857
858Configure Staticv6 On Eth0 And DHCPv6 On Eth1 With Eth0 In Static And Eth1 In DHCPv4
859    [Documentation]  Set eth0 static and eth1 DHCPv4, Verify staticv6 on eth0 and DHCPv6 on eth1.
860    [Tags]  Configure_Staticv6_On_Eth0_And_DHCPv6_On_Eth1_With_Eth0_In_Static_And_Eth1_In_DHCPv4
861    [Setup]  Toggle DHCPv4 State And Verify  Enabled  2
862
863    Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr_2}  ${test_prefix_length}  Success
864    Toggle DHCPv6 State And Verify  Enabled  2
865
866
867Configure Staticv6 And DHCPv6 On Eth1 With Eth0 And Eth1 In Staticv4
868    [Documentation]  Set eth0 and eth1 to staticv4, verify staticv6 and DHCPv6 on eth1.
869    [Tags]  Configure_Staticv6_And_DHCPv6_On_Eth1_With_Eth0_And_Eth1_In_Staticv4
870
871    Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr_2}
872    ...  ${test_prefix_length}  Success  None  2
873    Toggle DHCPv6 State And Verify  Enabled  2
874
875
876*** Keywords ***
877
878Suite Setup Execution
879    [Documentation]  Do suite setup tasks.
880
881    Launch Browser And Login GUI
882    Wait Until Keyword Succeeds  1 min  15 sec
883    ...  Click Element  ${xpath_settings_menu}
884    Click Element  ${xpath_network_sub_menu}
885    Wait Until Keyword Succeeds  30 sec  10 sec  Location Should Contain  network
886    Wait Until Element Is Not Visible   ${xpath_page_loading_progress_bar}  timeout=30
887    ${default_gateway}=  Get BMC Default Gateway
888    Set Suite Variable  ${default_gateway}
889    ${default_gateway_2}=  Get BMC Default Gateway  2
890    Set Suite Variable  ${default_gateway_2}
891    ${ipv4_eth1}=  Get IPv4 Values From Eth1
892    Set Suite Variable  ${ipv4_eth1}
893
894Launch Browser Login GUI And Navigate To Network Page
895    [Documentation]  Launch browser Login GUI and navigate to network page.
896
897    Launch Browser And Login GUI
898    Wait Until Keyword Succeeds  1 min  15 sec
899    ...  Click Element  ${xpath_settings_menu}
900    Click Element  ${xpath_network_sub_menu}
901    Wait Until Keyword Succeeds  30 sec  10 sec  Location Should Contain  network
902    Wait Until Element Is Not Visible   ${xpath_page_loading_progress_bar}  timeout=30
903
904Configure the Hostname Back And Verify
905    [Documentation]  Configure the hostname back.
906
907    Configure And Verify Network Settings Via GUI
908    ...  ${xpath_hostname}  ${xpath_hostname_input}  ${hostname}
909    ${bmc_hostname_after}=  Get BMC Hostname
910    Should Be Equal As Strings  ${bmc_hostname_after}  ${hostname}
911
912
913Delete DNS Servers And Verify
914    [Documentation]  Login to GUI Network page,delete static name servers
915    ...  and verify that page does not reflect static name servers.
916
917    Page Should Contain Element  ${xpath_delete_dns_server}
918    Wait Until Element Is Enabled  ${xpath_delete_dns_server}
919    Click Button  ${xpath_delete_dns_server}
920    Wait Until Page Contains Element  ${xpath_add_dns_ip_address_button}  timeout=15
921    # Check if all name servers deleted on BMC.
922    ${nameservers}=  CLI Get Nameservers
923    Should Not Contain  ${nameservers}  ${original_nameservers}
924
925    DNS Test Setup Execution
926
927    Should Be Empty  ${original_nameservers}
928
929
930Add Static IP Address And Verify
931    [Documentation]  Add static IP address, subnet mask and
932    ...  gateway via GUI and verify.
933    [Arguments]  ${ip_address}  ${subnet_mask}  ${gateway_address}
934    ...          ${expected_status}=error  ${CHANNEL_NUMBER}=1
935
936    # Description of argument(s):
937    # ip_address          IP address to be added (e.g. 10.7.7.7).
938    # subnet_mask         Subnet mask for the IP to be added (e.g. 255.255.0.0).
939    # gateway_address     Gateway address for the IP to be added (e.g. 10.7.7.1).
940    # expected_status     Expected status while adding static IPv4 address
941    # ....                (e.g. Invalid format / Field required).
942    # CHANNEL_NUMBER      Channel number: 1 for eth0, 2 for eth1.
943
944    Wait Until Element Is Enabled  ${xpath_add_static_ipv4_addr_btn_eth0}  timeout=60sec
945    IF  '${CHANNEL_NUMBER}' == '1'
946      Click Element  ${xpath_eth0_interface}
947      Click Element  ${xpath_add_static_ipv4_addr_btn_eth0}
948    ELSE
949      Click Element  ${xpath_eth1_interface}
950      Click Element  ${xpath_add_static_ipv4_addr_btn_eth1}
951    END
952
953    Input Text  ${xpath_input_ip_address}  ${ip_address}
954    Input Text  ${xpath_input_subnetmask}  ${subnet_mask}
955    Input Text  ${xpath_input_gateway}  ${gateway_address}
956
957    Click Element  ${xpath_add_button}
958    IF  '${expected_status}' == 'Success'
959        Wait Until Page Contains  ${ip_address}  timeout=40sec
960        Validate Network Config On BMC
961    ELSE
962        Page Should Contain  Invalid format
963        Click Button  ${xpath_cancel_button}
964        Wait Until Page Does Not Contain Element  ${xpath_cancel_button}
965    END
966
967
968Add Static IPv6 Address And Verify Via GUI
969    [Documentation]  Add static IPv6 address and prefix length and verify.
970    [Arguments]  ${ipv6_address}  ${prefix_length}  ${expected_status}=error
971    ...          ${expected_ipv6}=None  ${CHANNEL_NUMBER}=1
972
973    # Description of argument(s):
974    # ipv6_address        IPv6 address to be added.
975    # prefix_length       Prefix length of the IPv6 to be added.
976    # expected_status     Expected status while adding static IPv6 address.
977    # expected_ipv6       Expected IPv6 which gets added with truncated zeroes.
978    # CHANNEL_NUMBER      Channel number: 1 for eth0, 2 for eth1.
979
980    Wait Until Element Is Enabled  ${xpath_add_static_ipv6_addr_btn_eth0}  timeout=60sec
981    IF  '${CHANNEL_NUMBER}' == '1'
982      Click Element  ${xpath_eth0_interface}
983      Click Element  ${xpath_add_static_ipv6_addr_btn_eth0}
984    ELSE
985      Click Element  ${xpath_eth1_interface}
986      Click Element  ${xpath_add_static_ipv6_addr_btn_eth1}
987    END
988
989    Input Text  ${xpath_input_ip_address}  ${ipv6_address}
990    Input Text  ${xpath_input_prefix_length}  ${prefix_length}
991
992    Click Element  ${xpath_add_button}
993    IF  '${expected_status}' == 'Success'
994        IF  '${expected_ipv6}' == 'None'
995            Wait Until Page Contains  ${ipv6_address}  timeout=40sec
996        ELSE
997            Wait Until Page Contains  ${expected_ipv6}  timeout=40sec
998        END
999        Validate Network Config On BMC
1000    ELSE
1001        Page Should Contain  Invalid format
1002        Cancel And Verify Network Heading
1003    END
1004
1005
1006Add IPv6 Static Default Gateway And Verify
1007    [Documentation]  Add IPv6 static default gateway and verify.
1008    [Arguments]  ${ipv6_static_def_gw}  ${expected_status}=error
1009
1010    # Description of argument(s):
1011    # ipv6_static_def_gw  IPv6 static default gateway.
1012    # expected_status     Expected status (Success or Fail).
1013
1014    Wait Until Element Is Enabled  ${xpath_add_static_def_gateway_button}  timeout=60sec
1015    Click Element  ${xpath_add_static_def_gateway_button}
1016
1017    Input Text  ${xpath_input_ip_address}  ${ipv6_static_def_gw}
1018
1019    Click Element  ${xpath_add_button}
1020    IF  '${expected_status}' == 'Success'
1021        Wait Until Page Contains  ${ipv6_static_def_gw}  timeout=40sec
1022        Validate Network Config On BMC
1023    ELSE
1024        Page Should Contain  Invalid format
1025        Cancel And Verify Network Heading
1026    END
1027    ${redfish_ipv6_staticdef_gw}=  Get Static Default Gateway Property Via Redfish
1028    Should Be Equal  ${ipv6_static_def_gw}  ${redfish_ipv6_staticdef_gw}
1029
1030
1031Get Static Default Gateway Property Via Redfish
1032     [Documentation]  Get Static Default Gateway property value via redfish.
1033
1034     ${active_channel_config}=  Get Active Channel Config
1035     ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
1036     ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1037     ${ipv6_static_def_gw}=  Get From Dictionary  ${resp.dict}  IPv6StaticDefaultGateways
1038     RETURN  ${resp.dict["IPv6StaticDefaultGateways"][0]["Address"]}
1039
1040
1041Configure And Verify Network Settings Via GUI
1042    [Documentation]  Configure and verify network settings via GUI.
1043    [Arguments]  ${xpath_nw_settings}  ${xpath_nw_settings_input_field}  ${input_value}
1044
1045    # Description of argument(s):
1046    # xpath_nw_settings               xpath of the network settings.
1047    # xpath_nw_settings_input_field   xpath of the network setting's input field.
1048    # input_value                     Input value for configuration. E.g. hostname, IP etc.
1049
1050    Wait Until Keyword Succeeds  30 sec  10 sec  Click Element  ${xpath_nw_settings}
1051    Input Text  ${xpath_nw_settings_input_field}  ${input_value}
1052    Click Button  ${xpath_save_button}
1053
1054    # Re-Login gui and navigate to network page.
1055    Launch Browser Login GUI And Navigate To Network Page
1056
1057    Wait Until Page Contains  ${input_value}  timeout=30sec
1058
1059
1060Toggle DHCPv4 Property And Verify
1061    [Documentation]  Toggle DHVPv4 property and verify.
1062    [Arguments]  ${property}   ${xpath_property}
1063
1064    # Description of argument(s):
1065    # property          DHCP Property name (e.g. UseDNSServers, UseDomainName, etc.).
1066    # xpath_property    xpath of the DHCPv4 property.
1067
1068    Wait Until Page Contains Element  ${xpath_property}
1069
1070    ${redfish_before_set}=  Get DHCP Property Via Redfish  ${property}
1071    ${gui_before_set}=  Get Text  ${xpath_property}
1072
1073    Click Element  ${xpath_property}
1074    Verify Popup Message And Close Popup  ${xpath_success_popup}
1075    Wait Until Element Is Not Visible
1076    ...  ${xpath_page_loading_progress_bar}  timeout=120s
1077
1078    ${redfish_after_set}=  Get DHCP Property Via Redfish  ${property}
1079    Should Not Be Equal  ${redfish_before_set}  ${redfish_after_set}
1080
1081    ${gui_after_set}=  Get Text  ${xpath_property}
1082    Should Not Be Equal  ${gui_before_set}  ${gui_after_set}
1083
1084    Click Element At Coordinates   ${xpath_property}  0  0
1085    Verify Popup Message And Close Popup  ${xpath_success_popup}
1086
1087
1088Get DHCP Property Via Redfish
1089    [Documentation]  Get DHCPv4 property value via redfish.
1090    [Arguments]   ${property}
1091
1092    # Description of argument(s):
1093    # ${property}       DHCP Property name.
1094
1095    ${active_channel_config}=  Get Active Channel Config
1096    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
1097    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1098    RETURN  ${resp.dict["DHCPv4"]["${property}"]}
1099
1100
1101Verify Popup Message And Close Popup
1102    [Documentation]  Verify popup message and close popup.
1103    [Arguments]   ${popup_msg}
1104
1105    # Description of argument(s):
1106    # popup_msg        Popup message (Eg: Success or Error).
1107
1108    Wait Until Keyword Succeeds  1 min  15 sec
1109    ...  Wait Until Page Contains Element  ${popup_msg}
1110    Click Element  ${popup_msg}
1111
1112
1113Delete IP Address And Verify
1114    [Documentation]  Delete IPv4 or IPv6 address and verify deletion via GUI and BMC.
1115    [Arguments]  ${ip_version}  ${ip_addr}
1116
1117    # Description of argument(s):
1118    # ip_version   Either 'ipv4' or 'ipv6'.
1119    # ip_addr      IP address to be deleted.
1120
1121    ${delete_xpath}=  Set Variable If  '${ip_version}' == 'ipv4'
1122    ...  ${xpath_delete_ipv4_addres}  ${xpath_delete_ipv6_addres}
1123
1124    Wait Until Element Is Not Visible  ${xpath_page_loading_progress_bar}  timeout=120s
1125    Wait Until Element Is Enabled  ${delete_xpath}
1126
1127    Click Element  ${delete_xpath}
1128    Click Element  ${xpath_delete_button}
1129    Wait Until Page Contains Element  ${xpath_success_message}
1130    Sleep  ${NETWORK_TIMEOUT}s
1131
1132    # Verify IP on BMC is deleted.
1133    IF  '${ip_version}' == 'ipv4'
1134        ${delete_status}=  Run Keyword And Return Status  Verify IP On BMC  ${ip_addr}
1135    ELSE
1136        ${delete_status}=  Run Keyword And Return Status  Verify IPv6 On BMC  ${ip_addr}
1137    END
1138
1139    Should Be Equal  ${delete_status}  ${False}
1140    Wait Until Page Does Not Contain  ${ip_addr}
1141
1142
1143Modify IP Address And Verify
1144    [Documentation]  Modify IPv4 or IPv6 address via GUI.
1145    [Arguments]  ${ip_version}  ${old_ip}  ${new_ip}
1146
1147    # Description of argument(s):
1148    # ip_version   Either 'ipv4' or 'ipv6'.
1149    # old_ip       The existing IP address visible on GUI(ipv4 or ipv6).
1150    # new_ip       The new IP address to update(ipv4 or ipv6).
1151
1152    Wait Until Element Is Not Visible  ${xpath_page_loading_progress_bar}  timeout=120s
1153
1154    # Edit button based on version.
1155    ${edit_button}=  Set Variable If  '${ip_version}' == 'ipv4'
1156    ...  ${xpath_edit_ipv4_addres}  ${xpath_edit_ipv6_addres}
1157    Wait Until Element Is Enabled  ${edit_button}
1158    Click Element  ${edit_button}
1159
1160    # Add new IP and save.
1161    Input Text  ${xpath_input_ip_address}  ${new_ip}
1162    Click Element  ${xpath_add_button}
1163
1164    Wait Until Page Contains Element  ${xpath_success_message}
1165    Sleep  ${NETWORK_TIMEOUT}s
1166
1167    # Verify IP on BMC.
1168    IF  '${ip_version}' == 'ipv4'
1169      ${edit_status}=  Run Keyword And Return Status  Verify IP On BMC  ${new_ip}
1170    ELSE
1171      ${edit_status}=  Run Keyword And Return Status  Verify IPv6 On BMC  ${new_ip}
1172    END
1173
1174    Should Be Equal  ${edit_status}  ${True}
1175    Wait Until Page Contains  ${new_ip}
1176
1177
1178Delete Default IPv6 Gateway And Verify
1179   [Documentation]  Delete default IPv6 gateway and verify.
1180   [Arguments]  ${ip_addr}
1181
1182   # Description of argument(s):
1183   # ip_addr      IP address to be deleted.
1184
1185   Wait Until Page Contains  ${ip_addr}
1186   Wait Until Element Is Not Visible   ${xpath_page_loading_progress_bar}  timeout=120s
1187   Wait Until Element Is Enabled  ${xpath_delete_ipv6_def_gateway_addr}
1188   Click Element  ${xpath_delete_ipv6_def_gateway_addr}
1189   Click Element  ${xpath_delete_button}
1190   Wait Until Page Contains Element   ${xpath_success_message}
1191   Sleep  ${NETWORK_TIMEOUT}s
1192
1193   # Verify delete IP via redfish.
1194   ${delete_status}=  Run Keyword And Return Status  Get Static Default Gateway Property Via Redfish
1195   Should Be Equal  ${delete_status}  ${False}
1196
1197   Wait Until Page Does Not Contain Element  ${xpath_delete_ipv6_def_gateway_addr}
1198
1199
1200Modify Default IPv6 Gateway And Verify
1201    [Documentation]  Modify Default IPv6 Gateway And Verify.
1202    [Arguments]  ${old_static_def_gw}  ${new_static_def_gw}
1203
1204    # Description of argument(s):
1205    # old_static_def_gw       The existing IPv6 address visible on GUI.
1206    # new_static_def_gw       The new IPv6 address to update.
1207
1208    Wait Until Element Is Not Visible  ${xpath_page_loading_progress_bar}  timeout=120s
1209    Wait Until Element Is Enabled  ${xpath_edit_ipv6_def_gateway_addr}
1210    Click Element  ${xpath_edit_ipv6_def_gateway_addr}
1211
1212    # Add new IP and save.
1213    Input Text  ${xpath_input_ip_address}  ${new_static_def_gw}
1214    Click Element  ${xpath_add_button}
1215
1216    Wait Until Page Contains Element  ${xpath_success_message}
1217    Sleep  ${NETWORK_TIMEOUT}s
1218
1219    # Verify IP via redfish.
1220    ${new_static_def_gw_redfish}=  Get Static Default Gateway Property Via Redfish
1221    Should Be Equal  ${new_static_def_gw}  ${new_static_def_gw_redfish}
1222
1223    Wait Until Page Contains Element  ${xpath_edit_ipv6_def_gateway_addr_1}
1224
1225
1226Get Network Interface Details
1227   [Documentation]  Get network interface details.
1228   [Arguments]   ${channel_number}
1229
1230   # Description of argument(s):
1231   # channel_number   Interface Channel Number(eg.eth0 or eth1).
1232
1233   ${active_channel_config}=  Get Active Channel Config
1234   ${ethernet_interface}=  Set Variable  ${active_channel_config['${channel_number}']['name']}
1235   ${resp}=  redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1236   RETURN  ${resp.dict}
1237
1238
1239Cancel And Verify Network Heading
1240    [Documentation]  Cancel and verify network heading.
1241
1242    Click Button  ${xpath_cancel_button}
1243    Wait Until Keyword Succeeds  10 sec  5 sec
1244    ...  Refresh GUI And Verify Element Value  ${xpath_network_heading}  Network
1245
1246
1247Set IPv6 AutoConfig State
1248    [Documentation]  Set SLAAC state and verify.
1249    [Arguments]    ${desired_autoconfig_state}  ${channel_number}
1250
1251    # Description of argument(s):
1252    # desired_autoconfig_state      IPv6 autoconfig Toggle state(eg: Enabled or Disabled).
1253    # xpath_ipv6_autoconfig_button  xpath of eth0 or eth1 ipv6 autoconfig button.
1254
1255    IF  '${channel_number}' == '1'
1256      ${xpath_autoconfig_button}=  Set Variable  ${xpath_eth0_autoconfig_button}
1257      Click Element  ${xpath_eth0_interface}
1258      Set Suite Variable  ${CHANNEL_NUMBER}  1
1259    ELSE IF  '${channel_number}' == '2'
1260      ${xpath_autoconfig_button}=  Set Variable  ${xpath_eth1_autoconfig_button}
1261      Click Element  ${xpath_eth1_interface}
1262      Set Suite Variable  ${CHANNEL_NUMBER}  2
1263    END
1264
1265    ${current_autoconfig_state}=    Get Text    ${xpath_autoconfig_button}
1266
1267    IF  '${desired_autoconfig_state}' == '${current_autoconfig_state}'
1268      Perform SLAAC Toggle  ${xpath_autoconfig_button}  ${channel_number}
1269      Perform SLAAC Toggle  ${xpath_autoconfig_button}  ${channel_number}
1270    ELSE
1271      Perform SLAAC Toggle  ${xpath_autoconfig_button}  ${channel_number}
1272    END
1273
1274    Wait Until Keyword Succeeds  2 min  30 sec
1275    ...  Element Text Should Be  ${xpath_autoconfig_button}  ${desired_autoconfig_state}
1276
1277    IF  '${desired_autoconfig_state}' == 'Enabled'
1278      Verify SLAAC Address On Autoconfig Enable
1279    ELSE IF  '${desired_autoconfig_state}' == 'Disabled'
1280      Wait Until Page Does Not Contain  SLAAC  timeout=60s
1281    END
1282    Reload Page
1283    Wait Until Element Is Not Visible  ${xpath_page_loading_progress_bar}  timeout=120s
1284
1285
1286Perform SLAAC Toggle
1287    [Documentation]  Toggle SLAAC button.
1288    [Arguments]  ${xpath_autoconfig_button}  ${channel_number}
1289
1290    # Description of argument(s):
1291    # xpath_autoconfig_button   SLAAC Toggle button xpath.
1292    # channel_number            Channel number: 1 for eth0, 2 for eth1.
1293
1294    Reload Page
1295    Wait Until Element Is Enabled  ${xpath_autoconfig_button}  timeout=60s
1296
1297    IF  '${channel_number}' == '2'
1298      Click Element  ${xpath_eth1_interface}
1299    END
1300
1301    Click Element  ${xpath_autoconfig_button}
1302    Wait Until Element Is Not Visible  ${xpath_page_loading_progress_bar}  timeout=120s
1303
1304
1305Set SLAAC Property On Eth0 And Eth1
1306    [Documentation]  Enable or Disable and verify slaac on both interfaces.
1307    [Arguments]  ${State}=Enabled
1308
1309    # Description of argument(s):
1310    # ${State}  Enabled or Disabled on both interfaces
1311
1312    Set IPv6 AutoConfig State  ${State}  1
1313    Set IPv6 AutoConfig State  ${State}  2
1314
1315
1316Verify SLAAC Address On Autoconfig Enable
1317    [Documentation]  Verify SLAAC IPv6 on autoconfig enable.
1318
1319    TRY
1320      Sleep  ${NETWORK_TIMEOUT}
1321      @{ipv6_address_origin_list}  ${ipv6_slaac_addr}=
1322    ...    Get Address Origin List And Address For Type  SLAAC
1323    EXCEPT
1324      Log  SLAAC gateway setup not Enabled!  WARN
1325      RETURN
1326    ELSE
1327      Wait Until Page Contains  ${ipv6_slaac_addr}  timeout=60sec
1328      Wait Until Page Contains  SLAAC  timeout=60sec
1329    END
1330
1331
1332Toggle DHCPv4 State And Verify
1333    [Documentation]  Toggle DHCPv4 state and verify for eth1.
1334    [Arguments]  ${desired_dhcpv4_state}  ${channel_number}=2
1335
1336    # Description of argument(s):
1337    # desired_dhcpv4_state  DHCPv4 Toggle state (Enabled or Disabled).
1338    # channel_number        Channel number: 1 for eth0, 2 for eth1.
1339
1340    IF  '${channel_number}' == '1'
1341      ${xpath_dhcpv4_button}=  Set Variable  ${xpath_eth0_dhcpv4_button}
1342      Click Element  ${xpath_eth0_interface}
1343      Set Suite Variable  ${CHANNEL_NUMBER}  1
1344    ELSE IF  '${channel_number}' == '2'
1345      ${xpath_dhcpv4_button}=  Set Variable  ${xpath_eth1_dhcpv4_button}
1346      Click Element  ${xpath_eth1_interface}
1347      Set Suite Variable  ${CHANNEL_NUMBER}  2
1348    END
1349
1350    ${current_dhcpv4_state}=  Get Text  ${xpath_dhcpv4_button}
1351
1352    IF  '${desired_dhcpv4_state}' == '${current_dhcpv4_state}'
1353      Perform DHCPv4 Toggle  ${xpath_dhcpv4_button}  ${channel_number}
1354      Perform DHCPv4 Toggle  ${xpath_dhcpv4_button}  ${channel_number}
1355    ELSE
1356      Perform DHCPv4 Toggle  ${xpath_dhcpv4_button}  ${channel_number}
1357    END
1358
1359    Wait Until Keyword Succeeds  2 min  30 sec
1360    ...  Element Text Should Be  ${xpath_dhcpv4_button}  ${desired_dhcpv4_state}
1361
1362    IF  '${desired_dhcpv4_state}' == 'Enabled'
1363      TRY
1364        @{ipv4_addressorigin_list}  ${ipv4_addr_list}=
1365        ...  Get Address Origin List And IPv4 or IPv6 Address  IPv4Addresses
1366        Should Contain  ${ipv4_addressorigin_list}  DHCP
1367      EXCEPT
1368        Log  DHCP setup is missing!  WARN
1369        RETURN
1370      ELSE
1371        Wait Until Element Contains  ${ipv4_elements}  DHCP  timeout=30s
1372      END
1373    ELSE IF  '${desired_dhcpv4_state}' == 'Disabled'
1374      Element Should Not Contain  ${ipv4_elements}  DHCP  timeout=60s
1375    END
1376    Reload Page
1377    Wait Until Element Is Not Visible  ${xpath_page_loading_progress_bar}  timeout=120s
1378
1379
1380Perform DHCPv4 Toggle
1381    [Documentation]  Toggle DHCPv4 button.
1382    [Arguments]  ${xpath_dhcpv4_button}  ${channel_number}
1383
1384    # Description of argument(s):
1385    # xpath_dhcpv4_button   DHCPv4 Toggle button xpath.
1386    # channel_number        Channel number: 1 for eth0, 2 for eth1.
1387
1388    Reload Page
1389    Wait Until Element Is Enabled  ${xpath_dhcpv4_button}  timeout=60s
1390
1391    IF  '${channel_number}' == '2'
1392      Click Element  ${xpath_eth1_interface}
1393    END
1394
1395    Click Element  ${xpath_dhcpv4_button}
1396    Click Element  ${xpath_dhcpv4_alert}
1397    Wait Until Element Is Not Visible  ${xpath_page_loading_progress_bar}  timeout=120s
1398
1399
1400Toggle DHCPv6 State And Verify
1401    [Documentation]  Toggle DHCPv6 state and verify.
1402    [Arguments]  ${desired_dhcpv6_state}  ${channel_number}
1403
1404    # Description of argument(s):
1405    # desired_dhcpv6_state  DHCPv6 Toggle state (Enabled or Disabled).
1406    # channel_number        Channel number: 1 for eth0, 2 for eth1.
1407
1408    IF  '${channel_number}' == '1'
1409      ${xpath_dhcpv6_button}=  Set Variable  ${xpath_eth0_dhcpv6_button}
1410      Click Element  ${xpath_eth0_interface}
1411      Set Suite Variable  ${CHANNEL_NUMBER}  1
1412    ELSE IF  '${channel_number}' == '2'
1413      ${xpath_dhcpv6_button}=  Set Variable  ${xpath_eth1_dhcpv6_button}
1414      Click Element  ${xpath_eth1_interface}
1415      Set Suite Variable  ${CHANNEL_NUMBER}  2
1416    END
1417
1418    ${current_dhcpv6_state}=  Get Text  ${xpath_dhcpv6_button}
1419
1420    IF  '${desired_dhcpv6_state}' == '${current_dhcpv6_state}'
1421      Perform DHCPv6 Toggle  ${xpath_dhcpv6_button}  ${channel_number}
1422      Perform DHCPv6 Toggle  ${xpath_dhcpv6_button}  ${channel_number}
1423    ELSE
1424      Perform DHCPv6 Toggle  ${xpath_dhcpv6_button}  ${channel_number}
1425    END
1426
1427    Wait Until Keyword Succeeds  2 min  30 sec
1428    ...  Element Text Should Be  ${xpath_dhcpv6_button}  ${desired_dhcpv6_state}
1429
1430    IF  '${desired_dhcpv6_state}' == 'Enabled'
1431      Verify DHCPv6 Address On Enable
1432    ELSE IF  '${desired_dhcpv6_state}' == 'Disabled'
1433      Wait Until Page Does Not Contain  DHCPv6  timeout=60s
1434    END
1435    Reload Page
1436    Wait Until Element Is Not Visible  ${xpath_page_loading_progress_bar}  timeout=120s
1437
1438
1439Perform DHCPv6 Toggle
1440    [Documentation]  Toggle DHCPv6 button.
1441    [Arguments]  ${xpath_dhcpv6_button}  ${channel_number}
1442
1443    # Description of argument(s):
1444    # xpath_dhcpv6_button   DHCPv6 Toggle button xpath.
1445    # channel_number        Channel number: 1 for eth0, 2 for eth1.
1446
1447    Reload Page
1448    Wait Until Element Is Enabled  ${xpath_dhcpv6_button}  timeout=60s
1449
1450    IF  '${channel_number}' == '2'
1451      Click Element  ${xpath_eth1_interface}
1452    END
1453
1454    Click Element  ${xpath_dhcpv6_button}
1455    Wait Until Element Is Not Visible  ${xpath_page_loading_progress_bar}  timeout=120s
1456
1457
1458Verify DHCPv6 Address On Enable
1459    [Documentation]  Verify DHCPv6 on enable, if missing log warning and continue.
1460
1461    TRY
1462      @{ipv6_address_origin_list}  ${ipv6_dhcpv6_addr}=
1463      ...  Get Address Origin List And Address For Type  DHCPv6
1464    EXCEPT
1465      Log  DHCPv6 setup is missing!  WARN
1466      RETURN
1467    ELSE
1468      Wait Until Page Contains  ${ipv6_dhcpv6_addr}  timeout=30s
1469      Wait Until Page Contains  DHCPv6  timeout=30s
1470    END
1471
1472
1473Set And Verify DHCPv6 States
1474    [Documentation]  Set and verify DHCPv6 states.
1475    [Arguments]  ${eth0_state}  ${eth1_state}
1476
1477    # Description of argument(s):
1478    # eth0_state    DHCPv6 toggle state of eth0(Enabled or Disabled).
1479    # eth1_state    DHCPv6 toggle state of eth1(Enabled or Disabled).
1480
1481    # Channel 1: eth0.
1482    Toggle DHCPv6 State And Verify  ${eth0_state}  1
1483    # Channel 2: eth1.
1484    Toggle DHCPv6 State And Verify  ${eth1_state}  2
1485
1486
1487Verify Persistency Of IPv6 On BMC Reboot
1488    [Documentation]  Verify IPv6 persistency on BMC reboot for the specified interface.
1489    [Arguments]  ${ipv6_type}  ${channel_number}=${CHANNEL_NUMBER}
1490
1491    # Description of argument(s):
1492    # ipv6_type       Type of IPv6 address(e.g:slaac/static/linklocal).
1493    # channel_number  Ethernet channel number, 1(eth0) or 2(eth1).
1494
1495    IF  '${channel_number}' == '1'
1496        # Capture IPv6 addresses before reboot.
1497        Set Suite Variable  ${CHANNEL_NUMBER}  1
1498        @{ipv6_address_origin_list}  ${addr_before_reboot}=
1499        ...  Get Address Origin List And Address For Type  ${ipv6_type}
1500
1501        Reboot BMC via GUI
1502        Launch Browser Login GUI And Navigate To Network Page
1503
1504        # Capture IPv6 addresses after reboot.
1505        Set Suite Variable  ${CHANNEL_NUMBER}  1
1506        @{ipv6_address_origin_list}  ${addr_after_reboot}=
1507        ...  Get Address Origin List And Address For Type  ${ipv6_type}
1508
1509        Should Be Equal    ${addr_before_reboot}    ${addr_after_reboot}
1510        Click Element  ${xpath_network_sub_menu}
1511    ELSE IF  '${channel_number}' == '2'
1512        # Capture IPv6 addresses before reboot.
1513        Set Suite Variable  ${CHANNEL_NUMBER}  2
1514        @{ipv6_address_origin_list}  ${addr_before_reboot}=
1515        ...  Get Address Origin List And Address For Type  ${ipv6_type}
1516
1517        Reboot BMC via GUI
1518        Launch Browser Login GUI And Navigate To Network Page
1519
1520        # Capture IPv6 addresses after reboot.
1521        Set Suite Variable  ${CHANNEL_NUMBER}  2
1522        @{ipv6_address_origin_list}  ${addr_after_reboot}=
1523        ...  Get Address Origin List And Address For Type  ${ipv6_type}
1524
1525        Should Be Equal    ${addr_before_reboot}    ${addr_after_reboot}
1526        Click Element  ${xpath_network_sub_menu}
1527        Click Element  ${xpath_eth1_interface}
1528    END
1529    Wait Until Page Contains  ${addr_after_reboot}
1530    Wait Until Page Contains  ${ipv6_type}
1531
1532
1533Collect All IP Addresses On Both Interfaces
1534    [Documentation]  Collecting all the IP addresses on both interfaces.
1535    [Arguments]  ${ip_version}  ${channel_number}
1536
1537    # Description of argument(s):
1538    # ip_version      Either 'ipv4' or 'ipv6'.
1539    # channel_number  Ethernet channel number, 1(eth0) or 2(eth1).
1540
1541    IF  '${channel_number}' == '1'
1542      Wait Until Element Is Enabled  ${xpath_eth1_interface}  timeout=60s
1543      Click Element  ${xpath_eth0_interface}
1544    ELSE
1545      Wait Until Element Is Enabled  ${xpath_eth1_interface}  timeout=60s
1546      Click Element  ${xpath_eth1_interface}
1547    END
1548
1549    IF  '${ip_version}' == 'ipv4'
1550      Wait Until Element Is Enabled  ${xpath_add_static_ipv4_addr_btn_eth0}  timeout=30s
1551      ${ip_elements}=  Get WebElements  ${ipv4_elements}
1552    ELSE IF  '${ip_version}' == 'ipv6'
1553      Wait Until Element Is Enabled  ${xpath_add_static_ipv6_addr_btn_eth0}  timeout=30s
1554      ${ip_elements}=  Get WebElements  ${ipv6_elements}
1555    ELSE
1556      Fail  Invalid IP version provided. Use 'ipv4' or 'ipv6'.
1557    END
1558
1559    ${ip_list}=  Create List
1560    FOR  ${elem}  IN  @{ip_elements}
1561      ${ip}=  Get Text  ${elem}
1562      ${ip}=  Strip String  ${ip}
1563      IF  '${ip}' != '' and '${ip}' != 'No items available'
1564        Append To List  ${ip_list}  ${ip}
1565      END
1566    END
1567    RETURN  ${ip_list}
1568
1569
1570Enable Or Disable DHCPv6 And Verify Impact On IPv4 Settings
1571    [Documentation]  Enable or Disable DHCPv6 and it does not have impact on IPv4 settings.
1572    [Arguments]  ${ip_version}  ${channel_number}  ${desired_dhcpv6_state}
1573
1574    # Description of argument(s):
1575    # ip_version            Either 'ipv4' or 'ipv6'.
1576    # channel_number        Ethernet channel number, 1(eth0) or 2(eth1).
1577    # desired_dhcpv6_state  DHCPv6 Toggle state (Enabled or Disabled).
1578
1579    # Capture IPv4 addresses before disabling DHCPv6.
1580    ${ipv4_before}=  Collect All IP Addresses On Both Interfaces  ${ip_version}  ${channel_number}
1581
1582    Toggle DHCPv6 State And Verify  ${desired_dhcpv6_state}  ${channel_number}
1583    Sleep  ${NETWORK_TIMEOUT}
1584    Reload Page
1585    Wait Until Element Is Enabled  ${xpath_static_ipv4}  timeout=30s
1586
1587    # Capture IPv4 addresses after disabling DHCPv6.
1588    ${ipv4_after}=  Collect All IP Addresses On Both Interfaces  ${ip_version}  ${channel_number}
1589    Lists Should Be Equal  ${ipv4_before}  ${ipv4_after}  ignore_order=True
1590
1591
1592Get IPv4 Values From Eth1
1593    [Documentation]  Capturing IPv4 values before DHCP toggle.
1594
1595    ${active_channel_config}=  Get Active Channel Config
1596    ${ethernet_interface}=  Set Variable  ${active_channel_config['${2}']['name']}
1597    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
1598    @{network_configurations}=  Get From Dictionary  ${resp.dict}  IPv4StaticAddresses
1599    RETURN  @{network_configurations}
1600
1601
1602Assign Static IP Address on Eth1
1603    [Documentation]  Assigning static IPv4 on eth1.
1604
1605    Sleep  ${NETWORK_TIMEOUT}
1606    FOR  ${ip}  IN  @{ipv4_eth1}
1607      Add Static IP Address And Verify  ${ip['Address']}  ${ip['SubnetMask']}  ${ip['Gateway']}  Success  2
1608    END
1609
1610
1611Coexistence Of IP Addresses
1612    [Documentation]  Checking coexistence of IP addresses on both interfaces.
1613    [Arguments]  ${channel_number}  @{address_types}
1614
1615    # Description of argument(s):
1616    # channel_number   Ethernet channel number, 1(eth0) or 2(eth1).
1617    # address_types    Type of IPv4/IPv6 address(slaac/linklocal/dhcp/static).
1618
1619    IF  '${channel_number}' == '1'
1620      Wait Until Element Is Enabled  ${xpath_eth0_interface}  timeout=60s
1621      Click Element  ${xpath_eth0_interface}
1622    ELSE
1623      Wait Until Element Is Enabled  ${xpath_eth1_interface}  timeout=60s
1624      Click Element  ${xpath_eth1_interface}
1625    END
1626
1627    # Get IPv4 origins
1628    ${ipv4_elems}=  Get WebElements  ${ipv4_addr_origin_elements}
1629    ${ipv4_list}=  Get IP Origins  @{ipv4_elems}
1630
1631    # Get IPv6 origins
1632    ${ipv6_elems}=  Get WebElements  ${ipv6_addr_origin_elements}
1633    ${ipv6_list}=  Get IP Origins  @{ipv6_elems}
1634
1635    # Validate all expected types
1636    FOR  ${type}  IN  @{address_types}
1637      Validate Expected IPv4 And IPv6 Origin  ${type}  ${ipv4_list}  ${ipv6_list}
1638    END
1639
1640
1641Get IP Origins
1642    [Documentation]  Getting IP Origins.
1643    [Arguments]  @{elements}
1644
1645    # Description of argument(s):
1646    # elements   List of IPv4 or IPv6 origins.
1647
1648    ${list}=  Create List
1649    FOR  ${e}  IN  @{elements}
1650      ${t}=  Strip String  ${e.text}
1651      IF  '${t}' != '' and '${t}' != 'No items available'
1652        Append To List  ${list}  ${t}
1653      END
1654    END
1655    RETURN  ${list}
1656
1657
1658Validate Expected IPv4 And IPv6 Origin
1659    [Documentation]  Validate IPv4 and IPv6 origin.
1660    [Arguments]  ${type}  ${ipv4_list}  ${ipv6_list}
1661
1662    # Description of argument(s):
1663    # type       Type of IP address(IPv4/IPv6).
1664    # ipv4_list  List of IPv4 origins.
1665    # ipv6_list  List of IPv6 origins.
1666
1667    ${origin}=  Replace String  ${type}    v4  ${EMPTY}
1668    ${origin}=  Replace String  ${origin}  v6  ${EMPTY}
1669
1670    IF  $type.endswith('v4')
1671      ${target_list}=  Set Variable  ${ipv4_list}
1672    ELSE
1673      ${target_list}=  Set Variable  ${ipv6_list}
1674    END
1675
1676    Should Contain  ${target_list}  ${origin}
1677
1678
1679Configure IPv4 And IPv6 On Both Interfaces
1680    [Documentation]  Add IPv4 and IPv6 on both interfaces.
1681
1682    Add Static IP Address And Verify  ${test_ipv4_addr}  ${test_subnet_mask}
1683    ...  ${default_gateway}  Success
1684    Add Static IP Address And Verify  ${test_ipv4_addr_1}  ${test_subnet_mask}
1685    ...  ${default_gateway_2}  Success  2
1686    Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr_2}
1687    ...  ${test_prefix_length}  Success
1688    Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr}
1689    ...  ${test_prefix_length}  Success  None  2
1690
1691
1692Enable Or Disable SLAAC And Verify Impact On Existing Settings
1693    [Documentation]  Enable or disable slaac and verify impact on existing settings.
1694    [Arguments]  ${ip_version}  ${channel_number}  ${desired_slaac_state}
1695
1696    # Description of argument(s):
1697    # ip_version            Either 'ipv4' or 'ipv6'.
1698    # channel_number        Ethernet channel number, 1(eth0) or 2(eth1).
1699    # desired_slaac_state   Set autoconfig state (Enabled or Disabled).
1700
1701    # Capture existing settings on both interfaces before changing slaac state.
1702    ${ip_addresses_before_eth0}=  Collect All IP Addresses On Both Interfaces  ${ip_version}  1
1703    ${ip_addresses_before_eth1}=  Collect All IP Addresses On Both Interfaces  ${ip_version}  2
1704
1705    IF  '${channel_number}' == '1'
1706        Click Element  ${xpath_eth0_interface}
1707        Set IPv6 AutoConfig State  ${desired_slaac_state}  ${channel_number}
1708    ELSE
1709        Click Element  ${xpath_eth1_interface}
1710        Set IPv6 AutoConfig State  ${desired_slaac_state}  ${channel_number}
1711    END
1712
1713    Sleep  ${NETWORK_TIMEOUT}
1714
1715    # Capture settings on both interfaces after changing slaac state.
1716    ${ip_addresses_after_eth0}=  Collect All IP Addresses On Both Interfaces  ${ip_version}  1
1717    ${ip_addresses_after_eth1}=  Collect All IP Addresses On Both Interfaces  ${ip_version}  2
1718
1719    # Verify existing  network settings remains intact after slaac state change.
1720    Lists Should Be Equal  ${ip_addresses_before_eth0}  ${ip_addresses_after_eth0}  ignore_order=True
1721    Lists Should Be Equal  ${ip_addresses_before_eth1}  ${ip_addresses_after_eth1}  ignore_order=True
1722