blob: 9643937a780588736e4a587a287c9ddf1fa1cfb0 [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
Shradha Sumanc7df7db2021-03-08 05:16:44 -060091 10.5.20.30 10.5.20.1 255.255.252.0 ${HTTP_ACCEPTED}
92 a.3.118.94 10.5.20.1 255.255.252.0 ${HTTP_BAD_REQUEST}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -050093
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
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600100 ${ip1}= Create dictionary Address=10.5.5.10 SubnetMask=255.255.252.0 Gateway=10.5.5.1
101 ${ip2}= Create dictionary Address=10.5.5.11 SubnetMask=255.255.252.0 Gateway=10.5.5.1
102 ${ip3}= Create dictionary Address=10.5.5.12 SubnetMask=255.255.252.0 Gateway=10.5.5.1
shrsuman123e37b0cc2020-09-02 00:33:42 -0500103 ${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
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600117 10.5.5.10 10.5.5.1 255.255.252.0 ${HTTP_ACCEPTED}
118 10.5.5.11 10.5.5.1 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
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600190 [Setup] Redfish Power On
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500191 [Teardown] Test Teardown Execution
192
shrsuman123f559cbe2021-01-06 05:40:45 -0600193 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500194 Set VMI IPv4 Origin ${True}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500195 ${vmi_network_conf}= Get VMI Network Interface Details
196 Should Not Be Equal As Strings ${test_ipv4} ${vmi_network_conf["IPv4_Address"]}
197
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500198
shrsuman123e37b0cc2020-09-02 00:33:42 -0500199Verify VMI Static IP Configuration Persist On BMC Reset Before Host Boot
200 [Documentation] Verify VMI static IP configuration persist on BMC reset.
201 [Tags] Verify_VMI_Static_IP_Configuration_Persist_On_BMC_Reset_Before_Host_Boot
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600202 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail
shrsuman123e37b0cc2020-09-02 00:33:42 -0500203
shrsuman12375e77062020-09-18 01:08:45 -0500204 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500205 OBMC Reboot (off)
206 Redfish Power On
shrsuman123e37b0cc2020-09-02 00:33:42 -0500207 # Verifying the VMI static configuration
208 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
209
shrsuman12375e77062020-09-18 01:08:45 -0500210Add Static IP When Host Poweroff And Verify On Poweron
211 [Documentation] Add Static IP When Host Poweroff And Verify on power on
212 [Tags] Add_Static_IP_When_Host_Poweroff_And_Verify_On_Poweron
213 [Setup] Redfish Power Off
214 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail
215
216 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
217 Redfish Power On
218 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
219
220Add VMI Static IP When Host Poweroff And Verify Static IP On BMC Reset
221 [Documentation] Add Static IP When Host Poweroff And Verify Static IP On BMC Reset.
222 [Tags] Add_VMI_Static_IP_When_Host_Poweroff_And_Verify_Static_IP_On_BMC_Reset
223 [Setup] Redfish Power Off
224 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail
225
226 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
227 OBMC Reboot (off)
228 Redfish Power On
229 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
230
231Enable 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
240 Verify VMI Network Interface Details ${vmi_ip_config["IPv4_Address"]} DHCP ${vmi_ip_config["IPv4_Gateway"]}
241 ... ${vmi_ip_config["IPv4_SubnetMask"]}
242
243Verify User Cannot Delete VMI DHCP IP Address
244 [Documentation] Verify user cannot delete VMI DHCP IP Address
245 [Tags] Verify_User_Cannot_Delete_VMI_DHCP_IP_Address
246 [Setup] Set VMI IPv4 Origin ${True}
247 [Teardown] Test Teardown Execution
248
249 Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_BAD_REQUEST}
250 ${active_channel_config}= Get Active Channel Config
251 ${resp}= Redfish.Get
252 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
253 Should Not Be Empty ${resp.dict["IPv4Addresses"]}
254
255Enable DHCP When Static IP Configured DHCP Server Unavailable And Verify IP
256 [Documentation] Enable DHCP When Static IP Configured And DHCP Server Unavailable And Verify No IP.
257 [Tags] Enable_DHCP_When_Static_IP_Configured_DHCP_Server_Unavailable_And_Verify_IP
258 [Teardown] Test Teardown Execution
259
260 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
261 Set VMI IPv4 Origin ${True}
262 ${default}= Set Variable 0.0.0.0
263 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
264
shrsuman123e37b0cc2020-09-02 00:33:42 -0500265
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500266Verify To Configure VMI Static IP Address With Different User Roles
267 [Documentation] Verify to configure vmi static ip address with different user roles.
268 [Tags] Verify_To_Configure_VMI_Static_IP_Address_With_Different_User_Roles
269 [Setup] Create Users With Different Roles users=${USERS} force=${True}
270 [Template] Config VMI Static IP Address Using Different Users
271 [Teardown] Delete BMC Users Using Redfish
272
273 # username password ip_address gateway nemask valid_status_code
274 admin_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_ACCEPTED}
275 operator_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN}
276 readonly_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN}
277 noaccess_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN}
278
279
280Verify To Delete VMI Static IP Address With Different User Roles
281 [Documentation] Verify to delete vmi static IP address with different user roles.
282 [Tags] Verify_To_Delete_VMI_Static_IP_Address_With_Different_User_Roles
283 [Setup] Create Users With Different Roles users=${USERS} force=${True}
284 [Template] Delete VMI Static IP Address Using Different Users
285 [Teardown] Delete BMC Users Using Redfish
286
287 # username password valid_status_code
288 admin_user TestPwd123 ${HTTP_ACCEPTED}
289 operator_user TestPwd123 ${HTTP_FORBIDDEN}
290 readonly_user TestPwd123 ${HTTP_FORBIDDEN}
291 noaccess_user TestPwd123 ${HTTP_FORBIDDEN}
292
293
294Verify To Update VMI Static IP Address With Different User Roles
295 [Documentation] Verify to update vmi static IP address with different user roles.
296 [Tags] Verify_To_Update_VMI_Static_IP_Address_With_Different_User_Roles_And_Verify
297 [Setup] Create Users With Different Roles users=${USERS} force=${True}
298 [Template] Config VMI Static IP Address Using Different Users
299 [Teardown] Delete BMC Users Using Redfish
300
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600301 # username password ip_address gateway netmask valid_status_code
302 admin_user TestPwd123 10.5.10.20 10.5.10.1 255.255.0.0 ${HTTP_ACCEPTED}
303 operator_user TestPwd123 10.5.10.30 10.5.10.1 255.255.0.0 ${HTTP_FORBIDDEN}
304 readonly_user TestPwd123 10.5.20.40 10.5.20.1 255.255.0.0 ${HTTP_FORBIDDEN}
305 noaccess_user TestPwd123 10.5.30.50 10.5.30.1 255.255.0.0 ${HTTP_FORBIDDEN}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500306
307
308Verify To Read VMI Network Configuration With Different User Roles
309 [Documentation] Verify to read vmi network configuration with different user roles.
310 [Tags] Verify_To_Read_VMI_Network_Configuration_Via_Different_User_Roles
311 [Setup] Create Users With Different Roles users=${USERS} force=${True}
312 [Template] Read VMI Static IP Address Using Different Users
313 [Teardown] Delete BMC Users Using Redfish
314
315 # username password valid_status_code
316 admin_user TestPwd123 ${HTTP_OK}
317 operator_user TestPwd123 ${HTTP_OK}
318 readonly_user TestPwd123 ${HTTP_OK}
319 noaccess_user TestPwd123 ${HTTP_FORBIDDEN}
320
shrsuman123b361d412020-09-30 06:17:23 -0500321Enable DHCP On VMI Network Via Different Users Roles And Verify
322 [Documentation] Enable DHCP On VMI Network Via Different Users Roles And Verify.
323 [Tags] Enable_DHCP_On_VMI_Network_Via_Different_Users_Roles_And_Verify
324 [Setup] Create Users With Different Roles users=${USERS} force=${True}
325 [Template] Update User Role And Set VMI IPv4 Origin
326 [Teardown] Delete BMC Users Using Redfish
327
328 # username password dhcp_enabled valid_status_code
329 admin_user TestPwd123 ${True} ${HTTP_ACCEPTED}
330 operator_user TestPwd123 ${True} ${HTTP_FORBIDDEN}
331 readonly_user TestPwd123 ${True} ${HTTP_FORBIDDEN}
332 noaccess_user TestPwd123 ${True} ${HTTP_FORBIDDEN}
333
334Disable DHCP On VMI Network Via Different Users Roles And Verify
335 [Documentation] Disable DHCP On VMI Network Via Different Users Roles And Verify.
336 [Tags] Disable_DHCP_On_VMI_Network_Via_Different_Users_Roles_And_Verify
337 [Setup] Create Users With Different Roles users=${USERS} force=${True}
338 [Template] Update User Role And Set VMI IPv4 Origin
339 [Teardown] Delete BMC Users Using Redfish
340
341 # username password dhcp_enabled valid_status_code
342 admin_user TestPwd123 ${False} ${HTTP_ACCEPTED}
343 operator_user TestPwd123 ${False} ${HTTP_FORBIDDEN}
344 readonly_user TestPwd123 ${False} ${HTTP_FORBIDDEN}
345 noaccess_user TestPwd123 ${False} ${HTTP_FORBIDDEN}
346
shrsuman123e37b0cc2020-09-02 00:33:42 -0500347
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500348Enable And Disable DHCP And Verify
349 [Documentation] verify enable DHCP and disable DHCP.
350 [Tags] Enabled_And_Disabled_DHCP_Verify
351
352 Set VMI IPv4 Origin ${True}
353 ${default}= Set Variable 0.0.0.0
354 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
355 Set VMI IPv4 Origin ${False}
shrsuman1237a0e7f52021-01-07 00:43:11 -0600356 ${resp}= Redfish.Get
357 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
358 Should Be Empty ${resp.dict["IPv4Addresses"]}
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500359
360
361Multiple Times Enable And Disable DHCP And Verify
362 [Documentation] Enable and Disable DHCP in a loop and verify VMI gets an IP address from DHCP
363 ... each time when DHCP is enabled
364 [Tags] Multiple_Times_Enable_And_Disable_DHCP_And_Verify
365
366 ${default}= Set Variable 0.0.0.0
367 FOR ${i} IN RANGE ${2}
368 Set VMI IPv4 Origin ${True}
369 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
370 Set VMI IPv4 Origin ${False}
shrsuman1237a0e7f52021-01-07 00:43:11 -0600371 ${resp}= Redfish.Get
372 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
373 Should Be Empty ${resp.dict["IPv4Addresses"]}
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500374 END
375
376
Vijay06a169d2020-04-23 09:28:24 -0500377*** Keywords ***
378
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500379Suite Setup Execution
380 [Documentation] Do test setup execution task.
381
382 Redfish.Login
383 Redfish Power On
384 ${active_channel_config}= Get Active Channel Config
385 Set Suite Variable ${active_channel_config}
386 ${resp}= Redfish.Get
387 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
388 ${ip_resp}= Evaluate json.loads('''${resp.text}''') json
389 ${length}= Get Length ${ip_resp["IPv4StaticAddresses"]}
390 ${vmi_network_conf}= Run Keyword If ${length} != ${0} Get VMI Network Interface Details
391 Set Suite Variable ${vmi_network_conf}
392
393
394Test Teardown Execution
395 [Documentation] Do test teardown execution task.
396
397 FFDC On Test Case Fail
398 ${curr_mode}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
399 Run Keyword If ${curr_mode} == ${True} Set VMI IPv4 Origin ${False}
400 Run Keyword If ${vmi_network_conf} != ${None}
shrsuman123f559cbe2021-01-06 05:40:45 -0600401 ... Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500402 ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]}
403
404
Vijay06a169d2020-04-23 09:28:24 -0500405Get VMI Network Interface Details
406 [Documentation] Get VMI network interface details.
407 [Arguments] ${valid_status_code}=${HTTP_OK}
408
409 # Description of argument(s):
410 # valid_status_code Expected valid status code from GET request.
411
Anves Kumar rayankulaaa33b052020-07-22 04:24:51 -0500412 # Note: It returns a dictionary of VMI eth0 parameters.
Vijay06a169d2020-04-23 09:28:24 -0500413
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -0500414 ${active_channel_config}= Get Active Channel Config
415 ${resp}= Redfish.Get
416 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
Vijay06a169d2020-04-23 09:28:24 -0500417 ... valid_status_codes=[${valid_status_code}]
418
419 ${ip_resp}= Evaluate json.loads('''${resp.text}''') json
420
421 ${static_exists}= Run Keyword And Ignore Error
422 ... Set Variable ${ip_resp["IPv4StaticAddresses"][0]["Address"]}
423 ${static_exists}= Set Variable If '${static_exists[0]}' == 'PASS' ${True} ${False}
424
425 ${vmi_ip}= Create Dictionary DHCPv4=${${ip_resp["DHCPv4"]["DHCPEnabled"]}} Id=${ip_resp["Id"]}
426 ... Description=${ip_resp["Description"]} IPv4_Address=${ip_resp["IPv4Addresses"][0]["Address"]}
427 ... IPv4_AddressOrigin=${ip_resp["IPv4Addresses"][0]["AddressOrigin"]} Name=${ip_resp["Name"]}
Sushil Singh810234d2020-05-13 12:12:03 -0500428 ... IPv4_Gateway=${ip_resp["IPv4Addresses"][0]["Gateway"]}
429 ... InterfaceEnabled=${${ip_resp["InterfaceEnabled"]}}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500430 ... IPv4_SubnetMask=${ip_resp["IPv4Addresses"][0]["SubnetMask"]}
Vijay06a169d2020-04-23 09:28:24 -0500431 ... IPv4StaticAddresses=${${static_exists}}
432
433 [Return] &{vmi_ip}
434
435
436Get Immediate Child Parameter From VMI Network Interface
437 [Documentation] Get immediate child parameter from VMI network interface.
438 [Arguments] ${parameter} ${valid_status_code}=${HTTP_OK}
439
440 # Description of argument(s):
441 # parameter parameter for which value is required. Ex: DHCPEnabled, MACAddress etc.
442 # valid_status_code Expected valid status code from GET request.
443
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -0500444 ${active_channel_config}= Get Active Channel Config
445 ${resp}= Redfish.Get
446 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
Vijay06a169d2020-04-23 09:28:24 -0500447 ... valid_status_codes=[${valid_status_code}]
448
449 ${ip_resp}= Evaluate json.loads('''${resp.text}''') json
450 ${value}= Set Variable If '${parameter}' != 'DHCPEnabled' ${ip_resp["${parameter}"]}
451 ... ${ip_resp["DHCPv4"]["${parameter}"]}
452
453 [Return] ${value}
454
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600455
Vijay06a169d2020-04-23 09:28:24 -0500456Verify VMI EthernetInterfaces
457 [Documentation] Verify VMI ethernet interfaces.
458 [Arguments] ${valid_status_code}=${HTTP_OK}
459
460 # Description of argument(s):
461 # valid_status_code Expected valid status code from GET request.
462
463 ${resp}= Redfish.Get /redfish/v1/Systems/hypervisor/EthernetInterfaces
464 ... valid_status_codes=[${valid_status_code}]
465
466 ${resp}= Evaluate json.loads('''${resp.text}''') json
467 ${interfaces}= Set Variable ${resp["Members"]}
468
469 Should Be Equal As Strings ${interfaces[0]}[@odata.id]
Anves Kumar rayankulaaa33b052020-07-22 04:24:51 -0500470 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/eth0
Vijay06a169d2020-04-23 09:28:24 -0500471 Should Be Equal As Strings ${interfaces[1]}[@odata.id]
Anves Kumar rayankulaaa33b052020-07-22 04:24:51 -0500472 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/eth1
Vijay06a169d2020-04-23 09:28:24 -0500473
474 Should Be Equal ${resp["Members@odata.count"]} ${2}
475
476
477Verify VMI Network Interface Details
478 [Documentation] Verify VMI network interface details.
479 [Arguments] ${ip} ${origin} ${gateway} ${netmask}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500480 ... ${valid_status_code}=${HTTP_OK}
Vijay06a169d2020-04-23 09:28:24 -0500481
482 # Description of argument(s):
483 # ip VMI IPv4 address.
484 # origin Origin of IPv4 address eg. Static or DHCP.
485 # gateway Gateway for VMI IP.
486 # netmask Subnetmask for VMI IP.
487 # valid_status_code Expected valid status code from GET request. Default is HTTP_OK.
Vijay06a169d2020-04-23 09:28:24 -0500488
Vijay06a169d2020-04-23 09:28:24 -0500489 ${vmi_ip}= Get VMI Network Interface Details ${valid_status_code}
490 Should Be Equal As Strings ${origin} ${vmi_ip["IPv4_AddressOrigin"]}
491 Should Be Equal As Strings ${gateway} ${vmi_ip["IPv4_Gateway"]}
492 Should Be Equal As Strings ${netmask} ${vmi_ip["IPv4_SubnetMask"]}
Vijay06a169d2020-04-23 09:28:24 -0500493 Should Be Equal As Strings ${ip} ${vmi_ip["IPv4_Address"]}
494
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600495
496Set Static IPv4 Address To VMI And Verify
Vijay06a169d2020-04-23 09:28:24 -0500497 [Documentation] Set static IPv4 address to VMI.
498 [Arguments] ${ip} ${gateway} ${netmask} ${valid_status_code}=${HTTP_ACCEPTED}
499
500 # Description of argument(s):
501 # ip VMI IPv4 address.
502 # gateway Gateway for VMI IP.
503 # netmask Subnetmask for VMI IP.
504 # valid_status_code Expected valid status code from GET request. Default is HTTP_ACCEPTED.
505
506 ${data}= Set Variable
507 ... {"IPv4StaticAddresses": [{"Address": "${ip}","SubnetMask": "${netmask}","Gateway": "${gateway}"}]}
508
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -0500509 ${active_channel_config}= Get Active Channel Config
510 ${resp}= Redfish.Patch
511 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
512 ... body=${data} valid_status_codes=[${valid_status_code}]
Prashanth Katti1ce68212020-11-13 00:39:03 -0600513
514 # Wait few seconds for new configuration to get populated on runtime.
515 Sleep ${wait_time}
Vijay06a169d2020-04-23 09:28:24 -0500516
Vijay06a169d2020-04-23 09:28:24 -0500517 Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED}
shrsuman12375e77062020-09-18 01:08:45 -0500518 ${host_power_state} ${host_state}= Redfish Get Host State
519 Run Keyword If '${host_power_state}' == 'On' and '${host_state}' == 'Enabled'
520 ... Verify VMI Network Interface Details ${ip} Static ${gateway} ${netmask}
Vijay06a169d2020-04-23 09:28:24 -0500521
522
523Delete VMI IPv4 Address
524 [Documentation] Delete VMI IPv4 address.
525 [Arguments] ${delete_param}=IPv4StaticAddresses ${valid_status_code}=${HTTP_ACCEPTED}
526
527 # Description of argument(s):
528 # delete_param Parameter to be deleted eg. IPv4StaticAddresses or IPv4Addresses.
529 # Default is IPv4StaticAddresses.
530 # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK.
531
532 ${data}= Set Variable {"${delete_param}": [${Null}]}
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -0500533 ${active_channel_config}= Get Active Channel Config
534 ${resp}= Redfish.Patch
535 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
536 ... body=${data} valid_status_codes=[${valid_status_code}]
Vijay06a169d2020-04-23 09:28:24 -0500537
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600538 Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED}
539 ${resp}= Redfish.Get
540 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
541 Should Be Empty ${resp.dict["IPv4StaticAddresses"]}
542
Vijay06a169d2020-04-23 09:28:24 -0500543
544Set VMI IPv4 Origin
545 [Documentation] Set VMI IPv4 origin.
546 [Arguments] ${dhcp_enabled}=${False} ${valid_status_code}=${HTTP_ACCEPTED}
547
548 # Description of argument(s):
549 # dhcp_enabled True if user wants to enable DHCP. Default is Static, hence value is set to False.
550 # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK.
551
552 ${data}= Set Variable If ${dhcp_enabled} == ${False} ${DISABLE_DHCP} ${ENABLE_DHCP}
Anves Kumar rayankulaaa33b052020-07-22 04:24:51 -0500553 ${resp}= Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/eth0 body=${data}
Vijay06a169d2020-04-23 09:28:24 -0500554 ... valid_status_codes=[${valid_status_code}]
shrsuman123b361d412020-09-30 06:17:23 -0500555 Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED}
556 ${resp}= Redfish.Get
557 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
558 Should Be Equal ${resp.dict["DHCPv4"]["DHCPEnabled"]} ${dhcp_enabled}
Vijay06a169d2020-04-23 09:28:24 -0500559
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600560 Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED}
561 ${resp}= Redfish.Get
562 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
563 Should Be Equal ${resp.dict["DHCPv4"]["DHCPEnabled"]} ${dhcp_enabled}
564
Vijay06a169d2020-04-23 09:28:24 -0500565
566Switch VMI IPv4 Origin And Verify Details
567 [Documentation] Switch VMI IPv4 origin and verify details.
Vijay06a169d2020-04-23 09:28:24 -0500568
569 ${curr_mode}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
570 ${dhcp_enabled}= Set Variable If ${curr_mode} == ${False} ${True} ${False}
571
572 ${default}= Set Variable 0.0.0.0
573 ${origin}= Set Variable If ${curr_mode} == ${False} DHCP Static
574 Set VMI IPv4 Origin ${dhcp_enabled} ${HTTP_ACCEPTED}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500575 Verify VMI Network Interface Details ${default} ${origin} ${default} ${default}
Vijay06a169d2020-04-23 09:28:24 -0500576
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500577
578Delete VMI Static IP Address Using Different Users
579 [Documentation] Update user role and delete vmi static IP address.
580 [Arguments] ${username} ${password} ${valid_status_code}
581 [Teardown] Run Keywords Redfish.Login AND
shrsuman123f559cbe2021-01-06 05:40:45 -0600582 ... Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500583 ... ${test_netmask} ${HTTP_ACCEPTED} AND Redfish.Logout
584
585 # Description of argument(s):
586 # username The host username.
587 # password The host password.
588 # valid_status_code The expected valid status code.
589
590 Redfish.Login ${username} ${password}
591 Delete VMI IPv4 Address delete_param=IPv4StaticAddresses valid_status_code=${valid_status_code}
592 Redfish.Logout
593
594
595Config VMI Static IP Address Using Different Users
596 [Documentation] Update user role and update vmi static ip address.
597 [Arguments] ${username} ${password} ${ip} ${gateway} ${netmask}
598 ... ${valid_status_code}
599
600 # Description of argument(s):
601 # username The host username.
602 # password The host password.
603 # ip IP address to be added (e.g. "10.7.7.7").
604 # subnet_mask Subnet mask for the IP to be added
605 # (e.g. "255.255.0.0").
606 # gateway Gateway for the IP to be added (e.g. "10.7.7.1").
607 # valid_status_code The expected valid status code.
608
609 Redfish.Login ${username} ${password}
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600610 Set Static IPv4 Address To VMI And Verify ${ip} ${gateway} ${netmask} ${valid_status_code}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500611 Redfish.Logout
612
613
614Read VMI Static IP Address Using Different Users
615 [Documentation] Update user role and read vmi static ip address.
616 [Arguments] ${username} ${password} ${valid_status_code}
617
618 # Description of argument(s):
619 # username The host username.
620 # password The host password.
621 # valid_status_code The expected valid status code.
622
623 Redfish.Login ${username} ${password}
624 Redfish.Get
625 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
626 ... valid_status_codes=[${valid_status_code}]
627 Redfish.Logout
628
629
630Delete BMC Users Using Redfish
631 [Documentation] Delete BMC users via redfish.
632
633 Redfish.Login
634 Delete BMC Users Via Redfish users=${USERS}
shrsuman123b361d412020-09-30 06:17:23 -0500635
636Update User Role And Set VMI IPv4 Origin
637 [Documentation] Update User Role And Set VMI IPv4 Origin.
638 [Arguments] ${username} ${password} ${dhcp_enabled} ${valid_status_code}
639
640 # Description of argument(s):
641 # username The host username.
642 # password The host password.
643 # dhcp_enabled Indicates whether dhcp should be enabled
644 # (${True}, ${False}).
645 # valid_status_code The expected valid status code.
646
647 Redfish.Login ${username} ${password}
648 Set VMI IPv4 Origin ${dhcp_enabled} ${valid_status_code}
649 Redfish.Logout