blob: c52660304fe66c423047472fdde396f161ac749f [file] [log] [blame]
Vijay06a169d2020-04-23 09:28:24 -05001*** Settings ***
2
Megha GN80ef5ca2022-06-09 00:29:57 -05003Documentation VMI static/dynamic IP config tests.
Vijay06a169d2020-04-23 09:28:24 -05004
Megha GN80ef5ca2022-06-09 00:29:57 -05005Resource ../../lib/external_intf/vmi_utils.robot
Vijay06a169d2020-04-23 09:28:24 -05006
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -05007Suite Setup Suite Setup Execution
Vijay06a169d2020-04-23 09:28:24 -05008Test Teardown FFDC On Test Case Fail
George Keishing4e0978d2022-07-27 10:21:18 -05009Suite Teardown Run Keyword And Ignore Error Suite Teardown Execution
Vijay06a169d2020-04-23 09:28:24 -050010
Matt Fischer6fb70d92023-10-24 19:06:33 -060011Test Tags Vmi
George Keishing725e0662022-07-20 22:18:14 -050012
Vijay06a169d2020-04-23 09:28:24 -050013*** Variables ***
14
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -050015# users User Name password
16@{ADMIN} admin_user TestPwd123
17@{OPERATOR} operator_user TestPwd123
18@{ReadOnly} readonly_user TestPwd123
Megha GN80ef5ca2022-06-09 00:29:57 -050019&{USERS} Administrator=${ADMIN} ReadOnly=${ReadOnly}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -050020
Prashanth Katti1ce68212020-11-13 00:39:03 -060021${test_ipv4} 10.6.6.6
22${test_gateway} 10.6.6.1
shrsuman123c1d3fe32020-09-08 05:04:07 -050023${test_netmask} 255.255.252.0
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -050024
Vijay06a169d2020-04-23 09:28:24 -050025&{DHCP_ENABLED} DHCPEnabled=${${True}}
26&{DHCP_DISABLED} DHCPEnabled=${${False}}
27
28&{ENABLE_DHCP} DHCPv4=&{DHCP_ENABLED}
29&{DISABLE_DHCP} DHCPv4=&{DHCP_DISABLED}
30
Megha G N38acd842024-10-14 14:28:11 -050031&{SLAAC_ENABLED} IPv6AutoConfigEnabled=${True}
32&{SLAAC_DISABLED} IPv6AutoConfigEnabled=${False}
33
34&{ENABLE_SLAAC} StatelessAddressAutoConfig=&{SLAAC_ENABLED}
35&{DISABLE_SLAAC} StatelessAddressAutoConfig=&{SLAAC_DISABLED}
36
Megha G N02cbfa12022-12-12 02:05:03 -060037${default} 0.0.0.0
Megha G Na37b8da2025-01-06 00:23:15 -060038${default_ipv6addr} ::
Megha G N02cbfa12022-12-12 02:05:03 -060039
Vijay06a169d2020-04-23 09:28:24 -050040
41*** Test Cases ***
42
43Verify All VMI EthernetInterfaces
44 [Documentation] Verify all VMI ethernet interfaces.
shrsuman1235c7e4d72021-04-16 05:42:57 -050045 [Tags] Verify_All_VMI_EthernetInterfaces
Vijay06a169d2020-04-23 09:28:24 -050046
47 Verify VMI EthernetInterfaces
48
49
50Verify Existing VMI Network Interface Details
51 [Documentation] Verify existing VMI network interface details.
shrsuman1235c7e4d72021-04-16 05:42:57 -050052 [Tags] Verify_Existing_VMI_Network_Interface_Details
Vijay06a169d2020-04-23 09:28:24 -050053
54 ${vmi_ip}= Get VMI Network Interface Details
55 ${origin}= Set Variable If ${vmi_ip["DHCPv4"]} == ${False} Static DHCP
Vijay06a169d2020-04-23 09:28:24 -050056 Should Not Be Equal ${vmi_ip["DHCPv4"]} ${vmi_ip["IPv4StaticAddresses"]}
shrsuman123bfb851b2021-07-02 04:59:16 -050057 Should Be Equal As Strings ${vmi_ip["Id"]} ${ethernet_interface}
George Keishingb3ea0952020-07-01 05:03:56 -050058 Should Be Equal As Strings ${vmi_ip["Description"]}
shrsuman1235c7e4d72021-04-16 05:42:57 -050059 ... Hypervisor's Virtual Management Ethernet Interface
60 Should Be Equal As Strings ${vmi_ip["Name"]} Hypervisor Ethernet Interface
shrsuman1235c7e4d72021-04-16 05:42:57 -050061 Run Keyword 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"]}
Vijay06a169d2020-04-23 09:28:24 -050064
65
66Delete Existing Static VMI IP Address
67 [Documentation] Delete existing static VMI IP address.
68 [Tags] Delete_Existing_Static_VMI_IP_Address
69
70 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
71 Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED}
72
shrsuman1235c7e4d72021-04-16 05:42:57 -050073 Delete VMI IPv4 Address
Vijay06a169d2020-04-23 09:28:24 -050074
75
76Verify User Cannot Delete ReadOnly Property IPv4Addresses
77 [Documentation] Verify user cannot delete readonly property IPv4Addresses.
78 [Tags] Verify_User_Cannot_Delete_ReadOnly_Property_IPv4Addresses
79
80 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
shrsuman1235c7e4d72021-04-16 05:42:57 -050081 Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED}
82 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
shrsuman123b25343d2021-09-22 04:33:47 -050083 Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_FORBIDDEN}
Vijay06a169d2020-04-23 09:28:24 -050084
85
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -050086Assign Valid And Invalid Static IPv4 Address To VMI
Vijay06a169d2020-04-23 09:28:24 -050087 [Documentation] Assign static IPv4 address to VMI.
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -050088 [Tags] Assign_Valid_And_Invalid_Static_IPv4_Address_To_VMI
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -060089 [Template] Set Static IPv4 Address To VMI And Verify
90 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
Vijay06a169d2020-04-23 09:28:24 -050091
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -050092 # ip gateway netmask valid_status_code
Shradha Sumanc7df7db2021-03-08 05:16:44 -060093 10.5.20.30 10.5.20.1 255.255.252.0 ${HTTP_ACCEPTED}
94 a.3.118.94 10.5.20.1 255.255.252.0 ${HTTP_BAD_REQUEST}
Anves Kumar rayankula81fd9db2021-05-10 02:39:51 -050095 10.5.20 10.5.20.1 255.255.252.0 ${HTTP_BAD_REQUEST}
96 10.5.20.-5 10.5.20.1 255.255.252.0 ${HTTP_BAD_REQUEST}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -050097
Vijay06a169d2020-04-23 09:28:24 -050098
George Keishing16b3c7b2021-01-28 09:23:37 -060099Add Multiple IP Addresses On VMI Interface And Verify
100 [Documentation] Add multiple IP addresses on VMI interface and verify.
101 [Tags] Add_Multiple_IP_Addresses_On_VMI_Interface_And_Verify
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600102 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
shrsuman123e37b0cc2020-09-02 00:33:42 -0500103
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600104 ${ip1}= Create dictionary Address=10.5.5.10 SubnetMask=255.255.252.0 Gateway=10.5.5.1
105 ${ip2}= Create dictionary Address=10.5.5.11 SubnetMask=255.255.252.0 Gateway=10.5.5.1
106 ${ip3}= Create dictionary Address=10.5.5.12 SubnetMask=255.255.252.0 Gateway=10.5.5.1
shrsuman123e37b0cc2020-09-02 00:33:42 -0500107 ${ips}= Create List ${ip1} ${ip2} ${ip3}
108
shrsuman123bfb851b2021-07-02 04:59:16 -0500109 Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
shrsuman123993a5c92021-04-19 06:40:16 -0500110 ... body={'IPv4StaticAddresses':${ips}} valid_status_codes=[${HTTP_BAD_REQUEST}]
shrsuman123e37b0cc2020-09-02 00:33:42 -0500111
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500112
shrsuman123e37b0cc2020-09-02 00:33:42 -0500113Modify IP Addresses On VMI Interface And Verify
114 [Documentation] Modify IP addresses on VMI interface and verify.
115 [Tags] Modify_IP_Addresses_On_VMI_Interface_And_Verify
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600116 [Template] Set Static IPv4 Address To VMI And Verify
117 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
shrsuman123e37b0cc2020-09-02 00:33:42 -0500118
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500119 # ip gateway netmask valid_status_code
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600120 10.5.5.10 10.5.5.1 255.255.252.0 ${HTTP_ACCEPTED}
121 10.5.5.11 10.5.5.1 255.255.252.0 ${HTTP_ACCEPTED}
Vijay06a169d2020-04-23 09:28:24 -0500122
Megha GN80ef5ca2022-06-09 00:29:57 -0500123
Vijay06a169d2020-04-23 09:28:24 -0500124Switch Between IP Origins On VMI And Verify Details
125 [Documentation] Switch between IP origins on VMI and verify details.
126 [Tags] Switch_Between_IP_Origins_On_VMI_And_Verify_Details
127
128 Switch VMI IPv4 Origin And Verify Details
129 Switch VMI IPv4 Origin And Verify Details
130
131
132Verify Persistency Of VMI IPv4 Details After Host Reboot
133 [Documentation] Verify persistency of VMI IPv4 details after host reboot.
134 [Tags] Verify_Persistency_Of_VMI_IPv4_Details_After_Host_Reboot
135
136 # Verifying persistency of dynamic address.
137 Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
Anves Kumar rayankula7936eee2021-04-19 05:38:36 -0500138 Redfish Power Off stack_mode=skip
139 Redfish Power On
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500140 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
Vijay06a169d2020-04-23 09:28:24 -0500141
142 # Verifying persistency of static address.
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600143 Switch VMI IPv4 Origin And Verify Details
Anves Kumar rayankula7936eee2021-04-19 05:38:36 -0500144 Redfish Power Off stack_mode=skip
145 Redfish Power On
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600146 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Vijay06a169d2020-04-23 09:28:24 -0500147
148
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500149Delete VMI Static IP Address And Verify
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500150 [Documentation] Delete VMI static IP address and verify.
151 [Tags] Delete_VMI_Static_IP_Address_And_Verify
152 [Teardown] Test Teardown Execution
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500153
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600154 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
155 Delete VMI IPv4 Address
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500156
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500157
shrsuman123c1d3fe32020-09-08 05:04:07 -0500158Verify Successful VMI IP Static Configuration On HOST Boot After Session Delete
159 [Documentation] Verify VMI IP static Configuration On HOST Boot After session deleted.
160 [Tags] Verify_Successful_VMI_IP_Static_Configuration_On_HOST_Boot_After_Session_Delete
shrsuman123b25343d2021-09-22 04:33:47 -0500161 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
shrsuman123c1d3fe32020-09-08 05:04:07 -0500162
shrsuman12375e77062020-09-18 01:08:45 -0500163 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
shrsuman123c1d3fe32020-09-08 05:04:07 -0500164
165 ${session_info}= Get Redfish Session Info
166 Redfish.Delete ${session_info["location"]}
167
168 # Create a new Redfish session
shrsuman1235c7e4d72021-04-16 05:42:57 -0500169 Redfish.Login
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500170 Redfish Power Off
171 Redfish Power On
shrsuman123c1d3fe32020-09-08 05:04:07 -0500172
173 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
174
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500175
shrsuman123c1d3fe32020-09-08 05:04:07 -0500176Verify Persistency Of VMI DHCP IP Configuration After Multiple HOST Reboots
177 [Documentation] Verify Persistency Of VMI DHCP IP configuration After Multiple HOST Reboots
178 [Tags] Verify_Persistency_Of_VMI_DHCP_IP_Configuration_After_Multiple_HOST_Reboots
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500179 [Teardown] Test Teardown Execution
shrsuman123c1d3fe32020-09-08 05:04:07 -0500180
shrsuman123c1d3fe32020-09-08 05:04:07 -0500181 Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
shrsuman123c1d3fe32020-09-08 05:04:07 -0500182 ${vmi_ip_config}= Get VMI Network Interface Details
183 # Verifying persistency of dynamic address after multiple reboots.
shrsuman123f559cbe2021-01-06 05:40:45 -0600184 FOR ${i} IN RANGE ${2}
185 Redfish Power Off
186 Redfish Power On
George Keishing538f1742022-03-14 05:00:55 -0500187 Verify VMI Network Interface Details ${vmi_ip_config["IPv4_Address"]}
188 ... DHCP ${vmi_ip_config["IPv4_Gateway"]} ${vmi_ip_config["IPv4_SubnetMask"]}
shrsuman123f559cbe2021-01-06 05:40:45 -0600189 END
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500190
191
192Enable DHCP When Static IP Configured And Verify Static IP
193 [Documentation] Enable DHCP when static ip configured and verify static ip
George Keishing4203fad2022-01-31 12:22:33 -0600194 [Tags] Enable_DHCP_When_Static_IP_Configured_And_Verify_Static_IP
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600195 [Setup] Redfish Power On
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500196 [Teardown] Test Teardown Execution
197
shrsuman123f559cbe2021-01-06 05:40:45 -0600198 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500199 Set VMI IPv4 Origin ${True}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500200 ${vmi_network_conf}= Get VMI Network Interface Details
201 Should Not Be Equal As Strings ${test_ipv4} ${vmi_network_conf["IPv4_Address"]}
202
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500203
shrsuman123e37b0cc2020-09-02 00:33:42 -0500204Verify VMI Static IP Configuration Persist On BMC Reset Before Host Boot
205 [Documentation] Verify VMI static IP configuration persist on BMC reset.
206 [Tags] Verify_VMI_Static_IP_Configuration_Persist_On_BMC_Reset_Before_Host_Boot
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600207 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail
shrsuman123e37b0cc2020-09-02 00:33:42 -0500208
shrsuman12375e77062020-09-18 01:08:45 -0500209 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Megha GNbe428592022-07-21 10:33:02 -0500210 Redfish OBMC Reboot (off) stack_mode=skip
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500211 Redfish Power On
shrsuman123e37b0cc2020-09-02 00:33:42 -0500212 # Verifying the VMI static configuration
213 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
214
Megha GN80ef5ca2022-06-09 00:29:57 -0500215
shrsuman12375e77062020-09-18 01:08:45 -0500216Add Static IP When Host Poweroff And Verify On Poweron
217 [Documentation] Add Static IP When Host Poweroff And Verify on power on
218 [Tags] Add_Static_IP_When_Host_Poweroff_And_Verify_On_Poweron
219 [Setup] Redfish Power Off
220 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail
221
222 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
223 Redfish Power On
224 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
225
Megha GN80ef5ca2022-06-09 00:29:57 -0500226
shrsuman12375e77062020-09-18 01:08:45 -0500227Add VMI Static IP When Host Poweroff And Verify Static IP On BMC Reset
228 [Documentation] Add Static IP When Host Poweroff And Verify Static IP On BMC Reset.
229 [Tags] Add_VMI_Static_IP_When_Host_Poweroff_And_Verify_Static_IP_On_BMC_Reset
230 [Setup] Redfish Power Off
231 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail
232
233 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Megha GNbe428592022-07-21 10:33:02 -0500234 Redfish OBMC Reboot (off) stack_mode=skip
shrsuman12375e77062020-09-18 01:08:45 -0500235 Redfish Power On
236 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
237
Megha GN80ef5ca2022-06-09 00:29:57 -0500238
shrsuman12375e77062020-09-18 01:08:45 -0500239Enable DHCP When No Static IP Configured And Verify DHCP IP
240 [Documentation] Enable DHCP when no static ip configured and verify dhcp ip
241 [Tags] Enable_DHCP_When_No_Static_IP_Configured_And_Verify_DHCP_IP
242 [Setup] Run Keyword And Ignore Error Delete VMI IPv4 Address
243 [Teardown] Test Teardown Execution
244
245 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
246 Run Keyword If ${curr_origin} == ${False} Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
247 ${vmi_ip_config}= Get VMI Network Interface Details
George Keishing538f1742022-03-14 05:00:55 -0500248 Verify VMI Network Interface Details ${vmi_ip_config["IPv4_Address"]}
249 ... DHCP ${vmi_ip_config["IPv4_Gateway"]} ${vmi_ip_config["IPv4_SubnetMask"]}
shrsuman12375e77062020-09-18 01:08:45 -0500250
Megha GN80ef5ca2022-06-09 00:29:57 -0500251
shrsuman12375e77062020-09-18 01:08:45 -0500252Verify User Cannot Delete VMI DHCP IP Address
253 [Documentation] Verify user cannot delete VMI DHCP IP Address
254 [Tags] Verify_User_Cannot_Delete_VMI_DHCP_IP_Address
255 [Setup] Set VMI IPv4 Origin ${True}
256 [Teardown] Test Teardown Execution
257
shrsuman123b25343d2021-09-22 04:33:47 -0500258 Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_FORBIDDEN}
shrsuman12375e77062020-09-18 01:08:45 -0500259 ${resp}= Redfish.Get
shrsuman123bfb851b2021-07-02 04:59:16 -0500260 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
shrsuman12375e77062020-09-18 01:08:45 -0500261 Should Not Be Empty ${resp.dict["IPv4Addresses"]}
262
Megha GN80ef5ca2022-06-09 00:29:57 -0500263
shrsuman12375e77062020-09-18 01:08:45 -0500264Enable DHCP When Static IP Configured DHCP Server Unavailable And Verify IP
265 [Documentation] Enable DHCP When Static IP Configured And DHCP Server Unavailable And Verify No IP.
266 [Tags] Enable_DHCP_When_Static_IP_Configured_DHCP_Server_Unavailable_And_Verify_IP
267 [Teardown] Test Teardown Execution
268
269 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
270 Set VMI IPv4 Origin ${True}
shrsuman12375e77062020-09-18 01:08:45 -0500271 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
272
shrsuman123e37b0cc2020-09-02 00:33:42 -0500273
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500274Verify To Configure VMI Static IP Address With Different User Roles
275 [Documentation] Verify to configure vmi static ip address with different user roles.
276 [Tags] Verify_To_Configure_VMI_Static_IP_Address_With_Different_User_Roles
Megha G N4e2b5732023-02-02 04:52:27 -0600277 [Setup] Run Keywords Delete BMC Users Using Redfish
278 ... AND Create Users With Different Roles users=${USERS} force=${True}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500279 [Template] Config VMI Static IP Address Using Different Users
280 [Teardown] Delete BMC Users Using Redfish
281
282 # username password ip_address gateway nemask valid_status_code
283 admin_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_ACCEPTED}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500284 readonly_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500285
286
287Verify To Configure VMI Static IP Address With Operator User Role
288 [Documentation] Verify to configure vmi static ip address with operator user role.
289 [Tags] Verify_To_Configure_VMI_Static_IP_Address_With_Operator_User_Role
290 [Setup] Create Users With Different Roles users=${USERS} force=${True}
291 [Template] Config VMI Static IP Address Using Different Users
292 [Teardown] Delete BMC Users Using Redfish
293
294 # username password ip_address gateway nemask valid_status_code
295 operator_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500296
297
298Verify To Delete VMI Static IP Address With Different User Roles
299 [Documentation] Verify to delete vmi static IP address with different user roles.
300 [Tags] Verify_To_Delete_VMI_Static_IP_Address_With_Different_User_Roles
301 [Setup] Create Users With Different Roles users=${USERS} force=${True}
302 [Template] Delete VMI Static IP Address Using Different Users
303 [Teardown] Delete BMC Users Using Redfish
304
305 # username password valid_status_code
306 admin_user TestPwd123 ${HTTP_ACCEPTED}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500307 readonly_user TestPwd123 ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500308
309
310Verify To Delete VMI Static IP Address With Operator User Role
311 [Documentation] Verify to delete vmi static IP address with operator user role.
312 [Tags] Verify_To_Delete_VMI_Static_IP_Address_With_Operator_User_Role
313 [Setup] Create Users With Different Roles users=${USERS} force=${True}
314 [Template] Delete VMI Static IP Address Using Different Users
315 [Teardown] Delete BMC Users Using Redfish
316
317 # username password valid_status_code
318 operator_user TestPwd123 ${HTTP_FORBIDDEN}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500319
320
321Verify To Update VMI Static IP Address With Different User Roles
322 [Documentation] Verify to update vmi static IP address with different user roles.
George Keishing4203fad2022-01-31 12:22:33 -0600323 [Tags] Verify_To_Update_VMI_Static_IP_Address_With_Different_User_Roles
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500324 [Setup] Create Users With Different Roles users=${USERS} force=${True}
325 [Template] Config VMI Static IP Address Using Different Users
326 [Teardown] Delete BMC Users Using Redfish
327
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600328 # username password ip_address gateway netmask valid_status_code
329 admin_user TestPwd123 10.5.10.20 10.5.10.1 255.255.0.0 ${HTTP_ACCEPTED}
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600330 readonly_user TestPwd123 10.5.20.40 10.5.20.1 255.255.0.0 ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500331
332
333Verify To Update VMI Static IP Address With Operator User Role
334 [Documentation] Verify to update vmi static IP address with operator user role.
335 [Tags] Verify_To_Update_VMI_Static_IP_Address_With_Operator_User_Role
336 [Setup] Create Users With Different Roles users=${USERS} force=${True}
337 [Template] Config VMI Static IP Address Using Different Users
338 [Teardown] Delete BMC Users Using Redfish
339
340 # username password ip_address gateway netmask valid_status_code
341 operator_user TestPwd123 10.5.10.30 10.5.10.1 255.255.0.0 ${HTTP_FORBIDDEN}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500342
343
344Verify To Read VMI Network Configuration With Different User Roles
345 [Documentation] Verify to read vmi network configuration with different user roles.
George Keishing4203fad2022-01-31 12:22:33 -0600346 [Tags] Verify_To_Read_VMI_Network_Configuration_With_Different_User_Roles
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500347 [Setup] Create Users With Different Roles users=${USERS} force=${True}
348 [Template] Read VMI Static IP Address Using Different Users
349 [Teardown] Delete BMC Users Using Redfish
350
351 # username password valid_status_code
352 admin_user TestPwd123 ${HTTP_OK}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500353 readonly_user TestPwd123 ${HTTP_OK}
Megha GN80ef5ca2022-06-09 00:29:57 -0500354
355
356Verify To Read VMI Network Configuration With Operator User Role
357 [Documentation] Verify to read vmi network configuration with operator user role.
358 [Tags] Verify_To_Read_VMI_Network_Configuration_With_Operator_User_Role
359 [Setup] Create Users With Different Roles users=${USERS} force=${True}
360 [Template] Read VMI Static IP Address Using Different Users
361 [Teardown] Delete BMC Users Using Redfish
362
363 # username password valid_status_code
364 operator_user TestPwd123 ${HTTP_FORBIDDEN}
365
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500366
shrsuman123b361d412020-09-30 06:17:23 -0500367Enable DHCP On VMI Network Via Different Users Roles And Verify
368 [Documentation] Enable DHCP On VMI Network Via Different Users Roles And Verify.
369 [Tags] Enable_DHCP_On_VMI_Network_Via_Different_Users_Roles_And_Verify
370 [Setup] Create Users With Different Roles users=${USERS} force=${True}
371 [Template] Update User Role And Set VMI IPv4 Origin
372 [Teardown] Delete BMC Users Using Redfish
373
374 # username password dhcp_enabled valid_status_code
375 admin_user TestPwd123 ${True} ${HTTP_ACCEPTED}
shrsuman123b361d412020-09-30 06:17:23 -0500376 readonly_user TestPwd123 ${True} ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500377
378
379Enable DHCP On VMI Network Via Operator User Role And Verify
380 [Documentation] Enable DHCP On VMI Network Via Operator User Role And Verify.
381 [Tags] Enable_DHCP_On_VMI_Network_Via_Operator_User_Role_And_Verify
382 [Setup] Create Users With Different Roles users=${USERS} force=${True}
383 [Template] Update User Role And Set VMI IPv4 Origin
384 [Teardown] Delete BMC Users Using Redfish
385
386 # username password dhcp_enabled valid_status_code
387 operator_user TestPwd123 ${True} ${HTTP_FORBIDDEN}
388
shrsuman123b361d412020-09-30 06:17:23 -0500389
390Disable DHCP On VMI Network Via Different Users Roles And Verify
391 [Documentation] Disable DHCP On VMI Network Via Different Users Roles And Verify.
392 [Tags] Disable_DHCP_On_VMI_Network_Via_Different_Users_Roles_And_Verify
393 [Setup] Create Users With Different Roles users=${USERS} force=${True}
394 [Template] Update User Role And Set VMI IPv4 Origin
395 [Teardown] Delete BMC Users Using Redfish
396
397 # username password dhcp_enabled valid_status_code
398 admin_user TestPwd123 ${False} ${HTTP_ACCEPTED}
shrsuman123b361d412020-09-30 06:17:23 -0500399 readonly_user TestPwd123 ${False} ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500400
401
402Disable DHCP On VMI Network Via Operator User Role And Verify
403 [Documentation] Disable DHCP On VMI Network Via Operator User Role And Verify.
404 [Tags] Disable_DHCP_On_VMI_Network_Via_Operator_User_Role_And_Verify
405 [Setup] Create Users With Different Roles users=${USERS} force=${True}
406 [Template] Update User Role And Set VMI IPv4 Origin
407 [Teardown] Delete BMC Users Using Redfish
408
409 # username password dhcp_enabled valid_status_code
410 operator_user TestPwd123 ${False} ${HTTP_FORBIDDEN}
shrsuman123b361d412020-09-30 06:17:23 -0500411
shrsuman123e37b0cc2020-09-02 00:33:42 -0500412
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500413Enable And Disable DHCP And Verify
414 [Documentation] verify enable DHCP and disable DHCP.
George Keishing4203fad2022-01-31 12:22:33 -0600415 [Tags] Enable_And_Disable_DHCP_And_Verify
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500416
417 Set VMI IPv4 Origin ${True}
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500418 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
419 Set VMI IPv4 Origin ${False}
Megha GN80ef5ca2022-06-09 00:29:57 -0500420 Verify VMI Network Interface Details ${default} Static ${default} ${default}
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500421
422
423Multiple Times Enable And Disable DHCP And Verify
424 [Documentation] Enable and Disable DHCP in a loop and verify VMI gets an IP address from DHCP
425 ... each time when DHCP is enabled
426 [Tags] Multiple_Times_Enable_And_Disable_DHCP_And_Verify
427
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500428 FOR ${i} IN RANGE ${2}
429 Set VMI IPv4 Origin ${True}
430 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
431 Set VMI IPv4 Origin ${False}
Megha GN80ef5ca2022-06-09 00:29:57 -0500432 Verify VMI Network Interface Details ${default} Static ${default} ${default}
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500433 END
434
435
Anves Kumar rayankula81fd9db2021-05-10 02:39:51 -0500436Assign Static IPv4 Address With Invalid Netmask To VMI
437 [Documentation] Assign static IPv4 address with invalid netmask and expect error.
438 [Tags] Assign_Static_IPv4_Address_With_Invalid_Netmask_To_VMI
439 [Template] Set Static IPv4 Address To VMI And Verify
440
441 # ip gateway netmask valid_status_code
442 ${test_ipv4} ${test_gateway} 255.256.255.0 ${HTTP_BAD_REQUEST}
443 ${test_ipv4} ${test_gateway} ff.ff.ff.ff ${HTTP_BAD_REQUEST}
444 ${test_ipv4} ${test_gateway} 255.255.253.0 ${HTTP_BAD_REQUEST}
445
446
447Assign Static IPv4 Address With Invalid Gateway To VMI
448 [Documentation] Add static IPv4 address with invalid gateway and expect error.
449 [Tags] Assign_Static_IPv4_Address_With_Invalid_Gateway_To_VMI
450 [Template] Set Static IPv4 Address To VMI And Verify
451
452 # ip gateway netmask valid_status_code
453 ${test_ipv4} @@@.%%.44.11 ${test_netmask} ${HTTP_BAD_REQUEST}
454 ${test_ipv4} 0xa.0xb.0xc.0xd ${test_netmask} ${HTTP_BAD_REQUEST}
455 ${test_ipv4} 10.3.36 ${test_netmask} ${HTTP_BAD_REQUEST}
456 ${test_ipv4} 10.3.36.-10 ${test_netmask} ${HTTP_BAD_REQUEST}
457
458
Megha G N02cbfa12022-12-12 02:05:03 -0600459Enable DHCP When Host Is Off And Verify After Poweron
460 [Documentation] Enable DHCP when host is off and
461 ... check whether it is enabled after poweron.
462 [Tags] Enable_DHCP_When_Host_Is_Off_And_Verify_After_Poweron
463 [Setup] Redfish Power Off stack_mode=skip
464
465 Set VMI IPv4 Origin ${True}
466 Redfish Power On stack_mode=skip
467 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
468
469
Megha G N89174682023-01-24 23:28:27 -0600470Disable DHCP When Host Is Off And Verify New State Reflects After Power On
471 [Documentation] Disable DHCP when host is off and
472 ... get network info and verify that VMI origin is static.
473 [Tags] Disable_DHCP_When_Host_Is_Off_And_Verify_New_State_Reflects_After_Power_On
474 [Setup] Redfish Power Off stack_mode=skip
475
476 Set VMI IPv4 Origin ${False}
477 Redfish Power On stack_mode=skip
478 Verify VMI Network Interface Details ${default} Static ${default} ${default}
479
480
Megha G N38acd842024-10-14 14:28:11 -0500481Enable VMI Stateless Address AutoConfig And Verify
482 [Documentation] Enable VMI SLAACv6 and verify an origin.
483 [Tags] Enable_VMI_Stateless_Address_AutoConfig_And_Verify
484
485 Set VMI SLAACv6 Origin ${True}
486
487 # Check origin is set to slaac and address are getting displayed.
488 Verify VMI IPv6 Address SLAAC
489
490
Megha G Ne8c0e422024-12-04 03:12:55 -0600491Disable VMI Stateless Address AutoConfig And Verify
492 [Documentation] Disable VMI SLAACv6 and verify an origin.
493 [Tags] Disable_VMI_Stateless_Address_AutoConfig_And_Verify
494 [Setup] Set VMI SLAACv6 Origin ${True}
495
496 Set VMI SLAACv6 Origin ${False}
497
498 # Check origin is set to static and slaacv6 address are getting erased.
499 Verify VMI IPv6 Address Static
500
501
Megha G Na37b8da2025-01-06 00:23:15 -0600502Enable VMI SLAAC And Check Persistency On BMC Reboot
503 [Documentation] Enable VMI SLAACv6 and verify its persistency
504 ... on BMC reboot and this works on the setup where router
505 ... advertise network prefix.
506 [Tags] Enable_VMI_SLAAC_And_Check_Persistency_On_BMC_Reboot
507
508 Set VMI SLAACv6 Origin ${True}
509
510 # Reboot BMC and verify persistency.
511 OBMC Reboot (off)
512 Redfish Power On
513 Wait For Host Boot Progress To Reach Required State
514
515 # Check origin is set to slaac and address are getting displayed.
516 ${vmi_ipv6addr}= Verify VMI IPv6 Address SLAAC
517 Should Not Be Equal ${vmi_ipv6addr["Address"]} ${default_ipv6addr}
518
519
Megha G N49657382025-01-07 23:10:42 -0600520Disable VMI SLAAC And Check Persistency On BMC Reboot
521 [Documentation] Disable VMI SLAACv6 and verify its persistency
522 ... on BMC reboot.
523 [Tags] Disable_VMI_SLAAC_And_Check_Persistency_On_BMC_Reboot
524
525 Set VMI SLAACv6 Origin ${False}
526
527 # Reboot BMC and verify persistency.
528 OBMC Reboot (off)
529 Redfish Power On
530 Wait For Host Boot Progress To Reach Required State
531
532 # Check if origin is set to static and SLAAC address are getting erased.
533 ${vmi_ipv6addr}= Verify VMI IPv6 Address Static
534 Should Be Equal ${vmi_ipv6addr["Address"]} ${default_ipv6addr}
535
536
Vijay06a169d2020-04-23 09:28:24 -0500537*** Keywords ***
538
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500539Suite Setup Execution
540 [Documentation] Do test setup execution task.
541
542 Redfish.Login
Megha G Nd0b4da92024-02-08 15:04:24 -0600543
544 Redfish Power Off
545 Set BIOS Attribute pvm_hmc_managed Enabled
Megha G N1e538242024-06-11 03:42:03 -0500546 Set BIOS Attribute pvm_stop_at_standby Disabled
547
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500548 Redfish Power On
Megha G N1e538242024-06-11 03:42:03 -0500549 Wait For Host Boot Progress To Reach Required State
Megha G N86507da2024-02-07 23:16:27 -0600550
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500551 ${active_channel_config}= Get Active Channel Config
552 Set Suite Variable ${active_channel_config}
shrsuman123bfb851b2021-07-02 04:59:16 -0500553 Set Suite Variable ${ethernet_interface} ${active_channel_config['${CHANNEL_NUMBER}']['name']}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500554 ${resp}= Redfish.Get
shrsuman123bfb851b2021-07-02 04:59:16 -0500555 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
shrsuman12362e5be52021-05-20 02:42:59 -0500556 ${ip_resp}= Evaluate json.loads(r'''${resp.text}''') json
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500557 ${length}= Get Length ${ip_resp["IPv4StaticAddresses"]}
558 ${vmi_network_conf}= Run Keyword If ${length} != ${0} Get VMI Network Interface Details
559 Set Suite Variable ${vmi_network_conf}
560
561
562Test Teardown Execution
563 [Documentation] Do test teardown execution task.
564
565 FFDC On Test Case Fail
566 ${curr_mode}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
567 Run Keyword If ${curr_mode} == ${True} Set VMI IPv4 Origin ${False}
Megha G N1e538242024-06-11 03:42:03 -0500568 Run Keyword If '${vmi_network_conf["IPv4_Address"]}' != '${default}'
shrsuman123f559cbe2021-01-06 05:40:45 -0600569 ... Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500570 ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]}
571
572
Vijay06a169d2020-04-23 09:28:24 -0500573Get Immediate Child Parameter From VMI Network Interface
574 [Documentation] Get immediate child parameter from VMI network interface.
575 [Arguments] ${parameter} ${valid_status_code}=${HTTP_OK}
576
577 # Description of argument(s):
578 # parameter parameter for which value is required. Ex: DHCPEnabled, MACAddress etc.
579 # valid_status_code Expected valid status code from GET request.
580
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -0500581 ${resp}= Redfish.Get
shrsuman123bfb851b2021-07-02 04:59:16 -0500582 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
Vijay06a169d2020-04-23 09:28:24 -0500583 ... valid_status_codes=[${valid_status_code}]
584
shrsuman12362e5be52021-05-20 02:42:59 -0500585 ${ip_resp}= Evaluate json.loads(r'''${resp.text}''') json
Vijay06a169d2020-04-23 09:28:24 -0500586 ${value}= Set Variable If '${parameter}' != 'DHCPEnabled' ${ip_resp["${parameter}"]}
587 ... ${ip_resp["DHCPv4"]["${parameter}"]}
588
George Keishing409df052024-01-17 22:36:14 +0530589 RETURN ${value}
Vijay06a169d2020-04-23 09:28:24 -0500590
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600591
Vijay06a169d2020-04-23 09:28:24 -0500592Switch VMI IPv4 Origin And Verify Details
593 [Documentation] Switch VMI IPv4 origin and verify details.
Vijay06a169d2020-04-23 09:28:24 -0500594
Anves Kumar rayankula7936eee2021-04-19 05:38:36 -0500595 ${dhcp_mode_before}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
Anves Kumar rayankulae7dc89a2021-04-28 04:29:38 -0500596 ${dhcp_enabled}= Set Variable If ${dhcp_mode_before} == ${False} ${True} ${False}
Vijay06a169d2020-04-23 09:28:24 -0500597
Anves Kumar rayankulae7dc89a2021-04-28 04:29:38 -0500598 ${origin}= Set Variable If ${dhcp_mode_before} == ${False} DHCP Static
Vijay06a169d2020-04-23 09:28:24 -0500599 Set VMI IPv4 Origin ${dhcp_enabled} ${HTTP_ACCEPTED}
Anves Kumar rayankula7936eee2021-04-19 05:38:36 -0500600
601 ${dhcp_mode_after}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
602 Should Not Be Equal ${dhcp_mode_before} ${dhcp_mode_after}
603
604 Run Keyword If ${dhcp_mode_after} == ${True}
605 ... Verify VMI Network Interface Details ${default} ${origin} ${default} ${default}
Vijay06a169d2020-04-23 09:28:24 -0500606
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500607
608Delete VMI Static IP Address Using Different Users
609 [Documentation] Update user role and delete vmi static IP address.
610 [Arguments] ${username} ${password} ${valid_status_code}
611 [Teardown] Run Keywords Redfish.Login AND
shrsuman123f559cbe2021-01-06 05:40:45 -0600612 ... Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500613 ... ${test_netmask} ${HTTP_ACCEPTED} AND Redfish.Logout
614
615 # Description of argument(s):
616 # username The host username.
617 # password The host password.
618 # valid_status_code The expected valid status code.
619
Megha GN80ef5ca2022-06-09 00:29:57 -0500620 # TODO: operator_user role is not yet supported.
621 Skip If '${username}' == 'operator_user'
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500622 Redfish.Login ${username} ${password}
623 Delete VMI IPv4 Address delete_param=IPv4StaticAddresses valid_status_code=${valid_status_code}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500624
625
626Config VMI Static IP Address Using Different Users
627 [Documentation] Update user role and update vmi static ip address.
628 [Arguments] ${username} ${password} ${ip} ${gateway} ${netmask}
629 ... ${valid_status_code}
630
631 # Description of argument(s):
632 # username The host username.
633 # password The host password.
634 # ip IP address to be added (e.g. "10.7.7.7").
635 # subnet_mask Subnet mask for the IP to be added
636 # (e.g. "255.255.0.0").
637 # gateway Gateway for the IP to be added (e.g. "10.7.7.1").
638 # valid_status_code The expected valid status code.
639
Megha GN80ef5ca2022-06-09 00:29:57 -0500640 # TODO: operator_user role is not yet supported.
641 Skip If '${username}' == 'operator_user'
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500642 Redfish.Login ${username} ${password}
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600643 Set Static IPv4 Address To VMI And Verify ${ip} ${gateway} ${netmask} ${valid_status_code}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500644
645
646Read VMI Static IP Address Using Different Users
647 [Documentation] Update user role and read vmi static ip address.
648 [Arguments] ${username} ${password} ${valid_status_code}
649
650 # Description of argument(s):
651 # username The host username.
652 # password The host password.
653 # valid_status_code The expected valid status code.
654
Megha GN80ef5ca2022-06-09 00:29:57 -0500655 # TODO: operator_user role is not yet supported.
656 Skip If '${username}' == 'operator_user'
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500657 Redfish.Login ${username} ${password}
658 Redfish.Get
shrsuman123bfb851b2021-07-02 04:59:16 -0500659 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500660 ... valid_status_codes=[${valid_status_code}]
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500661
662
663Delete BMC Users Using Redfish
664 [Documentation] Delete BMC users via redfish.
665
666 Redfish.Login
667 Delete BMC Users Via Redfish users=${USERS}
shrsuman123b361d412020-09-30 06:17:23 -0500668
Sweta Potthurid52b2732021-08-12 12:48:24 -0500669
shrsuman123b361d412020-09-30 06:17:23 -0500670Update User Role And Set VMI IPv4 Origin
671 [Documentation] Update User Role And Set VMI IPv4 Origin.
672 [Arguments] ${username} ${password} ${dhcp_enabled} ${valid_status_code}
673
674 # Description of argument(s):
675 # username The host username.
676 # password The host password.
677 # dhcp_enabled Indicates whether dhcp should be enabled
678 # (${True}, ${False}).
679 # valid_status_code The expected valid status code.
680
Megha GNbe428592022-07-21 10:33:02 -0500681 # TODO: operator_user role is not yet supported.
682 Skip If '${username}' == 'operator_user'
shrsuman123b361d412020-09-30 06:17:23 -0500683 Redfish.Login ${username} ${password}
684 Set VMI IPv4 Origin ${dhcp_enabled} ${valid_status_code}
shrsuman123bfb851b2021-07-02 04:59:16 -0500685
Sweta Potthurid52b2732021-08-12 12:48:24 -0500686
shrsuman123bfb851b2021-07-02 04:59:16 -0500687Suite Teardown Execution
688 [Documentation] Do suite teardown execution task.
689
690 Run Keyword If ${vmi_network_conf} != ${None}
691 ... Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]}
692 ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]}
shrsuman123b25343d2021-09-22 04:33:47 -0500693 Delete All Redfish Sessions
shrsuman123bfb851b2021-07-02 04:59:16 -0500694 Redfish.Logout
Megha G N38acd842024-10-14 14:28:11 -0500695
696
697Set VMI SLAACv6 Origin
698 [Documentation] Set VMI SLAACv6 origin.
699 [Arguments] ${slaac_enabled}=${False} ${valid_status_code}=${HTTP_ACCEPTED}
700 ... ${interface}=${ethernet_interface}
701
702 # Description of argument(s):
703 # slaacv6_enabled True if user wants to enable SLAACv6. Default is Static, hence value is set to False.
704 # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK.
705 # interface VMI interface (eg. eth0 or eth1).
706
707 ${data}= Set Variable If ${slaac_enabled} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC}
708 ${resp}= Redfish.Patch
709 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface}
710 ... body=${data} valid_status_codes=[${valid_status_code}]
711
712 Sleep ${wait_time}
713 Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED}
714 ${resp}= Redfish.Get
715 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface}
716 Should Be Equal ${resp.dict["StatelessAddressAutoConfig"]["IPv6AutoConfigEnabled"]} ${slaac_enabled}
717
718
719Verify VMI IPv6 Address
720 [Documentation] Verify VMI IPv6 address configurations.
721 [Arguments] ${ipv6_origin} ${interface}=${ethernet_interface}
722
723 # Description of argument(s):
724 # ipv6_origin Origin of IPv6 address eg. Static or DHCPv6 or SLAAC.
725 # interface VMI interface (eg. eth0 or eth1).
726
727 ${resp}= Redfish.Get /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface}
728
729 @{vmi_ipv6_configurations}= Get From Dictionary ${resp.dict} IPv6Addresses
730 ${vmi_ipv6_config}= Get From List ${vmi_ipv6_configurations} 0
731 Should Not Be Empty ${vmi_ipv6_config["Address"]}
732 Should Be Equal As Strings   ${vmi_ipv6_config["AddressOrigin"]} ${ipv6_origin}
Megha G Na37b8da2025-01-06 00:23:15 -0600733 RETURN &{vmi_ipv6_config}