blob: 934f40b5d2af62509d87d4d572b2d53d8474bbf1 [file] [log] [blame]
Vijay06a169d2020-04-23 09:28:24 -05001*** Settings ***
2
Megha GN80ef5ca2022-06-09 00:29:57 -05003Documentation VMI static/dynamic IP config tests.
Vijay06a169d2020-04-23 09:28:24 -05004
Megha GN80ef5ca2022-06-09 00:29:57 -05005Resource ../../lib/external_intf/vmi_utils.robot
Vijay06a169d2020-04-23 09:28:24 -05006
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -05007Suite Setup Suite Setup Execution
Vijay06a169d2020-04-23 09:28:24 -05008Test Teardown FFDC On Test Case Fail
George Keishing4e0978d2022-07-27 10:21:18 -05009Suite Teardown Run Keyword And Ignore Error Suite Teardown Execution
Vijay06a169d2020-04-23 09:28:24 -050010
George Keishing725e0662022-07-20 22:18:14 -050011Force Tags vmi_interface_test
12
Vijay06a169d2020-04-23 09:28:24 -050013*** Variables ***
14
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -050015# users User Name password
16@{ADMIN} admin_user TestPwd123
17@{OPERATOR} operator_user TestPwd123
18@{ReadOnly} readonly_user TestPwd123
Megha GN80ef5ca2022-06-09 00:29:57 -050019&{USERS} Administrator=${ADMIN} ReadOnly=${ReadOnly}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -050020
Prashanth Katti1ce68212020-11-13 00:39:03 -060021${test_ipv4} 10.6.6.6
22${test_gateway} 10.6.6.1
shrsuman123c1d3fe32020-09-08 05:04:07 -050023${test_netmask} 255.255.252.0
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -050024
Vijay06a169d2020-04-23 09:28:24 -050025&{DHCP_ENABLED} DHCPEnabled=${${True}}
26&{DHCP_DISABLED} DHCPEnabled=${${False}}
27
28&{ENABLE_DHCP} DHCPv4=&{DHCP_ENABLED}
29&{DISABLE_DHCP} DHCPv4=&{DHCP_DISABLED}
Prashanth Katti1ce68212020-11-13 00:39:03 -060030${wait_time} 10s
Vijay06a169d2020-04-23 09:28:24 -050031
Megha G N02cbfa12022-12-12 02:05:03 -060032${default} 0.0.0.0
33
Vijay06a169d2020-04-23 09:28:24 -050034
35*** Test Cases ***
36
37Verify All VMI EthernetInterfaces
38 [Documentation] Verify all VMI ethernet interfaces.
shrsuman1235c7e4d72021-04-16 05:42:57 -050039 [Tags] Verify_All_VMI_EthernetInterfaces
Vijay06a169d2020-04-23 09:28:24 -050040
41 Verify VMI EthernetInterfaces
42
43
44Verify Existing VMI Network Interface Details
45 [Documentation] Verify existing VMI network interface details.
shrsuman1235c7e4d72021-04-16 05:42:57 -050046 [Tags] Verify_Existing_VMI_Network_Interface_Details
Vijay06a169d2020-04-23 09:28:24 -050047
48 ${vmi_ip}= Get VMI Network Interface Details
49 ${origin}= Set Variable If ${vmi_ip["DHCPv4"]} == ${False} Static DHCP
Vijay06a169d2020-04-23 09:28:24 -050050 Should Not Be Equal ${vmi_ip["DHCPv4"]} ${vmi_ip["IPv4StaticAddresses"]}
shrsuman123bfb851b2021-07-02 04:59:16 -050051 Should Be Equal As Strings ${vmi_ip["Id"]} ${ethernet_interface}
George Keishingb3ea0952020-07-01 05:03:56 -050052 Should Be Equal As Strings ${vmi_ip["Description"]}
shrsuman1235c7e4d72021-04-16 05:42:57 -050053 ... Hypervisor's Virtual Management Ethernet Interface
54 Should Be Equal As Strings ${vmi_ip["Name"]} Hypervisor Ethernet Interface
Megha G N49274632023-01-27 03:22:20 -060055 Run Keyword If '${vmi_ip["IPv4_Address"]}' != '${default}'
56 ... Should Be True ${vmi_ip["InterfaceEnabled"]}
shrsuman1235c7e4d72021-04-16 05:42:57 -050057 Run Keyword If ${vmi_ip["IPv4StaticAddresses"]} != @{empty}
58 ... Verify VMI Network Interface Details ${vmi_ip["IPv4_Address"]}
59 ... ${origin} ${vmi_ip["IPv4_Gateway"]} ${vmi_ip["IPv4_SubnetMask"]}
Vijay06a169d2020-04-23 09:28:24 -050060
61
62Delete Existing Static VMI IP Address
63 [Documentation] Delete existing static VMI IP address.
64 [Tags] Delete_Existing_Static_VMI_IP_Address
65
66 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
67 Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED}
68
shrsuman1235c7e4d72021-04-16 05:42:57 -050069 Delete VMI IPv4 Address
Vijay06a169d2020-04-23 09:28:24 -050070
71
72Verify User Cannot Delete ReadOnly Property IPv4Addresses
73 [Documentation] Verify user cannot delete readonly property IPv4Addresses.
74 [Tags] Verify_User_Cannot_Delete_ReadOnly_Property_IPv4Addresses
75
76 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
shrsuman1235c7e4d72021-04-16 05:42:57 -050077 Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED}
78 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
shrsuman123b25343d2021-09-22 04:33:47 -050079 Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_FORBIDDEN}
Vijay06a169d2020-04-23 09:28:24 -050080
81
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -050082Assign Valid And Invalid Static IPv4 Address To VMI
Vijay06a169d2020-04-23 09:28:24 -050083 [Documentation] Assign static IPv4 address to VMI.
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -050084 [Tags] Assign_Valid_And_Invalid_Static_IPv4_Address_To_VMI
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -060085 [Template] Set Static IPv4 Address To VMI And Verify
86 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
Vijay06a169d2020-04-23 09:28:24 -050087
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -050088 # ip gateway netmask valid_status_code
Shradha Sumanc7df7db2021-03-08 05:16:44 -060089 10.5.20.30 10.5.20.1 255.255.252.0 ${HTTP_ACCEPTED}
90 a.3.118.94 10.5.20.1 255.255.252.0 ${HTTP_BAD_REQUEST}
Anves Kumar rayankula81fd9db2021-05-10 02:39:51 -050091 10.5.20 10.5.20.1 255.255.252.0 ${HTTP_BAD_REQUEST}
92 10.5.20.-5 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
shrsuman123bfb851b2021-07-02 04:59:16 -0500105 Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
shrsuman123993a5c92021-04-19 06:40:16 -0500106 ... body={'IPv4StaticAddresses':${ips}} valid_status_codes=[${HTTP_BAD_REQUEST}]
shrsuman123e37b0cc2020-09-02 00:33:42 -0500107
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500108
shrsuman123e37b0cc2020-09-02 00:33:42 -0500109Modify IP Addresses On VMI Interface And Verify
110 [Documentation] Modify IP addresses on VMI interface and verify.
111 [Tags] Modify_IP_Addresses_On_VMI_Interface_And_Verify
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600112 [Template] Set Static IPv4 Address To VMI And Verify
113 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
shrsuman123e37b0cc2020-09-02 00:33:42 -0500114
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500115 # ip gateway netmask valid_status_code
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600116 10.5.5.10 10.5.5.1 255.255.252.0 ${HTTP_ACCEPTED}
117 10.5.5.11 10.5.5.1 255.255.252.0 ${HTTP_ACCEPTED}
Vijay06a169d2020-04-23 09:28:24 -0500118
Megha GN80ef5ca2022-06-09 00:29:57 -0500119
Vijay06a169d2020-04-23 09:28:24 -0500120Switch 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}
Anves Kumar rayankula7936eee2021-04-19 05:38:36 -0500134 Redfish Power Off stack_mode=skip
135 Redfish Power On
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500136 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
Vijay06a169d2020-04-23 09:28:24 -0500137
138 # Verifying persistency of static address.
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600139 Switch VMI IPv4 Origin And Verify Details
Anves Kumar rayankula7936eee2021-04-19 05:38:36 -0500140 Redfish Power Off stack_mode=skip
141 Redfish Power On
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600142 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Vijay06a169d2020-04-23 09:28:24 -0500143
144
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500145Delete VMI Static IP Address And Verify
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500146 [Documentation] Delete VMI static IP address and verify.
147 [Tags] Delete_VMI_Static_IP_Address_And_Verify
148 [Teardown] Test Teardown Execution
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500149
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600150 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
151 Delete VMI IPv4 Address
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500152
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
shrsuman123b25343d2021-09-22 04:33:47 -0500157 [Teardown] Run keywords Delete VMI IPv4 Address 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
shrsuman1235c7e4d72021-04-16 05:42:57 -0500165 Redfish.Login
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500166 Redfish Power Off
167 Redfish Power On
shrsuman123c1d3fe32020-09-08 05:04:07 -0500168
169 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
170
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500171
shrsuman123c1d3fe32020-09-08 05:04:07 -0500172Verify Persistency Of VMI DHCP IP Configuration After Multiple HOST Reboots
173 [Documentation] Verify Persistency Of VMI DHCP IP configuration After Multiple HOST Reboots
174 [Tags] Verify_Persistency_Of_VMI_DHCP_IP_Configuration_After_Multiple_HOST_Reboots
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500175 [Teardown] Test Teardown Execution
shrsuman123c1d3fe32020-09-08 05:04:07 -0500176
shrsuman123c1d3fe32020-09-08 05:04:07 -0500177 Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
shrsuman123c1d3fe32020-09-08 05:04:07 -0500178 ${vmi_ip_config}= Get VMI Network Interface Details
179 # Verifying persistency of dynamic address after multiple reboots.
shrsuman123f559cbe2021-01-06 05:40:45 -0600180 FOR ${i} IN RANGE ${2}
181 Redfish Power Off
182 Redfish Power On
George Keishing538f1742022-03-14 05:00:55 -0500183 Verify VMI Network Interface Details ${vmi_ip_config["IPv4_Address"]}
184 ... DHCP ${vmi_ip_config["IPv4_Gateway"]} ${vmi_ip_config["IPv4_SubnetMask"]}
shrsuman123f559cbe2021-01-06 05:40:45 -0600185 END
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500186
187
188Enable DHCP When Static IP Configured And Verify Static IP
189 [Documentation] Enable DHCP when static ip configured and verify static ip
George Keishing4203fad2022-01-31 12:22:33 -0600190 [Tags] Enable_DHCP_When_Static_IP_Configured_And_Verify_Static_IP
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600191 [Setup] Redfish Power On
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500192 [Teardown] Test Teardown Execution
193
shrsuman123f559cbe2021-01-06 05:40:45 -0600194 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500195 Set VMI IPv4 Origin ${True}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500196 ${vmi_network_conf}= Get VMI Network Interface Details
197 Should Not Be Equal As Strings ${test_ipv4} ${vmi_network_conf["IPv4_Address"]}
198
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500199
shrsuman123e37b0cc2020-09-02 00:33:42 -0500200Verify VMI Static IP Configuration Persist On BMC Reset Before Host Boot
201 [Documentation] Verify VMI static IP configuration persist on BMC reset.
202 [Tags] Verify_VMI_Static_IP_Configuration_Persist_On_BMC_Reset_Before_Host_Boot
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600203 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail
shrsuman123e37b0cc2020-09-02 00:33:42 -0500204
shrsuman12375e77062020-09-18 01:08:45 -0500205 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Megha GNbe428592022-07-21 10:33:02 -0500206 Redfish OBMC Reboot (off) stack_mode=skip
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500207 Redfish Power On
shrsuman123e37b0cc2020-09-02 00:33:42 -0500208 # Verifying the VMI static configuration
209 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
210
Megha GN80ef5ca2022-06-09 00:29:57 -0500211
shrsuman12375e77062020-09-18 01:08:45 -0500212Add Static IP When Host Poweroff And Verify On Poweron
213 [Documentation] Add Static IP When Host Poweroff And Verify on power on
214 [Tags] Add_Static_IP_When_Host_Poweroff_And_Verify_On_Poweron
215 [Setup] Redfish Power Off
216 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail
217
218 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
219 Redfish Power On
220 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
221
Megha GN80ef5ca2022-06-09 00:29:57 -0500222
shrsuman12375e77062020-09-18 01:08:45 -0500223Add VMI Static IP When Host Poweroff And Verify Static IP On BMC Reset
224 [Documentation] Add Static IP When Host Poweroff And Verify Static IP On BMC Reset.
225 [Tags] Add_VMI_Static_IP_When_Host_Poweroff_And_Verify_Static_IP_On_BMC_Reset
226 [Setup] Redfish Power Off
227 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail
228
229 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Megha GNbe428592022-07-21 10:33:02 -0500230 Redfish OBMC Reboot (off) stack_mode=skip
shrsuman12375e77062020-09-18 01:08:45 -0500231 Redfish Power On
232 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
233
Megha GN80ef5ca2022-06-09 00:29:57 -0500234
shrsuman12375e77062020-09-18 01:08:45 -0500235Enable DHCP When No Static IP Configured And Verify DHCP IP
236 [Documentation] Enable DHCP when no static ip configured and verify dhcp ip
237 [Tags] Enable_DHCP_When_No_Static_IP_Configured_And_Verify_DHCP_IP
238 [Setup] Run Keyword And Ignore Error Delete VMI IPv4 Address
239 [Teardown] Test Teardown Execution
240
241 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
242 Run Keyword If ${curr_origin} == ${False} Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
243 ${vmi_ip_config}= Get VMI Network Interface Details
George Keishing538f1742022-03-14 05:00:55 -0500244 Verify VMI Network Interface Details ${vmi_ip_config["IPv4_Address"]}
245 ... DHCP ${vmi_ip_config["IPv4_Gateway"]} ${vmi_ip_config["IPv4_SubnetMask"]}
shrsuman12375e77062020-09-18 01:08:45 -0500246
Megha GN80ef5ca2022-06-09 00:29:57 -0500247
shrsuman12375e77062020-09-18 01:08:45 -0500248Verify User Cannot Delete VMI DHCP IP Address
249 [Documentation] Verify user cannot delete VMI DHCP IP Address
250 [Tags] Verify_User_Cannot_Delete_VMI_DHCP_IP_Address
251 [Setup] Set VMI IPv4 Origin ${True}
252 [Teardown] Test Teardown Execution
253
shrsuman123b25343d2021-09-22 04:33:47 -0500254 Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_FORBIDDEN}
shrsuman12375e77062020-09-18 01:08:45 -0500255 ${resp}= Redfish.Get
shrsuman123bfb851b2021-07-02 04:59:16 -0500256 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
shrsuman12375e77062020-09-18 01:08:45 -0500257 Should Not Be Empty ${resp.dict["IPv4Addresses"]}
258
Megha GN80ef5ca2022-06-09 00:29:57 -0500259
shrsuman12375e77062020-09-18 01:08:45 -0500260Enable DHCP When Static IP Configured DHCP Server Unavailable And Verify IP
261 [Documentation] Enable DHCP When Static IP Configured And DHCP Server Unavailable And Verify No IP.
262 [Tags] Enable_DHCP_When_Static_IP_Configured_DHCP_Server_Unavailable_And_Verify_IP
263 [Teardown] Test Teardown Execution
264
265 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
266 Set VMI IPv4 Origin ${True}
shrsuman12375e77062020-09-18 01:08:45 -0500267 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
268
shrsuman123e37b0cc2020-09-02 00:33:42 -0500269
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500270Verify To Configure VMI Static IP Address With Different User Roles
271 [Documentation] Verify to configure vmi static ip address with different user roles.
272 [Tags] Verify_To_Configure_VMI_Static_IP_Address_With_Different_User_Roles
273 [Setup] Create Users With Different Roles users=${USERS} force=${True}
274 [Template] Config VMI Static IP Address Using Different Users
275 [Teardown] Delete BMC Users Using Redfish
276
277 # username password ip_address gateway nemask valid_status_code
278 admin_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_ACCEPTED}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500279 readonly_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500280
281
282Verify To Configure VMI Static IP Address With Operator User Role
283 [Documentation] Verify to configure vmi static ip address with operator user role.
284 [Tags] Verify_To_Configure_VMI_Static_IP_Address_With_Operator_User_Role
285 [Setup] Create Users With Different Roles users=${USERS} force=${True}
286 [Template] Config VMI Static IP Address Using Different Users
287 [Teardown] Delete BMC Users Using Redfish
288
289 # username password ip_address gateway nemask valid_status_code
290 operator_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500291
292
293Verify To Delete VMI Static IP Address With Different User Roles
294 [Documentation] Verify to delete vmi static IP address with different user roles.
295 [Tags] Verify_To_Delete_VMI_Static_IP_Address_With_Different_User_Roles
296 [Setup] Create Users With Different Roles users=${USERS} force=${True}
297 [Template] Delete VMI Static IP Address Using Different Users
298 [Teardown] Delete BMC Users Using Redfish
299
300 # username password valid_status_code
301 admin_user TestPwd123 ${HTTP_ACCEPTED}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500302 readonly_user TestPwd123 ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500303
304
305Verify To Delete VMI Static IP Address With Operator User Role
306 [Documentation] Verify to delete vmi static IP address with operator user role.
307 [Tags] Verify_To_Delete_VMI_Static_IP_Address_With_Operator_User_Role
308 [Setup] Create Users With Different Roles users=${USERS} force=${True}
309 [Template] Delete VMI Static IP Address Using Different Users
310 [Teardown] Delete BMC Users Using Redfish
311
312 # username password valid_status_code
313 operator_user TestPwd123 ${HTTP_FORBIDDEN}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500314
315
316Verify To Update VMI Static IP Address With Different User Roles
317 [Documentation] Verify to update vmi static IP address with different user roles.
George Keishing4203fad2022-01-31 12:22:33 -0600318 [Tags] Verify_To_Update_VMI_Static_IP_Address_With_Different_User_Roles
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500319 [Setup] Create Users With Different Roles users=${USERS} force=${True}
320 [Template] Config VMI Static IP Address Using Different Users
321 [Teardown] Delete BMC Users Using Redfish
322
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600323 # username password ip_address gateway netmask valid_status_code
324 admin_user TestPwd123 10.5.10.20 10.5.10.1 255.255.0.0 ${HTTP_ACCEPTED}
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600325 readonly_user TestPwd123 10.5.20.40 10.5.20.1 255.255.0.0 ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500326
327
328Verify To Update VMI Static IP Address With Operator User Role
329 [Documentation] Verify to update vmi static IP address with operator user role.
330 [Tags] Verify_To_Update_VMI_Static_IP_Address_With_Operator_User_Role
331 [Setup] Create Users With Different Roles users=${USERS} force=${True}
332 [Template] Config VMI Static IP Address Using Different Users
333 [Teardown] Delete BMC Users Using Redfish
334
335 # username password ip_address gateway netmask valid_status_code
336 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 -0500337
338
339Verify To Read VMI Network Configuration With Different User Roles
340 [Documentation] Verify to read vmi network configuration with different user roles.
George Keishing4203fad2022-01-31 12:22:33 -0600341 [Tags] Verify_To_Read_VMI_Network_Configuration_With_Different_User_Roles
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500342 [Setup] Create Users With Different Roles users=${USERS} force=${True}
343 [Template] Read VMI Static IP Address Using Different Users
344 [Teardown] Delete BMC Users Using Redfish
345
346 # username password valid_status_code
347 admin_user TestPwd123 ${HTTP_OK}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500348 readonly_user TestPwd123 ${HTTP_OK}
Megha GN80ef5ca2022-06-09 00:29:57 -0500349
350
351Verify To Read VMI Network Configuration With Operator User Role
352 [Documentation] Verify to read vmi network configuration with operator user role.
353 [Tags] Verify_To_Read_VMI_Network_Configuration_With_Operator_User_Role
354 [Setup] Create Users With Different Roles users=${USERS} force=${True}
355 [Template] Read VMI Static IP Address Using Different Users
356 [Teardown] Delete BMC Users Using Redfish
357
358 # username password valid_status_code
359 operator_user TestPwd123 ${HTTP_FORBIDDEN}
360
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500361
shrsuman123b361d412020-09-30 06:17:23 -0500362Enable DHCP On VMI Network Via Different Users Roles And Verify
363 [Documentation] Enable DHCP On VMI Network Via Different Users Roles And Verify.
364 [Tags] Enable_DHCP_On_VMI_Network_Via_Different_Users_Roles_And_Verify
365 [Setup] Create Users With Different Roles users=${USERS} force=${True}
366 [Template] Update User Role And Set VMI IPv4 Origin
367 [Teardown] Delete BMC Users Using Redfish
368
369 # username password dhcp_enabled valid_status_code
370 admin_user TestPwd123 ${True} ${HTTP_ACCEPTED}
shrsuman123b361d412020-09-30 06:17:23 -0500371 readonly_user TestPwd123 ${True} ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500372
373
374Enable DHCP On VMI Network Via Operator User Role And Verify
375 [Documentation] Enable DHCP On VMI Network Via Operator User Role And Verify.
376 [Tags] Enable_DHCP_On_VMI_Network_Via_Operator_User_Role_And_Verify
377 [Setup] Create Users With Different Roles users=${USERS} force=${True}
378 [Template] Update User Role And Set VMI IPv4 Origin
379 [Teardown] Delete BMC Users Using Redfish
380
381 # username password dhcp_enabled valid_status_code
382 operator_user TestPwd123 ${True} ${HTTP_FORBIDDEN}
383
shrsuman123b361d412020-09-30 06:17:23 -0500384
385Disable DHCP On VMI Network Via Different Users Roles And Verify
386 [Documentation] Disable DHCP On VMI Network Via Different Users Roles And Verify.
387 [Tags] Disable_DHCP_On_VMI_Network_Via_Different_Users_Roles_And_Verify
388 [Setup] Create Users With Different Roles users=${USERS} force=${True}
389 [Template] Update User Role And Set VMI IPv4 Origin
390 [Teardown] Delete BMC Users Using Redfish
391
392 # username password dhcp_enabled valid_status_code
393 admin_user TestPwd123 ${False} ${HTTP_ACCEPTED}
shrsuman123b361d412020-09-30 06:17:23 -0500394 readonly_user TestPwd123 ${False} ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500395
396
397Disable DHCP On VMI Network Via Operator User Role And Verify
398 [Documentation] Disable DHCP On VMI Network Via Operator User Role And Verify.
399 [Tags] Disable_DHCP_On_VMI_Network_Via_Operator_User_Role_And_Verify
400 [Setup] Create Users With Different Roles users=${USERS} force=${True}
401 [Template] Update User Role And Set VMI IPv4 Origin
402 [Teardown] Delete BMC Users Using Redfish
403
404 # username password dhcp_enabled valid_status_code
405 operator_user TestPwd123 ${False} ${HTTP_FORBIDDEN}
shrsuman123b361d412020-09-30 06:17:23 -0500406
shrsuman123e37b0cc2020-09-02 00:33:42 -0500407
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500408Enable And Disable DHCP And Verify
409 [Documentation] verify enable DHCP and disable DHCP.
George Keishing4203fad2022-01-31 12:22:33 -0600410 [Tags] Enable_And_Disable_DHCP_And_Verify
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500411
412 Set VMI IPv4 Origin ${True}
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500413 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
414 Set VMI IPv4 Origin ${False}
Megha GN80ef5ca2022-06-09 00:29:57 -0500415 Verify VMI Network Interface Details ${default} Static ${default} ${default}
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500416
417
418Multiple Times Enable And Disable DHCP And Verify
419 [Documentation] Enable and Disable DHCP in a loop and verify VMI gets an IP address from DHCP
420 ... each time when DHCP is enabled
421 [Tags] Multiple_Times_Enable_And_Disable_DHCP_And_Verify
422
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500423 FOR ${i} IN RANGE ${2}
424 Set VMI IPv4 Origin ${True}
425 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
426 Set VMI IPv4 Origin ${False}
Megha GN80ef5ca2022-06-09 00:29:57 -0500427 Verify VMI Network Interface Details ${default} Static ${default} ${default}
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500428 END
429
430
Anves Kumar rayankula81fd9db2021-05-10 02:39:51 -0500431Assign Static IPv4 Address With Invalid Netmask To VMI
432 [Documentation] Assign static IPv4 address with invalid netmask and expect error.
433 [Tags] Assign_Static_IPv4_Address_With_Invalid_Netmask_To_VMI
434 [Template] Set Static IPv4 Address To VMI And Verify
435
436 # ip gateway netmask valid_status_code
437 ${test_ipv4} ${test_gateway} 255.256.255.0 ${HTTP_BAD_REQUEST}
438 ${test_ipv4} ${test_gateway} ff.ff.ff.ff ${HTTP_BAD_REQUEST}
439 ${test_ipv4} ${test_gateway} 255.255.253.0 ${HTTP_BAD_REQUEST}
440
441
442Assign Static IPv4 Address With Invalid Gateway To VMI
443 [Documentation] Add static IPv4 address with invalid gateway and expect error.
444 [Tags] Assign_Static_IPv4_Address_With_Invalid_Gateway_To_VMI
445 [Template] Set Static IPv4 Address To VMI And Verify
446
447 # ip gateway netmask valid_status_code
448 ${test_ipv4} @@@.%%.44.11 ${test_netmask} ${HTTP_BAD_REQUEST}
449 ${test_ipv4} 0xa.0xb.0xc.0xd ${test_netmask} ${HTTP_BAD_REQUEST}
450 ${test_ipv4} 10.3.36 ${test_netmask} ${HTTP_BAD_REQUEST}
451 ${test_ipv4} 10.3.36.-10 ${test_netmask} ${HTTP_BAD_REQUEST}
452
453
Megha G N02cbfa12022-12-12 02:05:03 -0600454Enable DHCP When Host Is Off And Verify After Poweron
455 [Documentation] Enable DHCP when host is off and
456 ... check whether it is enabled after poweron.
457 [Tags] Enable_DHCP_When_Host_Is_Off_And_Verify_After_Poweron
458 [Setup] Redfish Power Off stack_mode=skip
459
460 Set VMI IPv4 Origin ${True}
461 Redfish Power On stack_mode=skip
462 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
463
464
Vijay06a169d2020-04-23 09:28:24 -0500465*** Keywords ***
466
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500467Suite Setup Execution
468 [Documentation] Do test setup execution task.
469
470 Redfish.Login
471 Redfish Power On
472 ${active_channel_config}= Get Active Channel Config
473 Set Suite Variable ${active_channel_config}
shrsuman123bfb851b2021-07-02 04:59:16 -0500474 Set Suite Variable ${ethernet_interface} ${active_channel_config['${CHANNEL_NUMBER}']['name']}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500475 ${resp}= Redfish.Get
shrsuman123bfb851b2021-07-02 04:59:16 -0500476 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
shrsuman12362e5be52021-05-20 02:42:59 -0500477 ${ip_resp}= Evaluate json.loads(r'''${resp.text}''') json
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500478 ${length}= Get Length ${ip_resp["IPv4StaticAddresses"]}
479 ${vmi_network_conf}= Run Keyword If ${length} != ${0} Get VMI Network Interface Details
480 Set Suite Variable ${vmi_network_conf}
481
482
483Test Teardown Execution
484 [Documentation] Do test teardown execution task.
485
486 FFDC On Test Case Fail
487 ${curr_mode}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
488 Run Keyword If ${curr_mode} == ${True} Set VMI IPv4 Origin ${False}
489 Run Keyword If ${vmi_network_conf} != ${None}
shrsuman123f559cbe2021-01-06 05:40:45 -0600490 ... Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500491 ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]}
492
493
Vijay06a169d2020-04-23 09:28:24 -0500494Get Immediate Child Parameter From VMI Network Interface
495 [Documentation] Get immediate child parameter from VMI network interface.
496 [Arguments] ${parameter} ${valid_status_code}=${HTTP_OK}
497
498 # Description of argument(s):
499 # parameter parameter for which value is required. Ex: DHCPEnabled, MACAddress etc.
500 # valid_status_code Expected valid status code from GET request.
501
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -0500502 ${resp}= Redfish.Get
shrsuman123bfb851b2021-07-02 04:59:16 -0500503 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
Vijay06a169d2020-04-23 09:28:24 -0500504 ... valid_status_codes=[${valid_status_code}]
505
shrsuman12362e5be52021-05-20 02:42:59 -0500506 ${ip_resp}= Evaluate json.loads(r'''${resp.text}''') json
Vijay06a169d2020-04-23 09:28:24 -0500507 ${value}= Set Variable If '${parameter}' != 'DHCPEnabled' ${ip_resp["${parameter}"]}
508 ... ${ip_resp["DHCPv4"]["${parameter}"]}
509
510 [Return] ${value}
511
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600512
Vijay06a169d2020-04-23 09:28:24 -0500513Switch VMI IPv4 Origin And Verify Details
514 [Documentation] Switch VMI IPv4 origin and verify details.
Vijay06a169d2020-04-23 09:28:24 -0500515
Anves Kumar rayankula7936eee2021-04-19 05:38:36 -0500516 ${dhcp_mode_before}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
Anves Kumar rayankulae7dc89a2021-04-28 04:29:38 -0500517 ${dhcp_enabled}= Set Variable If ${dhcp_mode_before} == ${False} ${True} ${False}
Vijay06a169d2020-04-23 09:28:24 -0500518
Anves Kumar rayankulae7dc89a2021-04-28 04:29:38 -0500519 ${origin}= Set Variable If ${dhcp_mode_before} == ${False} DHCP Static
Vijay06a169d2020-04-23 09:28:24 -0500520 Set VMI IPv4 Origin ${dhcp_enabled} ${HTTP_ACCEPTED}
Anves Kumar rayankula7936eee2021-04-19 05:38:36 -0500521
522 ${dhcp_mode_after}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
523 Should Not Be Equal ${dhcp_mode_before} ${dhcp_mode_after}
524
525 Run Keyword If ${dhcp_mode_after} == ${True}
526 ... Verify VMI Network Interface Details ${default} ${origin} ${default} ${default}
Vijay06a169d2020-04-23 09:28:24 -0500527
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500528
529Delete VMI Static IP Address Using Different Users
530 [Documentation] Update user role and delete vmi static IP address.
531 [Arguments] ${username} ${password} ${valid_status_code}
532 [Teardown] Run Keywords Redfish.Login AND
shrsuman123f559cbe2021-01-06 05:40:45 -0600533 ... Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500534 ... ${test_netmask} ${HTTP_ACCEPTED} AND Redfish.Logout
535
536 # Description of argument(s):
537 # username The host username.
538 # password The host password.
539 # valid_status_code The expected valid status code.
540
Megha GN80ef5ca2022-06-09 00:29:57 -0500541 # TODO: operator_user role is not yet supported.
542 Skip If '${username}' == 'operator_user'
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500543 Redfish.Login ${username} ${password}
544 Delete VMI IPv4 Address delete_param=IPv4StaticAddresses valid_status_code=${valid_status_code}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500545
546
547Config VMI Static IP Address Using Different Users
548 [Documentation] Update user role and update vmi static ip address.
549 [Arguments] ${username} ${password} ${ip} ${gateway} ${netmask}
550 ... ${valid_status_code}
551
552 # Description of argument(s):
553 # username The host username.
554 # password The host password.
555 # ip IP address to be added (e.g. "10.7.7.7").
556 # subnet_mask Subnet mask for the IP to be added
557 # (e.g. "255.255.0.0").
558 # gateway Gateway for the IP to be added (e.g. "10.7.7.1").
559 # valid_status_code The expected valid status code.
560
Megha GN80ef5ca2022-06-09 00:29:57 -0500561 # TODO: operator_user role is not yet supported.
562 Skip If '${username}' == 'operator_user'
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500563 Redfish.Login ${username} ${password}
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600564 Set Static IPv4 Address To VMI And Verify ${ip} ${gateway} ${netmask} ${valid_status_code}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500565
566
567Read VMI Static IP Address Using Different Users
568 [Documentation] Update user role and read vmi static ip address.
569 [Arguments] ${username} ${password} ${valid_status_code}
570
571 # Description of argument(s):
572 # username The host username.
573 # password The host password.
574 # valid_status_code The expected valid status code.
575
Megha GN80ef5ca2022-06-09 00:29:57 -0500576 # TODO: operator_user role is not yet supported.
577 Skip If '${username}' == 'operator_user'
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500578 Redfish.Login ${username} ${password}
579 Redfish.Get
shrsuman123bfb851b2021-07-02 04:59:16 -0500580 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500581 ... valid_status_codes=[${valid_status_code}]
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500582
583
584Delete BMC Users Using Redfish
585 [Documentation] Delete BMC users via redfish.
586
587 Redfish.Login
588 Delete BMC Users Via Redfish users=${USERS}
shrsuman123b361d412020-09-30 06:17:23 -0500589
Sweta Potthurid52b2732021-08-12 12:48:24 -0500590
shrsuman123b361d412020-09-30 06:17:23 -0500591Update User Role And Set VMI IPv4 Origin
592 [Documentation] Update User Role And Set VMI IPv4 Origin.
593 [Arguments] ${username} ${password} ${dhcp_enabled} ${valid_status_code}
594
595 # Description of argument(s):
596 # username The host username.
597 # password The host password.
598 # dhcp_enabled Indicates whether dhcp should be enabled
599 # (${True}, ${False}).
600 # valid_status_code The expected valid status code.
601
Megha GNbe428592022-07-21 10:33:02 -0500602 # TODO: operator_user role is not yet supported.
603 Skip If '${username}' == 'operator_user'
shrsuman123b361d412020-09-30 06:17:23 -0500604 Redfish.Login ${username} ${password}
605 Set VMI IPv4 Origin ${dhcp_enabled} ${valid_status_code}
shrsuman123bfb851b2021-07-02 04:59:16 -0500606
Sweta Potthurid52b2732021-08-12 12:48:24 -0500607
shrsuman123bfb851b2021-07-02 04:59:16 -0500608Suite Teardown Execution
609 [Documentation] Do suite teardown execution task.
610
611 Run Keyword If ${vmi_network_conf} != ${None}
612 ... Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]}
613 ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]}
shrsuman123b25343d2021-09-22 04:33:47 -0500614 Delete All Redfish Sessions
shrsuman123bfb851b2021-07-02 04:59:16 -0500615 Redfish.Logout