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 | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 8 | Library ../../lib/bmc_network_utils.py |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 9 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 10 | Suite Setup Suite Setup Execution |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 11 | Test Teardown FFDC On Test Case Fail |
| 12 | Suite Teardown Redfish.Logout |
| 13 | |
| 14 | *** Variables *** |
| 15 | |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 16 | ${test_ipv4} 10.10.20.30 |
| 17 | ${test_gateway} 0.0.0.0 |
| 18 | ${test_netmask} 255.255.252.0 |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 19 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 20 | &{DHCP_ENABLED} DHCPEnabled=${${True}} |
| 21 | &{DHCP_DISABLED} DHCPEnabled=${${False}} |
| 22 | |
| 23 | &{ENABLE_DHCP} DHCPv4=&{DHCP_ENABLED} |
| 24 | &{DISABLE_DHCP} DHCPv4=&{DHCP_DISABLED} |
| 25 | |
| 26 | |
| 27 | *** Test Cases *** |
| 28 | |
| 29 | Verify All VMI EthernetInterfaces |
| 30 | [Documentation] Verify all VMI ethernet interfaces. |
| 31 | [Tags] Verify_All_VMI_EthernetINterfaces |
| 32 | |
| 33 | Verify VMI EthernetInterfaces |
| 34 | |
| 35 | |
| 36 | Verify Existing VMI Network Interface Details |
| 37 | [Documentation] Verify existing VMI network interface details. |
| 38 | [Tags] Verify_VMI_Network_Interface_Details |
| 39 | |
| 40 | ${vmi_ip}= Get VMI Network Interface Details |
| 41 | ${origin}= Set Variable If ${vmi_ip["DHCPv4"]} == ${False} Static DHCP |
| 42 | |
| 43 | Should Not Be Equal ${vmi_ip["DHCPv4"]} ${vmi_ip["IPv4StaticAddresses"]} |
| 44 | Should Be Equal As Strings ${origin} ${vmi_ip["IPv4_AddressOrigin"]} |
| 45 | Should Be Equal As Strings ${vmi_ip["Id"]} intf0 |
George Keishing | b3ea095 | 2020-07-01 05:03:56 -0500 | [diff] [blame] | 46 | Should Be Equal As Strings ${vmi_ip["Description"]} |
| 47 | ... Ethernet Interface for Virtual Management Interface |
| 48 | Should Be Equal As Strings ${vmi_ip["Name"]} Virtual Management Interface |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 49 | Should Be True ${vmi_ip["InterfaceEnabled"]} |
| 50 | |
| 51 | |
| 52 | Delete Existing Static VMI IP Address |
| 53 | [Documentation] Delete existing static VMI IP address. |
| 54 | [Tags] Delete_Existing_Static_VMI_IP_Address |
| 55 | |
| 56 | ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled |
| 57 | Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED} |
| 58 | |
| 59 | Delete VMI IPv4 Address IPv4StaticAddresses valid_status_code=${HTTP_ACCEPTED} |
| 60 | ${default}= Set Variable 0.0.0.0 |
| 61 | Verify VMI Network Interface Details ${default} Static ${default} ${default} ${True} |
| 62 | |
| 63 | |
| 64 | Verify User Cannot Delete ReadOnly Property IPv4Addresses |
| 65 | [Documentation] Verify user cannot delete readonly property IPv4Addresses. |
| 66 | [Tags] Verify_User_Cannot_Delete_ReadOnly_Property_IPv4Addresses |
| 67 | |
| 68 | ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled |
| 69 | Run Keyword If ${curr_origin} == ${False} Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED} |
| 70 | Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_BAD_REQUEST} |
| 71 | |
| 72 | |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 73 | Assign Valid And Invalid Static IPv4 Address To VMI |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 74 | [Documentation] Assign static IPv4 address to VMI. |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 75 | [Tags] Assign_Valid_And_Invalid_Static_IPv4_Address_To_VMI |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 76 | [Template] Verify Assigning Static IPv4 Address To VMI |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 77 | [Teardown] Run keywords Delete VMI IPv4 Address IPv4Addresses |
| 78 | ... AND Test Teardown Execution |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 79 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 80 | # ip gateway netmask valid_status_code |
| 81 | 10.5.20.30 0.0.0.0 255.255.252.0 ${HTTP_ACCEPTED} |
| 82 | a.3.118.94 0.0.0.0 255.255.252.0 ${HTTP_BAD_REQUEST} |
| 83 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 84 | |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 85 | Add Multiple IP Addreses On VMI Interface And Verify |
| 86 | [Documentation] Add multiple IP addreses on VMI interface and verify. |
| 87 | [Tags] Add_Multiple_IP_Addreses_On_VMI_Interface_And_Verify |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 88 | [Teardown] Run keywords Delete VMI IPv4 Address IPv4Addresses |
| 89 | ... AND Test Teardown Execution |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 90 | |
| 91 | ${ip1}= Create dictionary Address=10.5.5.10 SubnetMask=255.255.252.0 Gateway=0.0.0.0 |
| 92 | ${ip2}= Create dictionary Address=10.5.5.11 SubnetMask=255.255.252.0 Gateway=0.0.0.0 |
| 93 | ${ip3}= Create dictionary Address=10.5.5.12 SubnetMask=255.255.252.0 Gateway=0.0.0.0 |
| 94 | ${ips}= Create List ${ip1} ${ip2} ${ip3} |
| 95 | |
| 96 | ${active_channel_config}= Get Active Channel Config |
| 97 | Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 98 | ... body={'IPv4StaticAddresses':${ips}} valid_status_codes=[${HTTP_ACCEPTED}] |
| 99 | Verify VMI Network Interface Details ${ip1["Address"]} Static ${ip1["Gateway"]} ${ip1["SubnetMask"]} ${True} |
| 100 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 101 | |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 102 | Modify IP Addresses On VMI Interface And Verify |
| 103 | [Documentation] Modify IP addresses on VMI interface and verify. |
| 104 | [Tags] Modify_IP_Addresses_On_VMI_Interface_And_Verify |
| 105 | [Template] Verify Assigning Static IPv4 Address To VMI |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 106 | [Teardown] Run keywords Delete VMI IPv4 Address IPv4Addresses |
| 107 | ... AND Test Teardown Execution |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 108 | |
| 109 | # ip gateway netmask del_curr_ip host_reboot valid_status_code |
| 110 | 10.5.5.10 0.0.0.0 255.255.252.0 ${False} ${True} ${HTTP_ACCEPTED} |
| 111 | 10.5.5.11 0.0.0.0 255.255.252.0 ${False} ${True} ${HTTP_ACCEPTED} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 112 | |
| 113 | Switch Between IP Origins On VMI And Verify Details |
| 114 | [Documentation] Switch between IP origins on VMI and verify details. |
| 115 | [Tags] Switch_Between_IP_Origins_On_VMI_And_Verify_Details |
| 116 | |
| 117 | Switch VMI IPv4 Origin And Verify Details |
| 118 | Switch VMI IPv4 Origin And Verify Details |
| 119 | |
| 120 | |
| 121 | Verify Persistency Of VMI IPv4 Details After Host Reboot |
| 122 | [Documentation] Verify persistency of VMI IPv4 details after host reboot. |
| 123 | [Tags] Verify_Persistency_Of_VMI_IPv4_Details_After_Host_Reboot |
| 124 | |
| 125 | # Verifying persistency of dynamic address. |
| 126 | Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED} |
| 127 | ${default}= Set Variable 0.0.0.0 |
| 128 | Verify VMI Network Interface Details ${default} DHCP ${default} ${default} ${True} |
| 129 | Verify VMI Network Interface Details ${default} DHCP ${default} ${default} ${True} |
| 130 | |
| 131 | # Verifying persistency of static address. |
| 132 | Switch VMI IPv4 Origin And Verify Details ${True} |
| 133 | Verify Assigning Static IPv4 Address To VMI ${VMI_IP} ${VMI_GATEWAY} ${VMI_NETMASK} ${False} |
| 134 | Verify VMI Network Interface Details ${VMI_IP} Static ${VMI_GATEWAY} ${VMI_NETMASK} ${True} |
| 135 | |
| 136 | |
Anves Kumar rayankula | 9fa524a | 2020-08-18 06:40:18 -0500 | [diff] [blame] | 137 | Delete VMI Static IP Address And Verify |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 138 | [Documentation] Delete VMI static IP address and verify. |
| 139 | [Tags] Delete_VMI_Static_IP_Address_And_Verify |
| 140 | [Teardown] Test Teardown Execution |
Anves Kumar rayankula | 9fa524a | 2020-08-18 06:40:18 -0500 | [diff] [blame] | 141 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 142 | Verify Assigning Static IPv4 Address To VMI ${test_ipv4} ${test_gateway} ${test_netmask} |
| 143 | Delete VMI IPv4 Address IPv4Addresses ${HTTP_ACCEPTED} |
| 144 | ${active_channel_config}= Get Active Channel Config |
| 145 | ${resp}= Redfish.Get |
| 146 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 147 | Should Be Empty ${resp.dict["IPv4Addresses"]} |
| 148 | |
Anves Kumar rayankula | 9fa524a | 2020-08-18 06:40:18 -0500 | [diff] [blame] | 149 | |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 150 | Verify Successful VMI IP Static Configuration On HOST Boot After Session Delete |
| 151 | [Documentation] Verify VMI IP static Configuration On HOST Boot After session deleted. |
| 152 | [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] | 153 | [Teardown] Run keywords Delete VMI IPv4 Address IPv4Addresses AND Test Teardown Execution |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 154 | |
| 155 | Set Static IPv4 Address To VMI ${test_ipv4} ${test_gateway} ${test_netmask} |
| 156 | |
| 157 | ${session_info}= Get Redfish Session Info |
| 158 | Redfish.Delete ${session_info["location"]} |
| 159 | |
| 160 | # Create a new Redfish session |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 161 | Redfish Power Off |
| 162 | Redfish Power On |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 163 | |
| 164 | Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask} |
| 165 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 166 | |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 167 | Verify Persistency Of VMI DHCP IP Configuration After Multiple HOST Reboots |
| 168 | [Documentation] Verify Persistency Of VMI DHCP IP configuration After Multiple HOST Reboots |
| 169 | [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] | 170 | [Teardown] Test Teardown Execution |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 171 | |
| 172 | ${LOOP_COUNT}= Set Variable ${3} |
| 173 | Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED} |
| 174 | Run Keywords Redfish Power Off AND Redfish Power On |
| 175 | ${vmi_ip_config}= Get VMI Network Interface Details |
| 176 | # Verifying persistency of dynamic address after multiple reboots. |
| 177 | Repeat Keyword ${LOOP_COUNT} times |
| 178 | ... 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] | 179 | ... ${vmi_ip_config["IPv4_SubnetMask"]} |
| 180 | |
| 181 | |
| 182 | Enable DHCP When Static IP Configured And Verify Static IP |
| 183 | [Documentation] Enable DHCP when static ip configured and verify static ip |
| 184 | [Tags] Enable_DHCP_when_Static_IP_Configured_And_Verify_Static_IP |
| 185 | [Teardown] Test Teardown Execution |
| 186 | |
| 187 | Verify Assigning Static IPv4 Address To VMI ${test_ipv4} ${test_gateway} ${test_netmask} |
| 188 | Set VMI IPv4 Origin ${True} |
| 189 | Redfish Power Off |
| 190 | Redfish Power On |
| 191 | ${vmi_network_conf}= Get VMI Network Interface Details |
| 192 | Should Not Be Equal As Strings ${test_ipv4} ${vmi_network_conf["IPv4_Address"]} |
| 193 | |
Anves Kumar rayankula | 9fa524a | 2020-08-18 06:40:18 -0500 | [diff] [blame] | 194 | |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 195 | Verify VMI Static IP Configuration Persist On BMC Reset Before Host Boot |
| 196 | [Documentation] Verify VMI static IP configuration persist on BMC reset. |
| 197 | [Tags] Verify_VMI_Static_IP_Configuration_Persist_On_BMC_Reset_Before_Host_Boot |
shrsuman123 | 5897ea7 | 2020-09-24 00:30:15 -0500 | [diff] [blame] | 198 | [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] | 199 | |
| 200 | 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] | 201 | OBMC Reboot (off) |
| 202 | Redfish Power On |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 203 | # Verifying the VMI static configuration |
| 204 | Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask} |
| 205 | |
| 206 | |
| 207 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 208 | *** Keywords *** |
| 209 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 210 | Suite Setup Execution |
| 211 | [Documentation] Do test setup execution task. |
| 212 | |
| 213 | Redfish.Login |
| 214 | Redfish Power On |
| 215 | ${active_channel_config}= Get Active Channel Config |
| 216 | Set Suite Variable ${active_channel_config} |
| 217 | ${resp}= Redfish.Get |
| 218 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 219 | ${ip_resp}= Evaluate json.loads('''${resp.text}''') json |
| 220 | ${length}= Get Length ${ip_resp["IPv4StaticAddresses"]} |
| 221 | ${vmi_network_conf}= Run Keyword If ${length} != ${0} Get VMI Network Interface Details |
| 222 | Set Suite Variable ${vmi_network_conf} |
| 223 | |
| 224 | |
| 225 | Test Teardown Execution |
| 226 | [Documentation] Do test teardown execution task. |
| 227 | |
| 228 | FFDC On Test Case Fail |
| 229 | ${curr_mode}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled |
| 230 | Run Keyword If ${curr_mode} == ${True} Set VMI IPv4 Origin ${False} |
| 231 | Run Keyword If ${vmi_network_conf} != ${None} |
| 232 | ... Verify Assigning Static IPv4 Address To VMI ${vmi_network_conf["IPv4_Address"]} |
| 233 | ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]} |
| 234 | |
| 235 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 236 | Get VMI Network Interface Details |
| 237 | [Documentation] Get VMI network interface details. |
| 238 | [Arguments] ${valid_status_code}=${HTTP_OK} |
| 239 | |
| 240 | # Description of argument(s): |
| 241 | # valid_status_code Expected valid status code from GET request. |
| 242 | |
Anves Kumar rayankula | aa33b05 | 2020-07-22 04:24:51 -0500 | [diff] [blame] | 243 | # Note: It returns a dictionary of VMI eth0 parameters. |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 244 | |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 245 | ${active_channel_config}= Get Active Channel Config |
| 246 | ${resp}= Redfish.Get |
| 247 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 248 | ... valid_status_codes=[${valid_status_code}] |
| 249 | |
| 250 | ${ip_resp}= Evaluate json.loads('''${resp.text}''') json |
| 251 | |
| 252 | ${static_exists}= Run Keyword And Ignore Error |
| 253 | ... Set Variable ${ip_resp["IPv4StaticAddresses"][0]["Address"]} |
| 254 | ${static_exists}= Set Variable If '${static_exists[0]}' == 'PASS' ${True} ${False} |
| 255 | |
| 256 | ${vmi_ip}= Create Dictionary DHCPv4=${${ip_resp["DHCPv4"]["DHCPEnabled"]}} Id=${ip_resp["Id"]} |
| 257 | ... Description=${ip_resp["Description"]} IPv4_Address=${ip_resp["IPv4Addresses"][0]["Address"]} |
| 258 | ... IPv4_AddressOrigin=${ip_resp["IPv4Addresses"][0]["AddressOrigin"]} Name=${ip_resp["Name"]} |
Sushil Singh | 810234d | 2020-05-13 12:12:03 -0500 | [diff] [blame] | 259 | ... IPv4_Gateway=${ip_resp["IPv4Addresses"][0]["Gateway"]} |
| 260 | ... InterfaceEnabled=${${ip_resp["InterfaceEnabled"]}} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 261 | ... IPv4_SubnetMask=${ip_resp["IPv4Addresses"][0]["SubnetMask"]} MACAddress=${ip_resp["MACAddress"]} |
| 262 | ... IPv4StaticAddresses=${${static_exists}} |
| 263 | |
| 264 | [Return] &{vmi_ip} |
| 265 | |
| 266 | |
| 267 | Get Immediate Child Parameter From VMI Network Interface |
| 268 | [Documentation] Get immediate child parameter from VMI network interface. |
| 269 | [Arguments] ${parameter} ${valid_status_code}=${HTTP_OK} |
| 270 | |
| 271 | # Description of argument(s): |
| 272 | # parameter parameter for which value is required. Ex: DHCPEnabled, MACAddress etc. |
| 273 | # valid_status_code Expected valid status code from GET request. |
| 274 | |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 275 | ${active_channel_config}= Get Active Channel Config |
| 276 | ${resp}= Redfish.Get |
| 277 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 278 | ... valid_status_codes=[${valid_status_code}] |
| 279 | |
| 280 | ${ip_resp}= Evaluate json.loads('''${resp.text}''') json |
| 281 | ${value}= Set Variable If '${parameter}' != 'DHCPEnabled' ${ip_resp["${parameter}"]} |
| 282 | ... ${ip_resp["DHCPv4"]["${parameter}"]} |
| 283 | |
| 284 | [Return] ${value} |
| 285 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 286 | Verify VMI EthernetInterfaces |
| 287 | [Documentation] Verify VMI ethernet interfaces. |
| 288 | [Arguments] ${valid_status_code}=${HTTP_OK} |
| 289 | |
| 290 | # Description of argument(s): |
| 291 | # valid_status_code Expected valid status code from GET request. |
| 292 | |
| 293 | ${resp}= Redfish.Get /redfish/v1/Systems/hypervisor/EthernetInterfaces |
| 294 | ... valid_status_codes=[${valid_status_code}] |
| 295 | |
| 296 | ${resp}= Evaluate json.loads('''${resp.text}''') json |
| 297 | ${interfaces}= Set Variable ${resp["Members"]} |
| 298 | |
| 299 | Should Be Equal As Strings ${interfaces[0]}[@odata.id] |
Anves Kumar rayankula | aa33b05 | 2020-07-22 04:24:51 -0500 | [diff] [blame] | 300 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/eth0 |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 301 | Should Be Equal As Strings ${interfaces[1]}[@odata.id] |
Anves Kumar rayankula | aa33b05 | 2020-07-22 04:24:51 -0500 | [diff] [blame] | 302 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/eth1 |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 303 | |
| 304 | Should Be Equal ${resp["Members@odata.count"]} ${2} |
| 305 | |
| 306 | |
| 307 | Verify VMI Network Interface Details |
| 308 | [Documentation] Verify VMI network interface details. |
| 309 | [Arguments] ${ip} ${origin} ${gateway} ${netmask} |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 310 | ... ${valid_status_code}=${HTTP_OK} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 311 | |
| 312 | # Description of argument(s): |
| 313 | # ip VMI IPv4 address. |
| 314 | # origin Origin of IPv4 address eg. Static or DHCP. |
| 315 | # gateway Gateway for VMI IP. |
| 316 | # netmask Subnetmask for VMI IP. |
| 317 | # 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] | 318 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 319 | Run Keywords Redfish Power Off AND Redfish Power On |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 320 | ${vmi_ip}= Get VMI Network Interface Details ${valid_status_code} |
| 321 | Should Be Equal As Strings ${origin} ${vmi_ip["IPv4_AddressOrigin"]} |
| 322 | Should Be Equal As Strings ${gateway} ${vmi_ip["IPv4_Gateway"]} |
| 323 | Should Be Equal As Strings ${netmask} ${vmi_ip["IPv4_SubnetMask"]} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 324 | Should Be Equal As Strings ${ip} ${vmi_ip["IPv4_Address"]} |
| 325 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 326 | Set Static IPv4 Address To VMI |
| 327 | [Documentation] Set static IPv4 address to VMI. |
| 328 | [Arguments] ${ip} ${gateway} ${netmask} ${valid_status_code}=${HTTP_ACCEPTED} |
| 329 | |
| 330 | # Description of argument(s): |
| 331 | # ip VMI IPv4 address. |
| 332 | # gateway Gateway for VMI IP. |
| 333 | # netmask Subnetmask for VMI IP. |
| 334 | # valid_status_code Expected valid status code from GET request. Default is HTTP_ACCEPTED. |
| 335 | |
| 336 | ${data}= Set Variable |
| 337 | ... {"IPv4StaticAddresses": [{"Address": "${ip}","SubnetMask": "${netmask}","Gateway": "${gateway}"}]} |
| 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.Patch |
| 341 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 342 | ... body=${data} valid_status_codes=[${valid_status_code}] |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 343 | Log To Console ${resp.text} |
| 344 | |
| 345 | |
| 346 | Verify Assigning Static IPv4 Address To VMI |
| 347 | [Documentation] Verify assigning static IPv4 address to VMI. |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 348 | [Arguments] ${ip} ${gateway} ${netmask} ${valid_status_code}=${HTTP_ACCEPTED} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 349 | |
| 350 | # Description of argument(s): |
| 351 | # ip VMI IPv4 address. |
| 352 | # gateway Gateway for VMI IP. |
| 353 | # netmask Subnetmask for VMI IP. |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 354 | # valid_status_code Expected valid status code from GET request. Default is HTTP_ACCEPTED. |
| 355 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 356 | |
| 357 | Set Static IPv4 Address To VMI ${ip} ${gateway} ${netmask} valid_status_code=${valid_status_code} |
| 358 | Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED} |
| 359 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 360 | Verify VMI Network Interface Details ${ip} Static ${gateway} ${netmask} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 361 | |
| 362 | |
| 363 | Delete VMI IPv4 Address |
| 364 | [Documentation] Delete VMI IPv4 address. |
| 365 | [Arguments] ${delete_param}=IPv4StaticAddresses ${valid_status_code}=${HTTP_ACCEPTED} |
| 366 | |
| 367 | # Description of argument(s): |
| 368 | # delete_param Parameter to be deleted eg. IPv4StaticAddresses or IPv4Addresses. |
| 369 | # Default is IPv4StaticAddresses. |
| 370 | # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK. |
| 371 | |
| 372 | ${data}= Set Variable {"${delete_param}": [${Null}]} |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 373 | ${active_channel_config}= Get Active Channel Config |
| 374 | ${resp}= Redfish.Patch |
| 375 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 376 | ... body=${data} valid_status_codes=[${valid_status_code}] |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 377 | |
| 378 | |
| 379 | Set VMI IPv4 Origin |
| 380 | [Documentation] Set VMI IPv4 origin. |
| 381 | [Arguments] ${dhcp_enabled}=${False} ${valid_status_code}=${HTTP_ACCEPTED} |
| 382 | |
| 383 | # Description of argument(s): |
| 384 | # dhcp_enabled True if user wants to enable DHCP. Default is Static, hence value is set to False. |
| 385 | # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK. |
| 386 | |
| 387 | ${data}= Set Variable If ${dhcp_enabled} == ${False} ${DISABLE_DHCP} ${ENABLE_DHCP} |
Anves Kumar rayankula | aa33b05 | 2020-07-22 04:24:51 -0500 | [diff] [blame] | 388 | ${resp}= Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/eth0 body=${data} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 389 | ... valid_status_codes=[${valid_status_code}] |
| 390 | |
| 391 | |
| 392 | Switch VMI IPv4 Origin And Verify Details |
| 393 | [Documentation] Switch VMI IPv4 origin and verify details. |
| 394 | [Arguments] ${host_reboot}=${False} |
| 395 | |
| 396 | # Description of argument(s): |
| 397 | # host_reboot Reboot HOST if True. |
| 398 | |
| 399 | ${curr_mode}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled |
| 400 | ${dhcp_enabled}= Set Variable If ${curr_mode} == ${False} ${True} ${False} |
| 401 | |
| 402 | ${default}= Set Variable 0.0.0.0 |
| 403 | ${origin}= Set Variable If ${curr_mode} == ${False} DHCP Static |
| 404 | Set VMI IPv4 Origin ${dhcp_enabled} ${HTTP_ACCEPTED} |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 405 | Verify VMI Network Interface Details ${default} ${origin} ${default} ${default} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 406 | |
| 407 | [Return] ${origin} |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 408 | |