Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 3 | Documentation VMI static/dynamic IP config tests. |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 4 | |
| 5 | Resource ../../lib/resource.robot |
| 6 | Resource ../../lib/bmc_redfish_resource.robot |
| 7 | Resource ../../lib/openbmc_ffdc.robot |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 8 | Resource ../../lib/bmc_redfish_utils.robot |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 9 | Library ../../lib/bmc_network_utils.py |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 10 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 11 | Suite Setup Suite Setup Execution |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 12 | Test Teardown FFDC On Test Case Fail |
| 13 | Suite Teardown Redfish.Logout |
| 14 | |
| 15 | *** Variables *** |
| 16 | |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 17 | # users User Name password |
| 18 | @{ADMIN} admin_user TestPwd123 |
| 19 | @{OPERATOR} operator_user TestPwd123 |
| 20 | @{ReadOnly} readonly_user TestPwd123 |
| 21 | @{NoAccess} noaccess_user TestPwd123 |
| 22 | &{USERS} Administrator=${ADMIN} Operator=${OPERATOR} ReadOnly=${ReadOnly} |
| 23 | ... NoAccess=${NoAccess} |
| 24 | |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 25 | ${test_ipv4} 10.10.20.30 |
| 26 | ${test_gateway} 0.0.0.0 |
| 27 | ${test_netmask} 255.255.252.0 |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 28 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 29 | &{DHCP_ENABLED} DHCPEnabled=${${True}} |
| 30 | &{DHCP_DISABLED} DHCPEnabled=${${False}} |
| 31 | |
| 32 | &{ENABLE_DHCP} DHCPv4=&{DHCP_ENABLED} |
| 33 | &{DISABLE_DHCP} DHCPv4=&{DHCP_DISABLED} |
| 34 | |
| 35 | |
| 36 | *** Test Cases *** |
| 37 | |
| 38 | Verify All VMI EthernetInterfaces |
| 39 | [Documentation] Verify all VMI ethernet interfaces. |
| 40 | [Tags] Verify_All_VMI_EthernetINterfaces |
| 41 | |
| 42 | Verify VMI EthernetInterfaces |
| 43 | |
| 44 | |
| 45 | Verify Existing VMI Network Interface Details |
| 46 | [Documentation] Verify existing VMI network interface details. |
| 47 | [Tags] Verify_VMI_Network_Interface_Details |
| 48 | |
| 49 | ${vmi_ip}= Get VMI Network Interface Details |
| 50 | ${origin}= Set Variable If ${vmi_ip["DHCPv4"]} == ${False} Static DHCP |
| 51 | |
| 52 | Should Not Be Equal ${vmi_ip["DHCPv4"]} ${vmi_ip["IPv4StaticAddresses"]} |
| 53 | Should Be Equal As Strings ${origin} ${vmi_ip["IPv4_AddressOrigin"]} |
| 54 | Should Be Equal As Strings ${vmi_ip["Id"]} intf0 |
George Keishing | b3ea095 | 2020-07-01 05:03:56 -0500 | [diff] [blame] | 55 | Should Be Equal As Strings ${vmi_ip["Description"]} |
| 56 | ... Ethernet Interface for Virtual Management Interface |
| 57 | Should Be Equal As Strings ${vmi_ip["Name"]} Virtual Management Interface |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 58 | Should Be True ${vmi_ip["InterfaceEnabled"]} |
| 59 | |
| 60 | |
| 61 | Delete Existing Static VMI IP Address |
| 62 | [Documentation] Delete existing static VMI IP address. |
| 63 | [Tags] Delete_Existing_Static_VMI_IP_Address |
| 64 | |
| 65 | ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled |
| 66 | Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED} |
| 67 | |
| 68 | Delete VMI IPv4 Address IPv4StaticAddresses valid_status_code=${HTTP_ACCEPTED} |
| 69 | ${default}= Set Variable 0.0.0.0 |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 70 | Verify VMI Network Interface Details ${default} Static ${default} ${default} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 71 | |
| 72 | |
| 73 | Verify User Cannot Delete ReadOnly Property IPv4Addresses |
| 74 | [Documentation] Verify user cannot delete readonly property IPv4Addresses. |
| 75 | [Tags] Verify_User_Cannot_Delete_ReadOnly_Property_IPv4Addresses |
| 76 | |
| 77 | ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled |
| 78 | Run Keyword If ${curr_origin} == ${False} Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED} |
| 79 | Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_BAD_REQUEST} |
| 80 | |
| 81 | |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 82 | Assign Valid And Invalid Static IPv4 Address To VMI |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 83 | [Documentation] Assign static IPv4 address to VMI. |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 84 | [Tags] Assign_Valid_And_Invalid_Static_IPv4_Address_To_VMI |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 85 | [Template] Verify Assigning Static IPv4 Address To VMI |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 86 | [Teardown] Run keywords Delete VMI IPv4 Address IPv4Addresses |
| 87 | ... AND Test Teardown Execution |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 88 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 89 | # ip gateway netmask valid_status_code |
| 90 | 10.5.20.30 0.0.0.0 255.255.252.0 ${HTTP_ACCEPTED} |
| 91 | a.3.118.94 0.0.0.0 255.255.252.0 ${HTTP_BAD_REQUEST} |
| 92 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 93 | |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 94 | Add Multiple IP Addreses On VMI Interface And Verify |
| 95 | [Documentation] Add multiple IP addreses on VMI interface and verify. |
| 96 | [Tags] Add_Multiple_IP_Addreses_On_VMI_Interface_And_Verify |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 97 | [Teardown] Run keywords Delete VMI IPv4 Address IPv4Addresses |
| 98 | ... AND Test Teardown Execution |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 99 | |
| 100 | ${ip1}= Create dictionary Address=10.5.5.10 SubnetMask=255.255.252.0 Gateway=0.0.0.0 |
| 101 | ${ip2}= Create dictionary Address=10.5.5.11 SubnetMask=255.255.252.0 Gateway=0.0.0.0 |
| 102 | ${ip3}= Create dictionary Address=10.5.5.12 SubnetMask=255.255.252.0 Gateway=0.0.0.0 |
| 103 | ${ips}= Create List ${ip1} ${ip2} ${ip3} |
| 104 | |
| 105 | ${active_channel_config}= Get Active Channel Config |
| 106 | Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 107 | ... body={'IPv4StaticAddresses':${ips}} valid_status_codes=[${HTTP_ACCEPTED}] |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 108 | Verify VMI Network Interface Details ${ip1["Address"]} Static ${ip1["Gateway"]} ${ip1["SubnetMask"]} |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 109 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 110 | |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 111 | Modify IP Addresses On VMI Interface And Verify |
| 112 | [Documentation] Modify IP addresses on VMI interface and verify. |
| 113 | [Tags] Modify_IP_Addresses_On_VMI_Interface_And_Verify |
| 114 | [Template] Verify Assigning Static IPv4 Address To VMI |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 115 | [Teardown] Run keywords Delete VMI IPv4 Address IPv4Addresses |
| 116 | ... AND Test Teardown Execution |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 117 | |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 118 | # ip gateway netmask valid_status_code |
| 119 | 10.5.5.10 0.0.0.0 255.255.252.0 ${HTTP_ACCEPTED} |
| 120 | 10.5.5.11 0.0.0.0 255.255.252.0 ${HTTP_ACCEPTED} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 121 | |
| 122 | Switch Between IP Origins On VMI And Verify Details |
| 123 | [Documentation] Switch between IP origins on VMI and verify details. |
| 124 | [Tags] Switch_Between_IP_Origins_On_VMI_And_Verify_Details |
| 125 | |
| 126 | Switch VMI IPv4 Origin And Verify Details |
| 127 | Switch VMI IPv4 Origin And Verify Details |
| 128 | |
| 129 | |
| 130 | Verify Persistency Of VMI IPv4 Details After Host Reboot |
| 131 | [Documentation] Verify persistency of VMI IPv4 details after host reboot. |
| 132 | [Tags] Verify_Persistency_Of_VMI_IPv4_Details_After_Host_Reboot |
| 133 | |
| 134 | # Verifying persistency of dynamic address. |
| 135 | Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED} |
| 136 | ${default}= Set Variable 0.0.0.0 |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 137 | Verify VMI Network Interface Details ${default} DHCP ${default} ${default} |
| 138 | Verify VMI Network Interface Details ${default} DHCP ${default} ${default} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 139 | |
| 140 | # Verifying persistency of static address. |
| 141 | Switch VMI IPv4 Origin And Verify Details ${True} |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 142 | Verify Assigning Static IPv4 Address To VMI ${test_ipv4} ${test_gateway} ${test_netmask} |
| 143 | Verify VMI Network Interface Details ${test_ipv4} ${test_gateway} ${test_netmask} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 144 | |
| 145 | |
Anves Kumar rayankula | 9fa524a | 2020-08-18 06:40:18 -0500 | [diff] [blame] | 146 | Delete VMI Static IP Address And Verify |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 147 | [Documentation] Delete VMI static IP address and verify. |
| 148 | [Tags] Delete_VMI_Static_IP_Address_And_Verify |
| 149 | [Teardown] Test Teardown Execution |
Anves Kumar rayankula | 9fa524a | 2020-08-18 06:40:18 -0500 | [diff] [blame] | 150 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 151 | Verify Assigning Static IPv4 Address To VMI ${test_ipv4} ${test_gateway} ${test_netmask} |
| 152 | Delete VMI IPv4 Address IPv4Addresses ${HTTP_ACCEPTED} |
| 153 | ${active_channel_config}= Get Active Channel Config |
| 154 | ${resp}= Redfish.Get |
| 155 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 156 | Should Be Empty ${resp.dict["IPv4Addresses"]} |
| 157 | |
Anves Kumar rayankula | 9fa524a | 2020-08-18 06:40:18 -0500 | [diff] [blame] | 158 | |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 159 | Verify Successful VMI IP Static Configuration On HOST Boot After Session Delete |
| 160 | [Documentation] Verify VMI IP static Configuration On HOST Boot After session deleted. |
| 161 | [Tags] Verify_Successful_VMI_IP_Static_Configuration_On_HOST_Boot_After_Session_Delete |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 162 | [Teardown] Run keywords Delete VMI IPv4 Address IPv4Addresses AND Test Teardown Execution |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 163 | |
| 164 | Set Static IPv4 Address To VMI ${test_ipv4} ${test_gateway} ${test_netmask} |
| 165 | |
| 166 | ${session_info}= Get Redfish Session Info |
| 167 | Redfish.Delete ${session_info["location"]} |
| 168 | |
| 169 | # Create a new Redfish session |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 170 | Redfish Power Off |
| 171 | Redfish Power On |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 172 | |
| 173 | Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask} |
| 174 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 175 | |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 176 | Verify Persistency Of VMI DHCP IP Configuration After Multiple HOST Reboots |
| 177 | [Documentation] Verify Persistency Of VMI DHCP IP configuration After Multiple HOST Reboots |
| 178 | [Tags] Verify_Persistency_Of_VMI_DHCP_IP_Configuration_After_Multiple_HOST_Reboots |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 179 | [Teardown] Test Teardown Execution |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 180 | |
| 181 | ${LOOP_COUNT}= Set Variable ${3} |
| 182 | Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED} |
| 183 | Run Keywords Redfish Power Off AND Redfish Power On |
| 184 | ${vmi_ip_config}= Get VMI Network Interface Details |
| 185 | # Verifying persistency of dynamic address after multiple reboots. |
| 186 | Repeat Keyword ${LOOP_COUNT} times |
| 187 | ... Verify VMI Network Interface Details ${vmi_ip_config["IPv4_Address"]} DHCP ${vmi_ip_config["IPv4_Gateway"]} |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 188 | ... ${vmi_ip_config["IPv4_SubnetMask"]} |
| 189 | |
| 190 | |
| 191 | Enable DHCP When Static IP Configured And Verify Static IP |
| 192 | [Documentation] Enable DHCP when static ip configured and verify static ip |
| 193 | [Tags] Enable_DHCP_when_Static_IP_Configured_And_Verify_Static_IP |
| 194 | [Teardown] Test Teardown Execution |
| 195 | |
| 196 | Verify Assigning Static IPv4 Address To VMI ${test_ipv4} ${test_gateway} ${test_netmask} |
| 197 | Set VMI IPv4 Origin ${True} |
| 198 | Redfish Power Off |
| 199 | Redfish Power On |
| 200 | ${vmi_network_conf}= Get VMI Network Interface Details |
| 201 | Should Not Be Equal As Strings ${test_ipv4} ${vmi_network_conf["IPv4_Address"]} |
| 202 | |
Anves Kumar rayankula | 9fa524a | 2020-08-18 06:40:18 -0500 | [diff] [blame] | 203 | |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 204 | Verify VMI Static IP Configuration Persist On BMC Reset Before Host Boot |
| 205 | [Documentation] Verify VMI static IP configuration persist on BMC reset. |
| 206 | [Tags] Verify_VMI_Static_IP_Configuration_Persist_On_BMC_Reset_Before_Host_Boot |
shrsuman123 | 5897ea7 | 2020-09-24 00:30:15 -0500 | [diff] [blame] | 207 | [Teardown] Run keywords Delete VMI IPv4 Address IPv4Addresses AND FFDC On Test Case Fail |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 208 | |
| 209 | Set Static IPv4 Address To VMI ${test_ipv4} ${test_gateway} ${test_netmask} |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 210 | OBMC Reboot (off) |
| 211 | Redfish Power On |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 212 | # Verifying the VMI static configuration |
| 213 | Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask} |
| 214 | |
| 215 | |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 216 | Verify To Configure VMI Static IP Address With Different User Roles |
| 217 | [Documentation] Verify to configure vmi static ip address with different user roles. |
| 218 | [Tags] Verify_To_Configure_VMI_Static_IP_Address_With_Different_User_Roles |
| 219 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 220 | [Template] Config VMI Static IP Address Using Different Users |
| 221 | [Teardown] Delete BMC Users Using Redfish |
| 222 | |
| 223 | # username password ip_address gateway nemask valid_status_code |
| 224 | admin_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_ACCEPTED} |
| 225 | operator_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN} |
| 226 | readonly_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN} |
| 227 | noaccess_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN} |
| 228 | |
| 229 | |
| 230 | Verify To Delete VMI Static IP Address With Different User Roles |
| 231 | [Documentation] Verify to delete vmi static IP address with different user roles. |
| 232 | [Tags] Verify_To_Delete_VMI_Static_IP_Address_With_Different_User_Roles |
| 233 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 234 | [Template] Delete VMI Static IP Address Using Different Users |
| 235 | [Teardown] Delete BMC Users Using Redfish |
| 236 | |
| 237 | # username password valid_status_code |
| 238 | admin_user TestPwd123 ${HTTP_ACCEPTED} |
| 239 | operator_user TestPwd123 ${HTTP_FORBIDDEN} |
| 240 | readonly_user TestPwd123 ${HTTP_FORBIDDEN} |
| 241 | noaccess_user TestPwd123 ${HTTP_FORBIDDEN} |
| 242 | |
| 243 | |
| 244 | Verify To Update VMI Static IP Address With Different User Roles |
| 245 | [Documentation] Verify to update vmi static IP address with different user roles. |
| 246 | [Tags] Verify_To_Update_VMI_Static_IP_Address_With_Different_User_Roles_And_Verify |
| 247 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 248 | [Template] Config VMI Static IP Address Using Different Users |
| 249 | [Teardown] Delete BMC Users Using Redfish |
| 250 | |
| 251 | # username password ip_address gateway nemask valid_status_code |
| 252 | admin_user TestPwd123 10.5.10.20 0.0.0.0 255.255.0.0 ${HTTP_ACCEPTED} |
| 253 | operator_user TestPwd123 10.5.10.30 0.0.0.0 255.255.0.0 ${HTTP_FORBIDDEN} |
| 254 | readonly_user TestPwd123 10.5.20.40 0.0.0.0 255.255.0.0 ${HTTP_FORBIDDEN} |
| 255 | noaccess_user TestPwd123 10.5.30.50 0.0.0.0 255.255.0.0 ${HTTP_FORBIDDEN} |
| 256 | |
| 257 | |
| 258 | Verify To Read VMI Network Configuration With Different User Roles |
| 259 | [Documentation] Verify to read vmi network configuration with different user roles. |
| 260 | [Tags] Verify_To_Read_VMI_Network_Configuration_Via_Different_User_Roles |
| 261 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 262 | [Template] Read VMI Static IP Address Using Different Users |
| 263 | [Teardown] Delete BMC Users Using Redfish |
| 264 | |
| 265 | # username password valid_status_code |
| 266 | admin_user TestPwd123 ${HTTP_OK} |
| 267 | operator_user TestPwd123 ${HTTP_OK} |
| 268 | readonly_user TestPwd123 ${HTTP_OK} |
| 269 | noaccess_user TestPwd123 ${HTTP_FORBIDDEN} |
| 270 | |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 271 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 272 | *** Keywords *** |
| 273 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 274 | Suite Setup Execution |
| 275 | [Documentation] Do test setup execution task. |
| 276 | |
| 277 | Redfish.Login |
| 278 | Redfish Power On |
| 279 | ${active_channel_config}= Get Active Channel Config |
| 280 | Set Suite Variable ${active_channel_config} |
| 281 | ${resp}= Redfish.Get |
| 282 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 283 | ${ip_resp}= Evaluate json.loads('''${resp.text}''') json |
| 284 | ${length}= Get Length ${ip_resp["IPv4StaticAddresses"]} |
| 285 | ${vmi_network_conf}= Run Keyword If ${length} != ${0} Get VMI Network Interface Details |
| 286 | Set Suite Variable ${vmi_network_conf} |
| 287 | |
| 288 | |
| 289 | Test Teardown Execution |
| 290 | [Documentation] Do test teardown execution task. |
| 291 | |
| 292 | FFDC On Test Case Fail |
| 293 | ${curr_mode}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled |
| 294 | Run Keyword If ${curr_mode} == ${True} Set VMI IPv4 Origin ${False} |
| 295 | Run Keyword If ${vmi_network_conf} != ${None} |
| 296 | ... Verify Assigning Static IPv4 Address To VMI ${vmi_network_conf["IPv4_Address"]} |
| 297 | ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]} |
| 298 | |
| 299 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 300 | Get VMI Network Interface Details |
| 301 | [Documentation] Get VMI network interface details. |
| 302 | [Arguments] ${valid_status_code}=${HTTP_OK} |
| 303 | |
| 304 | # Description of argument(s): |
| 305 | # valid_status_code Expected valid status code from GET request. |
| 306 | |
Anves Kumar rayankula | aa33b05 | 2020-07-22 04:24:51 -0500 | [diff] [blame] | 307 | # Note: It returns a dictionary of VMI eth0 parameters. |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 308 | |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 309 | ${active_channel_config}= Get Active Channel Config |
| 310 | ${resp}= Redfish.Get |
| 311 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 312 | ... valid_status_codes=[${valid_status_code}] |
| 313 | |
| 314 | ${ip_resp}= Evaluate json.loads('''${resp.text}''') json |
| 315 | |
| 316 | ${static_exists}= Run Keyword And Ignore Error |
| 317 | ... Set Variable ${ip_resp["IPv4StaticAddresses"][0]["Address"]} |
| 318 | ${static_exists}= Set Variable If '${static_exists[0]}' == 'PASS' ${True} ${False} |
| 319 | |
| 320 | ${vmi_ip}= Create Dictionary DHCPv4=${${ip_resp["DHCPv4"]["DHCPEnabled"]}} Id=${ip_resp["Id"]} |
| 321 | ... Description=${ip_resp["Description"]} IPv4_Address=${ip_resp["IPv4Addresses"][0]["Address"]} |
| 322 | ... IPv4_AddressOrigin=${ip_resp["IPv4Addresses"][0]["AddressOrigin"]} Name=${ip_resp["Name"]} |
Sushil Singh | 810234d | 2020-05-13 12:12:03 -0500 | [diff] [blame] | 323 | ... IPv4_Gateway=${ip_resp["IPv4Addresses"][0]["Gateway"]} |
| 324 | ... InterfaceEnabled=${${ip_resp["InterfaceEnabled"]}} |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 325 | ... IPv4_SubnetMask=${ip_resp["IPv4Addresses"][0]["SubnetMask"]} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 326 | ... IPv4StaticAddresses=${${static_exists}} |
| 327 | |
| 328 | [Return] &{vmi_ip} |
| 329 | |
| 330 | |
| 331 | Get Immediate Child Parameter From VMI Network Interface |
| 332 | [Documentation] Get immediate child parameter from VMI network interface. |
| 333 | [Arguments] ${parameter} ${valid_status_code}=${HTTP_OK} |
| 334 | |
| 335 | # Description of argument(s): |
| 336 | # parameter parameter for which value is required. Ex: DHCPEnabled, MACAddress etc. |
| 337 | # valid_status_code Expected valid status code from GET request. |
| 338 | |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 339 | ${active_channel_config}= Get Active Channel Config |
| 340 | ${resp}= Redfish.Get |
| 341 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 342 | ... valid_status_codes=[${valid_status_code}] |
| 343 | |
| 344 | ${ip_resp}= Evaluate json.loads('''${resp.text}''') json |
| 345 | ${value}= Set Variable If '${parameter}' != 'DHCPEnabled' ${ip_resp["${parameter}"]} |
| 346 | ... ${ip_resp["DHCPv4"]["${parameter}"]} |
| 347 | |
| 348 | [Return] ${value} |
| 349 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 350 | Verify VMI EthernetInterfaces |
| 351 | [Documentation] Verify VMI ethernet interfaces. |
| 352 | [Arguments] ${valid_status_code}=${HTTP_OK} |
| 353 | |
| 354 | # Description of argument(s): |
| 355 | # valid_status_code Expected valid status code from GET request. |
| 356 | |
| 357 | ${resp}= Redfish.Get /redfish/v1/Systems/hypervisor/EthernetInterfaces |
| 358 | ... valid_status_codes=[${valid_status_code}] |
| 359 | |
| 360 | ${resp}= Evaluate json.loads('''${resp.text}''') json |
| 361 | ${interfaces}= Set Variable ${resp["Members"]} |
| 362 | |
| 363 | Should Be Equal As Strings ${interfaces[0]}[@odata.id] |
Anves Kumar rayankula | aa33b05 | 2020-07-22 04:24:51 -0500 | [diff] [blame] | 364 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/eth0 |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 365 | Should Be Equal As Strings ${interfaces[1]}[@odata.id] |
Anves Kumar rayankula | aa33b05 | 2020-07-22 04:24:51 -0500 | [diff] [blame] | 366 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/eth1 |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 367 | |
| 368 | Should Be Equal ${resp["Members@odata.count"]} ${2} |
| 369 | |
| 370 | |
| 371 | Verify VMI Network Interface Details |
| 372 | [Documentation] Verify VMI network interface details. |
| 373 | [Arguments] ${ip} ${origin} ${gateway} ${netmask} |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 374 | ... ${valid_status_code}=${HTTP_OK} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 375 | |
| 376 | # Description of argument(s): |
| 377 | # ip VMI IPv4 address. |
| 378 | # origin Origin of IPv4 address eg. Static or DHCP. |
| 379 | # gateway Gateway for VMI IP. |
| 380 | # netmask Subnetmask for VMI IP. |
| 381 | # valid_status_code Expected valid status code from GET request. Default is HTTP_OK. |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 382 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 383 | Run Keywords Redfish Power Off AND Redfish Power On |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 384 | ${vmi_ip}= Get VMI Network Interface Details ${valid_status_code} |
| 385 | Should Be Equal As Strings ${origin} ${vmi_ip["IPv4_AddressOrigin"]} |
| 386 | Should Be Equal As Strings ${gateway} ${vmi_ip["IPv4_Gateway"]} |
| 387 | Should Be Equal As Strings ${netmask} ${vmi_ip["IPv4_SubnetMask"]} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 388 | Should Be Equal As Strings ${ip} ${vmi_ip["IPv4_Address"]} |
| 389 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 390 | Set Static IPv4 Address To VMI |
| 391 | [Documentation] Set static IPv4 address to VMI. |
| 392 | [Arguments] ${ip} ${gateway} ${netmask} ${valid_status_code}=${HTTP_ACCEPTED} |
| 393 | |
| 394 | # Description of argument(s): |
| 395 | # ip VMI IPv4 address. |
| 396 | # gateway Gateway for VMI IP. |
| 397 | # netmask Subnetmask for VMI IP. |
| 398 | # valid_status_code Expected valid status code from GET request. Default is HTTP_ACCEPTED. |
| 399 | |
| 400 | ${data}= Set Variable |
| 401 | ... {"IPv4StaticAddresses": [{"Address": "${ip}","SubnetMask": "${netmask}","Gateway": "${gateway}"}]} |
| 402 | |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 403 | ${active_channel_config}= Get Active Channel Config |
| 404 | ${resp}= Redfish.Patch |
| 405 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 406 | ... body=${data} valid_status_codes=[${valid_status_code}] |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 407 | Log To Console ${resp.text} |
| 408 | |
| 409 | |
| 410 | Verify Assigning Static IPv4 Address To VMI |
| 411 | [Documentation] Verify assigning static IPv4 address to VMI. |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 412 | [Arguments] ${ip} ${gateway} ${netmask} ${valid_status_code}=${HTTP_ACCEPTED} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 413 | |
| 414 | # Description of argument(s): |
| 415 | # ip VMI IPv4 address. |
| 416 | # gateway Gateway for VMI IP. |
| 417 | # netmask Subnetmask for VMI IP. |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 418 | # valid_status_code Expected valid status code from GET request. Default is HTTP_ACCEPTED. |
| 419 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 420 | |
| 421 | Set Static IPv4 Address To VMI ${ip} ${gateway} ${netmask} valid_status_code=${valid_status_code} |
| 422 | Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED} |
| 423 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 424 | Verify VMI Network Interface Details ${ip} Static ${gateway} ${netmask} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 425 | |
| 426 | |
| 427 | Delete VMI IPv4 Address |
| 428 | [Documentation] Delete VMI IPv4 address. |
| 429 | [Arguments] ${delete_param}=IPv4StaticAddresses ${valid_status_code}=${HTTP_ACCEPTED} |
| 430 | |
| 431 | # Description of argument(s): |
| 432 | # delete_param Parameter to be deleted eg. IPv4StaticAddresses or IPv4Addresses. |
| 433 | # Default is IPv4StaticAddresses. |
| 434 | # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK. |
| 435 | |
| 436 | ${data}= Set Variable {"${delete_param}": [${Null}]} |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 437 | ${active_channel_config}= Get Active Channel Config |
| 438 | ${resp}= Redfish.Patch |
| 439 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 440 | ... body=${data} valid_status_codes=[${valid_status_code}] |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 441 | |
| 442 | |
| 443 | Set VMI IPv4 Origin |
| 444 | [Documentation] Set VMI IPv4 origin. |
| 445 | [Arguments] ${dhcp_enabled}=${False} ${valid_status_code}=${HTTP_ACCEPTED} |
| 446 | |
| 447 | # Description of argument(s): |
| 448 | # dhcp_enabled True if user wants to enable DHCP. Default is Static, hence value is set to False. |
| 449 | # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK. |
| 450 | |
| 451 | ${data}= Set Variable If ${dhcp_enabled} == ${False} ${DISABLE_DHCP} ${ENABLE_DHCP} |
Anves Kumar rayankula | aa33b05 | 2020-07-22 04:24:51 -0500 | [diff] [blame] | 452 | ${resp}= Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/eth0 body=${data} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 453 | ... valid_status_codes=[${valid_status_code}] |
| 454 | |
| 455 | |
| 456 | Switch VMI IPv4 Origin And Verify Details |
| 457 | [Documentation] Switch VMI IPv4 origin and verify details. |
| 458 | [Arguments] ${host_reboot}=${False} |
| 459 | |
| 460 | # Description of argument(s): |
| 461 | # host_reboot Reboot HOST if True. |
| 462 | |
| 463 | ${curr_mode}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled |
| 464 | ${dhcp_enabled}= Set Variable If ${curr_mode} == ${False} ${True} ${False} |
| 465 | |
| 466 | ${default}= Set Variable 0.0.0.0 |
| 467 | ${origin}= Set Variable If ${curr_mode} == ${False} DHCP Static |
| 468 | Set VMI IPv4 Origin ${dhcp_enabled} ${HTTP_ACCEPTED} |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 469 | Verify VMI Network Interface Details ${default} ${origin} ${default} ${default} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 470 | |
| 471 | [Return] ${origin} |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 472 | |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 473 | |
| 474 | Delete VMI Static IP Address Using Different Users |
| 475 | [Documentation] Update user role and delete vmi static IP address. |
| 476 | [Arguments] ${username} ${password} ${valid_status_code} |
| 477 | [Teardown] Run Keywords Redfish.Login AND |
| 478 | ... Verify Assigning Static IPv4 Address To VMI ${test_ipv4} ${test_gateway} |
| 479 | ... ${test_netmask} ${HTTP_ACCEPTED} AND Redfish.Logout |
| 480 | |
| 481 | # Description of argument(s): |
| 482 | # username The host username. |
| 483 | # password The host password. |
| 484 | # valid_status_code The expected valid status code. |
| 485 | |
| 486 | Redfish.Login ${username} ${password} |
| 487 | Delete VMI IPv4 Address delete_param=IPv4StaticAddresses valid_status_code=${valid_status_code} |
| 488 | Redfish.Logout |
| 489 | |
| 490 | |
| 491 | Config VMI Static IP Address Using Different Users |
| 492 | [Documentation] Update user role and update vmi static ip address. |
| 493 | [Arguments] ${username} ${password} ${ip} ${gateway} ${netmask} |
| 494 | ... ${valid_status_code} |
| 495 | |
| 496 | # Description of argument(s): |
| 497 | # username The host username. |
| 498 | # password The host password. |
| 499 | # ip IP address to be added (e.g. "10.7.7.7"). |
| 500 | # subnet_mask Subnet mask for the IP to be added |
| 501 | # (e.g. "255.255.0.0"). |
| 502 | # gateway Gateway for the IP to be added (e.g. "10.7.7.1"). |
| 503 | # valid_status_code The expected valid status code. |
| 504 | |
| 505 | Redfish.Login ${username} ${password} |
| 506 | Verify Assigning Static IPv4 Address To VMI ${ip} ${gateway} ${netmask} ${valid_status_code} |
| 507 | Redfish.Logout |
| 508 | |
| 509 | |
| 510 | Read VMI Static IP Address Using Different Users |
| 511 | [Documentation] Update user role and read vmi static ip address. |
| 512 | [Arguments] ${username} ${password} ${valid_status_code} |
| 513 | |
| 514 | # Description of argument(s): |
| 515 | # username The host username. |
| 516 | # password The host password. |
| 517 | # valid_status_code The expected valid status code. |
| 518 | |
| 519 | Redfish.Login ${username} ${password} |
| 520 | Redfish.Get |
| 521 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 522 | ... valid_status_codes=[${valid_status_code}] |
| 523 | Redfish.Logout |
| 524 | |
| 525 | |
| 526 | Delete BMC Users Using Redfish |
| 527 | [Documentation] Delete BMC users via redfish. |
| 528 | |
| 529 | Redfish.Login |
| 530 | Delete BMC Users Via Redfish users=${USERS} |