blob: aa57b89254763ce648244206e5a0e6713022301a [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
Megha G Nf9867142025-02-03 23:10:57 -060011Test Tags Vmi
George Keishing725e0662022-07-20 22:18:14 -050012
Vijay06a169d2020-04-23 09:28:24 -050013*** Variables ***
14
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -050015# users User Name password
16@{ADMIN} admin_user TestPwd123
17@{OPERATOR} operator_user TestPwd123
18@{ReadOnly} readonly_user TestPwd123
Megha GN80ef5ca2022-06-09 00:29:57 -050019&{USERS} Administrator=${ADMIN} ReadOnly=${ReadOnly}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -050020
Prashanth Katti1ce68212020-11-13 00:39:03 -060021${test_ipv4} 10.6.6.6
22${test_gateway} 10.6.6.1
shrsuman123c1d3fe32020-09-08 05:04:07 -050023${test_netmask} 255.255.252.0
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -050024
Vijay06a169d2020-04-23 09:28:24 -050025&{DHCP_ENABLED} DHCPEnabled=${${True}}
26&{DHCP_DISABLED} DHCPEnabled=${${False}}
27
28&{ENABLE_DHCP} DHCPv4=&{DHCP_ENABLED}
29&{DISABLE_DHCP} DHCPv4=&{DHCP_DISABLED}
30
Megha G N38acd842024-10-14 14:28:11 -050031&{SLAAC_ENABLED} IPv6AutoConfigEnabled=${True}
32&{SLAAC_DISABLED} IPv6AutoConfigEnabled=${False}
33
34&{ENABLE_SLAAC} StatelessAddressAutoConfig=&{SLAAC_ENABLED}
35&{DISABLE_SLAAC} StatelessAddressAutoConfig=&{SLAAC_DISABLED}
36
Megha G Ndf255642025-01-10 02:12:21 -060037&{DHCPv6_ENABLED} OperatingMode=Enabled
38&{DHCPv6_DISABLED} OperatingMode=Disabled
39
40&{ENABLE_DHCPv6} DHCPv6=&{DHCPv6_ENABLED}
41&{DISABLE_DHCPv6} DHCPv6=&{DHCPv6_DISABLED}
42
Megha G N02cbfa12022-12-12 02:05:03 -060043${default} 0.0.0.0
Megha G Na37b8da2025-01-06 00:23:15 -060044${default_ipv6addr} ::
Sridevi Ramesh70f087b2025-01-26 00:27:05 -060045${prefix_length} ${64}
Megha G N02cbfa12022-12-12 02:05:03 -060046
Vijay06a169d2020-04-23 09:28:24 -050047
48*** Test Cases ***
49
50Verify All VMI EthernetInterfaces
51 [Documentation] Verify all VMI ethernet interfaces.
shrsuman1235c7e4d72021-04-16 05:42:57 -050052 [Tags] Verify_All_VMI_EthernetInterfaces
Vijay06a169d2020-04-23 09:28:24 -050053
54 Verify VMI EthernetInterfaces
55
56
57Verify Existing VMI Network Interface Details
58 [Documentation] Verify existing VMI network interface details.
shrsuman1235c7e4d72021-04-16 05:42:57 -050059 [Tags] Verify_Existing_VMI_Network_Interface_Details
Vijay06a169d2020-04-23 09:28:24 -050060
61 ${vmi_ip}= Get VMI Network Interface Details
62 ${origin}= Set Variable If ${vmi_ip["DHCPv4"]} == ${False} Static DHCP
Vijay06a169d2020-04-23 09:28:24 -050063 Should Not Be Equal ${vmi_ip["DHCPv4"]} ${vmi_ip["IPv4StaticAddresses"]}
shrsuman123bfb851b2021-07-02 04:59:16 -050064 Should Be Equal As Strings ${vmi_ip["Id"]} ${ethernet_interface}
George Keishingb3ea0952020-07-01 05:03:56 -050065 Should Be Equal As Strings ${vmi_ip["Description"]}
shrsuman1235c7e4d72021-04-16 05:42:57 -050066 ... Hypervisor's Virtual Management Ethernet Interface
67 Should Be Equal As Strings ${vmi_ip["Name"]} Hypervisor Ethernet Interface
shrsuman1235c7e4d72021-04-16 05:42:57 -050068 Run Keyword If ${vmi_ip["IPv4StaticAddresses"]} != @{empty}
69 ... Verify VMI Network Interface Details ${vmi_ip["IPv4_Address"]}
70 ... ${origin} ${vmi_ip["IPv4_Gateway"]} ${vmi_ip["IPv4_SubnetMask"]}
Vijay06a169d2020-04-23 09:28:24 -050071
72
73Delete Existing Static VMI IP Address
74 [Documentation] Delete existing static VMI IP address.
75 [Tags] Delete_Existing_Static_VMI_IP_Address
76
77 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
78 Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED}
79
shrsuman1235c7e4d72021-04-16 05:42:57 -050080 Delete VMI IPv4 Address
Vijay06a169d2020-04-23 09:28:24 -050081
82
83Verify User Cannot Delete ReadOnly Property IPv4Addresses
84 [Documentation] Verify user cannot delete readonly property IPv4Addresses.
85 [Tags] Verify_User_Cannot_Delete_ReadOnly_Property_IPv4Addresses
86
87 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
shrsuman1235c7e4d72021-04-16 05:42:57 -050088 Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED}
89 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
shrsuman123b25343d2021-09-22 04:33:47 -050090 Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_FORBIDDEN}
Vijay06a169d2020-04-23 09:28:24 -050091
92
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -050093Assign Valid And Invalid Static IPv4 Address To VMI
Vijay06a169d2020-04-23 09:28:24 -050094 [Documentation] Assign static IPv4 address to VMI.
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -050095 [Tags] Assign_Valid_And_Invalid_Static_IPv4_Address_To_VMI
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -060096 [Template] Set Static IPv4 Address To VMI And Verify
97 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
Vijay06a169d2020-04-23 09:28:24 -050098
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -050099 # ip gateway netmask valid_status_code
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600100 10.5.20.30 10.5.20.1 255.255.252.0 ${HTTP_ACCEPTED}
101 a.3.118.94 10.5.20.1 255.255.252.0 ${HTTP_BAD_REQUEST}
Anves Kumar rayankula81fd9db2021-05-10 02:39:51 -0500102 10.5.20 10.5.20.1 255.255.252.0 ${HTTP_BAD_REQUEST}
103 10.5.20.-5 10.5.20.1 255.255.252.0 ${HTTP_BAD_REQUEST}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500104
Vijay06a169d2020-04-23 09:28:24 -0500105
George Keishing16b3c7b2021-01-28 09:23:37 -0600106Add Multiple IP Addresses On VMI Interface And Verify
107 [Documentation] Add multiple IP addresses on VMI interface and verify.
108 [Tags] Add_Multiple_IP_Addresses_On_VMI_Interface_And_Verify
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600109 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
shrsuman123e37b0cc2020-09-02 00:33:42 -0500110
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600111 ${ip1}= Create dictionary Address=10.5.5.10 SubnetMask=255.255.252.0 Gateway=10.5.5.1
112 ${ip2}= Create dictionary Address=10.5.5.11 SubnetMask=255.255.252.0 Gateway=10.5.5.1
113 ${ip3}= Create dictionary Address=10.5.5.12 SubnetMask=255.255.252.0 Gateway=10.5.5.1
shrsuman123e37b0cc2020-09-02 00:33:42 -0500114 ${ips}= Create List ${ip1} ${ip2} ${ip3}
115
shrsuman123bfb851b2021-07-02 04:59:16 -0500116 Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
shrsuman123993a5c92021-04-19 06:40:16 -0500117 ... body={'IPv4StaticAddresses':${ips}} valid_status_codes=[${HTTP_BAD_REQUEST}]
shrsuman123e37b0cc2020-09-02 00:33:42 -0500118
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500119
shrsuman123e37b0cc2020-09-02 00:33:42 -0500120Modify IP Addresses On VMI Interface And Verify
121 [Documentation] Modify IP addresses on VMI interface and verify.
122 [Tags] Modify_IP_Addresses_On_VMI_Interface_And_Verify
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600123 [Template] Set Static IPv4 Address To VMI And Verify
124 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
shrsuman123e37b0cc2020-09-02 00:33:42 -0500125
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500126 # ip gateway netmask valid_status_code
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600127 10.5.5.10 10.5.5.1 255.255.252.0 ${HTTP_ACCEPTED}
128 10.5.5.11 10.5.5.1 255.255.252.0 ${HTTP_ACCEPTED}
Vijay06a169d2020-04-23 09:28:24 -0500129
Megha GN80ef5ca2022-06-09 00:29:57 -0500130
Vijay06a169d2020-04-23 09:28:24 -0500131Switch Between IP Origins On VMI And Verify Details
132 [Documentation] Switch between IP origins on VMI and verify details.
133 [Tags] Switch_Between_IP_Origins_On_VMI_And_Verify_Details
134
135 Switch VMI IPv4 Origin And Verify Details
136 Switch VMI IPv4 Origin And Verify Details
137
138
139Verify Persistency Of VMI IPv4 Details After Host Reboot
140 [Documentation] Verify persistency of VMI IPv4 details after host reboot.
141 [Tags] Verify_Persistency_Of_VMI_IPv4_Details_After_Host_Reboot
142
143 # Verifying persistency of dynamic address.
144 Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
Anves Kumar rayankula7936eee2021-04-19 05:38:36 -0500145 Redfish Power Off stack_mode=skip
146 Redfish Power On
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500147 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
Vijay06a169d2020-04-23 09:28:24 -0500148
149 # Verifying persistency of static address.
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600150 Switch VMI IPv4 Origin And Verify Details
Anves Kumar rayankula7936eee2021-04-19 05:38:36 -0500151 Redfish Power Off stack_mode=skip
152 Redfish Power On
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600153 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Vijay06a169d2020-04-23 09:28:24 -0500154
155
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500156Delete VMI Static IP Address And Verify
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500157 [Documentation] Delete VMI static IP address and verify.
158 [Tags] Delete_VMI_Static_IP_Address_And_Verify
159 [Teardown] Test Teardown Execution
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500160
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600161 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
162 Delete VMI IPv4 Address
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500163
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500164
shrsuman123c1d3fe32020-09-08 05:04:07 -0500165Verify Successful VMI IP Static Configuration On HOST Boot After Session Delete
166 [Documentation] Verify VMI IP static Configuration On HOST Boot After session deleted.
167 [Tags] Verify_Successful_VMI_IP_Static_Configuration_On_HOST_Boot_After_Session_Delete
shrsuman123b25343d2021-09-22 04:33:47 -0500168 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
shrsuman123c1d3fe32020-09-08 05:04:07 -0500169
shrsuman12375e77062020-09-18 01:08:45 -0500170 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
shrsuman123c1d3fe32020-09-08 05:04:07 -0500171
172 ${session_info}= Get Redfish Session Info
173 Redfish.Delete ${session_info["location"]}
174
175 # Create a new Redfish session
shrsuman1235c7e4d72021-04-16 05:42:57 -0500176 Redfish.Login
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500177 Redfish Power Off
178 Redfish Power On
shrsuman123c1d3fe32020-09-08 05:04:07 -0500179
180 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
181
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500182
shrsuman123c1d3fe32020-09-08 05:04:07 -0500183Verify Persistency Of VMI DHCP IP Configuration After Multiple HOST Reboots
184 [Documentation] Verify Persistency Of VMI DHCP IP configuration After Multiple HOST Reboots
185 [Tags] Verify_Persistency_Of_VMI_DHCP_IP_Configuration_After_Multiple_HOST_Reboots
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500186 [Teardown] Test Teardown Execution
shrsuman123c1d3fe32020-09-08 05:04:07 -0500187
shrsuman123c1d3fe32020-09-08 05:04:07 -0500188 Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
shrsuman123c1d3fe32020-09-08 05:04:07 -0500189 ${vmi_ip_config}= Get VMI Network Interface Details
190 # Verifying persistency of dynamic address after multiple reboots.
shrsuman123f559cbe2021-01-06 05:40:45 -0600191 FOR ${i} IN RANGE ${2}
192 Redfish Power Off
193 Redfish Power On
George Keishing538f1742022-03-14 05:00:55 -0500194 Verify VMI Network Interface Details ${vmi_ip_config["IPv4_Address"]}
195 ... DHCP ${vmi_ip_config["IPv4_Gateway"]} ${vmi_ip_config["IPv4_SubnetMask"]}
shrsuman123f559cbe2021-01-06 05:40:45 -0600196 END
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500197
198
199Enable DHCP When Static IP Configured And Verify Static IP
200 [Documentation] Enable DHCP when static ip configured and verify static ip
George Keishing4203fad2022-01-31 12:22:33 -0600201 [Tags] Enable_DHCP_When_Static_IP_Configured_And_Verify_Static_IP
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600202 [Setup] Redfish Power On
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500203 [Teardown] Test Teardown Execution
204
shrsuman123f559cbe2021-01-06 05:40:45 -0600205 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500206 Set VMI IPv4 Origin ${True}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500207 ${vmi_network_conf}= Get VMI Network Interface Details
208 Should Not Be Equal As Strings ${test_ipv4} ${vmi_network_conf["IPv4_Address"]}
209
Anves Kumar rayankula9fa524a2020-08-18 06:40:18 -0500210
shrsuman123e37b0cc2020-09-02 00:33:42 -0500211Verify VMI Static IP Configuration Persist On BMC Reset Before Host Boot
212 [Documentation] Verify VMI static IP configuration persist on BMC reset.
213 [Tags] Verify_VMI_Static_IP_Configuration_Persist_On_BMC_Reset_Before_Host_Boot
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600214 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail
shrsuman123e37b0cc2020-09-02 00:33:42 -0500215
shrsuman12375e77062020-09-18 01:08:45 -0500216 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Megha GNbe428592022-07-21 10:33:02 -0500217 Redfish OBMC Reboot (off) stack_mode=skip
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500218 Redfish Power On
shrsuman123e37b0cc2020-09-02 00:33:42 -0500219 # Verifying the VMI static configuration
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 Static IP When Host Poweroff And Verify On Poweron
224 [Documentation] Add Static IP When Host Poweroff And Verify on power on
225 [Tags] Add_Static_IP_When_Host_Poweroff_And_Verify_On_Poweron
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}
230 Redfish Power On
231 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
232
Megha GN80ef5ca2022-06-09 00:29:57 -0500233
shrsuman12375e77062020-09-18 01:08:45 -0500234Add VMI Static IP When Host Poweroff And Verify Static IP On BMC Reset
235 [Documentation] Add Static IP When Host Poweroff And Verify Static IP On BMC Reset.
236 [Tags] Add_VMI_Static_IP_When_Host_Poweroff_And_Verify_Static_IP_On_BMC_Reset
237 [Setup] Redfish Power Off
238 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail
239
240 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Megha GNbe428592022-07-21 10:33:02 -0500241 Redfish OBMC Reboot (off) stack_mode=skip
shrsuman12375e77062020-09-18 01:08:45 -0500242 Redfish Power On
243 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
244
Megha GN80ef5ca2022-06-09 00:29:57 -0500245
shrsuman12375e77062020-09-18 01:08:45 -0500246Enable DHCP When No Static IP Configured And Verify DHCP IP
247 [Documentation] Enable DHCP when no static ip configured and verify dhcp ip
248 [Tags] Enable_DHCP_When_No_Static_IP_Configured_And_Verify_DHCP_IP
249 [Setup] Run Keyword And Ignore Error Delete VMI IPv4 Address
250 [Teardown] Test Teardown Execution
251
252 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
253 Run Keyword If ${curr_origin} == ${False} Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
254 ${vmi_ip_config}= Get VMI Network Interface Details
George Keishing538f1742022-03-14 05:00:55 -0500255 Verify VMI Network Interface Details ${vmi_ip_config["IPv4_Address"]}
256 ... DHCP ${vmi_ip_config["IPv4_Gateway"]} ${vmi_ip_config["IPv4_SubnetMask"]}
shrsuman12375e77062020-09-18 01:08:45 -0500257
Megha GN80ef5ca2022-06-09 00:29:57 -0500258
shrsuman12375e77062020-09-18 01:08:45 -0500259Verify User Cannot Delete VMI DHCP IP Address
260 [Documentation] Verify user cannot delete VMI DHCP IP Address
261 [Tags] Verify_User_Cannot_Delete_VMI_DHCP_IP_Address
262 [Setup] Set VMI IPv4 Origin ${True}
263 [Teardown] Test Teardown Execution
264
shrsuman123b25343d2021-09-22 04:33:47 -0500265 Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_FORBIDDEN}
shrsuman12375e77062020-09-18 01:08:45 -0500266 ${resp}= Redfish.Get
shrsuman123bfb851b2021-07-02 04:59:16 -0500267 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
shrsuman12375e77062020-09-18 01:08:45 -0500268 Should Not Be Empty ${resp.dict["IPv4Addresses"]}
269
Megha GN80ef5ca2022-06-09 00:29:57 -0500270
shrsuman12375e77062020-09-18 01:08:45 -0500271Enable DHCP When Static IP Configured DHCP Server Unavailable And Verify IP
272 [Documentation] Enable DHCP When Static IP Configured And DHCP Server Unavailable And Verify No IP.
273 [Tags] Enable_DHCP_When_Static_IP_Configured_DHCP_Server_Unavailable_And_Verify_IP
274 [Teardown] Test Teardown Execution
275
276 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
277 Set VMI IPv4 Origin ${True}
shrsuman12375e77062020-09-18 01:08:45 -0500278 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
279
shrsuman123e37b0cc2020-09-02 00:33:42 -0500280
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500281Verify To Configure VMI Static IP Address With Different User Roles
282 [Documentation] Verify to configure vmi static ip address with different user roles.
283 [Tags] Verify_To_Configure_VMI_Static_IP_Address_With_Different_User_Roles
Megha G N4e2b5732023-02-02 04:52:27 -0600284 [Setup] Run Keywords Delete BMC Users Using Redfish
285 ... AND Create Users With Different Roles users=${USERS} force=${True}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500286 [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 admin_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_ACCEPTED}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500291 readonly_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500292
293
294Verify To Configure VMI Static IP Address With Operator User Role
295 [Documentation] Verify to configure vmi static ip address with operator user role.
296 [Tags] Verify_To_Configure_VMI_Static_IP_Address_With_Operator_User_Role
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
301 # username password ip_address gateway nemask valid_status_code
302 operator_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500303
304
305Verify To Delete VMI Static IP Address With Different User Roles
306 [Documentation] Verify to delete vmi static IP address with different user roles.
307 [Tags] Verify_To_Delete_VMI_Static_IP_Address_With_Different_User_Roles
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 admin_user TestPwd123 ${HTTP_ACCEPTED}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500314 readonly_user TestPwd123 ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500315
316
317Verify To Delete VMI Static IP Address With Operator User Role
318 [Documentation] Verify to delete vmi static IP address with operator user role.
319 [Tags] Verify_To_Delete_VMI_Static_IP_Address_With_Operator_User_Role
320 [Setup] Create Users With Different Roles users=${USERS} force=${True}
321 [Template] Delete VMI Static IP Address Using Different Users
322 [Teardown] Delete BMC Users Using Redfish
323
324 # username password valid_status_code
325 operator_user TestPwd123 ${HTTP_FORBIDDEN}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500326
327
328Verify To Update VMI Static IP Address With Different User Roles
329 [Documentation] Verify to update vmi static IP address with different user roles.
George Keishing4203fad2022-01-31 12:22:33 -0600330 [Tags] Verify_To_Update_VMI_Static_IP_Address_With_Different_User_Roles
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500331 [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
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600335 # username password ip_address gateway netmask valid_status_code
336 admin_user TestPwd123 10.5.10.20 10.5.10.1 255.255.0.0 ${HTTP_ACCEPTED}
Shradha Sumanc7df7db2021-03-08 05:16:44 -0600337 readonly_user TestPwd123 10.5.20.40 10.5.20.1 255.255.0.0 ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500338
339
340Verify To Update VMI Static IP Address With Operator User Role
341 [Documentation] Verify to update vmi static IP address with operator user role.
342 [Tags] Verify_To_Update_VMI_Static_IP_Address_With_Operator_User_Role
343 [Setup] Create Users With Different Roles users=${USERS} force=${True}
344 [Template] Config VMI Static IP Address Using Different Users
345 [Teardown] Delete BMC Users Using Redfish
346
347 # username password ip_address gateway netmask valid_status_code
348 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 -0500349
350
351Verify To Read VMI Network Configuration With Different User Roles
352 [Documentation] Verify to read vmi network configuration with different user roles.
George Keishing4203fad2022-01-31 12:22:33 -0600353 [Tags] Verify_To_Read_VMI_Network_Configuration_With_Different_User_Roles
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500354 [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 admin_user TestPwd123 ${HTTP_OK}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500360 readonly_user TestPwd123 ${HTTP_OK}
Megha GN80ef5ca2022-06-09 00:29:57 -0500361
362
363Verify To Read VMI Network Configuration With Operator User Role
364 [Documentation] Verify to read vmi network configuration with operator user role.
365 [Tags] Verify_To_Read_VMI_Network_Configuration_With_Operator_User_Role
366 [Setup] Create Users With Different Roles users=${USERS} force=${True}
367 [Template] Read VMI Static IP Address Using Different Users
368 [Teardown] Delete BMC Users Using Redfish
369
370 # username password valid_status_code
371 operator_user TestPwd123 ${HTTP_FORBIDDEN}
372
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500373
shrsuman123b361d412020-09-30 06:17:23 -0500374Enable DHCP On VMI Network Via Different Users Roles And Verify
375 [Documentation] Enable DHCP On VMI Network Via Different Users Roles And Verify.
376 [Tags] Enable_DHCP_On_VMI_Network_Via_Different_Users_Roles_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 admin_user TestPwd123 ${True} ${HTTP_ACCEPTED}
shrsuman123b361d412020-09-30 06:17:23 -0500383 readonly_user TestPwd123 ${True} ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500384
385
386Enable DHCP On VMI Network Via Operator User Role And Verify
387 [Documentation] Enable DHCP On VMI Network Via Operator User Role And Verify.
388 [Tags] Enable_DHCP_On_VMI_Network_Via_Operator_User_Role_And_Verify
389 [Setup] Create Users With Different Roles users=${USERS} force=${True}
390 [Template] Update User Role And Set VMI IPv4 Origin
391 [Teardown] Delete BMC Users Using Redfish
392
393 # username password dhcp_enabled valid_status_code
394 operator_user TestPwd123 ${True} ${HTTP_FORBIDDEN}
395
shrsuman123b361d412020-09-30 06:17:23 -0500396
397Disable DHCP On VMI Network Via Different Users Roles And Verify
398 [Documentation] Disable DHCP On VMI Network Via Different Users Roles And Verify.
399 [Tags] Disable_DHCP_On_VMI_Network_Via_Different_Users_Roles_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 admin_user TestPwd123 ${False} ${HTTP_ACCEPTED}
shrsuman123b361d412020-09-30 06:17:23 -0500406 readonly_user TestPwd123 ${False} ${HTTP_FORBIDDEN}
Megha GN80ef5ca2022-06-09 00:29:57 -0500407
408
409Disable DHCP On VMI Network Via Operator User Role And Verify
410 [Documentation] Disable DHCP On VMI Network Via Operator User Role And Verify.
411 [Tags] Disable_DHCP_On_VMI_Network_Via_Operator_User_Role_And_Verify
412 [Setup] Create Users With Different Roles users=${USERS} force=${True}
413 [Template] Update User Role And Set VMI IPv4 Origin
414 [Teardown] Delete BMC Users Using Redfish
415
416 # username password dhcp_enabled valid_status_code
417 operator_user TestPwd123 ${False} ${HTTP_FORBIDDEN}
shrsuman123b361d412020-09-30 06:17:23 -0500418
shrsuman123e37b0cc2020-09-02 00:33:42 -0500419
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500420Enable And Disable DHCP And Verify
421 [Documentation] verify enable DHCP and disable DHCP.
George Keishing4203fad2022-01-31 12:22:33 -0600422 [Tags] Enable_And_Disable_DHCP_And_Verify
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500423
424 Set VMI IPv4 Origin ${True}
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500425 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
429
430Multiple Times Enable And Disable DHCP And Verify
431 [Documentation] Enable and Disable DHCP in a loop and verify VMI gets an IP address from DHCP
432 ... each time when DHCP is enabled
433 [Tags] Multiple_Times_Enable_And_Disable_DHCP_And_Verify
434
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500435 FOR ${i} IN RANGE ${2}
436 Set VMI IPv4 Origin ${True}
437 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
438 Set VMI IPv4 Origin ${False}
Megha GN80ef5ca2022-06-09 00:29:57 -0500439 Verify VMI Network Interface Details ${default} Static ${default} ${default}
Anves Kumar rayankula55b939e2020-08-12 04:19:01 -0500440 END
441
442
Anves Kumar rayankula81fd9db2021-05-10 02:39:51 -0500443Assign Static IPv4 Address With Invalid Netmask To VMI
444 [Documentation] Assign static IPv4 address with invalid netmask and expect error.
445 [Tags] Assign_Static_IPv4_Address_With_Invalid_Netmask_To_VMI
446 [Template] Set Static IPv4 Address To VMI And Verify
447
448 # ip gateway netmask valid_status_code
449 ${test_ipv4} ${test_gateway} 255.256.255.0 ${HTTP_BAD_REQUEST}
450 ${test_ipv4} ${test_gateway} ff.ff.ff.ff ${HTTP_BAD_REQUEST}
451 ${test_ipv4} ${test_gateway} 255.255.253.0 ${HTTP_BAD_REQUEST}
452
453
454Assign Static IPv4 Address With Invalid Gateway To VMI
455 [Documentation] Add static IPv4 address with invalid gateway and expect error.
456 [Tags] Assign_Static_IPv4_Address_With_Invalid_Gateway_To_VMI
457 [Template] Set Static IPv4 Address To VMI And Verify
458
459 # ip gateway netmask valid_status_code
460 ${test_ipv4} @@@.%%.44.11 ${test_netmask} ${HTTP_BAD_REQUEST}
461 ${test_ipv4} 0xa.0xb.0xc.0xd ${test_netmask} ${HTTP_BAD_REQUEST}
462 ${test_ipv4} 10.3.36 ${test_netmask} ${HTTP_BAD_REQUEST}
463 ${test_ipv4} 10.3.36.-10 ${test_netmask} ${HTTP_BAD_REQUEST}
464
465
Megha G N02cbfa12022-12-12 02:05:03 -0600466Enable DHCP When Host Is Off And Verify After Poweron
467 [Documentation] Enable DHCP when host is off and
468 ... check whether it is enabled after poweron.
469 [Tags] Enable_DHCP_When_Host_Is_Off_And_Verify_After_Poweron
470 [Setup] Redfish Power Off stack_mode=skip
471
472 Set VMI IPv4 Origin ${True}
473 Redfish Power On stack_mode=skip
474 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
475
476
Megha G N89174682023-01-24 23:28:27 -0600477Disable DHCP When Host Is Off And Verify New State Reflects After Power On
478 [Documentation] Disable DHCP when host is off and
479 ... get network info and verify that VMI origin is static.
480 [Tags] Disable_DHCP_When_Host_Is_Off_And_Verify_New_State_Reflects_After_Power_On
481 [Setup] Redfish Power Off stack_mode=skip
482
483 Set VMI IPv4 Origin ${False}
484 Redfish Power On stack_mode=skip
485 Verify VMI Network Interface Details ${default} Static ${default} ${default}
486
487
Megha G N38acd842024-10-14 14:28:11 -0500488Enable VMI Stateless Address AutoConfig And Verify
489 [Documentation] Enable VMI SLAACv6 and verify an origin.
490 [Tags] Enable_VMI_Stateless_Address_AutoConfig_And_Verify
491
492 Set VMI SLAACv6 Origin ${True}
493
494 # Check origin is set to slaac and address are getting displayed.
495 Verify VMI IPv6 Address SLAAC
496
497
Megha G Ne8c0e422024-12-04 03:12:55 -0600498Disable VMI Stateless Address AutoConfig And Verify
499 [Documentation] Disable VMI SLAACv6 and verify an origin.
500 [Tags] Disable_VMI_Stateless_Address_AutoConfig_And_Verify
501 [Setup] Set VMI SLAACv6 Origin ${True}
502
503 Set VMI SLAACv6 Origin ${False}
504
505 # Check origin is set to static and slaacv6 address are getting erased.
506 Verify VMI IPv6 Address Static
507
508
Megha G Na37b8da2025-01-06 00:23:15 -0600509Enable VMI SLAAC And Check Persistency On BMC Reboot
510 [Documentation] Enable VMI SLAACv6 and verify its persistency
511 ... on BMC reboot and this works on the setup where router
Megha G Na727d5b2025-02-06 04:41:47 -0600512 ... advertises network prefix.
Megha G Na37b8da2025-01-06 00:23:15 -0600513 [Tags] Enable_VMI_SLAAC_And_Check_Persistency_On_BMC_Reboot
514
515 Set VMI SLAACv6 Origin ${True}
516
517 # Reboot BMC and verify persistency.
518 OBMC Reboot (off)
519 Redfish Power On
520 Wait For Host Boot Progress To Reach Required State
Megha G Na727d5b2025-02-06 04:41:47 -0600521 Sleep 5s
Megha G Na37b8da2025-01-06 00:23:15 -0600522
523 # Check origin is set to slaac and address are getting displayed.
524 ${vmi_ipv6addr}= Verify VMI IPv6 Address SLAAC
525 Should Not Be Equal ${vmi_ipv6addr["Address"]} ${default_ipv6addr}
526
527
Megha G N49657382025-01-07 23:10:42 -0600528Disable VMI SLAAC And Check Persistency On BMC Reboot
529 [Documentation] Disable VMI SLAACv6 and verify its persistency
530 ... on BMC reboot.
531 [Tags] Disable_VMI_SLAAC_And_Check_Persistency_On_BMC_Reboot
532
533 Set VMI SLAACv6 Origin ${False}
534
535 # Reboot BMC and verify persistency.
536 OBMC Reboot (off)
537 Redfish Power On
538 Wait For Host Boot Progress To Reach Required State
539
540 # Check if origin is set to static and SLAAC address are getting erased.
541 ${vmi_ipv6addr}= Verify VMI IPv6 Address Static
542 Should Be Equal ${vmi_ipv6addr["Address"]} ${default_ipv6addr}
543
544
Megha G N503fa352025-01-08 04:43:09 -0600545Disable VMI DHCPv4 When SLAAC Is Enabled And Verify
546 [Documentation] Disable VMI DHCPv4 parameter when SLAACv6 is enabled
547 ... and check whether the IPv4 address origin is set to static and
548 ... DHCPv4 address is getting erased.
549 [Tags] Disable_VMI_DHCPv4_When_SLAAC_Is_Enabled_And_Verify
550 [Setup] Set VMI IPv4 Origin ${True}
551
552 # Set IPv6 origin to SLAAC.
553 Set VMI SLAACv6 Origin ${True}
554 Verify VMI IPv6 Address SLAAC
555
556 # Disable VMI DHCPv4 and check IPv4 address origin is set to static.
557 Set VMI IPv4 Origin ${False}
558 Verify VMI Network Interface Details ${default} Static ${default} ${default}
559
560
Megha G Ndf255642025-01-10 02:12:21 -0600561Enable VMI SLAAC When DHCPv6 Is Enabled And Verify
562 [Documentation] Enable VMI SLAACv6 when VMI DHCPv6 is enabled and
563 ... check IPv6 gets Slaac address and this works on the setup
564 ... where router advertise network prefix.
565 [Tags] Enable_VMI_SLAAC_When_DHCPv6_Is_Enabled_And_Verify
566
567 Set VMI DHCPv6 Property Enabled
568
569 # Enable SLAAC and check whether IPv6 origin is set to SLAAC.
570 Set VMI SLAACv6 Origin ${True}
571
572 # Check if origin is set to slaac and address are getting displayed.
573 ${vmi_ipv6addr}= Verify VMI IPv6 Address SLAAC
574 Should Not Be Equal ${vmi_ipv6addr["Address"]} ${default_ipv6addr}
575 Should Be Equal ${vmi_ipv6addr["PrefixLength"]} ${prefix_length}
576
577
Megha G N80b4af32025-01-15 00:47:35 -0600578Disable VMI DHCPv6 Property And Verify
George Keishing4ebb3282025-01-17 10:01:34 +0530579 [Documentation] Disable VMI DHCPv6 property and verify IPv6 address
580 ... origin is set to static and DHCPv6 address is erased.
581 [Tags] Disable_VMI_DHCPv6_Property_And_Verify
Megha G N80b4af32025-01-15 00:47:35 -0600582 [Setup] Set VMI DHCPv6 Property Enabled
583
584 Set VMI DHCPv6 Property Disabled
585
586 # Verify IPv6 address origin is set to static and DHCPv6 address is erased.
587 ${vmi_ipv6addr}= Verify VMI IPv6 Address Static
588 Should Be Equal ${vmi_ipv6addr["Address"]} ${default_ipv6addr}
589
590
Megha G N58be5122025-01-16 08:26:53 -0600591Enable VMI SLAAC When DHCPv4 Is Enabled And Verify
592 [Documentation] On VMI enable SLAAC when DHCPv4 is enabled and verify DHCPv4 settings are intact
593 ... and IPv6 origin is set to SLAAC & it gets assigned with SLAAC IPv6 address and this
594 ... works on the setup where router advertise network prefix.
595 [Tags] Enable_VMI_SLAAC_When_DHCPv4_Is_Enabled_And_Verify
596 [Setup] Set VMI IPv4 Origin ${True}
597
598 # Enable Autoconfig address and check whether IPv6 address origin is set to SLAAC.
599 Set VMI SLAACv6 Origin ${True}
600 Verify VMI IPv6 Address SLAAC
601
602 # Check there is no impact on IPv4 settings, IPv4 address origin should be DHCP.
603 Verify VMI Network Interface Details ${default} DHCP ${default} ${default}
604
605
Megha G Nf9867142025-02-03 23:10:57 -0600606Disable VMI DHCPv6 Property And Check Persistency On BMC Reboot
607 [Documentation] Disable VMI DHCPv6 property and verify its persistency on
608 ... BMC reboot.
609 [Tags] Disable_VMI_DHCPv6_Property_And_Check_Persistency_On_BMC_Reboot
610 [Setup] Set VMI DHCPv6 Property Enabled
611
612 Set VMI DHCPv6 Property Disabled
613
614 # Reboot BMC and verify persistency.
615 OBMC Reboot (off)
616
617 # Verify IPv6 address origin is set to Static and DHCPv6 address is erased.
618 ${vmi_ipv6addr}= Verify VMI IPv6 Address Static
619 Should Be Equal ${vmi_ipv6addr["Address"]} ${default_ipv6addr}
620
621
Megha G N95e37d82025-02-06 03:56:04 -0600622Enable VMI SLAAC When IPv4 Origin Is Static And Verify
623 [Documentation] On VMI enable SLAAC when IPv4 origin is static and verify IPv4 settings are intact
624 ... and IPv6 origin is set to SLAAC & it gets assigned with SLAAC IPv6 address and this works
625 ... on the setup where router advertise network prefix.
626 [Tags] Enable_VMI_SLAAC_When_IPv4_Origin_Is_Static_And_Verify
627 [Setup] Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
628 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution
629
630 # Enable Autoconfig address and check whether IPv6 address origin is set to SLAAC.
631 Set VMI SLAACv6 Origin ${True}
632 Verify VMI IPv6 Address SLAAC
633
634 # Check there is no impact on IPv4 settings, IPv4 address origin should be Static.
635 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask}
636
637
Vijay06a169d2020-04-23 09:28:24 -0500638*** Keywords ***
639
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500640Suite Setup Execution
641 [Documentation] Do test setup execution task.
642
643 Redfish.Login
Megha G Nd0b4da92024-02-08 15:04:24 -0600644
645 Redfish Power Off
646 Set BIOS Attribute pvm_hmc_managed Enabled
Megha G N1e538242024-06-11 03:42:03 -0500647 Set BIOS Attribute pvm_stop_at_standby Disabled
648
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500649 Redfish Power On
Megha G N1e538242024-06-11 03:42:03 -0500650 Wait For Host Boot Progress To Reach Required State
Megha G N86507da2024-02-07 23:16:27 -0600651
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500652 ${active_channel_config}= Get Active Channel Config
653 Set Suite Variable ${active_channel_config}
shrsuman123bfb851b2021-07-02 04:59:16 -0500654 Set Suite Variable ${ethernet_interface} ${active_channel_config['${CHANNEL_NUMBER}']['name']}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500655 ${resp}= Redfish.Get
shrsuman123bfb851b2021-07-02 04:59:16 -0500656 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
shrsuman12362e5be52021-05-20 02:42:59 -0500657 ${ip_resp}= Evaluate json.loads(r'''${resp.text}''') json
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500658 ${length}= Get Length ${ip_resp["IPv4StaticAddresses"]}
659 ${vmi_network_conf}= Run Keyword If ${length} != ${0} Get VMI Network Interface Details
660 Set Suite Variable ${vmi_network_conf}
661
662
663Test Teardown Execution
664 [Documentation] Do test teardown execution task.
665
666 FFDC On Test Case Fail
667 ${curr_mode}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
668 Run Keyword If ${curr_mode} == ${True} Set VMI IPv4 Origin ${False}
Megha G N1e538242024-06-11 03:42:03 -0500669 Run Keyword If '${vmi_network_conf["IPv4_Address"]}' != '${default}'
shrsuman123f559cbe2021-01-06 05:40:45 -0600670 ... Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]}
Anves Kumar rayankulad7deb892020-08-24 02:58:20 -0500671 ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]}
672
673
Vijay06a169d2020-04-23 09:28:24 -0500674Get Immediate Child Parameter From VMI Network Interface
675 [Documentation] Get immediate child parameter from VMI network interface.
676 [Arguments] ${parameter} ${valid_status_code}=${HTTP_OK}
677
678 # Description of argument(s):
679 # parameter parameter for which value is required. Ex: DHCPEnabled, MACAddress etc.
680 # valid_status_code Expected valid status code from GET request.
681
Anves Kumar rayankula358c41d2020-08-14 04:53:06 -0500682 ${resp}= Redfish.Get
shrsuman123bfb851b2021-07-02 04:59:16 -0500683 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
Vijay06a169d2020-04-23 09:28:24 -0500684 ... valid_status_codes=[${valid_status_code}]
685
shrsuman12362e5be52021-05-20 02:42:59 -0500686 ${ip_resp}= Evaluate json.loads(r'''${resp.text}''') json
Vijay06a169d2020-04-23 09:28:24 -0500687 ${value}= Set Variable If '${parameter}' != 'DHCPEnabled' ${ip_resp["${parameter}"]}
688 ... ${ip_resp["DHCPv4"]["${parameter}"]}
689
George Keishing409df052024-01-17 22:36:14 +0530690 RETURN ${value}
Vijay06a169d2020-04-23 09:28:24 -0500691
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600692
Vijay06a169d2020-04-23 09:28:24 -0500693Switch VMI IPv4 Origin And Verify Details
694 [Documentation] Switch VMI IPv4 origin and verify details.
Vijay06a169d2020-04-23 09:28:24 -0500695
Anves Kumar rayankula7936eee2021-04-19 05:38:36 -0500696 ${dhcp_mode_before}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
Anves Kumar rayankulae7dc89a2021-04-28 04:29:38 -0500697 ${dhcp_enabled}= Set Variable If ${dhcp_mode_before} == ${False} ${True} ${False}
Vijay06a169d2020-04-23 09:28:24 -0500698
Anves Kumar rayankulae7dc89a2021-04-28 04:29:38 -0500699 ${origin}= Set Variable If ${dhcp_mode_before} == ${False} DHCP Static
Vijay06a169d2020-04-23 09:28:24 -0500700 Set VMI IPv4 Origin ${dhcp_enabled} ${HTTP_ACCEPTED}
Anves Kumar rayankula7936eee2021-04-19 05:38:36 -0500701
702 ${dhcp_mode_after}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
703 Should Not Be Equal ${dhcp_mode_before} ${dhcp_mode_after}
704
705 Run Keyword If ${dhcp_mode_after} == ${True}
706 ... Verify VMI Network Interface Details ${default} ${origin} ${default} ${default}
Vijay06a169d2020-04-23 09:28:24 -0500707
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500708
709Delete VMI Static IP Address Using Different Users
710 [Documentation] Update user role and delete vmi static IP address.
711 [Arguments] ${username} ${password} ${valid_status_code}
712 [Teardown] Run Keywords Redfish.Login AND
shrsuman123f559cbe2021-01-06 05:40:45 -0600713 ... Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500714 ... ${test_netmask} ${HTTP_ACCEPTED} AND Redfish.Logout
715
716 # Description of argument(s):
717 # username The host username.
718 # password The host password.
719 # valid_status_code The expected valid status code.
720
Megha GN80ef5ca2022-06-09 00:29:57 -0500721 # TODO: operator_user role is not yet supported.
722 Skip If '${username}' == 'operator_user'
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500723 Redfish.Login ${username} ${password}
724 Delete VMI IPv4 Address delete_param=IPv4StaticAddresses valid_status_code=${valid_status_code}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500725
726
727Config VMI Static IP Address Using Different Users
728 [Documentation] Update user role and update vmi static ip address.
729 [Arguments] ${username} ${password} ${ip} ${gateway} ${netmask}
730 ... ${valid_status_code}
731
732 # Description of argument(s):
733 # username The host username.
734 # password The host password.
735 # ip IP address to be added (e.g. "10.7.7.7").
736 # subnet_mask Subnet mask for the IP to be added
737 # (e.g. "255.255.0.0").
738 # gateway Gateway for the IP to be added (e.g. "10.7.7.1").
739 # valid_status_code The expected valid status code.
740
Megha GN80ef5ca2022-06-09 00:29:57 -0500741 # TODO: operator_user role is not yet supported.
742 Skip If '${username}' == 'operator_user'
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500743 Redfish.Login ${username} ${password}
Anves Kumar rayankula1b64d942020-11-17 02:44:02 -0600744 Set Static IPv4 Address To VMI And Verify ${ip} ${gateway} ${netmask} ${valid_status_code}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500745
746
747Read VMI Static IP Address Using Different Users
748 [Documentation] Update user role and read vmi static ip address.
749 [Arguments] ${username} ${password} ${valid_status_code}
750
751 # Description of argument(s):
752 # username The host username.
753 # password The host password.
754 # valid_status_code The expected valid status code.
755
Megha GN80ef5ca2022-06-09 00:29:57 -0500756 # TODO: operator_user role is not yet supported.
757 Skip If '${username}' == 'operator_user'
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500758 Redfish.Login ${username} ${password}
759 Redfish.Get
shrsuman123bfb851b2021-07-02 04:59:16 -0500760 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500761 ... valid_status_codes=[${valid_status_code}]
Anves Kumar rayankulad5de2072020-09-30 06:24:11 -0500762
763
764Delete BMC Users Using Redfish
765 [Documentation] Delete BMC users via redfish.
766
767 Redfish.Login
768 Delete BMC Users Via Redfish users=${USERS}
shrsuman123b361d412020-09-30 06:17:23 -0500769
Sweta Potthurid52b2732021-08-12 12:48:24 -0500770
shrsuman123b361d412020-09-30 06:17:23 -0500771Update User Role And Set VMI IPv4 Origin
772 [Documentation] Update User Role And Set VMI IPv4 Origin.
773 [Arguments] ${username} ${password} ${dhcp_enabled} ${valid_status_code}
774
775 # Description of argument(s):
776 # username The host username.
777 # password The host password.
778 # dhcp_enabled Indicates whether dhcp should be enabled
779 # (${True}, ${False}).
780 # valid_status_code The expected valid status code.
781
Megha GNbe428592022-07-21 10:33:02 -0500782 # TODO: operator_user role is not yet supported.
783 Skip If '${username}' == 'operator_user'
shrsuman123b361d412020-09-30 06:17:23 -0500784 Redfish.Login ${username} ${password}
785 Set VMI IPv4 Origin ${dhcp_enabled} ${valid_status_code}
shrsuman123bfb851b2021-07-02 04:59:16 -0500786
Sweta Potthurid52b2732021-08-12 12:48:24 -0500787
shrsuman123bfb851b2021-07-02 04:59:16 -0500788Suite Teardown Execution
789 [Documentation] Do suite teardown execution task.
790
791 Run Keyword If ${vmi_network_conf} != ${None}
792 ... Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]}
793 ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]}
shrsuman123b25343d2021-09-22 04:33:47 -0500794 Delete All Redfish Sessions
shrsuman123bfb851b2021-07-02 04:59:16 -0500795 Redfish.Logout
Megha G N38acd842024-10-14 14:28:11 -0500796
797
798Set VMI SLAACv6 Origin
799 [Documentation] Set VMI SLAACv6 origin.
800 [Arguments] ${slaac_enabled}=${False} ${valid_status_code}=${HTTP_ACCEPTED}
801 ... ${interface}=${ethernet_interface}
802
803 # Description of argument(s):
804 # slaacv6_enabled True if user wants to enable SLAACv6. Default is Static, hence value is set to False.
805 # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK.
806 # interface VMI interface (eg. eth0 or eth1).
807
808 ${data}= Set Variable If ${slaac_enabled} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC}
809 ${resp}= Redfish.Patch
810 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface}
811 ... body=${data} valid_status_codes=[${valid_status_code}]
812
813 Sleep ${wait_time}
814 Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED}
815 ${resp}= Redfish.Get
816 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface}
817 Should Be Equal ${resp.dict["StatelessAddressAutoConfig"]["IPv6AutoConfigEnabled"]} ${slaac_enabled}
818
819
820Verify VMI IPv6 Address
821 [Documentation] Verify VMI IPv6 address configurations.
822 [Arguments] ${ipv6_origin} ${interface}=${ethernet_interface}
823
824 # Description of argument(s):
825 # ipv6_origin Origin of IPv6 address eg. Static or DHCPv6 or SLAAC.
826 # interface VMI interface (eg. eth0 or eth1).
827
828 ${resp}= Redfish.Get /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface}
829
830 @{vmi_ipv6_configurations}= Get From Dictionary ${resp.dict} IPv6Addresses
831 ${vmi_ipv6_config}= Get From List ${vmi_ipv6_configurations} 0
832 Should Not Be Empty ${vmi_ipv6_config["Address"]}
833 Should Be Equal As Strings   ${vmi_ipv6_config["AddressOrigin"]} ${ipv6_origin}
Megha G Na37b8da2025-01-06 00:23:15 -0600834 RETURN &{vmi_ipv6_config}
Megha G Ndf255642025-01-10 02:12:21 -0600835
836
837Set VMI DHCPv6 Property
838 [Documentation] Set VMI DHCPv6 attribute.
839 [Arguments] ${dhcpv6_operatingmode}=${Disabled} ${valid_status_code}=${HTTP_ACCEPTED}
840 ... ${interface}=${ethernet_interface}
841
842 # Description of argument(s):
843 # dhcpv6_operatingmode Enabled if user wants to enable DHCPv6.
844 # ... Default is Static, hence value is set to Disabled.
845 # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK.
846 # interface VMI interface (eg. eth0 or eth1).
847
848 ${data}= Set Variable If '${dhcpv6_operatingmode}' == 'Disabled' ${DISABLE_DHCPv6} ${ENABLE_DHCPv6}
849 ${resp}= Redfish.Patch
850 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface}
851 ... body=${data} valid_status_codes=[${valid_status_code}]
852
853 Sleep ${wait_time}
854 Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED}
855 ${resp}= Redfish.Get
856 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface}
857 Should Be Equal ${resp.dict["DHCPv6"]["OperatingMode"]} ${dhcpv6_operatingmode}