xref: /openbmc/openbmc-test-automation/openpower/ext_interfaces/test_vmi.robot (revision 286e2f07a1261ad043902a6db05d39429a31a1d4)
1*** Settings ***
2
3Documentation     VMI static/dynamic IP config tests.
4
5Resource          ../../lib/external_intf/vmi_utils.robot
6
7Suite Setup       Suite Setup Execution
8Test Teardown     FFDC On Test Case Fail
9Suite Teardown    Run Keyword And Ignore Error  Suite Teardown Execution
10
11Test Tags         Vmi
12
13*** Variables ***
14
15# users           User Name               password
16@{ADMIN}          admin_user              TestPwd123
17@{OPERATOR}       operator_user           TestPwd123
18@{ReadOnly}       readonly_user           TestPwd123
19&{USERS}          Administrator=${ADMIN}  ReadOnly=${ReadOnly}
20
21${test_ipv4}              10.6.6.6
22${test_gateway}           10.6.6.1
23${test_netmask}           255.255.252.0
24
25&{DHCP_ENABLED}           DHCPEnabled=${${True}}
26&{DHCP_DISABLED}          DHCPEnabled=${${False}}
27
28&{ENABLE_DHCP}            DHCPv4=&{DHCP_ENABLED}
29&{DISABLE_DHCP}           DHCPv4=&{DHCP_DISABLED}
30
31${default}                0.0.0.0
32${default_ipv6addr}       ::
33${prefix_length}          ${64}
34${test_vmi_ipv6addr}      2001:db8:1111:2222:10:5:5:6
35${test_vmi_ipv6gateway}   2001:db8:1111:2222::1
36${ipv4_hexword_addr}      10.5.5.6:1A:1B:1C:1D:1E:1F
37${multicast_ipv6addr}     FF00
38${loopback_ipv6addr}      ::1
39
40
41*** Test Cases ***
42
43Verify All VMI EthernetInterfaces
44    [Documentation]  Verify all VMI ethernet interfaces.
45    [Tags]  Verify_All_VMI_EthernetInterfaces
46
47    Verify VMI EthernetInterfaces
48
49
50Verify Existing VMI Network Interface Details
51    [Documentation]  Verify existing VMI network interface details.
52    [Tags]  Verify_Existing_VMI_Network_Interface_Details
53
54    ${vmi_ip}=  Get VMI Network Interface Details
55    ${origin}=  Set Variable If  ${vmi_ip["DHCPv4"]} == ${False}  Static  DHCP
56    Should Not Be Equal  ${vmi_ip["DHCPv4"]}  ${vmi_ip["IPv4StaticAddresses"]}
57    Should Be Equal As Strings  ${vmi_ip["Id"]}  ${ethernet_interface}
58    Should Be Equal As Strings  ${vmi_ip["Description"]}
59    ...  Hypervisor's Virtual Management Ethernet Interface
60    Should Be Equal As Strings  ${vmi_ip["Name"]}  Hypervisor Ethernet Interface
61    IF   ${vmi_ip["IPv4StaticAddresses"]} != @{empty}
62         Verify VMI Network Interface Details  ${vmi_ip["IPv4_Address"]}
63         ...  ${origin}  ${vmi_ip["IPv4_Gateway"]}  ${vmi_ip["IPv4_SubnetMask"]}
64    END
65
66
67Delete Existing Static VMI IP Address
68    [Documentation]  Delete existing static VMI IP address.
69    [Tags]  Delete_Existing_Static_VMI_IP_Address
70
71    ${curr_origin}=  Get Immediate Child Parameter From VMI Network Interface  DHCPEnabled
72    IF  ${curr_origin} == ${True}
73        Set VMI IPv4 Origin  ${False}  ${HTTP_ACCEPTED}
74    END
75
76    Delete VMI IPv4 Address
77
78
79Verify User Cannot Delete ReadOnly Property IPv4Addresses
80    [Documentation]  Verify user cannot delete readonly property IPv4Addresses.
81    [Tags]  Verify_User_Cannot_Delete_ReadOnly_Property_IPv4Addresses
82
83    ${curr_origin}=  Get Immediate Child Parameter From VMI Network Interface  DHCPEnabled
84    IF  ${curr_origin} == ${True}
85        Set VMI IPv4 Origin  ${False}  ${HTTP_ACCEPTED}
86    END
87    Set Static IPv4 Address To VMI And Verify  ${test_ipv4}  ${test_gateway}  ${test_netmask}
88    Delete VMI IPv4 Address  IPv4Addresses  valid_status_code=${HTTP_FORBIDDEN}
89
90
91Assign Valid And Invalid Static IPv4 Address To VMI
92    [Documentation]  Assign static IPv4 address to VMI.
93    [Tags]  Assign_Valid_And_Invalid_Static_IPv4_Address_To_VMI
94    [Template]  Set Static IPv4 Address To VMI And Verify
95    [Teardown]   Run keywords  Delete VMI IPv4 Address  AND  Test Teardown Execution
96
97    # ip          gateway     netmask           valid_status_code
98    10.5.20.30    10.5.20.1     255.255.252.0    ${HTTP_ACCEPTED}
99    a.3.118.94    10.5.20.1     255.255.252.0    ${HTTP_BAD_REQUEST}
100    10.5.20       10.5.20.1     255.255.252.0    ${HTTP_BAD_REQUEST}
101    10.5.20.-5    10.5.20.1     255.255.252.0    ${HTTP_BAD_REQUEST}
102
103
104Add Multiple IP Addresses On VMI Interface And Verify
105    [Documentation]  Add multiple IP addresses on VMI interface and verify.
106    [Tags]  Add_Multiple_IP_Addresses_On_VMI_Interface_And_Verify
107    [Teardown]   Run keywords  Delete VMI IPv4 Address  AND  Test Teardown Execution
108
109    ${ip1}=  Create dictionary  Address=10.5.5.10  SubnetMask=255.255.252.0  Gateway=10.5.5.1
110    ${ip2}=  Create dictionary  Address=10.5.5.11  SubnetMask=255.255.252.0  Gateway=10.5.5.1
111    ${ip3}=  Create dictionary  Address=10.5.5.12  SubnetMask=255.255.252.0  Gateway=10.5.5.1
112    ${ips}=  Create List  ${ip1}  ${ip2}  ${ip3}
113
114    Redfish.Patch  /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
115    ...  body={'IPv4StaticAddresses':${ips}}  valid_status_codes=[${HTTP_BAD_REQUEST}]
116
117
118Modify IP Addresses On VMI Interface And Verify
119    [Documentation]  Modify IP addresses on VMI interface and verify.
120    [Tags]  Modify_IP_Addresses_On_VMI_Interface_And_Verify
121    [Template]  Set Static IPv4 Address To VMI And Verify
122    [Teardown]   Run keywords  Delete VMI IPv4 Address  AND  Test Teardown Execution
123
124    # ip        gateway       netmask        valid_status_code
125    10.5.5.10   10.5.5.1     255.255.252.0    ${HTTP_ACCEPTED}
126    10.5.5.11   10.5.5.1     255.255.252.0    ${HTTP_ACCEPTED}
127
128
129Switch Between IP Origins On VMI And Verify Details
130    [Documentation]  Switch between IP origins on VMI and verify details.
131    [Tags]  Switch_Between_IP_Origins_On_VMI_And_Verify_Details
132
133    Switch VMI IPv4 Origin And Verify Details
134    Switch VMI IPv4 Origin And Verify Details
135
136
137Verify Persistency Of VMI IPv4 Details After Host Reboot
138    [Documentation]  Verify persistency of VMI IPv4 details after host reboot.
139    [Tags]  Verify_Persistency_Of_VMI_IPv4_Details_After_Host_Reboot
140
141    # Verifying persistency of dynamic address.
142    Set VMI IPv4 Origin  ${True}  ${HTTP_ACCEPTED}
143    Redfish Power Off  stack_mode=skip
144    Redfish Power On
145    Verify VMI Network Interface Details  ${default}  DHCP  ${default}  ${default}
146
147    # Verifying persistency of static address.
148    Switch VMI IPv4 Origin And Verify Details
149    Redfish Power Off  stack_mode=skip
150    Redfish Power On
151    Set Static IPv4 Address To VMI And Verify  ${test_ipv4}  ${test_gateway}  ${test_netmask}
152
153
154Delete VMI Static IP Address And Verify
155    [Documentation]  Delete VMI static IP address and verify.
156    [Tags]  Delete_VMI_Static_IP_Address_And_Verify
157    [Teardown]  Test Teardown Execution
158
159    Set Static IPv4 Address To VMI And Verify  ${test_ipv4}  ${test_gateway}  ${test_netmask}
160    Delete VMI IPv4 Address
161
162
163Verify Successful VMI IP Static Configuration On HOST Boot After Session Delete
164    [Documentation]  Verify VMI IP static Configuration On HOST Boot After session deleted.
165    [Tags]  Verify_Successful_VMI_IP_Static_Configuration_On_HOST_Boot_After_Session_Delete
166    [Teardown]  Run keywords  Delete VMI IPv4 Address  AND  Test Teardown Execution
167
168    Set Static IPv4 Address To VMI And Verify  ${test_ipv4}  ${test_gateway}  ${test_netmask}
169
170    ${session_info}=  Get Redfish Session Info
171    Redfish.Delete  ${session_info["location"]}
172
173    # Create a new Redfish session
174    Redfish.Login
175    Redfish Power Off
176    Redfish Power On
177
178    Verify VMI Network Interface Details  ${test_ipv4}  Static  ${test_gateway}  ${test_netmask}
179
180
181Verify Persistency Of VMI DHCP IP Configuration After Multiple HOST Reboots
182    [Documentation]  Verify Persistency Of VMI DHCP IP configuration After Multiple HOST Reboots
183    [Tags]  Verify_Persistency_Of_VMI_DHCP_IP_Configuration_After_Multiple_HOST_Reboots
184    [Teardown]  Test Teardown Execution
185
186    Set VMI IPv4 Origin  ${True}  ${HTTP_ACCEPTED}
187    ${vmi_ip_config}=  Get VMI Network Interface Details
188    # Verifying persistency of dynamic address after multiple reboots.
189    FOR  ${i}  IN RANGE  ${2}
190        Redfish Power Off
191        Redfish Power On
192        Verify VMI Network Interface Details  ${vmi_ip_config["IPv4_Address"]}
193        ...  DHCP  ${vmi_ip_config["IPv4_Gateway"]}  ${vmi_ip_config["IPv4_SubnetMask"]}
194    END
195
196
197Enable DHCP When Static IP Configured And Verify Static IP
198    [Documentation]  Enable DHCP when static ip configured and verify static ip
199    [Tags]  Enable_DHCP_When_Static_IP_Configured_And_Verify_Static_IP
200    [Setup]  Redfish Power On
201    [Teardown]  Test Teardown Execution
202
203    Set Static IPv4 Address To VMI And Verify  ${test_ipv4}  ${test_gateway}  ${test_netmask}
204    Set VMI IPv4 Origin  ${True}
205    ${vmi_network_conf}=  Get VMI Network Interface Details
206    Should Not Be Equal As Strings  ${test_ipv4}  ${vmi_network_conf["IPv4_Address"]}
207
208
209Verify VMI Static IP Configuration Persist On BMC Reset Before Host Boot
210    [Documentation]  Verify VMI static IP configuration persist on BMC reset.
211    [Tags]   Verify_VMI_Static_IP_Configuration_Persist_On_BMC_Reset_Before_Host_Boot
212    [Teardown]  Run keywords  Delete VMI IPv4 Address  AND  FFDC On Test Case Fail
213
214    Set Static IPv4 Address To VMI And Verify  ${test_ipv4}  ${test_gateway}  ${test_netmask}
215    Redfish OBMC Reboot (off)  stack_mode=skip
216    Redfish Power On
217    # Verifying the VMI static configuration
218    Verify VMI Network Interface Details  ${test_ipv4}  Static   ${test_gateway}  ${test_netmask}
219
220
221Add Static IP When Host Poweroff And Verify On Poweron
222    [Documentation]  Add Static IP When Host Poweroff And Verify on power on
223    [Tags]   Add_Static_IP_When_Host_Poweroff_And_Verify_On_Poweron
224    [Setup]  Redfish Power Off
225    [Teardown]  Run keywords  Delete VMI IPv4 Address  AND  FFDC On Test Case Fail
226
227    Set Static IPv4 Address To VMI And Verify  ${test_ipv4}  ${test_gateway}  ${test_netmask}
228    Redfish Power On
229    Verify VMI Network Interface Details  ${test_ipv4}  Static  ${test_gateway}  ${test_netmask}
230
231
232Add VMI Static IP When Host Poweroff And Verify Static IP On BMC Reset
233    [Documentation]  Add Static IP When Host Poweroff And Verify Static IP On BMC Reset.
234    [Tags]  Add_VMI_Static_IP_When_Host_Poweroff_And_Verify_Static_IP_On_BMC_Reset
235    [Setup]  Redfish Power Off
236    [Teardown]  Run keywords  Delete VMI IPv4 Address  AND  FFDC On Test Case Fail
237
238    Set Static IPv4 Address To VMI And Verify  ${test_ipv4}  ${test_gateway}  ${test_netmask}
239    Redfish OBMC Reboot (off)  stack_mode=skip
240    Redfish Power On
241    Verify VMI Network Interface Details  ${test_ipv4}  Static  ${test_gateway}  ${test_netmask}
242
243
244Enable DHCP When No Static IP Configured And Verify DHCP IP
245    [Documentation]  Enable DHCP when no static ip configured and verify dhcp ip
246    [Tags]  Enable_DHCP_When_No_Static_IP_Configured_And_Verify_DHCP_IP
247    [Setup]  Run Keyword And Ignore Error  Delete VMI IPv4 Address
248    [Teardown]  Test Teardown Execution
249
250    ${curr_origin}=  Get Immediate Child Parameter From VMI Network Interface  DHCPEnabled
251    IF  ${curr_origin} == ${False}
252        Set VMI IPv4 Origin  ${True}  ${HTTP_ACCEPTED}
253    END
254    ${vmi_ip_config}=  Get VMI Network Interface Details
255    Verify VMI Network Interface Details  ${vmi_ip_config["IPv4_Address"]}
256    ...  DHCP  ${vmi_ip_config["IPv4_Gateway"]}  ${vmi_ip_config["IPv4_SubnetMask"]}
257
258
259Verify User Cannot Delete VMI DHCP IP Address
260    [Documentation]  Verify user cannot delete VMI DHCP IP Address
261    [Tags]  Verify_User_Cannot_Delete_VMI_DHCP_IP_Address
262    [Setup]  Set VMI IPv4 Origin  ${True}
263    [Teardown]  Test Teardown Execution
264
265    Delete VMI IPv4 Address  IPv4Addresses  valid_status_code=${HTTP_FORBIDDEN}
266    ${resp}=  Redfish.Get
267    ...  /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
268    Should Not Be Empty  ${resp.dict["IPv4Addresses"]}
269
270
271Enable DHCP When Static IP Configured DHCP Server Unavailable And Verify IP
272    [Documentation]  Enable DHCP When Static IP Configured And DHCP Server Unavailable And Verify No IP.
273    [Tags]  Enable_DHCP_When_Static_IP_Configured_DHCP_Server_Unavailable_And_Verify_IP
274    [Teardown]  Test Teardown Execution
275
276    Set Static IPv4 Address To VMI And Verify  ${test_ipv4}  ${test_gateway}  ${test_netmask}
277    Set VMI IPv4 Origin  ${True}
278    Verify VMI Network Interface Details  ${default}  DHCP  ${default}  ${default}
279
280
281Verify To Configure VMI Static IP Address With Different User Roles
282    [Documentation]  Verify to configure vmi static ip address with different user roles.
283    [Tags]  Verify_To_Configure_VMI_Static_IP_Address_With_Different_User_Roles
284    [Setup]  Run Keywords  Delete BMC Users Using Redfish
285    ...  AND  Create Users With Different Roles  users=${USERS}  force=${True}
286    [Template]  Config VMI Static IP Address Using Different Users
287    [Teardown]  Delete BMC Users Using Redfish
288
289    # username     password    ip_address    gateway          nemask           valid_status_code
290    admin_user     TestPwd123  ${test_ipv4}  ${test_gateway}  ${test_netmask}  ${HTTP_ACCEPTED}
291    readonly_user  TestPwd123  ${test_ipv4}  ${test_gateway}  ${test_netmask}  ${HTTP_FORBIDDEN}
292
293
294Verify To Configure VMI Static IP Address With Operator User Role
295    [Documentation]  Verify to configure vmi static ip address with operator user role.
296    [Tags]  Verify_To_Configure_VMI_Static_IP_Address_With_Operator_User_Role
297    [Setup]  Create Users With Different Roles  users=${USERS}  force=${True}
298    [Template]  Config VMI Static IP Address Using Different Users
299    [Teardown]  Delete BMC Users Using Redfish
300
301    # username     password    ip_address    gateway          nemask           valid_status_code
302    operator_user  TestPwd123  ${test_ipv4}  ${test_gateway}  ${test_netmask}  ${HTTP_FORBIDDEN}
303
304
305Verify To Delete VMI Static IP Address With Different User Roles
306    [Documentation]  Verify to delete vmi static IP address with different user roles.
307    [Tags]  Verify_To_Delete_VMI_Static_IP_Address_With_Different_User_Roles
308    [Setup]  Create Users With Different Roles  users=${USERS}  force=${True}
309    [Template]  Delete VMI Static IP Address Using Different Users
310    [Teardown]  Delete BMC Users Using Redfish
311
312    # username     password     valid_status_code
313    admin_user     TestPwd123   ${HTTP_ACCEPTED}
314    readonly_user  TestPwd123   ${HTTP_FORBIDDEN}
315
316
317Verify To Delete VMI Static IP Address With Operator User Role
318    [Documentation]  Verify to delete vmi static IP address with operator user role.
319    [Tags]  Verify_To_Delete_VMI_Static_IP_Address_With_Operator_User_Role
320    [Setup]  Create Users With Different Roles  users=${USERS}  force=${True}
321    [Template]  Delete VMI Static IP Address Using Different Users
322    [Teardown]  Delete BMC Users Using Redfish
323
324    # username     password     valid_status_code
325    operator_user     TestPwd123   ${HTTP_FORBIDDEN}
326
327
328Verify To Update VMI Static IP Address With Different User Roles
329    [Documentation]  Verify to update vmi static IP address with different user roles.
330    [Tags]  Verify_To_Update_VMI_Static_IP_Address_With_Different_User_Roles
331    [Setup]  Create Users With Different Roles  users=${USERS}  force=${True}
332    [Template]  Config VMI Static IP Address Using Different Users
333    [Teardown]  Delete BMC Users Using Redfish
334
335    # username     password     ip_address  gateway    netmask       valid_status_code
336    admin_user     TestPwd123   10.5.10.20  10.5.10.1  255.255.0.0  ${HTTP_ACCEPTED}
337    readonly_user  TestPwd123   10.5.20.40  10.5.20.1  255.255.0.0  ${HTTP_FORBIDDEN}
338
339
340Verify To Update VMI Static IP Address With Operator User Role
341    [Documentation]  Verify to update vmi static IP address with operator user role.
342    [Tags]  Verify_To_Update_VMI_Static_IP_Address_With_Operator_User_Role
343    [Setup]  Create Users With Different Roles  users=${USERS}  force=${True}
344    [Template]  Config VMI Static IP Address Using Different Users
345    [Teardown]  Delete BMC Users Using Redfish
346
347    # username     password     ip_address  gateway    netmask       valid_status_code
348    operator_user  TestPwd123   10.5.10.30  10.5.10.1  255.255.0.0  ${HTTP_FORBIDDEN}
349
350
351Verify To Read VMI Network Configuration With Different User Roles
352    [Documentation]  Verify to read vmi network configuration with different user roles.
353    [Tags]  Verify_To_Read_VMI_Network_Configuration_With_Different_User_Roles
354    [Setup]  Create Users With Different Roles  users=${USERS}  force=${True}
355    [Template]  Read VMI Static IP Address Using Different Users
356    [Teardown]  Delete BMC Users Using Redfish
357
358    # username     password     valid_status_code
359    admin_user     TestPwd123   ${HTTP_OK}
360    readonly_user  TestPwd123   ${HTTP_OK}
361
362
363Verify To Read VMI Network Configuration With Operator User Role
364    [Documentation]  Verify to read vmi network configuration with operator user role.
365    [Tags]  Verify_To_Read_VMI_Network_Configuration_With_Operator_User_Role
366    [Setup]  Create Users With Different Roles  users=${USERS}  force=${True}
367    [Template]  Read VMI Static IP Address Using Different Users
368    [Teardown]  Delete BMC Users Using Redfish
369
370    # username     password     valid_status_code
371    operator_user  TestPwd123   ${HTTP_FORBIDDEN}
372
373
374Enable DHCP On VMI Network Via Different Users Roles And Verify
375    [Documentation]  Enable DHCP On VMI Network Via Different Users Roles And Verify.
376    [Tags]  Enable_DHCP_On_VMI_Network_Via_Different_Users_Roles_And_Verify
377    [Setup]  Create Users With Different Roles  users=${USERS}  force=${True}
378    [Template]  Update User Role And Set VMI IPv4 Origin
379    [Teardown]  Delete BMC Users Using Redfish
380
381    # username     password     dhcp_enabled   valid_status_code
382    admin_user     TestPwd123   ${True}        ${HTTP_ACCEPTED}
383    readonly_user  TestPwd123   ${True}        ${HTTP_FORBIDDEN}
384
385
386Enable DHCP On VMI Network Via Operator User Role And Verify
387    [Documentation]  Enable DHCP On VMI Network Via Operator User Role And Verify.
388    [Tags]  Enable_DHCP_On_VMI_Network_Via_Operator_User_Role_And_Verify
389    [Setup]  Create Users With Different Roles  users=${USERS}  force=${True}
390    [Template]  Update User Role And Set VMI IPv4 Origin
391    [Teardown]  Delete BMC Users Using Redfish
392
393    # username     password     dhcp_enabled   valid_status_code
394    operator_user  TestPwd123   ${True}        ${HTTP_FORBIDDEN}
395
396
397Disable DHCP On VMI Network Via Different Users Roles And Verify
398    [Documentation]  Disable DHCP On VMI Network Via Different Users Roles And Verify.
399    [Tags]  Disable_DHCP_On_VMI_Network_Via_Different_Users_Roles_And_Verify
400    [Setup]  Create Users With Different Roles  users=${USERS}  force=${True}
401    [Template]  Update User Role And Set VMI IPv4 Origin
402    [Teardown]  Delete BMC Users Using Redfish
403
404    # username     password     dhcp_enabled    valid_status_code
405    admin_user     TestPwd123   ${False}        ${HTTP_ACCEPTED}
406    readonly_user  TestPwd123   ${False}        ${HTTP_FORBIDDEN}
407
408
409Disable DHCP On VMI Network Via Operator User Role And Verify
410    [Documentation]  Disable DHCP On VMI Network Via Operator User Role And Verify.
411    [Tags]  Disable_DHCP_On_VMI_Network_Via_Operator_User_Role_And_Verify
412    [Setup]  Create Users With Different Roles  users=${USERS}  force=${True}
413    [Template]  Update User Role And Set VMI IPv4 Origin
414    [Teardown]  Delete BMC Users Using Redfish
415
416    # username     password     dhcp_enabled    valid_status_code
417    operator_user  TestPwd123   ${False}        ${HTTP_FORBIDDEN}
418
419
420Enable And Disable DHCP And Verify
421    [Documentation]  verify enable DHCP and disable DHCP.
422    [Tags]  Enable_And_Disable_DHCP_And_Verify
423
424    Set VMI IPv4 Origin  ${True}
425    Verify VMI Network Interface Details  ${default}  DHCP  ${default}  ${default}
426    Set VMI IPv4 Origin  ${False}
427    Verify VMI Network Interface Details  ${default}  Static  ${default}  ${default}
428
429
430Multiple Times Enable And Disable DHCP And Verify
431    [Documentation]  Enable and Disable DHCP in a loop and verify VMI gets an IP address from DHCP
432    ...  each time when DHCP is enabled
433    [Tags]  Multiple_Times_Enable_And_Disable_DHCP_And_Verify
434
435    FOR  ${i}  IN RANGE  ${2}
436      Set VMI IPv4 Origin  ${True}
437      Verify VMI Network Interface Details  ${default}  DHCP  ${default}  ${default}
438      Set VMI IPv4 Origin  ${False}
439      Verify VMI Network Interface Details  ${default}  Static  ${default}  ${default}
440    END
441
442
443Assign Static IPv4 Address With Invalid Netmask To VMI
444    [Documentation]  Assign static IPv4 address with invalid netmask and expect error.
445    [Tags]  Assign_Static_IPv4_Address_With_Invalid_Netmask_To_VMI
446    [Template]  Set Static IPv4 Address To VMI And Verify
447
448    # ip          gateway          netmask         valid_status_code
449    ${test_ipv4}  ${test_gateway}  255.256.255.0   ${HTTP_BAD_REQUEST}
450    ${test_ipv4}  ${test_gateway}  ff.ff.ff.ff     ${HTTP_BAD_REQUEST}
451    ${test_ipv4}  ${test_gateway}  255.255.253.0   ${HTTP_BAD_REQUEST}
452
453
454Assign Static IPv4 Address With Invalid Gateway To VMI
455    [Documentation]  Add static IPv4 address with invalid gateway and expect error.
456    [Tags]  Assign_Static_IPv4_Address_With_Invalid_Gateway_To_VMI
457    [Template]  Set Static IPv4 Address To VMI And Verify
458
459    # ip          gateway          netmask           valid_status_code
460    ${test_ipv4}  @@@.%%.44.11     ${test_netmask}   ${HTTP_BAD_REQUEST}
461    ${test_ipv4}  0xa.0xb.0xc.0xd  ${test_netmask}   ${HTTP_BAD_REQUEST}
462    ${test_ipv4}  10.3.36          ${test_netmask}   ${HTTP_BAD_REQUEST}
463    ${test_ipv4}  10.3.36.-10      ${test_netmask}   ${HTTP_BAD_REQUEST}
464
465
466Enable DHCP When Host Is Off And Verify After Poweron
467    [Documentation]  Enable DHCP when host is off and
468    ...  check whether it is enabled after poweron.
469    [Tags]  Enable_DHCP_When_Host_Is_Off_And_Verify_After_Poweron
470    [Setup]  Redfish Power Off  stack_mode=skip
471
472    Set VMI IPv4 Origin  ${True}
473    Redfish Power On  stack_mode=skip
474    Verify VMI Network Interface Details  ${default}  DHCP  ${default}  ${default}
475
476
477Disable DHCP When Host Is Off And Verify New State Reflects After Power On
478    [Documentation]  Disable DHCP when host is off and
479    ...  get network info and verify that VMI origin is static.
480    [Tags]  Disable_DHCP_When_Host_Is_Off_And_Verify_New_State_Reflects_After_Power_On
481    [Setup]  Redfish Power Off  stack_mode=skip
482
483    Set VMI IPv4 Origin  ${False}
484    Redfish Power On  stack_mode=skip
485    Verify VMI Network Interface Details  ${default}  Static  ${default}  ${default}
486
487
488Enable VMI Stateless Address AutoConfig And Verify
489    [Documentation]  Enable VMI SLAACv6 and verify an origin.
490    [Tags]  Enable_VMI_Stateless_Address_AutoConfig_And_Verify
491
492    Set VMI SLAACv6 Origin    ${True}
493
494    # Check origin is set to slaac and address are getting displayed.
495    Verify VMI IPv6 Address  SLAAC
496
497
498Disable VMI Stateless Address AutoConfig And Verify
499    [Documentation]  Disable VMI SLAACv6 and verify an origin.
500    [Tags]  Disable_VMI_Stateless_Address_AutoConfig_And_Verify
501    [Setup]  Set VMI SLAACv6 Origin    ${True}
502
503    Set VMI SLAACv6 Origin    ${False}
504
505    # Check origin is set to static and slaacv6 address are getting erased.
506    Verify VMI IPv6 Address  Static
507
508
509Enable VMI SLAAC And Check Persistency On BMC Reboot
510    [Documentation]  Enable VMI SLAACv6 and verify its persistency
511    ...  on BMC reboot and this works on the setup where router
512    ...  advertises network prefix.
513    [Tags]  Enable_VMI_SLAAC_And_Check_Persistency_On_BMC_Reboot
514
515    Set VMI SLAACv6 Origin    ${True}
516
517    # Reboot BMC and verify persistency.
518    OBMC Reboot (off)
519    Redfish Power On
520    Wait For Host Boot Progress To Reach Required State
521    Sleep  5s
522
523    # Check origin is set to slaac and address are getting displayed.
524    ${vmi_ipv6addr}=  Verify VMI IPv6 Address  SLAAC
525    Should Not Be Equal  ${vmi_ipv6addr["Address"]}  ${default_ipv6addr}
526
527
528Disable VMI SLAAC And Check Persistency On BMC Reboot
529    [Documentation]  Disable VMI SLAACv6 and verify its persistency
530    ...  on BMC reboot.
531    [Tags]  Disable_VMI_SLAAC_And_Check_Persistency_On_BMC_Reboot
532
533    Set VMI SLAACv6 Origin    ${False}
534
535    # Reboot BMC and verify persistency.
536    OBMC Reboot (off)
537    Redfish Power On
538    Wait For Host Boot Progress To Reach Required State
539
540    # Check if origin is set to static and SLAAC address are getting erased.
541    ${vmi_ipv6addr}=  Verify VMI IPv6 Address  Static
542    Should Be Equal  ${vmi_ipv6addr["Address"]}  ${default_ipv6addr}
543
544
545Disable VMI DHCPv4 When SLAAC Is Enabled And Verify
546    [Documentation]  Disable VMI DHCPv4 parameter when SLAACv6 is enabled
547    ...  and check whether the IPv4 address origin is set to static and
548    ...  DHCPv4 address is getting erased.
549    [Tags]  Disable_VMI_DHCPv4_When_SLAAC_Is_Enabled_And_Verify
550    [Setup]  Set VMI IPv4 Origin  ${True}
551
552    # Set IPv6 origin to SLAAC.
553    Set VMI SLAACv6 Origin    ${True}
554    Verify VMI IPv6 Address  SLAAC
555
556    # Disable VMI DHCPv4 and check IPv4 address origin is set to static.
557    Set VMI IPv4 Origin  ${False}
558    Verify VMI Network Interface Details  ${default}  Static  ${default}  ${default}
559
560
561Enable VMI SLAAC When DHCPv6 Is Enabled And Verify
562    [Documentation]  Enable VMI SLAACv6 when VMI DHCPv6 is enabled and
563    ...  check IPv6 gets Slaac address and this works on the setup
564    ...  where router advertise network prefix.
565    [Tags]  Enable_VMI_SLAAC_When_DHCPv6_Is_Enabled_And_Verify
566
567    Set VMI DHCPv6 Property  Enabled
568
569    # Enable SLAAC and check whether IPv6 origin is set to SLAAC.
570    Set VMI SLAACv6 Origin    ${True}
571
572    # Check if origin is set to slaac and address are getting displayed.
573    ${vmi_ipv6addr}=  Verify VMI IPv6 Address  SLAAC
574    Should Not Be Equal  ${vmi_ipv6addr["Address"]}  ${default_ipv6addr}
575    Should Be Equal  ${vmi_ipv6addr["PrefixLength"]}  ${prefix_length}
576
577
578Disable VMI DHCPv6 Property And Verify
579    [Documentation]  Disable VMI DHCPv6 property and verify IPv6 address
580    ...              origin is set to static and DHCPv6 address is erased.
581    [Tags]  Disable_VMI_DHCPv6_Property_And_Verify
582    [Setup]  Set VMI DHCPv6 Property  Enabled
583
584    Set VMI DHCPv6 Property  Disabled
585
586    # Verify IPv6 address origin is set to static and DHCPv6 address is erased.
587    ${vmi_ipv6addr}=  Verify VMI IPv6 Address  Static
588    Should Be Equal  ${vmi_ipv6addr["Address"]}  ${default_ipv6addr}
589
590
591Enable VMI SLAAC When DHCPv4 Is Enabled And Verify
592    [Documentation]  On VMI enable SLAAC when DHCPv4 is enabled and verify DHCPv4 settings are intact
593    ...  and IPv6 origin is set to SLAAC & it gets assigned with SLAAC IPv6 address and this
594    ...  works on the setup where router advertise network prefix.
595    [Tags]  Enable_VMI_SLAAC_When_DHCPv4_Is_Enabled_And_Verify
596    [Setup]  Set VMI IPv4 Origin  ${True}
597
598    # Enable Autoconfig address and check whether IPv6 address origin is set to SLAAC.
599    Set VMI SLAACv6 Origin  ${True}
600    Verify VMI IPv6 Address  SLAAC
601
602    # Check there is no impact on IPv4 settings, IPv4 address origin should be DHCP.
603    Verify VMI Network Interface Details  ${default}  DHCP  ${default}  ${default}
604
605
606Disable VMI DHCPv6 Property And Check Persistency On BMC Reboot
607    [Documentation]  Disable VMI DHCPv6 property and verify its persistency on
608    ...  BMC reboot.
609    [Tags]  Disable_VMI_DHCPv6_Property_And_Check_Persistency_On_BMC_Reboot
610    [Setup]  Set VMI DHCPv6 Property  Enabled
611
612    Set VMI DHCPv6 Property  Disabled
613
614    # Reboot BMC and verify persistency.
615    OBMC Reboot (off)
616
617    # Verify IPv6 address origin is set to Static and DHCPv6 address is erased.
618    ${vmi_ipv6addr}=  Verify VMI IPv6 Address  Static
619    Should Be Equal  ${vmi_ipv6addr["Address"]}  ${default_ipv6addr}
620
621
622Enable VMI SLAAC When IPv4 Origin Is Static And Verify
623    [Documentation]  On VMI enable SLAAC when IPv4 origin is static and verify IPv4 settings are intact
624    ...  and IPv6 origin is set to SLAAC & it gets assigned with SLAAC IPv6 address and this works
625    ...  on the setup where router advertise network prefix.
626    [Tags]  Enable_VMI_SLAAC_When_IPv4_Origin_Is_Static_And_Verify
627    [Setup]  Set Static IPv4 Address To VMI And Verify  ${test_ipv4}  ${test_gateway}  ${test_netmask}
628    [Teardown]  Run keywords  Delete VMI IPv4 Address  AND  Test Teardown Execution
629
630    # Enable Autoconfig address and check whether IPv6 address origin is set to SLAAC.
631    Set VMI SLAACv6 Origin  ${True}
632    Verify VMI IPv6 Address  SLAAC
633
634    # Check there is no impact on IPv4 settings, IPv4 address origin should be Static.
635    Verify VMI Network Interface Details  ${test_ipv4}  Static  ${test_gateway}  ${test_netmask}
636
637
638Configure Static VMI IPv6 Address And Verify
639    [Documentation]  Add static VMI IPv6 address and check whether IPv6 origin is set to static
640    ...  and Static IPv6 address is assigned.
641    [Tags]  Configure_Static_VMI_IPv6_Address_And_Verify
642
643    Set Static VMI IPv6 Address  ${test_vmi_ipv6addr}  ${prefix_length}
644
645    # Verify IPv6 address origin is set to static and static IPv6 address is assigned.
646    ${vmi_ipv6addr}=  Verify VMI IPv6 Address  Static
647    Should Not Be Equal  ${vmi_ipv6addr["Address"]}  ${default_ipv6addr}
648    Should Be Equal  ${vmi_ipv6addr["PrefixLength"]}  ${prefix_length}
649
650
651Configure IPv6 Static Default Gateway On VMI And Verify
652    [Documentation]  Configure IPv6 static default gateway on VMI and verify.
653    [Tags]  Configure_IPv6_Static_Default_Gateway_On_VMI_And_Verify
654    [Setup]  Set Static VMI IPv6 Address  ${test_vmi_ipv6addr}  ${prefix_length}
655
656    Set VMI IPv6 Static Default Gateway  ${test_vmi_ipv6gateway}
657
658    ${resp}=  Redfish.Get
659    ...  /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
660    ${vmi_ipv6_gateways}=  Get From Dictionary  ${resp.dict}  IPv6StaticDefaultGateways
661    ${vmi_ipv6_gateway} =  Get From List  ${vmi_ipv6_gateways}  0
662    Should Be Equal  ${vmi_ipv6_gateway["Address"]}  ${test_vmi_ipv6gateway}
663
664
665Delete VMI Static IPv6 Address And Verify
666    [Documentation]  Delete VMI static IPv6 address and verify address is erased.
667    [Tags]  Delete_VMI_Static_IPv6_Address_And_Verify
668    [Setup]  Set Static VMI IPv6 Address  ${test_vmi_ipv6addr}  ${prefix_length}
669
670    # Delete VMI static IPv6 address.
671    Delete VMI IPv6 Static Address
672
673    # Verify VMI static IPv6 address is erased.
674    ${vmi_ipv6addr}=  Verify VMI IPv6 Address  Static
675    Should Not Be Equal  ${vmi_ipv6addr["Address"]}  ${test_vmi_ipv6addr}
676    Should Be Equal  ${vmi_ipv6addr["Address"]}  ${default_ipv6addr}
677
678
679Enable VMI DHCPv6 When IPv6 Origin Is Static And Verify
680    [Documentation]  Enable VMI DHCPv6 when IPv6 origin is in static and verify
681    ...  origin is set to DHCP and check if static IPv6 address is erased.
682    [Tags]  Enable_VMI_DHCPv6_When_IPv6_Origin_Is_Static_And_Verify
683
684    Set Static VMI IPv6 Address  ${test_vmi_ipv6addr}  ${prefix_length}
685    ${vmi_ipv6addr_static}=  Verify VMI IPv6 Address  Static
686
687    Sleep  5s
688
689    # Enable DHCPv6 property.
690    Set VMI DHCPv6 Property  Enabled
691
692    # Check origin is set to DHCP and static IPv6 address is erased.
693    ${vmi_dhcpv6addr}=  Verify VMI IPv6 Address  DHCPv6
694    Should Not Be Equal  ${vmi_dhcpv6addr["Address"]}  ${vmi_ipv6addr_static["Address"]}
695
696
697Configure Invalid Static IPv6 To VMI And Verify
698    [Documentation]  Configure invalid static IPv6 address to VMI and verify that address
699    ...  does not get assigned and it throws an error.
700    [Tags]  Configure_Invalid_Static_IPv6_To_VMI_And_Verify
701    [Setup]  Set Static VMI IPv6 Address  ${test_vmi_ipv6addr}  ${prefix_length}
702    [Template]  Set VMI Invalid Static IPv6 Address And Verify
703
704    # invalid_vmi_ipv6addr     invalid_prefix_length     valid_status_codes
705    ${default_ipv6addr}        128                       ${HTTP_BAD_REQUEST}
706    ${multicast_ipv6addr}      8                         ${HTTP_BAD_REQUEST}
707    ${loopback_ipv6addr}       64                        ${HTTP_BAD_REQUEST}
708    ${ipv4_hexword_addr}       64                        ${HTTP_BAD_REQUEST}
709
710
711Delete IPv6 Static Default Gateway On VMI And Verify
712    [Documentation]  Delete IPv6 static default gateway and verify address is erased.
713    [Tags]  Delete_IPv6_Static_Default_Gateway_On_VMI_And_Verify
714    [Setup]  Run Keywords  Set Static VMI IPv6 Address  ${test_vmi_ipv6addr}  ${prefix_length}
715    ...  AND  Set VMI IPv6 Static Default Gateway  ${test_vmi_ipv6gateway}
716
717    # Delete IPv6 static default gateway address.
718    Delete VMI IPv6 Static Default Gateway Address
719
720    Sleep  5s
721
722    # Verify static IPv6 default gateway address is deleted.
723    ${resp}=  Redfish.Get
724    ...  /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
725    Should Be Empty  ${resp.dict["IPv6StaticDefaultGateways"]}
726
727
728Disable VMI DHCPv6 When DHCPv4 Is Enabled And Verify
729    [Documentation]  Disable VMI DHCPv6 property when DHCPv4 is enabled and verify
730    ...  DHCPv4 settings are intact and verify IPv6 address origin is set to static.
731    [Tags]  Disable_VMI_DHCPv6_When_DHCPv4_Is_Enabled_And_Verify
732    [Setup]  Run Keywords  Set VMI DHCPv6 Property  Enabled
733    ...  AND  Set VMI IPv4 Origin  ${True}
734
735    Set VMI DHCPv6 Property  Disabled
736
737    # Verify IPv6 address origin is set to static and DHCPv6 address is erased.
738    ${vmi_ipv6addr}=  Verify VMI IPv6 Address  Static
739    Should Be Equal  ${vmi_ipv6addr["Address"]}  ${default_ipv6addr}
740
741    # Check there is no impact on IPv4 settings, IPv4 address origin should be DHCP.
742    Verify VMI Network Interface Details  ${default}  DHCP  ${default}  ${default}
743
744
745Assign Static VMI IPv6 Address And Check Persistency On BMC Reboot
746    [Documentation]  Add static VMI IPv6 address and check whether IPv6 origin is set to static
747    ...  and static IPv6 address is assigned after BMC reboot.
748    [Tags]  Assign_Static_VMI_IPv6_Address_And_Check_Persistency_On_BMC_Reboot
749
750    Set Static VMI IPv6 Address  ${test_vmi_ipv6addr}  ${prefix_length}
751
752    # Reboot BMC and verify persistency.
753    OBMC Reboot (off)
754    Redfish Power On
755    Wait For Host Boot Progress To Reach Required State
756
757    # Verify IPv6 address origin is set to static and static IPv6 address is assigned.
758    ${vmi_ipv6addr}=  Verify VMI IPv6 Address  Static
759    Should Not Be Equal  ${vmi_ipv6addr["Address"]}  ${default_ipv6addr}
760    Should Be Equal  ${vmi_ipv6addr["PrefixLength"]}  ${prefix_length}
761
762
763Enable VMI DHCPv6 When DHCPv4 Is Enabled And Verify
764    [Documentation]  Enable VMI DHCPv6 when DHCPv4 is enabled and verify
765    ...  DHCPv4 settings are intact and verify IPv6 address origin is set to DHCP.
766    [Tags]  Enable_VMI_DHCPv6_When_DHCPv4_Is_Enabled_And_Verify
767    [Setup]  Set VMI IPv4 Origin  ${True}
768
769    # Enable DHCPv6 property.
770    Set VMI DHCPv6 Property  Enabled
771
772    # Check IPv6 origin is set to DHCP.
773    Verify VMI IPv6 Address  DHCPv6
774
775    # Check there is no impact on IPv4 settings, IPv4 address origin should be DHCP.
776    Verify VMI Network Interface Details  ${default}  DHCP  ${default}  ${default}
777
778
779*** Keywords ***
780
781Suite Setup Execution
782    [Documentation]  Do test setup execution task.
783
784    Redfish.Login
785
786    Redfish Power Off
787    Set BIOS Attribute  pvm_hmc_managed  Enabled
788    Set BIOS Attribute  pvm_stop_at_standby  Disabled
789
790    Redfish Power On
791    Wait For Host Boot Progress To Reach Required State
792
793    ${active_channel_config}=  Get Active Channel Config
794    Set Suite Variable   ${active_channel_config}
795    Set Suite Variable  ${ethernet_interface}  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
796    ${resp}=  Redfish.Get
797    ...  /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
798    ${ip_resp}=  Evaluate  json.loads(r'''${resp.text}''')  json
799    ${length}=  Get Length  ${ip_resp["IPv4StaticAddresses"]}
800    ${vmi_network_conf}=  IF  ${length} != ${0}  Get VMI Network Interface Details
801    Set Suite Variable  ${vmi_network_conf}
802
803
804Test Teardown Execution
805    [Documentation]  Do test teardown execution task.
806
807    FFDC On Test Case Fail
808    ${curr_mode}=  Get Immediate Child Parameter From VMI Network Interface  DHCPEnabled
809    IF  ${curr_mode} == ${True}
810        Set VMI IPv4 Origin  ${False}
811    END
812    IF  '${vmi_network_conf["IPv4_Address"]}' != '${default}'
813         Set Static IPv4 Address To VMI And Verify  ${vmi_network_conf["IPv4_Address"]}
814         ...  ${vmi_network_conf["IPv4_Gateway"]}  ${vmi_network_conf["IPv4_SubnetMask"]}
815    END
816
817
818Get Immediate Child Parameter From VMI Network Interface
819    [Documentation]  Get immediate child parameter from VMI network interface.
820    [Arguments]  ${parameter}  ${valid_status_code}=${HTTP_OK}
821
822    # Description of argument(s):
823    # parameter          parameter for which value is required. Ex: DHCPEnabled, MACAddress etc.
824    # valid_status_code  Expected valid status code from GET request.
825
826    ${resp}=  Redfish.Get
827    ...  /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
828    ...  valid_status_codes=[${valid_status_code}]
829
830    ${ip_resp}=  Evaluate  json.loads(r'''${resp.text}''')  json
831    ${value}=  Set Variable If  '${parameter}' != 'DHCPEnabled'   ${ip_resp["${parameter}"]}
832    ...  ${ip_resp["DHCPv4"]["${parameter}"]}
833
834    RETURN  ${value}
835
836
837Switch VMI IPv4 Origin And Verify Details
838    [Documentation]  Switch VMI IPv4 origin and verify details.
839
840    ${dhcp_mode_before}=  Get Immediate Child Parameter From VMI Network Interface  DHCPEnabled
841    ${dhcp_enabled}=  Set Variable If  ${dhcp_mode_before} == ${False}  ${True}  ${False}
842
843    ${origin}=  Set Variable If  ${dhcp_mode_before} == ${False}  DHCP  Static
844    Set VMI IPv4 Origin  ${dhcp_enabled}  ${HTTP_ACCEPTED}
845
846    ${dhcp_mode_after}=  Get Immediate Child Parameter From VMI Network Interface  DHCPEnabled
847    Should Not Be Equal  ${dhcp_mode_before}  ${dhcp_mode_after}
848
849    IF  ${dhcp_mode_after} == ${True}
850        Verify VMI Network Interface Details  ${default}  ${origin}  ${default}  ${default}
851    END
852
853
854Delete VMI Static IP Address Using Different Users
855    [Documentation]  Update user role and delete vmi static IP address.
856    [Arguments]  ${username}  ${password}  ${valid_status_code}
857    [Teardown]  Run Keywords  Redfish.Login  AND
858    ...  Set Static IPv4 Address To VMI And Verify  ${test_ipv4}  ${test_gateway}
859    ...  ${test_netmask}  ${HTTP_ACCEPTED}  AND  Redfish.Logout
860
861    # Description of argument(s):
862    # username            The host username.
863    # password            The host password.
864    # valid_status_code   The expected valid status code.
865
866    # TODO: operator_user role is not yet supported.
867    Skip If  '${username}' == 'operator_user'
868    Redfish.Login  ${username}  ${password}
869    Delete VMI IPv4 Address  delete_param=IPv4StaticAddresses  valid_status_code=${valid_status_code}
870
871
872Config VMI Static IP Address Using Different Users
873   [Documentation]  Update user role and update vmi static ip address.
874   [Arguments]  ${username}  ${password}  ${ip}  ${gateway}  ${netmask}
875   ...  ${valid_status_code}
876
877    # Description of argument(s):
878    # username            The host username.
879    # password            The host password.
880    # ip                  IP address to be added (e.g. "10.7.7.7").
881    # subnet_mask         Subnet mask for the IP to be added
882    #                     (e.g. "255.255.0.0").
883    # gateway             Gateway for the IP to be added (e.g. "10.7.7.1").
884    # valid_status_code   The expected valid status code.
885
886    # TODO: operator_user role is not yet supported.
887    Skip If  '${username}' == 'operator_user'
888    Redfish.Login  ${username}  ${password}
889    Set Static IPv4 Address To VMI And Verify  ${ip}  ${gateway}  ${netmask}  ${valid_status_code}
890
891
892Read VMI Static IP Address Using Different Users
893   [Documentation]  Update user role and read vmi static ip address.
894   [Arguments]  ${username}  ${password}  ${valid_status_code}
895
896    # Description of argument(s):
897    # username            The host username.
898    # password            The host password.
899    # valid_status_code   The expected valid status code.
900
901    # TODO: operator_user role is not yet supported.
902    Skip If  '${username}' == 'operator_user'
903    Redfish.Login  ${username}  ${password}
904    Redfish.Get
905    ...  /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
906    ...  valid_status_codes=[${valid_status_code}]
907
908
909Delete BMC Users Using Redfish
910   [Documentation]  Delete BMC users via redfish.
911
912   Redfish.Login
913   Delete BMC Users Via Redfish  users=${USERS}
914
915
916Update User Role And Set VMI IPv4 Origin
917    [Documentation]  Update User Role And Set VMI IPv4 Origin.
918    [Arguments]  ${username}  ${password}  ${dhcp_enabled}  ${valid_status_code}
919
920    # Description of argument(s):
921    # username            The host username.
922    # password            The host password.
923    # dhcp_enabled        Indicates whether dhcp should be enabled
924    #                     (${True}, ${False}).
925    # valid_status_code   The expected valid status code.
926
927    # TODO: operator_user role is not yet supported.
928    Skip If  '${username}' == 'operator_user'
929    Redfish.Login  ${username}  ${password}
930    Set VMI IPv4 Origin  ${dhcp_enabled}  ${valid_status_code}
931
932
933Suite Teardown Execution
934    [Documentation]  Do suite teardown execution task.
935
936    IF  ${vmi_network_conf} != ${None}
937        Set Static IPv4 Address To VMI And Verify  ${vmi_network_conf["IPv4_Address"]}
938    ...  ${vmi_network_conf["IPv4_Gateway"]}  ${vmi_network_conf["IPv4_SubnetMask"]}
939    END
940
941    Delete All Redfish Sessions
942    Redfish.Logout
943
944
945Set VMI Invalid Static IPv6 Address And Verify
946    [Documentation]  Set VMI invalid static IPv6 address and verify it throws an error.
947    [Arguments]  ${invalid_vmi_ipv6addr}  ${invalid_prefix_length}  ${valid_status_codes}
948    ...  ${interface}=${ethernet_interface}
949
950    # Description of argument(s):
951    # invalid_vmi_ipv6addr           VMI IPv6 address to be added.
952    # invalid_prefix_length          Prefix length for the VMI IPv6 to be added.
953    # valid_status_codes             Expected status code for PATCH request.
954    # interface                      VMI interface (eg. eth0 or eth1).
955
956    Set Static VMI IPv6 Address  ${invalid_vmi_ipv6addr}  ${invalid_prefix_length}
957    ...  ${valid_status_codes}
958
959    ${resp}=  Redfish.Get  /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface}
960
961    @{vmi_ipv6_address}=  Get From Dictionary  ${resp.dict}  IPv6Addresses
962    ${vmi_ipv6_addr}=  Get From List  ${vmi_ipv6_address}  0
963    Should Not Be Equal  ${vmi_ipv6_addr["Address"]}  ${invalid_vmi_ipv6addr}
964
965
966Delete VMI IPv6 Static Default Gateway Address
967    [Documentation]  Delete VMI IPv6 static default gateway address.
968    [Arguments]  ${valid_status_codes}=${HTTP_ACCEPTED}
969    ...  ${interface}=${ethernet_interface}
970
971    # Description of argument(s):
972    # valid_status_codes       Expected valid status code from PATCH request.
973    # interface                VMI interface (eg. eth0 or eth1).
974
975    ${data}=  Set Variable  {"IPv6StaticDefaultGateways": [${Null}]}
976    Redfish.Patch  /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface}
977    ...  body=${data}  valid_status_codes=[${valid_status_codes}]
978