blob: f78ad663c198b132f33a401ebeee166ca9a7bf45 [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
shrsuman123bfb851b2021-07-02 04:59:16 -05009Suite Teardown Suite Teardown Execution
Vijay06a169d2020-04-23 09:28:24 -050010
11*** Variables ***
12
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -050013# users User Name password
14@{ADMIN} admin_user TestPwd123
15@{OPERATOR} operator_user TestPwd123
16@{ReadOnly} readonly_user TestPwd123
Megha GN80ef5ca2022-06-09 00:29:57 -050017&{USERS} Administrator=${ADMIN} ReadOnly=${ReadOnly}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -050018
Prashanth Katti1ce68212020-11-13 00:39:03 -060019${test_ipv4} 10.6.6.6
20${test_gateway} 10.6.6.1
shrsuman123c1d3fe32020-09-08 05:04:07 -050021${test_netmask} 255.255.252.0
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -050022
Vijay06a169d2020-04-23 09:28:24 -050023&{DHCP_ENABLED} DHCPEnabled=${${True}}
24&{DHCP_DISABLED} DHCPEnabled=${${False}}
25
26&{ENABLE_DHCP} DHCPv4=&{DHCP_ENABLED}
27&{DISABLE_DHCP} DHCPv4=&{DHCP_DISABLED}
Prashanth Katti1ce68212020-11-13 00:39:03 -060028${wait_time} 10s
Vijay06a169d2020-04-23 09:28:24 -050029
30
31*** Test Cases ***
32
33Verify All VMI EthernetInterfaces
34 [Documentation] Verify all VMI ethernet interfaces.
shrsuman1235c7e4d72021-04-16 05:42:57 -050035 [Tags] Verify_All_VMI_EthernetInterfaces
Vijay06a169d2020-04-23 09:28:24 -050036
37 Verify VMI EthernetInterfaces
38
39
40Verify Existing VMI Network Interface Details
41 [Documentation] Verify existing VMI network interface details.
shrsuman1235c7e4d72021-04-16 05:42:57 -050042 [Tags] Verify_Existing_VMI_Network_Interface_Details
Vijay06a169d2020-04-23 09:28:24 -050043
44 ${vmi_ip}= Get VMI Network Interface Details
45 ${origin}= Set Variable If ${vmi_ip["DHCPv4"]} == ${False} Static DHCP
Vijay06a169d2020-04-23 09:28:24 -050046 Should Not Be Equal ${vmi_ip["DHCPv4"]} ${vmi_ip["IPv4StaticAddresses"]}
shrsuman123bfb851b2021-07-02 04:59:16 -050047 Should Be Equal As Strings ${vmi_ip["Id"]} ${ethernet_interface}
George Keishingb3ea0952020-07-01 05:03:56 -050048 Should Be Equal As Strings ${vmi_ip["Description"]}
shrsuman1235c7e4d72021-04-16 05:42:57 -050049 ... Hypervisor's Virtual Management Ethernet Interface
50 Should Be Equal As Strings ${vmi_ip["Name"]} Hypervisor Ethernet Interface
Vijay06a169d2020-04-23 09:28:24 -050051 Should Be True ${vmi_ip["InterfaceEnabled"]}
shrsuman1235c7e4d72021-04-16 05:42:57 -050052 Run Keyword If ${vmi_ip["IPv4StaticAddresses"]} != @{empty}
53 ... Verify VMI Network Interface Details ${vmi_ip["IPv4_Address"]}
54 ... ${origin} ${vmi_ip["IPv4_Gateway"]} ${vmi_ip["IPv4_SubnetMask"]}
Vijay06a169d2020-04-23 09:28:24 -050055
56
57Delete Existing Static VMI IP Address
58 [Documentation] Delete existing static VMI IP address.
59 [Tags] Delete_Existing_Static_VMI_IP_Address
60
61 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
62 Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED}
63
shrsuman1235c7e4d72021-04-16 05:42:57 -050064 Delete VMI IPv4 Address
Vijay06a169d2020-04-23 09:28:24 -050065
66
67Verify User Cannot Delete ReadOnly Property IPv4Addresses
68 [Documentation] Verify user cannot delete readonly property IPv4Addresses.
69 [Tags] Verify_User_Cannot_Delete_ReadOnly_Property_IPv4Addresses
70
71 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
shrsuman1235c7e4d72021-04-16 05:42:57 -050072 Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED}
73 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
shrsuman123b25343d2021-09-22 04:33:47 -050074 Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_FORBIDDEN}
Vijay06a169d2020-04-23 09:28:24 -050075
76
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -050077Assign Valid And Invalid Static IPv4 Address To VMI
Vijay06a169d2020-04-23 09:28:24 -050078 [Documentation] Assign static IPv4 address to VMI.
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -050079 [Tags] Assign_Valid_And_Invalid_Static_IPv4_Address_To_VMI
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -060080 [Template] Set Static IPv4 Address To VMI And Verify
81 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
Vijay06a169d2020-04-23 09:28:24 -050082
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -050083 # ip gateway netmask valid_status_code
Shradha Sumanc7df7db2021-03-08 05:16:44 -060084 10.5.20.30 10.5.20.1 255.255.252.0 ${HTTP_ACCEPTED}
85 a.3.118.94 10.5.20.1 255.255.252.0 ${HTTP_BAD_REQUEST}
Anves Kumar rayankula81fd9db2021-05-10 02:39:51 -050086 10.5.20 10.5.20.1 255.255.252.0 ${HTTP_BAD_REQUEST}
87 10.5.20.-5 10.5.20.1 255.255.252.0 ${HTTP_BAD_REQUEST}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -050088
Vijay06a169d2020-04-23 09:28:24 -050089
George Keishing16b3c7b2021-01-28 09:23:37 -060090Add Multiple IP Addresses On VMI Interface And Verify
91 [Documentation] Add multiple IP addresses on VMI interface and verify.
92 [Tags] Add_Multiple_IP_Addresses_On_VMI_Interface_And_Verify
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -060093 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
shrsuman123e37b0cc2020-09-02 00:33:42 -050094
Shradha Sumanc7df7db2021-03-08 05:16:44 -060095 ${ip1}= Create dictionary Address=10.5.5.10 SubnetMask=255.255.252.0 Gateway=10.5.5.1
96 ${ip2}= Create dictionary Address=10.5.5.11 SubnetMask=255.255.252.0 Gateway=10.5.5.1
97 ${ip3}= Create dictionary Address=10.5.5.12 SubnetMask=255.255.252.0 Gateway=10.5.5.1
shrsuman123e37b0cc2020-09-02 00:33:42 -050098 ${ips}= Create List ${ip1} ${ip2} ${ip3}
99
shrsuman123bfb851b2021-07-02 04:59:16 -0500100 Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
shrsuman123993a5c92021-04-19 06:40:16 -0500101 ... body={'IPv4StaticAddresses':${ips}} valid_status_codes=[${HTTP_BAD_REQUEST}]
shrsuman123e37b0cc2020-09-02 00:33:42 -0500102
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500103
shrsuman123e37b0cc2020-09-02 00:33:42 -0500104Modify IP Addresses On VMI Interface And Verify
105 [Documentation] Modify IP addresses on VMI interface and verify.
106 [Tags] Modify_IP_Addresses_On_VMI_Interface_And_Verify
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600107 [Template] Set Static IPv4 Address To VMI And Verify
108 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
shrsuman123e37b0cc2020-09-02 00:33:42 -0500109
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500110 # ip gateway netmask valid_status_code
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600111 10.5.5.10 10.5.5.1 255.255.252.0 ${HTTP_ACCEPTED}
112 10.5.5.11 10.5.5.1 255.255.252.0 ${HTTP_ACCEPTED}
Vijay06a169d2020-04-23 09:28:24 -0500113
Megha GN80ef5ca2022-06-09 00:29:57 -0500114
Vijay06a169d2020-04-23 09:28:24 -0500115Switch Between IP Origins On VMI And Verify Details
116 [Documentation] Switch between IP origins on VMI and verify details.
117 [Tags] Switch_Between_IP_Origins_On_VMI_And_Verify_Details
118
119 Switch VMI IPv4 Origin And Verify Details
120 Switch VMI IPv4 Origin And Verify Details
121
122
123Verify Persistency Of VMI IPv4 Details After Host Reboot
124 [Documentation] Verify persistency of VMI IPv4 details after host reboot.
125 [Tags] Verify_Persistency_Of_VMI_IPv4_Details_After_Host_Reboot
126
127 # Verifying persistency of dynamic address.
128 Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
Anves Kumar rayankula7936eee2021-04-19 05:38:36 -0500129 Redfish Power Off stack_mode=skip
130 Redfish Power On
Vijay06a169d2020-04-23 09:28:24 -0500131 ${default}= Set Variable 0.0.0.0
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500132 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
Vijay06a169d2020-04-23 09:28:24 -0500133
134 # Verifying persistency of static address.
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600135 Switch VMI IPv4 Origin And Verify Details
Anves Kumar rayankula7936eee2021-04-19 05:38:36 -0500136 Redfish Power Off stack_mode=skip
137 Redfish Power On
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600138 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Vijay06a169d2020-04-23 09:28:24 -0500139
140
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500141Delete VMI Static IP Address And Verify
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500142 [Documentation] Delete VMI static IP address and verify.
143 [Tags] Delete_VMI_Static_IP_Address_And_Verify
144 [Teardown] Test Teardown Execution
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500145
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600146 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
147 Delete VMI IPv4 Address
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500148
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500149
shrsuman123c1d3fe32020-09-08 05:04:07 -0500150Verify Successful VMI IP Static Configuration On HOST Boot After Session Delete
151 [Documentation] Verify VMI IP static Configuration On HOST Boot After session deleted.
152 [Tags] Verify_Successful_VMI_IP_Static_Configuration_On_HOST_Boot_After_Session_Delete
shrsuman123b25343d2021-09-22 04:33:47 -0500153 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
shrsuman123c1d3fe32020-09-08 05:04:07 -0500154
shrsuman12375e77062020-09-18 01:08:45 -0500155 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
shrsuman123c1d3fe32020-09-08 05:04:07 -0500156
157 ${session_info}= Get Redfish Session Info
158 Redfish.Delete ${session_info["location"]}
159
160 # Create a new Redfish session
shrsuman1235c7e4d72021-04-16 05:42:57 -0500161 Redfish.Login
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500162 Redfish Power Off
163 Redfish Power On
shrsuman123c1d3fe32020-09-08 05:04:07 -0500164
165 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
166
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500167
shrsuman123c1d3fe32020-09-08 05:04:07 -0500168Verify Persistency Of VMI DHCP IP Configuration After Multiple HOST Reboots
169 [Documentation] Verify Persistency Of VMI DHCP IP configuration After Multiple HOST Reboots
170 [Tags] Verify_Persistency_Of_VMI_DHCP_IP_Configuration_After_Multiple_HOST_Reboots
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500171 [Teardown] Test Teardown Execution
shrsuman123c1d3fe32020-09-08 05:04:07 -0500172
shrsuman123c1d3fe32020-09-08 05:04:07 -0500173 Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
shrsuman123c1d3fe32020-09-08 05:04:07 -0500174 ${vmi_ip_config}= Get VMI Network Interface Details
175 # Verifying persistency of dynamic address after multiple reboots.
shrsuman123f559cbe2021-01-06 05:40:45 -0600176 FOR ${i} IN RANGE ${2}
177 Redfish Power Off
178 Redfish Power On
George Keishing538f1742022-03-14 05:00:55 -0500179 Verify VMI Network Interface Details ${vmi_ip_config["IPv4_Address"]}
180 ... DHCP ${vmi_ip_config["IPv4_Gateway"]} ${vmi_ip_config["IPv4_SubnetMask"]}
shrsuman123f559cbe2021-01-06 05:40:45 -0600181 END
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500182
183
184Enable DHCP When Static IP Configured And Verify Static IP
185 [Documentation] Enable DHCP when static ip configured and verify static ip
George Keishing4203fad2022-01-31 12:22:33 -0600186 [Tags] Enable_DHCP_When_Static_IP_Configured_And_Verify_Static_IP
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600187 [Setup] Redfish Power On
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500188 [Teardown] Test Teardown Execution
189
shrsuman123f559cbe2021-01-06 05:40:45 -0600190 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500191 Set VMI IPv4 Origin ${True}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500192 ${vmi_network_conf}= Get VMI Network Interface Details
193 Should Not Be Equal As Strings ${test_ipv4} ${vmi_network_conf["IPv4_Address"]}
194
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500195
shrsuman123e37b0cc2020-09-02 00:33:42 -0500196Verify VMI Static IP Configuration Persist On BMC Reset Before Host Boot
197 [Documentation] Verify VMI static IP configuration persist on BMC reset.
198 [Tags] Verify_VMI_Static_IP_Configuration_Persist_On_BMC_Reset_Before_Host_Boot
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600199 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail
shrsuman123e37b0cc2020-09-02 00:33:42 -0500200
shrsuman12375e77062020-09-18 01:08:45 -0500201 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500202 OBMC Reboot (off)
203 Redfish Power On
shrsuman123e37b0cc2020-09-02 00:33:42 -0500204 # Verifying the VMI static configuration
205 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
206
Megha GN80ef5ca2022-06-09 00:29:57 -0500207
shrsuman12375e77062020-09-18 01:08:45 -0500208Add Static IP When Host Poweroff And Verify On Poweron
209 [Documentation] Add Static IP When Host Poweroff And Verify on power on
210 [Tags] Add_Static_IP_When_Host_Poweroff_And_Verify_On_Poweron
211 [Setup] Redfish Power Off
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 Power On
216 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
217
Megha GN80ef5ca2022-06-09 00:29:57 -0500218
shrsuman12375e77062020-09-18 01:08:45 -0500219Add VMI Static IP When Host Poweroff And Verify Static IP On BMC Reset
220 [Documentation] Add Static IP When Host Poweroff And Verify Static IP On BMC Reset.
221 [Tags] Add_VMI_Static_IP_When_Host_Poweroff_And_Verify_Static_IP_On_BMC_Reset
222 [Setup] Redfish Power Off
223 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail
224
225 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
226 OBMC Reboot (off)
227 Redfish Power On
228 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
229
Megha GN80ef5ca2022-06-09 00:29:57 -0500230
shrsuman12375e77062020-09-18 01:08:45 -0500231Enable DHCP When No Static IP Configured And Verify DHCP IP
232 [Documentation] Enable DHCP when no static ip configured and verify dhcp ip
233 [Tags] Enable_DHCP_When_No_Static_IP_Configured_And_Verify_DHCP_IP
234 [Setup] Run Keyword And Ignore Error Delete VMI IPv4 Address
235 [Teardown] Test Teardown Execution
236
237 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
238 Run Keyword If ${curr_origin} == ${False} Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
239 ${vmi_ip_config}= Get VMI Network Interface Details
George Keishing538f1742022-03-14 05:00:55 -0500240 Verify VMI Network Interface Details ${vmi_ip_config["IPv4_Address"]}
241 ... DHCP ${vmi_ip_config["IPv4_Gateway"]} ${vmi_ip_config["IPv4_SubnetMask"]}
shrsuman12375e77062020-09-18 01:08:45 -0500242
Megha GN80ef5ca2022-06-09 00:29:57 -0500243
shrsuman12375e77062020-09-18 01:08:45 -0500244Verify User Cannot Delete VMI DHCP IP Address
245 [Documentation] Verify user cannot delete VMI DHCP IP Address
246 [Tags] Verify_User_Cannot_Delete_VMI_DHCP_IP_Address
247 [Setup] Set VMI IPv4 Origin ${True}
248 [Teardown] Test Teardown Execution
249
shrsuman123b25343d2021-09-22 04:33:47 -0500250 Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_FORBIDDEN}
shrsuman12375e77062020-09-18 01:08:45 -0500251 ${resp}= Redfish.Get
shrsuman123bfb851b2021-07-02 04:59:16 -0500252 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
shrsuman12375e77062020-09-18 01:08:45 -0500253 Should Not Be Empty ${resp.dict["IPv4Addresses"]}
254
Megha GN80ef5ca2022-06-09 00:29:57 -0500255
shrsuman12375e77062020-09-18 01:08:45 -0500256Enable DHCP When Static IP Configured DHCP Server Unavailable And Verify IP
257 [Documentation] Enable DHCP When Static IP Configured And DHCP Server Unavailable And Verify No IP.
258 [Tags] Enable_DHCP_When_Static_IP_Configured_DHCP_Server_Unavailable_And_Verify_IP
259 [Teardown] Test Teardown Execution
260
261 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
262 Set VMI IPv4 Origin ${True}
263 ${default}= Set Variable 0.0.0.0
264 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
265
shrsuman123e37b0cc2020-09-02 00:33:42 -0500266
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500267Verify To Configure VMI Static IP Address With Different User Roles
268 [Documentation] Verify to configure vmi static ip address with different user roles.
269 [Tags] Verify_To_Configure_VMI_Static_IP_Address_With_Different_User_Roles
270 [Setup] Create Users With Different Roles users=${USERS} force=${True}
271 [Template] Config VMI Static IP Address Using Different Users
272 [Teardown] Delete BMC Users Using Redfish
273
274 # username password ip_address gateway nemask valid_status_code
275 admin_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_ACCEPTED}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500276 readonly_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500277
278
279Verify To Configure VMI Static IP Address With Operator User Role
280 [Documentation] Verify to configure vmi static ip address with operator user role.
281 [Tags] Verify_To_Configure_VMI_Static_IP_Address_With_Operator_User_Role
282 [Setup] Create Users With Different Roles users=${USERS} force=${True}
283 [Template] Config VMI Static IP Address Using Different Users
284 [Teardown] Delete BMC Users Using Redfish
285
286 # username password ip_address gateway nemask valid_status_code
287 operator_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500288
289
290Verify To Delete VMI Static IP Address With Different User Roles
291 [Documentation] Verify to delete vmi static IP address with different user roles.
292 [Tags] Verify_To_Delete_VMI_Static_IP_Address_With_Different_User_Roles
293 [Setup] Create Users With Different Roles users=${USERS} force=${True}
294 [Template] Delete VMI Static IP Address Using Different Users
295 [Teardown] Delete BMC Users Using Redfish
296
297 # username password valid_status_code
298 admin_user TestPwd123 ${HTTP_ACCEPTED}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500299 readonly_user TestPwd123 ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500300
301
302Verify To Delete VMI Static IP Address With Operator User Role
303 [Documentation] Verify to delete vmi static IP address with operator user role.
304 [Tags] Verify_To_Delete_VMI_Static_IP_Address_With_Operator_User_Role
305 [Setup] Create Users With Different Roles users=${USERS} force=${True}
306 [Template] Delete VMI Static IP Address Using Different Users
307 [Teardown] Delete BMC Users Using Redfish
308
309 # username password valid_status_code
310 operator_user TestPwd123 ${HTTP_FORBIDDEN}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500311
312
313Verify To Update VMI Static IP Address With Different User Roles
314 [Documentation] Verify to update vmi static IP address with different user roles.
George Keishing4203fad2022-01-31 12:22:33 -0600315 [Tags] Verify_To_Update_VMI_Static_IP_Address_With_Different_User_Roles
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500316 [Setup] Create Users With Different Roles users=${USERS} force=${True}
317 [Template] Config VMI Static IP Address Using Different Users
318 [Teardown] Delete BMC Users Using Redfish
319
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600320 # username password ip_address gateway netmask valid_status_code
321 admin_user TestPwd123 10.5.10.20 10.5.10.1 255.255.0.0 ${HTTP_ACCEPTED}
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600322 readonly_user TestPwd123 10.5.20.40 10.5.20.1 255.255.0.0 ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500323
324
325Verify To Update VMI Static IP Address With Operator User Role
326 [Documentation] Verify to update vmi static IP address with operator user role.
327 [Tags] Verify_To_Update_VMI_Static_IP_Address_With_Operator_User_Role
328 [Setup] Create Users With Different Roles users=${USERS} force=${True}
329 [Template] Config VMI Static IP Address Using Different Users
330 [Teardown] Delete BMC Users Using Redfish
331
332 # username password ip_address gateway netmask valid_status_code
333 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 -0500334
335
336Verify To Read VMI Network Configuration With Different User Roles
337 [Documentation] Verify to read vmi network configuration with different user roles.
George Keishing4203fad2022-01-31 12:22:33 -0600338 [Tags] Verify_To_Read_VMI_Network_Configuration_With_Different_User_Roles
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500339 [Setup] Create Users With Different Roles users=${USERS} force=${True}
340 [Template] Read VMI Static IP Address Using Different Users
341 [Teardown] Delete BMC Users Using Redfish
342
343 # username password valid_status_code
344 admin_user TestPwd123 ${HTTP_OK}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500345 readonly_user TestPwd123 ${HTTP_OK}
Megha GN80ef5ca2022-06-09 00:29:57 -0500346
347
348Verify To Read VMI Network Configuration With Operator User Role
349 [Documentation] Verify to read vmi network configuration with operator user role.
350 [Tags] Verify_To_Read_VMI_Network_Configuration_With_Operator_User_Role
351 [Setup] Create Users With Different Roles users=${USERS} force=${True}
352 [Template] Read VMI Static IP Address Using Different Users
353 [Teardown] Delete BMC Users Using Redfish
354
355 # username password valid_status_code
356 operator_user TestPwd123 ${HTTP_FORBIDDEN}
357
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500358
shrsuman123b361d412020-09-30 06:17:23 -0500359Enable DHCP On VMI Network Via Different Users Roles And Verify
360 [Documentation] Enable DHCP On VMI Network Via Different Users Roles And Verify.
361 [Tags] Enable_DHCP_On_VMI_Network_Via_Different_Users_Roles_And_Verify
362 [Setup] Create Users With Different Roles users=${USERS} force=${True}
363 [Template] Update User Role And Set VMI IPv4 Origin
364 [Teardown] Delete BMC Users Using Redfish
365
366 # username password dhcp_enabled valid_status_code
367 admin_user TestPwd123 ${True} ${HTTP_ACCEPTED}
shrsuman123b361d412020-09-30 06:17:23 -0500368 readonly_user TestPwd123 ${True} ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500369
370
371Enable DHCP On VMI Network Via Operator User Role And Verify
372 [Documentation] Enable DHCP On VMI Network Via Operator User Role And Verify.
373 [Tags] Enable_DHCP_On_VMI_Network_Via_Operator_User_Role_And_Verify
374 [Setup] Create Users With Different Roles users=${USERS} force=${True}
375 [Template] Update User Role And Set VMI IPv4 Origin
376 [Teardown] Delete BMC Users Using Redfish
377
378 # username password dhcp_enabled valid_status_code
379 operator_user TestPwd123 ${True} ${HTTP_FORBIDDEN}
380
shrsuman123b361d412020-09-30 06:17:23 -0500381
382Disable DHCP On VMI Network Via Different Users Roles And Verify
383 [Documentation] Disable DHCP On VMI Network Via Different Users Roles And Verify.
384 [Tags] Disable_DHCP_On_VMI_Network_Via_Different_Users_Roles_And_Verify
385 [Setup] Create Users With Different Roles users=${USERS} force=${True}
386 [Template] Update User Role And Set VMI IPv4 Origin
387 [Teardown] Delete BMC Users Using Redfish
388
389 # username password dhcp_enabled valid_status_code
390 admin_user TestPwd123 ${False} ${HTTP_ACCEPTED}
shrsuman123b361d412020-09-30 06:17:23 -0500391 readonly_user TestPwd123 ${False} ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500392
393
394Disable DHCP On VMI Network Via Operator User Role And Verify
395 [Documentation] Disable DHCP On VMI Network Via Operator User Role And Verify.
396 [Tags] Disable_DHCP_On_VMI_Network_Via_Operator_User_Role_And_Verify
397 [Setup] Create Users With Different Roles users=${USERS} force=${True}
398 [Template] Update User Role And Set VMI IPv4 Origin
399 [Teardown] Delete BMC Users Using Redfish
400
401 # username password dhcp_enabled valid_status_code
402 operator_user TestPwd123 ${False} ${HTTP_FORBIDDEN}
shrsuman123b361d412020-09-30 06:17:23 -0500403
shrsuman123e37b0cc2020-09-02 00:33:42 -0500404
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500405Enable And Disable DHCP And Verify
406 [Documentation] verify enable DHCP and disable DHCP.
George Keishing4203fad2022-01-31 12:22:33 -0600407 [Tags] Enable_And_Disable_DHCP_And_Verify
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500408
409 Set VMI IPv4 Origin ${True}
410 ${default}= Set Variable 0.0.0.0
411 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
412 Set VMI IPv4 Origin ${False}
Megha GN80ef5ca2022-06-09 00:29:57 -0500413 Verify VMI Network Interface Details ${default} Static ${default} ${default}
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500414
415
416Multiple Times Enable And Disable DHCP And Verify
417 [Documentation] Enable and Disable DHCP in a loop and verify VMI gets an IP address from DHCP
418 ... each time when DHCP is enabled
419 [Tags] Multiple_Times_Enable_And_Disable_DHCP_And_Verify
420
421 ${default}= Set Variable 0.0.0.0
422 FOR ${i} IN RANGE ${2}
423 Set VMI IPv4 Origin ${True}
424 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
425 Set VMI IPv4 Origin ${False}
Megha GN80ef5ca2022-06-09 00:29:57 -0500426 Verify VMI Network Interface Details ${default} Static ${default} ${default}
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500427 END
428
429
Anves Kumar rayankula81fd9db2021-05-10 02:39:51 -0500430Assign Static IPv4 Address With Invalid Netmask To VMI
431 [Documentation] Assign static IPv4 address with invalid netmask and expect error.
432 [Tags] Assign_Static_IPv4_Address_With_Invalid_Netmask_To_VMI
433 [Template] Set Static IPv4 Address To VMI And Verify
434
435 # ip gateway netmask valid_status_code
436 ${test_ipv4} ${test_gateway} 255.256.255.0 ${HTTP_BAD_REQUEST}
437 ${test_ipv4} ${test_gateway} ff.ff.ff.ff ${HTTP_BAD_REQUEST}
438 ${test_ipv4} ${test_gateway} 255.255.253.0 ${HTTP_BAD_REQUEST}
439
440
441Assign Static IPv4 Address With Invalid Gateway To VMI
442 [Documentation] Add static IPv4 address with invalid gateway and expect error.
443 [Tags] Assign_Static_IPv4_Address_With_Invalid_Gateway_To_VMI
444 [Template] Set Static IPv4 Address To VMI And Verify
445
446 # ip gateway netmask valid_status_code
447 ${test_ipv4} @@@.%%.44.11 ${test_netmask} ${HTTP_BAD_REQUEST}
448 ${test_ipv4} 0xa.0xb.0xc.0xd ${test_netmask} ${HTTP_BAD_REQUEST}
449 ${test_ipv4} 10.3.36 ${test_netmask} ${HTTP_BAD_REQUEST}
450 ${test_ipv4} 10.3.36.-10 ${test_netmask} ${HTTP_BAD_REQUEST}
451
452
Vijay06a169d2020-04-23 09:28:24 -0500453*** Keywords ***
454
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500455Suite Setup Execution
456 [Documentation] Do test setup execution task.
457
458 Redfish.Login
459 Redfish Power On
460 ${active_channel_config}= Get Active Channel Config
461 Set Suite Variable ${active_channel_config}
shrsuman123bfb851b2021-07-02 04:59:16 -0500462 Set Suite Variable ${ethernet_interface} ${active_channel_config['${CHANNEL_NUMBER}']['name']}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500463 ${resp}= Redfish.Get
shrsuman123bfb851b2021-07-02 04:59:16 -0500464 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
shrsuman12362e5be52021-05-20 02:42:59 -0500465 ${ip_resp}= Evaluate json.loads(r'''${resp.text}''') json
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500466 ${length}= Get Length ${ip_resp["IPv4StaticAddresses"]}
467 ${vmi_network_conf}= Run Keyword If ${length} != ${0} Get VMI Network Interface Details
468 Set Suite Variable ${vmi_network_conf}
469
470
471Test Teardown Execution
472 [Documentation] Do test teardown execution task.
473
474 FFDC On Test Case Fail
475 ${curr_mode}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
476 Run Keyword If ${curr_mode} == ${True} Set VMI IPv4 Origin ${False}
477 Run Keyword If ${vmi_network_conf} != ${None}
shrsuman123f559cbe2021-01-06 05:40:45 -0600478 ... Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500479 ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]}
480
481
Vijay06a169d2020-04-23 09:28:24 -0500482Get Immediate Child Parameter From VMI Network Interface
483 [Documentation] Get immediate child parameter from VMI network interface.
484 [Arguments] ${parameter} ${valid_status_code}=${HTTP_OK}
485
486 # Description of argument(s):
487 # parameter parameter for which value is required. Ex: DHCPEnabled, MACAddress etc.
488 # valid_status_code Expected valid status code from GET request.
489
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -0500490 ${resp}= Redfish.Get
shrsuman123bfb851b2021-07-02 04:59:16 -0500491 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
Vijay06a169d2020-04-23 09:28:24 -0500492 ... valid_status_codes=[${valid_status_code}]
493
shrsuman12362e5be52021-05-20 02:42:59 -0500494 ${ip_resp}= Evaluate json.loads(r'''${resp.text}''') json
Vijay06a169d2020-04-23 09:28:24 -0500495 ${value}= Set Variable If '${parameter}' != 'DHCPEnabled' ${ip_resp["${parameter}"]}
496 ... ${ip_resp["DHCPv4"]["${parameter}"]}
497
498 [Return] ${value}
499
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600500
Vijay06a169d2020-04-23 09:28:24 -0500501Switch VMI IPv4 Origin And Verify Details
502 [Documentation] Switch VMI IPv4 origin and verify details.
Vijay06a169d2020-04-23 09:28:24 -0500503
Anves Kumar rayankula7936eee2021-04-19 05:38:36 -0500504 ${dhcp_mode_before}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
Anves Kumar rayankulae7dc89a2021-04-28 04:29:38 -0500505 ${dhcp_enabled}= Set Variable If ${dhcp_mode_before} == ${False} ${True} ${False}
Vijay06a169d2020-04-23 09:28:24 -0500506
507 ${default}= Set Variable 0.0.0.0
Anves Kumar rayankulae7dc89a2021-04-28 04:29:38 -0500508 ${origin}= Set Variable If ${dhcp_mode_before} == ${False} DHCP Static
Vijay06a169d2020-04-23 09:28:24 -0500509 Set VMI IPv4 Origin ${dhcp_enabled} ${HTTP_ACCEPTED}
Anves Kumar rayankula7936eee2021-04-19 05:38:36 -0500510
511 ${dhcp_mode_after}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
512 Should Not Be Equal ${dhcp_mode_before} ${dhcp_mode_after}
513
514 Run Keyword If ${dhcp_mode_after} == ${True}
515 ... Verify VMI Network Interface Details ${default} ${origin} ${default} ${default}
Vijay06a169d2020-04-23 09:28:24 -0500516
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500517
518Delete VMI Static IP Address Using Different Users
519 [Documentation] Update user role and delete vmi static IP address.
520 [Arguments] ${username} ${password} ${valid_status_code}
521 [Teardown] Run Keywords Redfish.Login AND
shrsuman123f559cbe2021-01-06 05:40:45 -0600522 ... Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500523 ... ${test_netmask} ${HTTP_ACCEPTED} AND Redfish.Logout
524
525 # Description of argument(s):
526 # username The host username.
527 # password The host password.
528 # valid_status_code The expected valid status code.
529
Megha GN80ef5ca2022-06-09 00:29:57 -0500530 # TODO: operator_user role is not yet supported.
531 Skip If '${username}' == 'operator_user'
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500532 Redfish.Login ${username} ${password}
533 Delete VMI IPv4 Address delete_param=IPv4StaticAddresses valid_status_code=${valid_status_code}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500534
535
536Config VMI Static IP Address Using Different Users
537 [Documentation] Update user role and update vmi static ip address.
538 [Arguments] ${username} ${password} ${ip} ${gateway} ${netmask}
539 ... ${valid_status_code}
540
541 # Description of argument(s):
542 # username The host username.
543 # password The host password.
544 # ip IP address to be added (e.g. "10.7.7.7").
545 # subnet_mask Subnet mask for the IP to be added
546 # (e.g. "255.255.0.0").
547 # gateway Gateway for the IP to be added (e.g. "10.7.7.1").
548 # valid_status_code The expected valid status code.
549
Megha GN80ef5ca2022-06-09 00:29:57 -0500550 # TODO: operator_user role is not yet supported.
551 Skip If '${username}' == 'operator_user'
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500552 Redfish.Login ${username} ${password}
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600553 Set Static IPv4 Address To VMI And Verify ${ip} ${gateway} ${netmask} ${valid_status_code}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500554
555
556Read VMI Static IP Address Using Different Users
557 [Documentation] Update user role and read vmi static ip address.
558 [Arguments] ${username} ${password} ${valid_status_code}
559
560 # Description of argument(s):
561 # username The host username.
562 # password The host password.
563 # valid_status_code The expected valid status code.
564
Megha GN80ef5ca2022-06-09 00:29:57 -0500565 # TODO: operator_user role is not yet supported.
566 Skip If '${username}' == 'operator_user'
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500567 Redfish.Login ${username} ${password}
568 Redfish.Get
shrsuman123bfb851b2021-07-02 04:59:16 -0500569 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500570 ... valid_status_codes=[${valid_status_code}]
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500571
572
573Delete BMC Users Using Redfish
574 [Documentation] Delete BMC users via redfish.
575
576 Redfish.Login
577 Delete BMC Users Via Redfish users=${USERS}
shrsuman123b361d412020-09-30 06:17:23 -0500578
Sweta Potthurid52b2732021-08-12 12:48:24 -0500579
shrsuman123b361d412020-09-30 06:17:23 -0500580Update User Role And Set VMI IPv4 Origin
581 [Documentation] Update User Role And Set VMI IPv4 Origin.
582 [Arguments] ${username} ${password} ${dhcp_enabled} ${valid_status_code}
583
584 # Description of argument(s):
585 # username The host username.
586 # password The host password.
587 # dhcp_enabled Indicates whether dhcp should be enabled
588 # (${True}, ${False}).
589 # valid_status_code The expected valid status code.
590
591 Redfish.Login ${username} ${password}
592 Set VMI IPv4 Origin ${dhcp_enabled} ${valid_status_code}
shrsuman123bfb851b2021-07-02 04:59:16 -0500593
Sweta Potthurid52b2732021-08-12 12:48:24 -0500594
shrsuman123bfb851b2021-07-02 04:59:16 -0500595Suite Teardown Execution
596 [Documentation] Do suite teardown execution task.
597
598 Run Keyword If ${vmi_network_conf} != ${None}
599 ... Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]}
600 ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]}
shrsuman123b25343d2021-09-22 04:33:47 -0500601 Delete All Redfish Sessions
shrsuman123bfb851b2021-07-02 04:59:16 -0500602 Redfish.Logout