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