xref: /openbmc/openbmc-test-automation/gui/gui_test/settings_menu/test_network_sub_menu.robot (revision 979b3f9dd145ba0076377acc758b76f87e34da6d)
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_static_ipv4}                     //h2[text()="IPv4"]
20${xpath_static_ipv6}                     //h2[text()="IPv6"]
21${xpath_static_ipv6_default_gateway}     //h2[text()="IPv6 static default gateways"]
22${xpath_domain_name_toggle}              //*[@data-test-id="networkSettings-switch-useDomainName"]
23${xpath_ntp_servers_toggle}              //*[@data-test-id="networkSettings-switch-useNtp"]
24${xpath_add_static_ipv4_address_button}  //button[contains(text(),"Add static IPv4 address")]
25${xpath_add_static_ipv6_address_button}  //button[contains(text(),"Add static IPv6 address")]
26${xpath_add_static_def_gateway_button}   //button[contains(text(),"Add IPv6 static default gateway address")]
27${xpath_hostname}                        //*[@title="Edit hostname"]
28${xpath_hostname_input}                  //*[@id="hostname"]
29${xpath_input_ip_address}                //*[@id="ipAddress"]
30${xpath_input_gateway}                   //*[@id="gateway"]
31${xpath_input_subnetmask}                //*[@id="subnetMask"]
32${xpath_input_ipv6address}               //*[@id="ipAddress"]
33${xpath_input_prefix_length}             //*[@id="prefixLength"]
34${xpath_input_addressorigin}             //*[@id="Address Origin"]
35${xpath_cancel_button}                   //button[contains(text(),'Cancel')]
36${xpath_delete_dns_server}               //*[@title="Delete DNS address"]
37${xpath_save_button}                     //button[contains(text(),'Save')]
38${xpath_dhcp_toggle_switch}              //*[@id='dhcpSwitch']
39${xpath_dhcpv6_toggle_switch}            //*[@id='dhcpIpv6Switch']
40${xpath_slaac_toggle_switch}             //*[@id='ipv6AutoConfigSwitch']
41${xpath_lldp_toggle_switch}              //*[@id='useLLDPSwitch']
42${xpath_ntp_switch_button}               //*[@id="useNtpSwitch"]/following-sibling::label
43${xpath_dns_switch_button}               //*[@id="useDnsSwitch"]/following-sibling::label
44${xpath_domainname_switch_button}        //*[@id="useDomainNameSwitch"]/following-sibling::label
45${xpath_success_popup}                   //*[contains(text(),'Success')]/following-sibling::button
46${ipv4_elements}                         //h2[contains(., "IPv4")]/following::table[1]/tbody/tr/td[1]
47${ipv6_elements}                         //h2[contains(., "IPv6")]/following::table[1]/tbody/tr/td[1]
48${xpath_delete_ipv4_addres}              //*[text()='${test_ipv4_addr_2}']/following::td[4]
49...                                      //*[@title="Delete IPv4 address"]
50${xpath_delete_ipv6_addres}              //*[text()='${test_ipv6_addr_2}']/following::td[3]
51...                                      //*[@title="Delete IPv6 address"]
52${xpath_edit_ipv4_addres}                //*[text()='${test_ipv4_addr}']/following::td[4]
53...                                      //*[@title="Edit static IPv4 address"]
54${xpath_edit_ipv6_addres}                //*[text()='${test_ipv6_addr}']/following::td[3]
55...                                      //*[@title="Edit static IPv6 address"]
56${xpath_delete_ipv6_def_gateway_addr}    //*[text()='${test_ipv6_addr_1}']/following::td[1]
57...                                      //*[@title="Delete IPv6 static default gateway address"]
58${xpath_edit_ipv6_def_gateway_addr}      //*[text()='${test_ipv6_addr}']/following::td[1]
59...                                      //*[@title="Edit IPv6 static default gateway address"]
60${xpath_edit_ipv6_def_gateway_addr_1}    //*[text()='${test_ipv6_addr_1}']/following::td[1]
61...                                      //*[@title="Edit IPv6 static default gateway address"]
62${xpath_ipv6_addr_edit_button}           //*[text()='{}']/following::td[3]
63...                                      //*[@title="Edit static IPv6 address"]
64${xpath_ipv6_addr_delete_button}         //*[text()='{}']/following::td[3]
65...                                      //*[@title="Delete IPv6 address"]
66${xpath_delete_button}                   //*[text()="Delete"]
67${xpath_eth0_interface}                  //*[text()="eth0"]
68${xpath_eth1_interface}                  //*[text()="eth1"]
69${xpath_linklocalv6}                     //*[text()="LinkLocal"]
70${xpath_eth0_ipv6_autoconfig_button}     (//*[@id="ipv6AutoConfigSwitch"]/following-sibling::label)[1]
71${xpath_eth1_ipv6_autoconfig_button}     (//*[@id="ipv6AutoConfigSwitch"]/following-sibling::label)[2]
72${xpath_eth0_dhcpv6_button}              (//*[@id="dhcpIpv6Switch"]/following-sibling::label)[1]
73${xpath_eth1_dhcpv6_button}              (//*[@id="dhcpIpv6Switch"]/following-sibling::label)[2]
74${dns_server}                            10.10.10.10
75${test_ipv4_addr}                        10.7.7.7
76${test_ipv4_addr_1}                      10.7.7.8
77${test_ipv4_addr_2}                      10.7.6.5
78${test_ipv6_addr}                        2001:db8:3333:4444:5555:6666:7777:8888
79${test_ipv6_addr_1}                      2001:db8:3333:4444:5555:6666:7777:8889
80${test_ipv6_addr_2}                      2001:db8:3333:4444:5555:6666:7777:8890
81${ipv4_hexword_addr}                     10.5.5.6:1A:1B:1C:1D:1E:1F
82${invalid_hexadec_ipv6}                  x:x:x:x:x:x:10.5.5.6
83${ipv6_multi_short}                      2001::33::111
84${ipv6_with_leadingzeroes_addr}          2001:0022:0033::0111
85${ipv6_without_leadingzeroes_addr}       2001:22:33::111
86${ipv6_onehextet_zero}                   2001:0022:1133::1111
87${ipv6_eliminate_onehextet_zero}         2001:22:1133::1111
88${link_local_addr}                       fe80::
89${link_local_prefix_len}                 10
90${test_prefix_length}                    64
91${out_of_range_ip}                       10.7.7.256
92${string_ip}                             aa.bb.cc.dd
93${negative_ip}                           10.-7.-7.-7
94${less_octet_ip}                         10.3.36
95${hex_ip}                                0xa.0xb.0xc.0xd
96${spl_char_ip}                           @@@.%%.44.11
97${test_subnet_mask}                      255.255.255.0
98${alpha_netmask}                         ff.ff.ff.ff
99${out_of_range_netmask}                  255.256.255.0
100${more_byte_netmask}                     255.255.255.0.0
101${lowest_netmask}                        128.0.0.0
102${test_hostname}                         openbmc
103
104*** Test Cases ***
105
106Verify Navigation To Network Page
107    [Documentation]  Login to GUI and navigate to the settings sub-menu network page.
108    [Tags]  Verify_Navigation_To_Network_Page
109
110    Page Should Contain Element  ${xpath_network_heading}
111
112Verify Existence Of All Sections In Network Page
113    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
114    ...  and confirm the page contains sections that should be accessible.
115    [Tags]  Verify_Existence_Of_All_Sections_In_Network_Page
116
117    Wait Until Page Contains Element  ${xpath_network_settings}  timeout=1min
118    Page Should Contain Element  ${xpath_interface_settings}
119    Page Should Contain Element  ${xpath_static_ipv4}
120    Page Should Contain Element  ${xpath_static_ipv6}
121    Page Should Contain Element  ${xpath_static_ipv6_default_gateway}
122    Page Should Contain Element  ${xpath_static_dns}
123
124
125Verify Existence Of All Buttons In Network Page
126    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
127    ...  and confirm the page contains basic features button that should be accessible.
128    [Tags]  Verify_Existence_Of_All_Buttons_In_Network_Page
129
130    Page Should Contain Button  ${xpath_add_static_ipv4_address_button}
131    Page Should Contain Button  ${xpath_add_static_ipv6_address_button}
132    Page Should Contain Button  ${xpath_add_dns_ip_address_button}
133    Page Should Contain Button  ${xpath_domain_name_toggle}
134    Page Should Contain Button  ${xpath_dns_servers_toggle}
135    Page Should Contain Button  ${xpath_ntp_servers_toggle}
136    Page Should Contain Button  ${xpath_dhcp_toggle_switch}
137    Page Should Contain Button  ${xpath_dhcpv6_toggle_switch}
138    Page Should Contain Button  ${xpath_slaac_toggle_switch}
139    Page Should Contain Button  ${xpath_lldp_toggle_switch}
140
141
142Verify Existence Of All Fields In Hostname
143    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
144    ...  and confirm hostname contains all the fields.
145    [Tags]  Verify_Existence_Of_All_Fields_In_Hostname
146    [Teardown]  Cancel And Verify Network Heading
147
148    Click Element  ${xpath_hostname}
149    Wait Until Page Contains  Edit hostname  timeout=1min
150    Page Should Contain Textfield  ${xpath_hostname_input}
151    Page Should Contain Button  ${xpath_cancel_button}
152    Page Should Contain Button  ${xpath_save_button}
153
154
155Verify Existence Of All Fields In Static IP Address
156    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
157    ...  and confirm section static IPv4 contains all the fields.
158    [Tags]  Verify_Existence_Of_All_Fields_In_Static_IP_Address
159    [Teardown]  Cancel And Verify Network Heading
160
161    Wait Until Keyword Succeeds  30 sec  10 sec  Click Element  ${xpath_add_static_ipv4_address_button}
162    Wait Until Page Contains  Add static IPv4 address  timeout=15s
163    Page Should Contain Textfield  ${xpath_input_ip_address}
164    Page Should Contain Textfield  ${xpath_input_gateway}
165    Page Should Contain Textfield  ${xpath_input_subnetmask}
166    Page Should Contain Button  ${xpath_cancel_button}
167    Page Should Contain Button  ${xpath_add_button}
168
169
170Verify Existence Of All Fields In Static IPv6 Address
171    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
172    ...  and confirm section static IPv6 contains all the fields.
173    [Tags]  Verify_Existence_Of_All_Fields_In_Static_IPv6_Address
174    [Teardown]  Cancel And Verify Network Heading
175
176    Wait Until Keyword Succeeds  30 sec  10 sec  Click Element  ${xpath_add_static_ipv6_address_button}
177    Wait Until Page Contains  Add static IPv6 address  timeout=15s
178    Page Should Contain Textfield  ${xpath_input_ipv6_address}
179    Page Should Contain Textfield  ${xpath_input_prefix_length}
180    Page Should Contain Button  ${xpath_cancel_button}
181    Page Should Contain Button  ${xpath_add_button}
182
183
184Verify Existence Of All Fields In IPv6 Static Default Gateway
185    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
186    ...  and confirm section IPv6 static default gateway contains all the fields.
187    [Tags]  Verify_Existence_Of_All_Fields_In_IPv6_Static_Default_Gateway
188    [Teardown]  Run Keywords  Click Button  ${xpath_cancel_button}  AND
189    ...  Wait Until Keyword Succeeds  10 sec  5 sec
190    ...  Refresh GUI And Verify Element Value  ${xpath_network_heading}  Network
191
192    Wait Until Keyword Succeeds  30 sec  10 sec  Click Element  ${xpath_add_static_def_gateway_button}
193    Wait Until Page Contains  Add IPv6 static default gateway address  timeout=11s
194    Page Should Contain Textfield  ${xpath_input_ip_address}
195    Page Should Contain Button  ${xpath_cancel_button}
196    Page Should Contain Button  ${xpath_add_button}
197
198
199Verify Existence Of All Fields In Static DNS
200    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
201    ...  and confirm section static DNS contains all the fields.
202    [Tags]  Verify_Existence_Of_All_Fields_In_Static_DNS
203    [Teardown]  Cancel And Verify Network Heading
204
205    Wait Until Keyword Succeeds  30 sec  10 sec  Click Element  ${xpath_add_dns_ip_address_button}
206    Wait Until Page Contains  Add IP address  timeout=11s
207    Page Should Contain Textfield  ${xpath_input_static_dns}
208    Page Should Contain Button  ${xpath_cancel_button}
209    Page Should Contain Button  ${xpath_add_button}
210
211
212Configure And Verify DNS Server Via GUI
213    [Documentation]  Login to GUI Network page, add DNS server IP
214    ...  and verify that the page reflects server IP.
215    [Tags]  Configure_And_Verify_DNS_Server_Via_GUI
216    [Setup]  DNS Test Setup Execution
217    [Teardown]  Run Keywords  Delete Static Name Servers  AND
218    ...  Configure Static Name Servers
219
220    Add DNS Servers And Verify  ${dns_server}
221
222
223Configure Static IPv4 Netmask Via GUI And Verify
224    [Documentation]  Login to GUI Network page, configure static IPv4 netmask and verify.
225    [Tags]  Configure_Static_IPv4_Netmask_Via_GUI_And_Verify
226    [Template]  Add Static IP Address And Verify
227
228    # ip_addresses      subnet_masks             gateway          expected_status
229    ${test_ipv4_addr}   ${lowest_netmask}        ${default_gateway}  Success
230    ${test_ipv4_addr}   ${more_byte_netmask}     ${default_gateway}  Invalid format
231    ${test_ipv4_addr}   ${alpha_netmask}         ${default_gateway}  Invalid format
232    ${test_ipv4_addr}   ${out_of_range_netmask}  ${default_gateway}  Invalid format
233    ${test_ipv4_addr}   ${test_subnet_mask}      ${default_gateway}  Success
234
235
236Configure And Verify Static IP Address
237    [Documentation]  Login to GUI Network page, configure static ip address and verify.
238    [Tags]  Configure_And_Verify_Static_IP_Address
239
240    Add Static IP Address And Verify  ${test_ipv4_addr}  ${test_subnet_mask}  ${default_gateway}  Success
241
242
243Configure And Verify Multiple Static IP Address
244    [Documentation]  Login to GUI Network page, configure multiple static IP address and verify.
245    [Tags]  Configure_And_Verify_Multiple_Static_IP_Address
246
247    Add Static IP Address And Verify  ${test_ipv4_addr}  ${test_subnet_mask}  ${default_gateway}  Success
248    Add Static IP Address And Verify  ${test_ipv4_addr_1}  ${test_subnet_mask}  ${default_gateway}  Success
249
250
251Configure And Verify Invalid Static IP Address
252    [Documentation]  Login to GUI Network page, configure invalid static IP address and verify.
253    [Tags]  Configure_And_Verify_Invalid_Static_IP_Address
254    [Template]  Add Static IP Address And Verify
255
256    # ip                 subnet_mask          gateway             status
257    ${out_of_range_ip}   ${test_subnet_mask}  ${default_gateway}  Invalid format
258    ${less_octet_ip}     ${test_subnet_mask}  ${default_gateway}  Invalid format
259    ${string_ip}         ${test_subnet_mask}  ${default_gateway}  Invalid format
260    ${negative_ip}       ${test_subnet_mask}  ${default_gateway}  Invalid format
261    ${hex_ip}            ${test_subnet_mask}  ${default_gateway}  Invalid format
262    ${spl_char_ip}       ${test_subnet_mask}  ${default_gateway}  Invalid format
263
264
265Configure And Verify Multiple Static IPv6 Address
266    [Documentation]  Login to GUI Network page, configure multiple static IPv6 address and verify.
267    [Tags]  Configure_And_Verify_Multiple_Static_IPv6_Address
268
269    Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr}    ${test_prefix_length}  Success
270    Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr_1}  ${test_prefix_length}  Success
271
272
273Configure And Verify Static IPv6 Address
274    [Documentation]  Login to GUI Network page, configure static IPv6 address and verify.
275    [Tags]  Configure_And_Verify_Static_IPv6_Address
276    [Template]  Add Static IPv6 Address And Verify Via GUI
277
278    # ipv6                           prefix_length          status           expected_ipv6
279    ${ipv6_with_leadingzeroes_addr}  ${test_prefix_length}  Success          ${ipv6_without_leadingzeroes_addr}
280    ${ipv6_onehextet_zero}           ${test_prefix_length}  Success          ${ipv6_eliminate_onehextet_zero}
281    ${test_ipv6_addr}                ${test_prefix_length}  Success
282    ${ipv4_hexword_addr}             ${test_prefix_length}  Invalid format
283    ${invalid_hexadec_ipv6}          ${test_prefix_length}  Invalid format
284    ${ipv6_multi_short}              ${test_prefix_length}  Invalid format
285
286
287Configure And Verify Static Default Gateway
288    [Documentation]  Login to GUI Network page, configure invalid static IPv6 default gateway and verify.
289    [Tags]  Configure_And_Verify_Static_Default_Gateway
290    [Template]  Add IPv6 Static Default Gateway And Verify
291
292    # ipv6 static default gateway  status
293    ${test_ipv6_addr}              Success
294
295
296Verify Coexistence of Staticv6 and Linklocal
297    [Documentation]  Verify coexistence of staticv6 and linklocal.
298    [Tags]  Verify_Coexistence_of_Staticv6_and_Linklocal
299
300    Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr}  ${test_prefix_length}  Success
301    @{ipv6_address_origin_list}  ${ipv6_linklocal_ipv6_addr}=
302    ...    Get Address Origin List And Address For Type  LinkLocal
303    Page Should Contain Element  ${xpath_linklocalv6}
304    Page Should Contain  ${ipv6_linklocal_ipv6_addr}
305    Page Should Contain  ${test_ipv6_addr}
306
307
308Modify DHCP Properties By Toggling And Verify
309    [Documentation]  Modify DHCP properties by toggling and verify.
310    [Tags]  Modify_DHCP_Properties_By_Toggling_And_Verify
311    [Template]  Toggle DHCPv4 property And Verify
312
313    # property                 xpath_property
314
315    UseNTPServers              ${xpath_ntp_switch_button}
316    UseDNSServers              ${xpath_dns_switch_button}
317    UseDomainName              ${xpath_domainname_switch_button}
318
319
320Delete IPv4 Address Via GUI And Verify
321   [Documentation]  Delete IPv4 Address via GUI and verify.
322   [Tags]  Delete_IPv4_Address_Via_GUI_And_Verify
323   [Setup]  Add Static IP Address And Verify  ${test_ipv4_addr_2}  ${test_subnet_mask}
324   ...  ${default_gateway}  Success
325
326   Delete IP Address And Verify  ipv4  ${test_ipv4_addr_2}
327
328
329Delete IPv6 Address Via GUI And Verify
330   [Documentation]  Delete IPv6 Address via GUI and verify.
331   [Tags]  Delete_IPv6_Address_Via_GUI_And_Verify
332   [Setup]  Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr_2}
333   ...  ${test_prefix_length}  Success
334
335   Delete IP Address And Verify  ipv6  ${test_ipv6_addr_2}
336
337
338Modify IPv4 Address Via GUI And Verify
339    [Documentation]  Edit IPv4 address via GUI and verify.
340    [Tags]  Modify_IPv4_Address_Via_GUI_And_Verify
341    [Setup]  Add Static IP Address And Verify  ${test_ipv4_addr}  ${test_subnet_mask}
342    ...  ${default_gateway}  Success
343
344    Modify IP Address And Verify  ipv4  ${test_ipv4_addr}  ${test_ipv4_addr_1}
345
346
347Modify IPv6 Address Via GUI And Verify
348    [Documentation]  Edit IPv6 address via GUI and verify.
349    [Tags]  Modify_IPv6_Address_Via_GUI_And_Verify
350    [Setup]  Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr}
351    ...  ${test_prefix_length}  Success
352
353    Modify IP Address And Verify  ipv6  ${test_ipv6_addr}  ${test_ipv6_addr_1}
354
355
356Verify MAC Address Is Displayed
357   [Documentation]  Verify MAC address is displayed.
358   [Tags]  Verify_MAC_Address_Is_Displayed
359
360   ${network_details}=  Get Network Interface Details  ${CHANNEL_NUMBER}
361
362   # Verify the MAC address on GUI.
363   Page Should Contain  ${network_details['MACAddress']}
364
365
366Verify MAC Address On Eth1 Interface
367    [Documentation]  Verify MAC address on eth1 interface.
368    [Tags]  Verify_MAC_Address_On_Eth1_Interface
369
370    Click Element  ${xpath_eth1_interface}
371
372    ${network_details}=  Get Network Interface Details  ${SECONDARY_CHANNEL_NUMBER}
373
374    # Verify eth1 interface MAC address on GUI.
375    Page Should Contain  ${network_details['MACAddress']}
376
377
378Configure Hostname Via GUI And Verify
379    [Documentation]  Login to GUI Network page, configure hostname and verify.
380    [Tags]  Configure_Hostname_Via_GUI_And_Verify
381    [Teardown]  Configure the Hostname Back And Verify
382
383    ${hostname}=  Get BMC Hostname
384    Set Suite Variable  ${hostname}
385    Configure And Verify Network Settings Via GUI  ${xpath_hostname}
386    ...  ${xpath_hostname_input}  ${test_hostname}
387
388    ${bmc_hostname}=  Get BMC Hostname
389    Should Be Equal As Strings  ${bmc_hostname}  ${test_hostname}
390
391
392Enable AutoConfig On Eth0 And Verify
393    [Documentation]  Enable SLAAC on eth0 via GUI & check it is set to enable state.
394    [Tags]  Enable_AutoConfig_On_Eth0_And_Verify
395
396    Set IPv6 AutoConfig State  Enabled  ${xpath_eth0_ipv6_autoconfig_button}
397    Verify SLAAC Address On Autoconfig Enable
398
399
400Disable AutoConfig On Eth0 And Verify
401    [Documentation]  Disable SLAAC on eth0 via GUI & check it is set to disable state.
402    [Tags]  Disable_AutoConfig_On_Eth0_And_Verify
403
404    Set IPv6 AutoConfig State  Disabled  ${xpath_eth0_ipv6_autoconfig_button}
405    Wait Until Page Does Not Contain    SLAAC
406
407
408Enable AutoConfig On Eth1 And Verify
409    [Documentation]  Enable SLAAC on eth1 via GUI & check it is set to enable state.
410    [Tags]  Enable_AutoConfig_On_Eth1_And_Verify
411
412    Click Element  ${xpath_eth1_interface}
413    Set IPv6 AutoConfig State  Enabled  ${xpath_eth1_ipv6_autoconfig_button}
414    Set Suite Variable  ${CHANNEL_NUMBER}  2
415    Verify SLAAC Address On Autoconfig Enable
416
417
418Disable AutoConfig On Eth1 And Verify
419    [Documentation]  Disable SLAAC on eth1 via GUI & check it is set to disable state.
420    [Tags]  Disable_AutoConfig_On_Eth1_And_Verify
421
422    Click Element  ${xpath_eth1_interface}
423    Set IPv6 AutoConfig State  Disabled  ${xpath_eth1_ipv6_autoconfig_button}
424    Wait Until Page Does Not Contain    SLAAC
425
426
427Enable SLAAC On Both Interfaces And Verify Eth0
428    [Documentation]  Enable SLAAC on eth0, then on eth1, verify eth0 is not impacted.
429    [Tags]  Enable_SLAAC_On_Both_Interfaces_And_Verify_Eth0
430
431    Set SLAAC Property On Eth0 And Eth1  Enabled
432    Click Element  ${xpath_refresh_button}
433    Wait Until Element Is Not Visible
434    ...  ${xpath_page_loading_progress_bar}  timeout=120s
435
436    # Verify SLAAC on eth0
437    Verify SLAAC Address On Autoconfig Enable
438
439
440Enable SLAAC On Both Interfaces Disable It On Eth0 And Verify Eth1
441    [Documentation]  Enable and verify SLAAC property on eth0 and eth1,
442    ...  disable it on eth0 and verify eth1 is not impacted.
443    [Tags]  Enable_SLAAC_On_Both_Interfaces_Disable_It_On_Eth0_And_Verify_Eth1
444
445    Set SLAAC Property On Eth0 And Eth1  Enabled
446    Click Element  ${xpath_refresh_button}
447    Wait Until Element Is Not Visible
448    ...  ${xpath_page_loading_progress_bar}  timeout=120s
449    Set IPv6 AutoConfig State  Disabled  ${xpath_eth0_ipv6_autoconfig_button}
450    Click Element  ${xpath_eth1_interface}
451
452    # Verify SLAAC on eth1 after disabling eth0
453    Set Suite Variable  ${CHANNEL_NUMBER}  2
454    Verify SLAAC Address On Autoconfig Enable
455
456
457Enable SLAAC On Both Interfaces Disable It On Eth1 And Verify Eth0
458    [Documentation]  Enable and verify SLAAC property on eth0 and eth1,
459    ...  disable it on eth1 and verify eth0 is not impacted.
460    [Tags]  Enable_SLAAC_On_Both_Interfaces_Disable_It_On_Eth1_And_Verify_Eth0
461
462    Set SLAAC Property On Eth0 And Eth1  Enabled
463    Set IPv6 AutoConfig State  Disabled  ${xpath_eth1_ipv6_autoconfig_button}
464    Click Element  ${xpath_refresh_button}
465    Wait Until Element Is Not Visible
466    ...  ${xpath_page_loading_progress_bar}  timeout=120s
467
468    # Verify SLAAC on eth0 after disabling eth1
469    Verify SLAAC Address On Autoconfig Enable
470
471
472Enable SLAAC On Both Interfaces Disable It On Both And Verify
473    [Documentation]  Enable and verify SLAAC property on eth0 and eth1,
474    ...  disable it on eth0,eth1 and verify.
475    [Tags]  Enable_SLAAC_On_Both_Interfaces_Disable_It_On_Both_And_Verify
476
477    Set SLAAC Property On Eth0 And Eth1  Enabled
478
479    # Verify SLAAC is disconfigured on both eth0 and eth1 after disabling
480    Set IPv6 AutoConfig State  Disabled  ${xpath_eth1_ipv6_autoconfig_button}
481    Wait Until Page Does Not Contain    SLAAC
482    Click Element  ${xpath_refresh_button}
483    Wait Until Element Is Not Visible
484    ...  ${xpath_page_loading_progress_bar}  timeout=120s
485    Set IPv6 AutoConfig State  Disabled  ${xpath_eth0_ipv6_autoconfig_button}
486    Wait Until Page Does Not Contain    SLAAC
487
488
489Add Static IPv6 Address Via GUI And Check Persistency
490    [Documentation]  Add static IPv6 address and verify persistency of static IPv6 on BMC reboot.
491    [Tags]  Add_Static_IPv6_Address_Via_GUI_And_Check_Persistency
492
493    Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr}  ${test_prefix_length}  Success
494    Verify Persistency Of IPv6 On BMC Reboot  Static  1
495
496
497Verify Persistency Of LinkLocal IPv6 On BMC Reboot For Both Interfaces
498    [Documentation]  Verify persistency of linklocal IPv6 on BMC reboot for both interfaces.
499    [Tags]  Verify_Persistency_Of_LinkLocal_IPv6_On_BMC_Reboot_For_Both_Interfaces
500
501    Verify Persistency Of IPv6 On BMC Reboot  LinkLocal  1
502    Verify Persistency Of IPv6 On BMC Reboot  LinkLocal  2
503
504
505Verify Persistency Of SLAAC On BMC Reboot For Both Interfaces
506    [Documentation]  Verify persistency of slaac on BMC reboot for both interfaces.
507    [Tags]  Verify_Persistency_Of_SLAAC_On_BMC_Reboot_For_Both_Interfaces
508    [Setup]  Set SLAAC Property On Eth0 And Eth1  Enabled
509
510    Verify Persistency Of IPv6 On BMC Reboot  SLAAC  1
511    Verify Persistency Of IPv6 On BMC Reboot  SLAAC  2
512
513
514Verify Persistency Of DHCPv6 On BMC Reboot For Both Interfaces
515    [Documentation]  Verify persistency of DHCPv6 on BMC reboot for both interfaces
516    ...  DHCPv6 setup should be in place for this testcase to pass.
517    [Tags]  Verify_Persistency_Of_DHCPv6_On_BMC_Reboot_For_Both_Interfaces
518    [Setup]  Set And Verify DHCPv6 States  Enabled  Enabled
519
520    Verify Persistency Of IPv6 On BMC Reboot  DHCPv6  1
521    Verify Persistency Of IPv6 On BMC Reboot  DHCPv6  2
522
523
524Verify DHCPv6 Enable And Disable On Both Interfaces Via GUI
525    [Documentation]  Verify DHCPv6 toggle on both interfaces via GUI.
526    [Tags]  Verify_DHCPv6_Enable_And_Disable_On_Both_Interfaces_Via_GUI
527    [Template]  Set And Verify DHCPv6 States
528
529    # eth0_state    eth1_state
530
531    Disabled        Enabled
532    Disabled        Disabled
533    Enabled         Disabled
534    Enabled         Enabled
535
536
537Delete Default IPv6 Static Gateway Address And Verify
538    [Documentation]  Delete default IPv6 static gateway address and verify.
539    [Tags]  Delete_Default_IPv6_Static_Gateway_Address_And_Verify
540    [Setup]  Add IPv6 Static Default Gateway And Verify  ${test_ipv6_addr_1}  Success
541
542    Delete Default IPv6 Gateway And Verify  ${test_ipv6_addr_1}
543
544
545Modify Default IPv6 Static Gateway Address And Verify
546    [Documentation]  Modify default IPv6 static gateway address and verify.
547    [Tags]  Modify_Default_IPv6_Static_Gateway_Address_And_Verify
548    [Setup]  Add IPv6 Static Default Gateway And Verify  ${test_ipv6_addr}  Success
549    [Teardown]  Delete Default IPv6 Gateway And Verify  ${test_ipv6_addr_1}
550
551    Modify Default IPv6 Gateway And Verify  ${test_ipv6_addr}  ${test_ipv6_addr_1}
552
553
554Verify Enable Or Disable DHCPv6 Does Not Impact IPv4 Settings
555    [Documentation]  Verify enable or disable DHCPv6 and it does not have impact on IPv4 settings
556    ...  Note: Enable testcase need DHCPv6 setup.
557    [Tags]  Verify_Enable_Or_Disable_DHCPv6_Does_Not_Impact_IPv4_Settings
558    [Template]  Enable Or Disable DHCPv6 And Verify Impact On IPv4 Settings
559
560    # ip_version   channel_number  desired_status
561    ipv4           1               Disabled
562    ipv4           1               Enabled
563    ipv4           2               Disabled
564    ipv4           2               Enabled
565
566
567Configure Link Local IPv6 Address Via GUI And Verify
568    [Documentation]  Configure link local IPv6 address via GUI and verify.
569    [Tags]  Configure_Link_Local_IPv6_Address_Via_GUI_And_Verify
570
571    Add Static IPv6 Address And Verify Via GUI  ${link_local_addr}  ${link_local_prefix_len}  Success
572
573    # Verify the address origin contains link local.
574    Sleep  ${NETWORK_TIMEOUT}
575    @{ipv6_address_origin_list}  ${ipv6_link_local_addr}=
576    ...    Get Address Origin List And Address For Type  LinkLocal
577
578    Should Contain  ${ipv6_link_local_addr}  ${link_local_addr}
579    ${count}=  Evaluate  ${ipv6_address_origin_list}.count("LinkLocal")
580
581    Should Be Equal As Integers  ${count}  2
582
583
584Configure Static IPv6 On Eth0 And DHCPv6 On Eth1 And Verify
585    [Documentation]  Configure static IPv6 on eth0 and DHCPv6 on eth1 and verify.
586    [Tags]  Configure_Static_IPv6_On_Eth0_And_DHCPv6_On_Eth1_And_Verify
587
588    Add Static IPv6 Address And Verify Via GUI  ${test_ipv6_addr}  ${test_prefix_length}  Success
589    Sleep  ${NETWORK_TIMEOUT}
590    Toggle DHCPv6 State And Verify  Enabled  2
591
592    # Verify network connectivity by pinging the IPv4 address.
593    Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT}
594
595
596*** Keywords ***
597
598Suite Setup Execution
599    [Documentation]  Do suite setup tasks.
600
601    Launch Browser And Login GUI
602    Wait Until Keyword Succeeds  1 min  15 sec
603    ...  Click Element  ${xpath_settings_menu}
604    Click Element  ${xpath_network_sub_menu}
605    Wait Until Keyword Succeeds  30 sec  10 sec  Location Should Contain  network
606    Wait Until Element Is Not Visible   ${xpath_page_loading_progress_bar}  timeout=30
607    ${default_gateway}=  Get BMC Default Gateway
608    Set Suite Variable  ${default_gateway}
609
610Launch Browser Login GUI And Navigate To Network Page
611    [Documentation]  Launch browser Login GUI and navigate to network page.
612
613    Launch Browser And Login GUI
614    Wait Until Keyword Succeeds  1 min  15 sec
615    ...  Click Element  ${xpath_settings_menu}
616    Click Element  ${xpath_network_sub_menu}
617    Wait Until Keyword Succeeds  30 sec  10 sec  Location Should Contain  network
618    Wait Until Element Is Not Visible   ${xpath_page_loading_progress_bar}  timeout=30
619
620Configure the Hostname Back And Verify
621    [Documentation]  Configure the hostname back.
622
623    Configure And Verify Network Settings Via GUI
624    ...  ${xpath_hostname}  ${xpath_hostname_input}  ${hostname}
625    ${bmc_hostname_after}=  Get BMC Hostname
626    Should Be Equal As Strings  ${bmc_hostname_after}  ${hostname}
627
628
629Delete DNS Servers And Verify
630    [Documentation]  Login to GUI Network page,delete static name servers
631    ...  and verify that page does not reflect static name servers.
632
633    Page Should Contain Element  ${xpath_delete_dns_server}
634    Wait Until Element Is Enabled  ${xpath_delete_dns_server}
635    Click Button  ${xpath_delete_dns_server}
636    Wait Until Page Contains Element  ${xpath_add_dns_ip_address_button}  timeout=15
637    # Check if all name servers deleted on BMC.
638    ${nameservers}=  CLI Get Nameservers
639    Should Not Contain  ${nameservers}  ${original_nameservers}
640
641    DNS Test Setup Execution
642
643    Should Be Empty  ${original_nameservers}
644
645
646Add Static IP Address And Verify
647    [Documentation]  Add static IP address, subnet mask and
648    ...  gateway via GUI and verify.
649    [Arguments]  ${ip_address}  ${subnet_mask}  ${gateway_address}  ${expected_status}=error
650
651    # Description of argument(s):
652    # ip_address          IP address to be added (e.g. 10.7.7.7).
653    # subnet_mask         Subnet mask for the IP to be added (e.g. 255.255.0.0).
654    # gateway_address     Gateway address for the IP to be added (e.g. 10.7.7.1).
655    # expected_status     Expected status while adding static IPv4 address
656    # ....                (e.g. Invalid format / Field required).
657
658    Wait Until Element Is Enabled  ${xpath_add_static_ipv4_address_button}  timeout=60sec
659    Click Element  ${xpath_add_static_ipv4_address_button}
660
661    Input Text  ${xpath_input_ip_address}  ${ip_address}
662    Input Text  ${xpath_input_subnetmask}  ${subnet_mask}
663    Input Text  ${xpath_input_gateway}  ${gateway_address}
664
665    Click Element  ${xpath_add_button}
666    IF  '${expected_status}' == 'Success'
667        Wait Until Page Contains  ${ip_address}  timeout=40sec
668        Validate Network Config On BMC
669    ELSE
670        Page Should Contain  Invalid format
671        Click Button  ${xpath_cancel_button}
672        Wait Until Page Does Not Contain Element  ${xpath_cancel_button}
673    END
674
675
676Add Static IPv6 Address And Verify Via GUI
677    [Documentation]  Add static IPv6 address and prefix length and verify.
678    [Arguments]  ${ipv6_address}  ${prefix_length}  ${expected_status}=error  ${expected_ipv6}=None
679
680    # Description of argument(s):
681    # ipv6_address        IPv6 address to be added.
682    # prefix_length       Prefix length of the IPv6 to be added.
683    # expected_status     Expected status while adding static IPv6 address.
684    # expected_ipv6       Expected IPv6 which gets added with truncated zeroes.
685
686    Wait Until Element Is Enabled  ${xpath_add_static_ipv6_address_button}  timeout=60sec
687    Click Element  ${xpath_add_static_ipv6_address_button}
688
689    Input Text  ${xpath_input_ip_address}  ${ipv6_address}
690    Input Text  ${xpath_input_prefix_length}  ${prefix_length}
691
692    Click Element  ${xpath_add_button}
693    IF  '${expected_status}' == 'Success'
694        IF  '${expected_ipv6}' == 'None'
695            Wait Until Page Contains  ${ipv6_address}  timeout=40sec
696        ELSE
697            Wait Until Page Contains  ${expected_ipv6}  timeout=40sec
698        END
699        Validate Network Config On BMC
700    ELSE
701        Page Should Contain  Invalid format
702        Cancel And Verify Network Heading
703    END
704
705
706Add IPv6 Static Default Gateway And Verify
707    [Documentation]  Add IPv6 static default gateway and verify.
708    [Arguments]  ${ipv6_static_def_gw}  ${expected_status}=error
709
710    # Description of argument(s):
711    # ipv6_static_def_gw  IPv6 static default gateway.
712    # expected_status     Expected status (Success or Fail).
713
714    Wait Until Element Is Enabled  ${xpath_add_static_def_gateway_button}  timeout=60sec
715    Click Element  ${xpath_add_static_def_gateway_button}
716
717    Input Text  ${xpath_input_ip_address}  ${ipv6_static_def_gw}
718
719    Click Element  ${xpath_add_button}
720    IF  '${expected_status}' == 'Success'
721        Wait Until Page Contains  ${ipv6_static_def_gw}  timeout=40sec
722        Validate Network Config On BMC
723    ELSE
724        Page Should Contain  Invalid format
725        Cancel And Verify Network Heading
726    END
727    ${redfish_ipv6_staticdef_gw}=  Get Static Default Gateway Property Via Redfish
728    Should Be Equal  ${ipv6_static_def_gw}  ${redfish_ipv6_staticdef_gw}
729
730
731Get Static Default Gateway Property Via Redfish
732     [Documentation]  Get Static Default Gateway property value via redfish.
733
734     ${active_channel_config}=  Get Active Channel Config
735     ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
736     ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
737     ${ipv6_static_def_gw}=  Get From Dictionary  ${resp.dict}  IPv6StaticDefaultGateways
738     RETURN  ${resp.dict["IPv6StaticDefaultGateways"][0]["Address"]}
739
740
741Configure And Verify Network Settings Via GUI
742    [Documentation]  Configure and verify network settings via GUI.
743    [Arguments]  ${xpath_nw_settings}  ${xpath_nw_settings_input_field}  ${input_value}
744
745    # Description of argument(s):
746    # xpath_nw_settings               xpath of the network settings.
747    # xpath_nw_settings_input_field   xpath of the network setting's input field.
748    # input_value                     Input value for configuration. E.g. hostname, IP etc.
749
750    Wait Until Keyword Succeeds  30 sec  10 sec  Click Element  ${xpath_nw_settings}
751    Input Text  ${xpath_nw_settings_input_field}  ${input_value}
752    Click Button  ${xpath_save_button}
753
754    # Re-Login gui and navigate to network page.
755    Launch Browser Login GUI And Navigate To Network Page
756
757    Wait Until Page Contains  ${input_value}  timeout=30sec
758
759
760Toggle DHCPv4 Property And Verify
761    [Documentation]  Toggle DHVPv4 property and verify.
762    [Arguments]  ${property}   ${xpath_property}
763
764    # Description of argument(s):
765    # property          DHCP Property name (e.g. UseDNSServers, UseDomainName, etc.).
766    # xpath_property    xpath of the DHCPv4 property.
767
768    Wait Until Page Contains Element  ${xpath_property}
769
770    ${redfish_before_set}=  Get DHCP Property Via Redfish  ${property}
771    ${gui_before_set}=  Get Text  ${xpath_property}
772
773    Click Element  ${xpath_property}
774    Verify Popup Message And Close Popup  ${xpath_success_popup}
775    Wait Until Element Is Not Visible
776    ...  ${xpath_page_loading_progress_bar}  timeout=120s
777
778    ${redfish_after_set}=  Get DHCP Property Via Redfish  ${property}
779    Should Not Be Equal  ${redfish_before_set}  ${redfish_after_set}
780
781    ${gui_after_set}=  Get Text  ${xpath_property}
782    Should Not Be Equal  ${gui_before_set}  ${gui_after_set}
783
784    Click Element At Coordinates   ${xpath_property}  0  0
785    Verify Popup Message And Close Popup  ${xpath_success_popup}
786
787
788Get DHCP Property Via Redfish
789     [Documentation]  Get DHCPv4 property value via redfish.
790     [Arguments]   ${property}
791
792     # Description of argument(s):
793     # ${property}       DHCP Property name.
794
795     ${active_channel_config}=  Get Active Channel Config
796     ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
797     ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
798     RETURN  ${resp.dict["DHCPv4"]["${property}"]}
799
800
801Verify Popup Message And Close Popup
802    [Documentation]  Verify popup message and close popup.
803    [Arguments]   ${popup_msg}
804
805    # Description of argument(s):
806    # popup_msg        Popup message (Eg: Success or Error).
807
808    Wait Until Keyword Succeeds  1 min  15 sec
809    ...  Wait Until Page Contains Element  ${popup_msg}
810    Click Element  ${popup_msg}
811
812
813Delete IP Address And Verify
814    [Documentation]  Delete IPv4 or IPv6 address and verify deletion via GUI and BMC.
815    [Arguments]  ${ip_version}  ${ip_addr}
816
817    # Description of argument(s):
818    # ip_version   Either 'ipv4' or 'ipv6'.
819    # ip_addr      IP address to be deleted.
820
821    ${delete_xpath}=  Set Variable If  '${ip_version}' == 'ipv4'
822    ...  ${xpath_delete_ipv4_addres}  ${xpath_delete_ipv6_addres}
823
824    Wait Until Element Is Not Visible  ${xpath_page_loading_progress_bar}  timeout=120s
825    Wait Until Element Is Enabled  ${delete_xpath}
826
827    Click Element  ${delete_xpath}
828    Click Element  ${xpath_delete_button}
829    Wait Until Page Contains Element  ${xpath_success_message}
830    Sleep  ${NETWORK_TIMEOUT}s
831
832    # Verify IP on BMC is deleted.
833    IF  '${ip_version}' == 'ipv4'
834        ${delete_status}=  Run Keyword And Return Status  Verify IP On BMC  ${ip_addr}
835    ELSE
836        ${delete_status}=  Run Keyword And Return Status  Verify IPv6 On BMC  ${ip_addr}
837    END
838
839    Should Be Equal  ${delete_status}  ${False}
840    Wait Until Page Does Not Contain  ${ip_addr}
841
842
843Modify IP Address And Verify
844    [Documentation]  Modify IPv4 or IPv6 address via GUI.
845    [Arguments]  ${ip_version}  ${old_ip}  ${new_ip}
846
847    # Description of argument(s):
848    # ip_version   Either 'ipv4' or 'ipv6'.
849    # old_ip       The existing IP address visible on GUI(ipv4 or ipv6).
850    # new_ip       The new IP address to update(ipv4 or ipv6).
851
852    Wait Until Element Is Not Visible  ${xpath_page_loading_progress_bar}  timeout=120s
853
854    # Edit button based on version.
855    ${edit_button}=  Set Variable If  '${ip_version}' == 'ipv4'
856    ...  ${xpath_edit_ipv4_addres}  ${xpath_edit_ipv6_addres}
857    Wait Until Element Is Enabled  ${edit_button}
858    Click Element  ${edit_button}
859
860    # Add new IP and save.
861    Input Text  ${xpath_input_ip_address}  ${new_ip}
862    Click Element  ${xpath_add_button}
863
864    Wait Until Page Contains Element  ${xpath_success_message}
865    Sleep  ${NETWORK_TIMEOUT}s
866
867    # Verify IP on BMC.
868    ${edit_status}=  Set Variable If  '${ip_version}' == 'ipv4'
869    ...  Run Keyword And Return Status  Verify IP On BMC  ${new_ip}
870    ...  ELSE
871    ...  Run Keyword And Return Status  Verify IPv6 On BMC  ${new_ip}
872
873    Should Be Equal  ${edit_status}  ${True}
874    Wait Until Page Contains  ${new_ip}
875
876
877Delete Default IPv6 Gateway And Verify
878   [Documentation]  Delete default IPv6 gateway and verify.
879   [Arguments]  ${ip_addr}
880
881   # Description of argument(s):
882   # ip_addr      IP address to be deleted.
883
884   Wait Until Page Contains  ${ip_addr}
885   Wait Until Element Is Not Visible   ${xpath_page_loading_progress_bar}  timeout=120s
886   Wait Until Element Is Enabled  ${xpath_delete_ipv6_def_gateway_addr}
887   Click Element  ${xpath_delete_ipv6_def_gateway_addr}
888   Click Element  ${xpath_delete_button}
889   Wait Until Page Contains Element   ${xpath_success_message}
890   Sleep  ${NETWORK_TIMEOUT}s
891
892   # Verify delete IP via redfish.
893   ${delete_status}=  Run Keyword And Return Status  Get Static Default Gateway Property Via Redfish
894   Should Be Equal  ${delete_status}  ${False}
895
896   Wait Until Page Does Not Contain Element  ${xpath_delete_ipv6_def_gateway_addr}
897
898
899Modify Default IPv6 Gateway And Verify
900    [Documentation]  Modify Default IPv6 Gateway And Verify.
901    [Arguments]  ${old_static_def_gw}  ${new_static_def_gw}
902
903    # Description of argument(s):
904    # old_static_def_gw       The existing IPv6 address visible on GUI.
905    # new_static_def_gw       The new IPv6 address to update.
906
907    Wait Until Element Is Not Visible  ${xpath_page_loading_progress_bar}  timeout=120s
908    Wait Until Element Is Enabled  ${xpath_edit_ipv6_def_gateway_addr}
909    Click Element  ${xpath_edit_ipv6_def_gateway_addr}
910
911    # Add new IP and save.
912    Input Text  ${xpath_input_ip_address}  ${new_static_def_gw}
913    Click Element  ${xpath_add_button}
914
915    Wait Until Page Contains Element  ${xpath_success_message}
916    Sleep  ${NETWORK_TIMEOUT}s
917
918    # Verify IP via redfish.
919    ${new_static_def_gw_redfish}=  Get Static Default Gateway Property Via Redfish
920    Should Be Equal  ${new_static_def_gw}  ${new_static_def_gw_redfish}
921
922    Wait Until Page Contains Element  ${xpath_edit_ipv6_def_gateway_addr_1}
923
924
925Get Network Interface Details
926   [Documentation]  Get network interface details.
927   [Arguments]   ${channel_number}
928
929   # Description of argument(s):
930   # channel_number   Interface Channel Number(eg.eth0 or eth1).
931
932   ${active_channel_config}=  Get Active Channel Config
933   ${ethernet_interface}=  Set Variable  ${active_channel_config['${channel_number}']['name']}
934   ${resp}=  redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
935   RETURN  ${resp.dict}
936
937
938Cancel And Verify Network Heading
939    [Documentation]  Cancel and verify network heading.
940
941    Click Button  ${xpath_cancel_button}
942    Wait Until Keyword Succeeds  10 sec  5 sec
943    ...  Refresh GUI And Verify Element Value  ${xpath_network_heading}  Network
944
945
946Set IPv6 AutoConfig State
947    [Arguments]    ${desired_autoconfig_state}  ${xpath_ipv6_autoconfig_button}
948
949    # Description of argument(s):
950    # desired_autoconfig_state      IPv6 autoconfig Toggle state(eg: Enabled or Disabled).
951    # xpath_ipv6_autoconfig_button  xpath of eth0 or eth1 ipv6 autoconfig button.
952
953    ${current_autoconfig_state}=    Get Text    ${xpath_ipv6_autoconfig_button}
954
955    IF    '${desired_autoconfig_state}' == '${current_autoconfig_state}'
956        # Already in desired state, reset by toggling twice
957        Wait Until Element Is Enabled  ${xpath_ipv6_autoconfig_button}  timeout=60s
958        Click Element  ${xpath_ipv6_autoconfig_button}
959        Wait Until Element Is Not Visible
960        ...  ${xpath_page_loading_progress_bar}  timeout=120s
961        Wait Until Element Is Enabled  ${xpath_ipv6_autoconfig_button}  timeout=60s
962        Click Element  ${xpath_ipv6_autoconfig_button}
963        Wait Until Element Is Not Visible
964        ...  ${xpath_page_loading_progress_bar}  timeout=120s
965    ELSE IF    '${desired_autoconfig_state}' != '${current_autoconfig_state}'
966        Wait Until Element Is Enabled  ${xpath_ipv6_autoconfig_button}  timeout=60s
967        Click Element  ${xpath_ipv6_autoconfig_button}
968        Wait Until Element Is Not Visible
969        ...  ${xpath_page_loading_progress_bar}  timeout=120s
970    END
971    Wait Until Keyword Succeeds  2 min  30 sec
972    ...  Element Text Should Be  ${xpath_ipv6_autoconfig_button}
973    ...  ${desired_autoconfig_state}
974
975
976Set SLAAC Property On Eth0 And Eth1
977    [Documentation]  Enable or Disable and verify slaac on both interfaces.
978    [Arguments]  ${State}=Enabled
979
980    # Description of argument(s):
981    # ${State}  Enabled or Disabled on both interfaces
982
983    Set IPv6 AutoConfig State  ${State}  ${xpath_eth0_ipv6_autoconfig_button}
984    Click Element  ${xpath_eth1_interface}
985    Set IPv6 AutoConfig State  ${State}  ${xpath_eth1_ipv6_autoconfig_button}
986
987
988Verify SLAAC Address On Autoconfig Enable
989    [Documentation]  Verify SLAAC IPv6 on autoconfig enable.
990
991    @{ipv6_address_origin_list}  ${ipv6_slaac_addr}=
992    ...    Get Address Origin List And Address For Type  SLAAC
993    Wait Until Page Contains  ${ipv6_slaac_addr}
994    Wait Until Page Contains  SLAAC
995
996
997Toggle DHCPv6 State And Verify
998    [Documentation]  Toggle DHCPv6 state and verify.
999    [Arguments]  ${desired_dhcpv6_state}  ${channel_number}
1000
1001    # Description of argument(s):
1002    # desired_dhcpv6_state  DHCPv6 Toggle state (Enabled or Disabled).
1003    # channel_number        Channel number: 1 for eth0, 2 for eth1.
1004
1005    IF    '${channel_number}' == '1'
1006        ${xpath_dhcpv6_button}=  Set Variable    ${xpath_eth0_dhcpv6_button}
1007    ELSE IF    '${channel_number}' == '2'
1008        ${xpath_dhcpv6_button}=  Set Variable    ${xpath_eth1_dhcpv6_button}
1009        Click Element  ${xpath_eth1_interface}
1010        Set Suite Variable  ${CHANNEL_NUMBER}  2
1011    END
1012
1013    ${current_dhcpv6_state}=    Get Text    ${xpath_dhcpv6_button}
1014
1015    IF    '${desired_dhcpv6_state}' == '${current_dhcpv6_state}'
1016        # Already in desired state, reset by toggling twice.
1017        Wait Until Element Is Enabled  ${xpath_dhcpv6_button}  timeout=60s
1018        Click Element  ${xpath_dhcpv6_button}
1019        Wait Until Element Is Not Visible
1020        ...    ${xpath_page_loading_progress_bar}  timeout=120s
1021        Wait Until Element Is Enabled  ${xpath_dhcpv6_button}  timeout=60s
1022        Click Element  ${xpath_dhcpv6_button}
1023        Wait Until Element Is Not Visible
1024        ...    ${xpath_page_loading_progress_bar}  timeout=120s
1025    ELSE
1026        Wait Until Element Is Enabled  ${xpath_dhcpv6_button}  timeout=60s
1027        Click Element  ${xpath_dhcpv6_button}
1028        Wait Until Element Is Not Visible
1029        ...    ${xpath_page_loading_progress_bar}  timeout=120s
1030    END
1031
1032    Wait Until Keyword Succeeds  2 min  30 sec
1033    ...    Element Text Should Be  ${xpath_dhcpv6_button}  ${desired_dhcpv6_state}
1034
1035    # Verify based on final state.
1036    IF    '${desired_dhcpv6_state}' == 'Enabled'
1037        Verify DHCPv6 Address On Enable
1038    ELSE IF    '${desired_dhcpv6_state}' == 'Disabled'
1039        Wait Until Page Does Not Contain  DHCPv6  timeout=60s
1040    END
1041    Click Element  ${xpath_refresh_button}
1042
1043
1044Verify DHCPv6 Address On Enable
1045    [Documentation]  Verify DHCPv6 on enable, if missing log warning and continue.
1046
1047    TRY
1048      @{ipv6_address_origin_list}  ${ipv6_dhcpv6_addr}=
1049      ...  Get Address Origin List And Address For Type  DHCPv6
1050    EXCEPT
1051      Log  DHCPv6 setup is missing!  WARN
1052      RETURN
1053    ELSE
1054      Wait Until Page Contains  ${ipv6_dhcpv6_addr}  timeout=30s
1055      Wait Until Page Contains  DHCPv6  timeout=30s
1056    END
1057
1058
1059Set And Verify DHCPv6 States
1060    [Documentation]  Set and verify DHCPv6 states.
1061    [Arguments]  ${eth0_state}  ${eth1_state}
1062
1063    # Description of argument(s):
1064    # eth0_state    DHCPv6 toggle state of eth0(Enabled or Disabled).
1065    # eth1_state    DHCPv6 toggle state of eth1(Enabled or Disabled).
1066
1067    # Channel 1: eth0.
1068    Toggle DHCPv6 State And Verify  ${eth0_state}  1
1069    # Channel 2: eth1.
1070    Toggle DHCPv6 State And Verify  ${eth1_state}  2
1071
1072
1073Verify Persistency Of IPv6 On BMC Reboot
1074    [Documentation]  Verify IPv6 persistency on BMC reboot for the specified interface.
1075    [Arguments]  ${ipv6_type}  ${channel_number}=${CHANNEL_NUMBER}
1076
1077    # Description of argument(s):
1078    # ipv6_type       Type of IPv6 address(e.g:slaac/static/linklocal).
1079    # channel_number  Ethernet channel number, 1(eth0) or 2(eth1).
1080
1081    IF  '${channel_number}' == '1'
1082        # Capture IPv6 addresses before reboot.
1083        @{ipv6_address_origin_list}  ${addr_before_reboot}=
1084        ...  Get Address Origin List And Address For Type  ${ipv6_type}
1085
1086        Reboot BMC via GUI
1087
1088        # Capture IPv6 addresses after reboot.
1089        @{ipv6_address_origin_list}  ${addr_after_reboot}=
1090        ...  Get Address Origin List And Address For Type  ${ipv6_type}
1091
1092        Should Be Equal    ${addr_before_reboot}    ${addr_after_reboot}
1093        Click Element  ${xpath_network_sub_menu}
1094    ELSE IF  '${channel_number}' == '2'
1095        # Capture IPv6 addresses before reboot.
1096        Set Suite Variable  ${CHANNEL_NUMBER}  2
1097        @{ipv6_address_origin_list}  ${addr_before_reboot}=
1098        ...  Get Address Origin List And Address For Type  ${ipv6_type}
1099
1100        Reboot BMC via GUI
1101
1102        # Capture IPv6 addresses after reboot.
1103        Set Suite Variable  ${CHANNEL_NUMBER}  2
1104        @{ipv6_address_origin_list}  ${addr_after_reboot}=
1105        ...  Get Address Origin List And Address For Type  ${ipv6_type}
1106
1107        Should Be Equal    ${addr_before_reboot}    ${addr_after_reboot}
1108        Click Element  ${xpath_network_sub_menu}
1109        Click Element  ${xpath_eth1_interface}
1110    END
1111    Wait Until Page Contains  ${addr_after_reboot}
1112    Wait Until Page Contains  ${ipv6_type}
1113
1114
1115Collect All IP Addresses On Both Interfaces
1116    [Documentation]  Collecting all the IP addresses on both interfaces.
1117    [Arguments]  ${ip_version}  ${channel_number}
1118
1119    # Description of argument(s):
1120    # ip_version      Either 'ipv4' or 'ipv6'.
1121    # channel_number  Ethernet channel number, 1(eth0) or 2(eth1).
1122
1123    IF  '${channel_number}' == '1'
1124      Wait Until Element Is Enabled  ${xpath_eth1_interface}  timeout=60s
1125      Click Element  ${xpath_eth0_interface}
1126    ELSE
1127      Wait Until Element Is Enabled  ${xpath_eth1_interface}  timeout=60s
1128      Click Element  ${xpath_eth1_interface}
1129    END
1130
1131    IF  '${ip_version}' == 'ipv4'
1132      Wait Until Element Is Enabled  ${xpath_add_static_ipv4_address_button}  timeout=30s
1133      ${ip_elements}=  Get WebElements  ${ipv4_elements}
1134    ELSE IF  '${ip_version}' == 'ipv6'
1135      Wait Until Element Is Enabled  ${xpath_add_static_ipv6_address_button}  timeout=30s
1136      ${ip_elements}=  Get WebElements  ${ipv6_elements}
1137    ELSE
1138      Fail  Invalid IP version provided. Use 'ipv4' or 'ipv6'.
1139    END
1140
1141    ${ip_list}=  Create List
1142    FOR  ${elem}  IN  @{ip_elements}
1143      ${ip}=  Get Text  ${elem}
1144      ${ip}=  Strip String  ${ip}
1145      IF  '${ip}' != '' and '${ip}' != 'No items available'
1146        Append To List  ${ip_list}  ${ip}
1147      END
1148    END
1149    RETURN  ${ip_list}
1150
1151
1152Enable Or Disable DHCPv6 And Verify Impact On IPv4 Settings
1153    [Documentation]  Enable or Disable DHCPv6 and it does not have impact on IPv4 settings.
1154    [Arguments]  ${ip_version}  ${channel_number}  ${desired_dhcpv6_state}
1155
1156    # Description of argument(s):
1157    # ip_version            Either 'ipv4' or 'ipv6'.
1158    # channel_number        Ethernet channel number, 1(eth0) or 2(eth1).
1159    # desired_dhcpv6_state  DHCPv6 Toggle state (Enabled or Disabled).
1160
1161    # Capture IPv4 addresses before disabling DHCPv6.
1162    ${ipv4_before}=  Collect All IP Addresses On Both Interfaces  ${ip_version}  ${channel_number}
1163
1164    Toggle DHCPv6 State And Verify  ${desired_dhcpv6_state}  ${channel_number}
1165    Sleep  ${NETWORK_TIMEOUT}
1166    Reload Page
1167    Wait Until Element Is Enabled  ${xpath_static_ipv4}  timeout=30s
1168
1169    # Capture IPv4 addresses after disabling DHCPv6.
1170    ${ipv4_after}=  Collect All IP Addresses On Both Interfaces  ${ip_version}  ${channel_number}
1171    Lists Should Be Equal  ${ipv4_before}  ${ipv4_after}  ignore_order=True
1172