blob: f26f3101e9cdc99ce78177cfc2ee69599e072843 [file] [log] [blame]
Vijay06a169d2020-04-23 09:28:24 -05001*** Settings ***
2
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -05003Documentation VMI static/dynamic IP config tests.
Vijay06a169d2020-04-23 09:28:24 -05004
5Resource ../../lib/resource.robot
6Resource ../../lib/bmc_redfish_resource.robot
7Resource ../../lib/openbmc_ffdc.robot
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -05008Resource ../../lib/bmc_redfish_utils.robot
shrsuman12375e77062020-09-18 01:08:45 -05009Resource ../../lib/state_manager.robot
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -050010Library ../../lib/bmc_network_utils.py
Vijay06a169d2020-04-23 09:28:24 -050011
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -050012Suite Setup Suite Setup Execution
Vijay06a169d2020-04-23 09:28:24 -050013Test Teardown FFDC On Test Case Fail
14Suite Teardown Redfish.Logout
15
16*** Variables ***
17
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -050018# users User Name password
19@{ADMIN} admin_user TestPwd123
20@{OPERATOR} operator_user TestPwd123
21@{ReadOnly} readonly_user TestPwd123
22@{NoAccess} noaccess_user TestPwd123
23&{USERS} Administrator=${ADMIN} Operator=${OPERATOR} ReadOnly=${ReadOnly}
24... NoAccess=${NoAccess}
25
Prashanth Katti1ce68212020-11-13 00:39:03 -060026${test_ipv4} 10.6.6.6
27${test_gateway} 10.6.6.1
shrsuman123c1d3fe32020-09-08 05:04:07 -050028${test_netmask} 255.255.252.0
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -050029
Vijay06a169d2020-04-23 09:28:24 -050030&{DHCP_ENABLED} DHCPEnabled=${${True}}
31&{DHCP_DISABLED} DHCPEnabled=${${False}}
32
33&{ENABLE_DHCP} DHCPv4=&{DHCP_ENABLED}
34&{DISABLE_DHCP} DHCPv4=&{DHCP_DISABLED}
Prashanth Katti1ce68212020-11-13 00:39:03 -060035${wait_time} 10s
Vijay06a169d2020-04-23 09:28:24 -050036
37
38*** Test Cases ***
39
40Verify All VMI EthernetInterfaces
41 [Documentation] Verify all VMI ethernet interfaces.
42 [Tags] Verify_All_VMI_EthernetINterfaces
43
44 Verify VMI EthernetInterfaces
45
46
47Verify Existing VMI Network Interface Details
48 [Documentation] Verify existing VMI network interface details.
49 [Tags] Verify_VMI_Network_Interface_Details
50
51 ${vmi_ip}= Get VMI Network Interface Details
52 ${origin}= Set Variable If ${vmi_ip["DHCPv4"]} == ${False} Static DHCP
53
54 Should Not Be Equal ${vmi_ip["DHCPv4"]} ${vmi_ip["IPv4StaticAddresses"]}
55 Should Be Equal As Strings ${origin} ${vmi_ip["IPv4_AddressOrigin"]}
56 Should Be Equal As Strings ${vmi_ip["Id"]} intf0
George Keishingb3ea0952020-07-01 05:03:56 -050057 Should Be Equal As Strings ${vmi_ip["Description"]}
58 ... Ethernet Interface for Virtual Management Interface
59 Should Be Equal As Strings ${vmi_ip["Name"]} Virtual Management Interface
Vijay06a169d2020-04-23 09:28:24 -050060 Should Be True ${vmi_ip["InterfaceEnabled"]}
61
62
63Delete Existing Static VMI IP Address
64 [Documentation] Delete existing static VMI IP address.
65 [Tags] Delete_Existing_Static_VMI_IP_Address
66
67 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
68 Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED}
69
70 Delete VMI IPv4 Address IPv4StaticAddresses valid_status_code=${HTTP_ACCEPTED}
71 ${default}= Set Variable 0.0.0.0
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -050072 Verify VMI Network Interface Details ${default} Static ${default} ${default}
Vijay06a169d2020-04-23 09:28:24 -050073
74
75Verify User Cannot Delete ReadOnly Property IPv4Addresses
76 [Documentation] Verify user cannot delete readonly property IPv4Addresses.
77 [Tags] Verify_User_Cannot_Delete_ReadOnly_Property_IPv4Addresses
78
79 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
80 Run Keyword If ${curr_origin} == ${False} Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
81 Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_BAD_REQUEST}
82
83
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -050084Assign Valid And Invalid Static IPv4 Address To VMI
Vijay06a169d2020-04-23 09:28:24 -050085 [Documentation] Assign static IPv4 address to VMI.
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -050086 [Tags] Assign_Valid_And_Invalid_Static_IPv4_Address_To_VMI
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -060087 [Template] Set Static IPv4 Address To VMI And Verify
88 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
Vijay06a169d2020-04-23 09:28:24 -050089
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -050090 # ip gateway netmask valid_status_code
91 10.5.20.30 0.0.0.0 255.255.252.0 ${HTTP_ACCEPTED}
92 a.3.118.94 0.0.0.0 255.255.252.0 ${HTTP_BAD_REQUEST}
93
Vijay06a169d2020-04-23 09:28:24 -050094
George Keishing16b3c7b2021-01-28 09:23:37 -060095Add Multiple IP Addresses On VMI Interface And Verify
96 [Documentation] Add multiple IP addresses on VMI interface and verify.
97 [Tags] Add_Multiple_IP_Addresses_On_VMI_Interface_And_Verify
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -060098 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
shrsuman123e37b0cc2020-09-02 00:33:42 -050099
100 ${ip1}= Create dictionary Address=10.5.5.10 SubnetMask=255.255.252.0 Gateway=0.0.0.0
101 ${ip2}= Create dictionary Address=10.5.5.11 SubnetMask=255.255.252.0 Gateway=0.0.0.0
102 ${ip3}= Create dictionary Address=10.5.5.12 SubnetMask=255.255.252.0 Gateway=0.0.0.0
103 ${ips}= Create List ${ip1} ${ip2} ${ip3}
104
shrsuman123e37b0cc2020-09-02 00:33:42 -0500105 Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
106 ... body={'IPv4StaticAddresses':${ips}} valid_status_codes=[${HTTP_ACCEPTED}]
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500107 Verify VMI Network Interface Details ${ip1["Address"]} Static ${ip1["Gateway"]} ${ip1["SubnetMask"]}
shrsuman123e37b0cc2020-09-02 00:33:42 -0500108
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500109
shrsuman123e37b0cc2020-09-02 00:33:42 -0500110Modify IP Addresses On VMI Interface And Verify
111 [Documentation] Modify IP addresses on VMI interface and verify.
112 [Tags] Modify_IP_Addresses_On_VMI_Interface_And_Verify
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600113 [Template] Set Static IPv4 Address To VMI And Verify
114 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
shrsuman123e37b0cc2020-09-02 00:33:42 -0500115
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500116 # ip gateway netmask valid_status_code
117 10.5.5.10 0.0.0.0 255.255.252.0 ${HTTP_ACCEPTED}
118 10.5.5.11 0.0.0.0 255.255.252.0 ${HTTP_ACCEPTED}
Vijay06a169d2020-04-23 09:28:24 -0500119
120Switch Between IP Origins On VMI And Verify Details
121 [Documentation] Switch between IP origins on VMI and verify details.
122 [Tags] Switch_Between_IP_Origins_On_VMI_And_Verify_Details
123
124 Switch VMI IPv4 Origin And Verify Details
125 Switch VMI IPv4 Origin And Verify Details
126
127
128Verify Persistency Of VMI IPv4 Details After Host Reboot
129 [Documentation] Verify persistency of VMI IPv4 details after host reboot.
130 [Tags] Verify_Persistency_Of_VMI_IPv4_Details_After_Host_Reboot
131
132 # Verifying persistency of dynamic address.
133 Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
134 ${default}= Set Variable 0.0.0.0
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500135 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
Vijay06a169d2020-04-23 09:28:24 -0500136
137 # Verifying persistency of static address.
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600138 Switch VMI IPv4 Origin And Verify Details
139 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Vijay06a169d2020-04-23 09:28:24 -0500140
141
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500142Delete VMI Static IP Address And Verify
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500143 [Documentation] Delete VMI static IP address and verify.
144 [Tags] Delete_VMI_Static_IP_Address_And_Verify
145 [Teardown] Test Teardown Execution
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500146
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600147 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
148 Delete VMI IPv4 Address
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500149 ${resp}= Redfish.Get
150 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
151 Should Be Empty ${resp.dict["IPv4Addresses"]}
152
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500153
shrsuman123c1d3fe32020-09-08 05:04:07 -0500154Verify Successful VMI IP Static Configuration On HOST Boot After Session Delete
155 [Documentation] Verify VMI IP static Configuration On HOST Boot After session deleted.
156 [Tags] Verify_Successful_VMI_IP_Static_Configuration_On_HOST_Boot_After_Session_Delete
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500157 [Teardown] Run keywords Delete VMI IPv4 Address IPv4Addresses AND Test Teardown Execution
shrsuman123c1d3fe32020-09-08 05:04:07 -0500158
shrsuman12375e77062020-09-18 01:08:45 -0500159 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
shrsuman123c1d3fe32020-09-08 05:04:07 -0500160
161 ${session_info}= Get Redfish Session Info
162 Redfish.Delete ${session_info["location"]}
163
164 # Create a new Redfish session
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500165 Redfish Power Off
166 Redfish Power On
shrsuman123c1d3fe32020-09-08 05:04:07 -0500167
168 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
169
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500170
shrsuman123c1d3fe32020-09-08 05:04:07 -0500171Verify Persistency Of VMI DHCP IP Configuration After Multiple HOST Reboots
172 [Documentation] Verify Persistency Of VMI DHCP IP configuration After Multiple HOST Reboots
173 [Tags] Verify_Persistency_Of_VMI_DHCP_IP_Configuration_After_Multiple_HOST_Reboots
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500174 [Teardown] Test Teardown Execution
shrsuman123c1d3fe32020-09-08 05:04:07 -0500175
shrsuman123c1d3fe32020-09-08 05:04:07 -0500176 Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
shrsuman123c1d3fe32020-09-08 05:04:07 -0500177 ${vmi_ip_config}= Get VMI Network Interface Details
178 # Verifying persistency of dynamic address after multiple reboots.
shrsuman123f559cbe2021-01-06 05:40:45 -0600179 FOR ${i} IN RANGE ${2}
180 Redfish Power Off
181 Redfish Power On
182 Verify VMI Network Interface Details ${vmi_ip_config["IPv4_Address"]} DHCP ${vmi_ip_config["IPv4_Gateway"]}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500183 ... ${vmi_ip_config["IPv4_SubnetMask"]}
shrsuman123f559cbe2021-01-06 05:40:45 -0600184 END
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500185
186
187Enable DHCP When Static IP Configured And Verify Static IP
188 [Documentation] Enable DHCP when static ip configured and verify static ip
189 [Tags] Enable_DHCP_when_Static_IP_Configured_And_Verify_Static_IP
190 [Teardown] Test Teardown Execution
191
shrsuman123f559cbe2021-01-06 05:40:45 -0600192 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500193 Set VMI IPv4 Origin ${True}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500194 ${vmi_network_conf}= Get VMI Network Interface Details
195 Should Not Be Equal As Strings ${test_ipv4} ${vmi_network_conf["IPv4_Address"]}
196
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500197
shrsuman123e37b0cc2020-09-02 00:33:42 -0500198Verify VMI Static IP Configuration Persist On BMC Reset Before Host Boot
199 [Documentation] Verify VMI static IP configuration persist on BMC reset.
200 [Tags] Verify_VMI_Static_IP_Configuration_Persist_On_BMC_Reset_Before_Host_Boot
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600201 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail
shrsuman123e37b0cc2020-09-02 00:33:42 -0500202
shrsuman12375e77062020-09-18 01:08:45 -0500203 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500204 OBMC Reboot (off)
205 Redfish Power On
shrsuman123e37b0cc2020-09-02 00:33:42 -0500206 # Verifying the VMI static configuration
207 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
208
shrsuman12375e77062020-09-18 01:08:45 -0500209Add Static IP When Host Poweroff And Verify On Poweron
210 [Documentation] Add Static IP When Host Poweroff And Verify on power on
211 [Tags] Add_Static_IP_When_Host_Poweroff_And_Verify_On_Poweron
212 [Setup] Redfish Power Off
213 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail
214
215 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
216 Redfish Power On
217 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
218
219Add 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
230Enable DHCP When No Static IP Configured And Verify DHCP IP
231 [Documentation] Enable DHCP when no static ip configured and verify dhcp ip
232 [Tags] Enable_DHCP_When_No_Static_IP_Configured_And_Verify_DHCP_IP
233 [Setup] Run Keyword And Ignore Error Delete VMI IPv4 Address
234 [Teardown] Test Teardown Execution
235
236 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
237 Run Keyword If ${curr_origin} == ${False} Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
238 ${vmi_ip_config}= Get VMI Network Interface Details
239 Verify VMI Network Interface Details ${vmi_ip_config["IPv4_Address"]} DHCP ${vmi_ip_config["IPv4_Gateway"]}
240 ... ${vmi_ip_config["IPv4_SubnetMask"]}
241
242Verify User Cannot Delete VMI DHCP IP Address
243 [Documentation] Verify user cannot delete VMI DHCP IP Address
244 [Tags] Verify_User_Cannot_Delete_VMI_DHCP_IP_Address
245 [Setup] Set VMI IPv4 Origin ${True}
246 [Teardown] Test Teardown Execution
247
248 Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_BAD_REQUEST}
249 ${active_channel_config}= Get Active Channel Config
250 ${resp}= Redfish.Get
251 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
252 Should Not Be Empty ${resp.dict["IPv4Addresses"]}
253
254Enable DHCP When Static IP Configured DHCP Server Unavailable And Verify IP
255 [Documentation] Enable DHCP When Static IP Configured And DHCP Server Unavailable And Verify No IP.
256 [Tags] Enable_DHCP_When_Static_IP_Configured_DHCP_Server_Unavailable_And_Verify_IP
257 [Teardown] Test Teardown Execution
258
259 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
260 Set VMI IPv4 Origin ${True}
261 ${default}= Set Variable 0.0.0.0
262 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
263
shrsuman123e37b0cc2020-09-02 00:33:42 -0500264
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500265Verify To Configure VMI Static IP Address With Different User Roles
266 [Documentation] Verify to configure vmi static ip address with different user roles.
267 [Tags] Verify_To_Configure_VMI_Static_IP_Address_With_Different_User_Roles
268 [Setup] Create Users With Different Roles users=${USERS} force=${True}
269 [Template] Config VMI Static IP Address Using Different Users
270 [Teardown] Delete BMC Users Using Redfish
271
272 # username password ip_address gateway nemask valid_status_code
273 admin_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_ACCEPTED}
274 operator_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN}
275 readonly_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN}
276 noaccess_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN}
277
278
279Verify To Delete VMI Static IP Address With Different User Roles
280 [Documentation] Verify to delete vmi static IP address with different user roles.
281 [Tags] Verify_To_Delete_VMI_Static_IP_Address_With_Different_User_Roles
282 [Setup] Create Users With Different Roles users=${USERS} force=${True}
283 [Template] Delete VMI Static IP Address Using Different Users
284 [Teardown] Delete BMC Users Using Redfish
285
286 # username password valid_status_code
287 admin_user TestPwd123 ${HTTP_ACCEPTED}
288 operator_user TestPwd123 ${HTTP_FORBIDDEN}
289 readonly_user TestPwd123 ${HTTP_FORBIDDEN}
290 noaccess_user TestPwd123 ${HTTP_FORBIDDEN}
291
292
293Verify To Update VMI Static IP Address With Different User Roles
294 [Documentation] Verify to update vmi static IP address with different user roles.
295 [Tags] Verify_To_Update_VMI_Static_IP_Address_With_Different_User_Roles_And_Verify
296 [Setup] Create Users With Different Roles users=${USERS} force=${True}
297 [Template] Config VMI Static IP Address Using Different Users
298 [Teardown] Delete BMC Users Using Redfish
299
300 # username password ip_address gateway nemask valid_status_code
301 admin_user TestPwd123 10.5.10.20 0.0.0.0 255.255.0.0 ${HTTP_ACCEPTED}
302 operator_user TestPwd123 10.5.10.30 0.0.0.0 255.255.0.0 ${HTTP_FORBIDDEN}
303 readonly_user TestPwd123 10.5.20.40 0.0.0.0 255.255.0.0 ${HTTP_FORBIDDEN}
304 noaccess_user TestPwd123 10.5.30.50 0.0.0.0 255.255.0.0 ${HTTP_FORBIDDEN}
305
306
307Verify To Read VMI Network Configuration With Different User Roles
308 [Documentation] Verify to read vmi network configuration with different user roles.
309 [Tags] Verify_To_Read_VMI_Network_Configuration_Via_Different_User_Roles
310 [Setup] Create Users With Different Roles users=${USERS} force=${True}
311 [Template] Read VMI Static IP Address Using Different Users
312 [Teardown] Delete BMC Users Using Redfish
313
314 # username password valid_status_code
315 admin_user TestPwd123 ${HTTP_OK}
316 operator_user TestPwd123 ${HTTP_OK}
317 readonly_user TestPwd123 ${HTTP_OK}
318 noaccess_user TestPwd123 ${HTTP_FORBIDDEN}
319
shrsuman123b361d412020-09-30 06:17:23 -0500320Enable DHCP On VMI Network Via Different Users Roles And Verify
321 [Documentation] Enable DHCP On VMI Network Via Different Users Roles And Verify.
322 [Tags] Enable_DHCP_On_VMI_Network_Via_Different_Users_Roles_And_Verify
323 [Setup] Create Users With Different Roles users=${USERS} force=${True}
324 [Template] Update User Role And Set VMI IPv4 Origin
325 [Teardown] Delete BMC Users Using Redfish
326
327 # username password dhcp_enabled valid_status_code
328 admin_user TestPwd123 ${True} ${HTTP_ACCEPTED}
329 operator_user TestPwd123 ${True} ${HTTP_FORBIDDEN}
330 readonly_user TestPwd123 ${True} ${HTTP_FORBIDDEN}
331 noaccess_user TestPwd123 ${True} ${HTTP_FORBIDDEN}
332
333Disable DHCP On VMI Network Via Different Users Roles And Verify
334 [Documentation] Disable DHCP On VMI Network Via Different Users Roles And Verify.
335 [Tags] Disable_DHCP_On_VMI_Network_Via_Different_Users_Roles_And_Verify
336 [Setup] Create Users With Different Roles users=${USERS} force=${True}
337 [Template] Update User Role And Set VMI IPv4 Origin
338 [Teardown] Delete BMC Users Using Redfish
339
340 # username password dhcp_enabled valid_status_code
341 admin_user TestPwd123 ${False} ${HTTP_ACCEPTED}
342 operator_user TestPwd123 ${False} ${HTTP_FORBIDDEN}
343 readonly_user TestPwd123 ${False} ${HTTP_FORBIDDEN}
344 noaccess_user TestPwd123 ${False} ${HTTP_FORBIDDEN}
345
shrsuman123e37b0cc2020-09-02 00:33:42 -0500346
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500347Enable And Disable DHCP And Verify
348 [Documentation] verify enable DHCP and disable DHCP.
349 [Tags] Enabled_And_Disabled_DHCP_Verify
350
351 Set VMI IPv4 Origin ${True}
352 ${default}= Set Variable 0.0.0.0
353 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
354 Set VMI IPv4 Origin ${False}
shrsuman1237a0e7f52021-01-07 00:43:11 -0600355 ${resp}= Redfish.Get
356 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
357 Should Be Empty ${resp.dict["IPv4Addresses"]}
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500358
359
360Multiple Times Enable And Disable DHCP And Verify
361 [Documentation] Enable and Disable DHCP in a loop and verify VMI gets an IP address from DHCP
362 ... each time when DHCP is enabled
363 [Tags] Multiple_Times_Enable_And_Disable_DHCP_And_Verify
364
365 ${default}= Set Variable 0.0.0.0
366 FOR ${i} IN RANGE ${2}
367 Set VMI IPv4 Origin ${True}
368 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
369 Set VMI IPv4 Origin ${False}
shrsuman1237a0e7f52021-01-07 00:43:11 -0600370 ${resp}= Redfish.Get
371 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
372 Should Be Empty ${resp.dict["IPv4Addresses"]}
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500373 END
374
375
Vijay06a169d2020-04-23 09:28:24 -0500376*** Keywords ***
377
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500378Suite Setup Execution
379 [Documentation] Do test setup execution task.
380
381 Redfish.Login
382 Redfish Power On
383 ${active_channel_config}= Get Active Channel Config
384 Set Suite Variable ${active_channel_config}
385 ${resp}= Redfish.Get
386 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
387 ${ip_resp}= Evaluate json.loads('''${resp.text}''') json
388 ${length}= Get Length ${ip_resp["IPv4StaticAddresses"]}
389 ${vmi_network_conf}= Run Keyword If ${length} != ${0} Get VMI Network Interface Details
390 Set Suite Variable ${vmi_network_conf}
391
392
393Test Teardown Execution
394 [Documentation] Do test teardown execution task.
395
396 FFDC On Test Case Fail
397 ${curr_mode}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
398 Run Keyword If ${curr_mode} == ${True} Set VMI IPv4 Origin ${False}
399 Run Keyword If ${vmi_network_conf} != ${None}
shrsuman123f559cbe2021-01-06 05:40:45 -0600400 ... Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500401 ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]}
402
403
Vijay06a169d2020-04-23 09:28:24 -0500404Get VMI Network Interface Details
405 [Documentation] Get VMI network interface details.
406 [Arguments] ${valid_status_code}=${HTTP_OK}
407
408 # Description of argument(s):
409 # valid_status_code Expected valid status code from GET request.
410
Anves Kumar rayankulaaa33b052020-07-22 04:24:51 -0500411 # Note: It returns a dictionary of VMI eth0 parameters.
Vijay06a169d2020-04-23 09:28:24 -0500412
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -0500413 ${active_channel_config}= Get Active Channel Config
414 ${resp}= Redfish.Get
415 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
Vijay06a169d2020-04-23 09:28:24 -0500416 ... valid_status_codes=[${valid_status_code}]
417
418 ${ip_resp}= Evaluate json.loads('''${resp.text}''') json
419
420 ${static_exists}= Run Keyword And Ignore Error
421 ... Set Variable ${ip_resp["IPv4StaticAddresses"][0]["Address"]}
422 ${static_exists}= Set Variable If '${static_exists[0]}' == 'PASS' ${True} ${False}
423
424 ${vmi_ip}= Create Dictionary DHCPv4=${${ip_resp["DHCPv4"]["DHCPEnabled"]}} Id=${ip_resp["Id"]}
425 ... Description=${ip_resp["Description"]} IPv4_Address=${ip_resp["IPv4Addresses"][0]["Address"]}
426 ... IPv4_AddressOrigin=${ip_resp["IPv4Addresses"][0]["AddressOrigin"]} Name=${ip_resp["Name"]}
Sushil Singh810234d2020-05-13 12:12:03 -0500427 ... IPv4_Gateway=${ip_resp["IPv4Addresses"][0]["Gateway"]}
428 ... InterfaceEnabled=${${ip_resp["InterfaceEnabled"]}}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500429 ... IPv4_SubnetMask=${ip_resp["IPv4Addresses"][0]["SubnetMask"]}
Vijay06a169d2020-04-23 09:28:24 -0500430 ... IPv4StaticAddresses=${${static_exists}}
431
432 [Return] &{vmi_ip}
433
434
435Get Immediate Child Parameter From VMI Network Interface
436 [Documentation] Get immediate child parameter from VMI network interface.
437 [Arguments] ${parameter} ${valid_status_code}=${HTTP_OK}
438
439 # Description of argument(s):
440 # parameter parameter for which value is required. Ex: DHCPEnabled, MACAddress etc.
441 # valid_status_code Expected valid status code from GET request.
442
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -0500443 ${active_channel_config}= Get Active Channel Config
444 ${resp}= Redfish.Get
445 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
Vijay06a169d2020-04-23 09:28:24 -0500446 ... valid_status_codes=[${valid_status_code}]
447
448 ${ip_resp}= Evaluate json.loads('''${resp.text}''') json
449 ${value}= Set Variable If '${parameter}' != 'DHCPEnabled' ${ip_resp["${parameter}"]}
450 ... ${ip_resp["DHCPv4"]["${parameter}"]}
451
452 [Return] ${value}
453
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600454
Vijay06a169d2020-04-23 09:28:24 -0500455Verify VMI EthernetInterfaces
456 [Documentation] Verify VMI ethernet interfaces.
457 [Arguments] ${valid_status_code}=${HTTP_OK}
458
459 # Description of argument(s):
460 # valid_status_code Expected valid status code from GET request.
461
462 ${resp}= Redfish.Get /redfish/v1/Systems/hypervisor/EthernetInterfaces
463 ... valid_status_codes=[${valid_status_code}]
464
465 ${resp}= Evaluate json.loads('''${resp.text}''') json
466 ${interfaces}= Set Variable ${resp["Members"]}
467
468 Should Be Equal As Strings ${interfaces[0]}[@odata.id]
Anves Kumar rayankulaaa33b052020-07-22 04:24:51 -0500469 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/eth0
Vijay06a169d2020-04-23 09:28:24 -0500470 Should Be Equal As Strings ${interfaces[1]}[@odata.id]
Anves Kumar rayankulaaa33b052020-07-22 04:24:51 -0500471 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/eth1
Vijay06a169d2020-04-23 09:28:24 -0500472
473 Should Be Equal ${resp["Members@odata.count"]} ${2}
474
475
476Verify VMI Network Interface Details
477 [Documentation] Verify VMI network interface details.
478 [Arguments] ${ip} ${origin} ${gateway} ${netmask}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500479 ... ${valid_status_code}=${HTTP_OK}
Vijay06a169d2020-04-23 09:28:24 -0500480
481 # Description of argument(s):
482 # ip VMI IPv4 address.
483 # origin Origin of IPv4 address eg. Static or DHCP.
484 # gateway Gateway for VMI IP.
485 # netmask Subnetmask for VMI IP.
486 # valid_status_code Expected valid status code from GET request. Default is HTTP_OK.
Vijay06a169d2020-04-23 09:28:24 -0500487
Vijay06a169d2020-04-23 09:28:24 -0500488 ${vmi_ip}= Get VMI Network Interface Details ${valid_status_code}
489 Should Be Equal As Strings ${origin} ${vmi_ip["IPv4_AddressOrigin"]}
490 Should Be Equal As Strings ${gateway} ${vmi_ip["IPv4_Gateway"]}
491 Should Be Equal As Strings ${netmask} ${vmi_ip["IPv4_SubnetMask"]}
Vijay06a169d2020-04-23 09:28:24 -0500492 Should Be Equal As Strings ${ip} ${vmi_ip["IPv4_Address"]}
493
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600494
495Set Static IPv4 Address To VMI And Verify
Vijay06a169d2020-04-23 09:28:24 -0500496 [Documentation] Set static IPv4 address to VMI.
497 [Arguments] ${ip} ${gateway} ${netmask} ${valid_status_code}=${HTTP_ACCEPTED}
498
499 # Description of argument(s):
500 # ip VMI IPv4 address.
501 # gateway Gateway for VMI IP.
502 # netmask Subnetmask for VMI IP.
503 # valid_status_code Expected valid status code from GET request. Default is HTTP_ACCEPTED.
504
505 ${data}= Set Variable
506 ... {"IPv4StaticAddresses": [{"Address": "${ip}","SubnetMask": "${netmask}","Gateway": "${gateway}"}]}
507
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -0500508 ${active_channel_config}= Get Active Channel Config
509 ${resp}= Redfish.Patch
510 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
511 ... body=${data} valid_status_codes=[${valid_status_code}]
Prashanth Katti1ce68212020-11-13 00:39:03 -0600512
513 # Wait few seconds for new configuration to get populated on runtime.
514 Sleep ${wait_time}
Vijay06a169d2020-04-23 09:28:24 -0500515
Vijay06a169d2020-04-23 09:28:24 -0500516 Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED}
shrsuman12375e77062020-09-18 01:08:45 -0500517 ${host_power_state} ${host_state}= Redfish Get Host State
518 Run Keyword If '${host_power_state}' == 'On' and '${host_state}' == 'Enabled'
519 ... Verify VMI Network Interface Details ${ip} Static ${gateway} ${netmask}
Vijay06a169d2020-04-23 09:28:24 -0500520
521
522Delete VMI IPv4 Address
523 [Documentation] Delete VMI IPv4 address.
524 [Arguments] ${delete_param}=IPv4StaticAddresses ${valid_status_code}=${HTTP_ACCEPTED}
525
526 # Description of argument(s):
527 # delete_param Parameter to be deleted eg. IPv4StaticAddresses or IPv4Addresses.
528 # Default is IPv4StaticAddresses.
529 # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK.
530
531 ${data}= Set Variable {"${delete_param}": [${Null}]}
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -0500532 ${active_channel_config}= Get Active Channel Config
533 ${resp}= Redfish.Patch
534 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
535 ... body=${data} valid_status_codes=[${valid_status_code}]
Vijay06a169d2020-04-23 09:28:24 -0500536
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600537 Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED}
538 ${resp}= Redfish.Get
539 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
540 Should Be Empty ${resp.dict["IPv4StaticAddresses"]}
541
Vijay06a169d2020-04-23 09:28:24 -0500542
543Set VMI IPv4 Origin
544 [Documentation] Set VMI IPv4 origin.
545 [Arguments] ${dhcp_enabled}=${False} ${valid_status_code}=${HTTP_ACCEPTED}
546
547 # Description of argument(s):
548 # dhcp_enabled True if user wants to enable DHCP. Default is Static, hence value is set to False.
549 # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK.
550
551 ${data}= Set Variable If ${dhcp_enabled} == ${False} ${DISABLE_DHCP} ${ENABLE_DHCP}
Anves Kumar rayankulaaa33b052020-07-22 04:24:51 -0500552 ${resp}= Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/eth0 body=${data}
Vijay06a169d2020-04-23 09:28:24 -0500553 ... valid_status_codes=[${valid_status_code}]
shrsuman123b361d412020-09-30 06:17:23 -0500554 Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED}
555 ${resp}= Redfish.Get
556 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
557 Should Be Equal ${resp.dict["DHCPv4"]["DHCPEnabled"]} ${dhcp_enabled}
Vijay06a169d2020-04-23 09:28:24 -0500558
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600559 Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED}
560 ${resp}= Redfish.Get
561 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
562 Should Be Equal ${resp.dict["DHCPv4"]["DHCPEnabled"]} ${dhcp_enabled}
563
Vijay06a169d2020-04-23 09:28:24 -0500564
565Switch VMI IPv4 Origin And Verify Details
566 [Documentation] Switch VMI IPv4 origin and verify details.
Vijay06a169d2020-04-23 09:28:24 -0500567
568 ${curr_mode}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
569 ${dhcp_enabled}= Set Variable If ${curr_mode} == ${False} ${True} ${False}
570
571 ${default}= Set Variable 0.0.0.0
572 ${origin}= Set Variable If ${curr_mode} == ${False} DHCP Static
573 Set VMI IPv4 Origin ${dhcp_enabled} ${HTTP_ACCEPTED}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500574 Verify VMI Network Interface Details ${default} ${origin} ${default} ${default}
Vijay06a169d2020-04-23 09:28:24 -0500575
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500576
577Delete VMI Static IP Address Using Different Users
578 [Documentation] Update user role and delete vmi static IP address.
579 [Arguments] ${username} ${password} ${valid_status_code}
580 [Teardown] Run Keywords Redfish.Login AND
shrsuman123f559cbe2021-01-06 05:40:45 -0600581 ... Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500582 ... ${test_netmask} ${HTTP_ACCEPTED} AND Redfish.Logout
583
584 # Description of argument(s):
585 # username The host username.
586 # password The host password.
587 # valid_status_code The expected valid status code.
588
589 Redfish.Login ${username} ${password}
590 Delete VMI IPv4 Address delete_param=IPv4StaticAddresses valid_status_code=${valid_status_code}
591 Redfish.Logout
592
593
594Config VMI Static IP Address Using Different Users
595 [Documentation] Update user role and update vmi static ip address.
596 [Arguments] ${username} ${password} ${ip} ${gateway} ${netmask}
597 ... ${valid_status_code}
598
599 # Description of argument(s):
600 # username The host username.
601 # password The host password.
602 # ip IP address to be added (e.g. "10.7.7.7").
603 # subnet_mask Subnet mask for the IP to be added
604 # (e.g. "255.255.0.0").
605 # gateway Gateway for the IP to be added (e.g. "10.7.7.1").
606 # valid_status_code The expected valid status code.
607
608 Redfish.Login ${username} ${password}
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600609 Set Static IPv4 Address To VMI And Verify ${ip} ${gateway} ${netmask} ${valid_status_code}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500610 Redfish.Logout
611
612
613Read VMI Static IP Address Using Different Users
614 [Documentation] Update user role and read vmi static ip address.
615 [Arguments] ${username} ${password} ${valid_status_code}
616
617 # Description of argument(s):
618 # username The host username.
619 # password The host password.
620 # valid_status_code The expected valid status code.
621
622 Redfish.Login ${username} ${password}
623 Redfish.Get
624 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
625 ... valid_status_codes=[${valid_status_code}]
626 Redfish.Logout
627
628
629Delete BMC Users Using Redfish
630 [Documentation] Delete BMC users via redfish.
631
632 Redfish.Login
633 Delete BMC Users Via Redfish users=${USERS}
shrsuman123b361d412020-09-30 06:17:23 -0500634
635Update User Role And Set VMI IPv4 Origin
636 [Documentation] Update User Role And Set VMI IPv4 Origin.
637 [Arguments] ${username} ${password} ${dhcp_enabled} ${valid_status_code}
638
639 # Description of argument(s):
640 # username The host username.
641 # password The host password.
642 # dhcp_enabled Indicates whether dhcp should be enabled
643 # (${True}, ${False}).
644 # valid_status_code The expected valid status code.
645
646 Redfish.Login ${username} ${password}
647 Set VMI IPv4 Origin ${dhcp_enabled} ${valid_status_code}
648 Redfish.Logout