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 |
shrsuman123 | 75e7706 | 2020-09-18 01:08:45 -0500 | [diff] [blame] | 9 | Resource ../../lib/state_manager.robot |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 10 | Library ../../lib/bmc_network_utils.py |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 11 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 12 | Suite Setup Suite Setup Execution |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 13 | Test Teardown FFDC On Test Case Fail |
| 14 | Suite Teardown Redfish.Logout |
| 15 | |
| 16 | *** Variables *** |
| 17 | |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 18 | # users User Name password |
| 19 | @{ADMIN} admin_user TestPwd123 |
| 20 | @{OPERATOR} operator_user TestPwd123 |
| 21 | @{ReadOnly} readonly_user TestPwd123 |
| 22 | @{NoAccess} noaccess_user TestPwd123 |
| 23 | &{USERS} Administrator=${ADMIN} Operator=${OPERATOR} ReadOnly=${ReadOnly} |
| 24 | ... NoAccess=${NoAccess} |
| 25 | |
Prashanth Katti | 1ce6821 | 2020-11-13 00:39:03 -0600 | [diff] [blame] | 26 | ${test_ipv4} 10.6.6.6 |
| 27 | ${test_gateway} 10.6.6.1 |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 28 | ${test_netmask} 255.255.252.0 |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 29 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 30 | &{DHCP_ENABLED} DHCPEnabled=${${True}} |
| 31 | &{DHCP_DISABLED} DHCPEnabled=${${False}} |
| 32 | |
| 33 | &{ENABLE_DHCP} DHCPv4=&{DHCP_ENABLED} |
| 34 | &{DISABLE_DHCP} DHCPv4=&{DHCP_DISABLED} |
Prashanth Katti | 1ce6821 | 2020-11-13 00:39:03 -0600 | [diff] [blame] | 35 | ${wait_time} 10s |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 36 | |
| 37 | |
| 38 | *** Test Cases *** |
| 39 | |
| 40 | Verify All VMI EthernetInterfaces |
| 41 | [Documentation] Verify all VMI ethernet interfaces. |
shrsuman123 | 5c7e4d7 | 2021-04-16 05:42:57 -0500 | [diff] [blame] | 42 | [Tags] Verify_All_VMI_EthernetInterfaces |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 43 | |
| 44 | Verify VMI EthernetInterfaces |
| 45 | |
| 46 | |
| 47 | Verify Existing VMI Network Interface Details |
| 48 | [Documentation] Verify existing VMI network interface details. |
shrsuman123 | 5c7e4d7 | 2021-04-16 05:42:57 -0500 | [diff] [blame] | 49 | [Tags] Verify_Existing_VMI_Network_Interface_Details |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 50 | |
| 51 | ${vmi_ip}= Get VMI Network Interface Details |
| 52 | ${origin}= Set Variable If ${vmi_ip["DHCPv4"]} == ${False} Static DHCP |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 53 | Should Not Be Equal ${vmi_ip["DHCPv4"]} ${vmi_ip["IPv4StaticAddresses"]} |
shrsuman123 | 5c7e4d7 | 2021-04-16 05:42:57 -0500 | [diff] [blame] | 54 | Should Be Equal As Strings ${vmi_ip["Id"]} eth0 |
George Keishing | b3ea095 | 2020-07-01 05:03:56 -0500 | [diff] [blame] | 55 | Should Be Equal As Strings ${vmi_ip["Description"]} |
shrsuman123 | 5c7e4d7 | 2021-04-16 05:42:57 -0500 | [diff] [blame] | 56 | ... Hypervisor's Virtual Management Ethernet Interface |
| 57 | Should Be Equal As Strings ${vmi_ip["Name"]} Hypervisor Ethernet Interface |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 58 | Should Be True ${vmi_ip["InterfaceEnabled"]} |
shrsuman123 | 5c7e4d7 | 2021-04-16 05:42:57 -0500 | [diff] [blame] | 59 | Run Keyword If ${vmi_ip["IPv4StaticAddresses"]} != @{empty} |
| 60 | ... Verify VMI Network Interface Details ${vmi_ip["IPv4_Address"]} |
| 61 | ... ${origin} ${vmi_ip["IPv4_Gateway"]} ${vmi_ip["IPv4_SubnetMask"]} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 62 | |
| 63 | |
| 64 | Delete Existing Static VMI IP Address |
| 65 | [Documentation] Delete existing static VMI IP address. |
| 66 | [Tags] Delete_Existing_Static_VMI_IP_Address |
| 67 | |
| 68 | ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled |
| 69 | Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED} |
| 70 | |
shrsuman123 | 5c7e4d7 | 2021-04-16 05:42:57 -0500 | [diff] [blame] | 71 | Delete VMI IPv4 Address |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 72 | |
| 73 | |
| 74 | Verify User Cannot Delete ReadOnly Property IPv4Addresses |
| 75 | [Documentation] Verify user cannot delete readonly property IPv4Addresses. |
| 76 | [Tags] Verify_User_Cannot_Delete_ReadOnly_Property_IPv4Addresses |
| 77 | |
| 78 | ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled |
shrsuman123 | 5c7e4d7 | 2021-04-16 05:42:57 -0500 | [diff] [blame] | 79 | Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED} |
| 80 | Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 81 | Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_BAD_REQUEST} |
| 82 | |
| 83 | |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 84 | Assign Valid And Invalid Static IPv4 Address To VMI |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 85 | [Documentation] Assign static IPv4 address to VMI. |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 86 | [Tags] Assign_Valid_And_Invalid_Static_IPv4_Address_To_VMI |
Anves Kumar rayankula | 1b64d94 | 2020-11-17 02:44:02 -0600 | [diff] [blame] | 87 | [Template] Set Static IPv4 Address To VMI And Verify |
| 88 | [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 89 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 90 | # ip gateway netmask valid_status_code |
Shradha Suman | c7df7db | 2021-03-08 05:16:44 -0600 | [diff] [blame] | 91 | 10.5.20.30 10.5.20.1 255.255.252.0 ${HTTP_ACCEPTED} |
| 92 | a.3.118.94 10.5.20.1 255.255.252.0 ${HTTP_BAD_REQUEST} |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 93 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 94 | |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 95 | Add Multiple IP Addresses On VMI Interface And Verify |
| 96 | [Documentation] Add multiple IP addresses on VMI interface and verify. |
| 97 | [Tags] Add_Multiple_IP_Addresses_On_VMI_Interface_And_Verify |
Anves Kumar rayankula | 1b64d94 | 2020-11-17 02:44:02 -0600 | [diff] [blame] | 98 | [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 99 | |
Shradha Suman | c7df7db | 2021-03-08 05:16:44 -0600 | [diff] [blame] | 100 | ${ip1}= Create dictionary Address=10.5.5.10 SubnetMask=255.255.252.0 Gateway=10.5.5.1 |
| 101 | ${ip2}= Create dictionary Address=10.5.5.11 SubnetMask=255.255.252.0 Gateway=10.5.5.1 |
| 102 | ${ip3}= Create dictionary Address=10.5.5.12 SubnetMask=255.255.252.0 Gateway=10.5.5.1 |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 103 | ${ips}= Create List ${ip1} ${ip2} ${ip3} |
| 104 | |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 105 | Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
shrsuman123 | 993a5c9 | 2021-04-19 06:40:16 -0500 | [diff] [blame] | 106 | ... body={'IPv4StaticAddresses':${ips}} valid_status_codes=[${HTTP_BAD_REQUEST}] |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 107 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 108 | |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 109 | Modify IP Addresses On VMI Interface And Verify |
| 110 | [Documentation] Modify IP addresses on VMI interface and verify. |
| 111 | [Tags] Modify_IP_Addresses_On_VMI_Interface_And_Verify |
Anves Kumar rayankula | 1b64d94 | 2020-11-17 02:44:02 -0600 | [diff] [blame] | 112 | [Template] Set Static IPv4 Address To VMI And Verify |
| 113 | [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 114 | |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 115 | # ip gateway netmask valid_status_code |
Shradha Suman | c7df7db | 2021-03-08 05:16:44 -0600 | [diff] [blame] | 116 | 10.5.5.10 10.5.5.1 255.255.252.0 ${HTTP_ACCEPTED} |
| 117 | 10.5.5.11 10.5.5.1 255.255.252.0 ${HTTP_ACCEPTED} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 118 | |
| 119 | Switch Between IP Origins On VMI And Verify Details |
| 120 | [Documentation] Switch between IP origins on VMI and verify details. |
| 121 | [Tags] Switch_Between_IP_Origins_On_VMI_And_Verify_Details |
| 122 | |
| 123 | Switch VMI IPv4 Origin And Verify Details |
| 124 | Switch VMI IPv4 Origin And Verify Details |
| 125 | |
| 126 | |
| 127 | Verify Persistency Of VMI IPv4 Details After Host Reboot |
| 128 | [Documentation] Verify persistency of VMI IPv4 details after host reboot. |
| 129 | [Tags] Verify_Persistency_Of_VMI_IPv4_Details_After_Host_Reboot |
| 130 | |
| 131 | # Verifying persistency of dynamic address. |
| 132 | Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED} |
Anves Kumar rayankula | 7936eee | 2021-04-19 05:38:36 -0500 | [diff] [blame] | 133 | Redfish Power Off stack_mode=skip |
| 134 | Redfish Power On |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 135 | ${default}= Set Variable 0.0.0.0 |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 136 | Verify VMI Network Interface Details ${default} DHCP ${default} ${default} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 137 | |
| 138 | # Verifying persistency of static address. |
Anves Kumar rayankula | 1b64d94 | 2020-11-17 02:44:02 -0600 | [diff] [blame] | 139 | Switch VMI IPv4 Origin And Verify Details |
Anves Kumar rayankula | 7936eee | 2021-04-19 05:38:36 -0500 | [diff] [blame] | 140 | Redfish Power Off stack_mode=skip |
| 141 | Redfish Power On |
Anves Kumar rayankula | 1b64d94 | 2020-11-17 02:44:02 -0600 | [diff] [blame] | 142 | Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 143 | |
| 144 | |
Anves Kumar rayankula | 9fa524a | 2020-08-18 06:40:18 -0500 | [diff] [blame] | 145 | Delete VMI Static IP Address And Verify |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 146 | [Documentation] Delete VMI static IP address and verify. |
| 147 | [Tags] Delete_VMI_Static_IP_Address_And_Verify |
| 148 | [Teardown] Test Teardown Execution |
Anves Kumar rayankula | 9fa524a | 2020-08-18 06:40:18 -0500 | [diff] [blame] | 149 | |
Anves Kumar rayankula | 1b64d94 | 2020-11-17 02:44:02 -0600 | [diff] [blame] | 150 | Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} |
| 151 | Delete VMI IPv4 Address |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 152 | ${resp}= Redfish.Get |
| 153 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 154 | Should Be Empty ${resp.dict["IPv4Addresses"]} |
| 155 | |
Anves Kumar rayankula | 9fa524a | 2020-08-18 06:40:18 -0500 | [diff] [blame] | 156 | |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 157 | Verify Successful VMI IP Static Configuration On HOST Boot After Session Delete |
| 158 | [Documentation] Verify VMI IP static Configuration On HOST Boot After session deleted. |
| 159 | [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] | 160 | [Teardown] Run keywords Delete VMI IPv4 Address IPv4Addresses AND Test Teardown Execution |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 161 | |
shrsuman123 | 75e7706 | 2020-09-18 01:08:45 -0500 | [diff] [blame] | 162 | Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 163 | |
| 164 | ${session_info}= Get Redfish Session Info |
| 165 | Redfish.Delete ${session_info["location"]} |
| 166 | |
| 167 | # Create a new Redfish session |
shrsuman123 | 5c7e4d7 | 2021-04-16 05:42:57 -0500 | [diff] [blame] | 168 | Redfish.Login |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 169 | Redfish Power Off |
| 170 | Redfish Power On |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 171 | |
| 172 | Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask} |
| 173 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 174 | |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 175 | Verify Persistency Of VMI DHCP IP Configuration After Multiple HOST Reboots |
| 176 | [Documentation] Verify Persistency Of VMI DHCP IP configuration After Multiple HOST Reboots |
| 177 | [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] | 178 | [Teardown] Test Teardown Execution |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 179 | |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 180 | Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED} |
shrsuman123 | c1d3fe3 | 2020-09-08 05:04:07 -0500 | [diff] [blame] | 181 | ${vmi_ip_config}= Get VMI Network Interface Details |
| 182 | # Verifying persistency of dynamic address after multiple reboots. |
shrsuman123 | f559cbe | 2021-01-06 05:40:45 -0600 | [diff] [blame] | 183 | FOR ${i} IN RANGE ${2} |
| 184 | Redfish Power Off |
| 185 | Redfish Power On |
| 186 | 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] | 187 | ... ${vmi_ip_config["IPv4_SubnetMask"]} |
shrsuman123 | f559cbe | 2021-01-06 05:40:45 -0600 | [diff] [blame] | 188 | END |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 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 |
Shradha Suman | c7df7db | 2021-03-08 05:16:44 -0600 | [diff] [blame] | 194 | [Setup] Redfish Power On |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 195 | [Teardown] Test Teardown Execution |
| 196 | |
shrsuman123 | f559cbe | 2021-01-06 05:40:45 -0600 | [diff] [blame] | 197 | Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 198 | Set VMI IPv4 Origin ${True} |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 199 | ${vmi_network_conf}= Get VMI Network Interface Details |
| 200 | Should Not Be Equal As Strings ${test_ipv4} ${vmi_network_conf["IPv4_Address"]} |
| 201 | |
Anves Kumar rayankula | 9fa524a | 2020-08-18 06:40:18 -0500 | [diff] [blame] | 202 | |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 203 | Verify VMI Static IP Configuration Persist On BMC Reset Before Host Boot |
| 204 | [Documentation] Verify VMI static IP configuration persist on BMC reset. |
| 205 | [Tags] Verify_VMI_Static_IP_Configuration_Persist_On_BMC_Reset_Before_Host_Boot |
Anves Kumar rayankula | 1b64d94 | 2020-11-17 02:44:02 -0600 | [diff] [blame] | 206 | [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 207 | |
shrsuman123 | 75e7706 | 2020-09-18 01:08:45 -0500 | [diff] [blame] | 208 | Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 209 | OBMC Reboot (off) |
| 210 | Redfish Power On |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 211 | # Verifying the VMI static configuration |
| 212 | Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask} |
| 213 | |
shrsuman123 | 75e7706 | 2020-09-18 01:08:45 -0500 | [diff] [blame] | 214 | Add Static IP When Host Poweroff And Verify On Poweron |
| 215 | [Documentation] Add Static IP When Host Poweroff And Verify on power on |
| 216 | [Tags] Add_Static_IP_When_Host_Poweroff_And_Verify_On_Poweron |
| 217 | [Setup] Redfish Power Off |
| 218 | [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail |
| 219 | |
| 220 | Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} |
| 221 | Redfish Power On |
| 222 | Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask} |
| 223 | |
| 224 | Add VMI Static IP When Host Poweroff And Verify Static IP On BMC Reset |
| 225 | [Documentation] Add Static IP When Host Poweroff And Verify Static IP On BMC Reset. |
| 226 | [Tags] Add_VMI_Static_IP_When_Host_Poweroff_And_Verify_Static_IP_On_BMC_Reset |
| 227 | [Setup] Redfish Power Off |
| 228 | [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail |
| 229 | |
| 230 | Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} |
| 231 | OBMC Reboot (off) |
| 232 | Redfish Power On |
| 233 | Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask} |
| 234 | |
| 235 | Enable DHCP When No Static IP Configured And Verify DHCP IP |
| 236 | [Documentation] Enable DHCP when no static ip configured and verify dhcp ip |
| 237 | [Tags] Enable_DHCP_When_No_Static_IP_Configured_And_Verify_DHCP_IP |
| 238 | [Setup] Run Keyword And Ignore Error Delete VMI IPv4 Address |
| 239 | [Teardown] Test Teardown Execution |
| 240 | |
| 241 | ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled |
| 242 | Run Keyword If ${curr_origin} == ${False} Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED} |
| 243 | ${vmi_ip_config}= Get VMI Network Interface Details |
| 244 | Verify VMI Network Interface Details ${vmi_ip_config["IPv4_Address"]} DHCP ${vmi_ip_config["IPv4_Gateway"]} |
| 245 | ... ${vmi_ip_config["IPv4_SubnetMask"]} |
| 246 | |
| 247 | Verify User Cannot Delete VMI DHCP IP Address |
| 248 | [Documentation] Verify user cannot delete VMI DHCP IP Address |
| 249 | [Tags] Verify_User_Cannot_Delete_VMI_DHCP_IP_Address |
| 250 | [Setup] Set VMI IPv4 Origin ${True} |
| 251 | [Teardown] Test Teardown Execution |
| 252 | |
| 253 | Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_BAD_REQUEST} |
| 254 | ${active_channel_config}= Get Active Channel Config |
| 255 | ${resp}= Redfish.Get |
| 256 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 257 | Should Not Be Empty ${resp.dict["IPv4Addresses"]} |
| 258 | |
| 259 | Enable DHCP When Static IP Configured DHCP Server Unavailable And Verify IP |
| 260 | [Documentation] Enable DHCP When Static IP Configured And DHCP Server Unavailable And Verify No IP. |
| 261 | [Tags] Enable_DHCP_When_Static_IP_Configured_DHCP_Server_Unavailable_And_Verify_IP |
| 262 | [Teardown] Test Teardown Execution |
| 263 | |
| 264 | Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} |
| 265 | Set VMI IPv4 Origin ${True} |
| 266 | ${default}= Set Variable 0.0.0.0 |
| 267 | Verify VMI Network Interface Details ${default} DHCP ${default} ${default} |
| 268 | |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 269 | |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 270 | Verify To Configure VMI Static IP Address With Different User Roles |
| 271 | [Documentation] Verify to configure vmi static ip address with different user roles. |
| 272 | [Tags] Verify_To_Configure_VMI_Static_IP_Address_With_Different_User_Roles |
| 273 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 274 | [Template] Config VMI Static IP Address Using Different Users |
| 275 | [Teardown] Delete BMC Users Using Redfish |
| 276 | |
| 277 | # username password ip_address gateway nemask valid_status_code |
| 278 | admin_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_ACCEPTED} |
| 279 | operator_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN} |
| 280 | readonly_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN} |
| 281 | noaccess_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN} |
| 282 | |
| 283 | |
| 284 | Verify To Delete VMI Static IP Address With Different User Roles |
| 285 | [Documentation] Verify to delete vmi static IP address with different user roles. |
| 286 | [Tags] Verify_To_Delete_VMI_Static_IP_Address_With_Different_User_Roles |
| 287 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 288 | [Template] Delete VMI Static IP Address Using Different Users |
| 289 | [Teardown] Delete BMC Users Using Redfish |
| 290 | |
| 291 | # username password valid_status_code |
| 292 | admin_user TestPwd123 ${HTTP_ACCEPTED} |
| 293 | operator_user TestPwd123 ${HTTP_FORBIDDEN} |
| 294 | readonly_user TestPwd123 ${HTTP_FORBIDDEN} |
| 295 | noaccess_user TestPwd123 ${HTTP_FORBIDDEN} |
| 296 | |
| 297 | |
| 298 | Verify To Update VMI Static IP Address With Different User Roles |
| 299 | [Documentation] Verify to update vmi static IP address with different user roles. |
| 300 | [Tags] Verify_To_Update_VMI_Static_IP_Address_With_Different_User_Roles_And_Verify |
| 301 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 302 | [Template] Config VMI Static IP Address Using Different Users |
| 303 | [Teardown] Delete BMC Users Using Redfish |
| 304 | |
Shradha Suman | c7df7db | 2021-03-08 05:16:44 -0600 | [diff] [blame] | 305 | # username password ip_address gateway netmask valid_status_code |
| 306 | admin_user TestPwd123 10.5.10.20 10.5.10.1 255.255.0.0 ${HTTP_ACCEPTED} |
| 307 | operator_user TestPwd123 10.5.10.30 10.5.10.1 255.255.0.0 ${HTTP_FORBIDDEN} |
| 308 | readonly_user TestPwd123 10.5.20.40 10.5.20.1 255.255.0.0 ${HTTP_FORBIDDEN} |
| 309 | noaccess_user TestPwd123 10.5.30.50 10.5.30.1 255.255.0.0 ${HTTP_FORBIDDEN} |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 310 | |
| 311 | |
| 312 | Verify To Read VMI Network Configuration With Different User Roles |
| 313 | [Documentation] Verify to read vmi network configuration with different user roles. |
| 314 | [Tags] Verify_To_Read_VMI_Network_Configuration_Via_Different_User_Roles |
| 315 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 316 | [Template] Read VMI Static IP Address Using Different Users |
| 317 | [Teardown] Delete BMC Users Using Redfish |
| 318 | |
| 319 | # username password valid_status_code |
| 320 | admin_user TestPwd123 ${HTTP_OK} |
| 321 | operator_user TestPwd123 ${HTTP_OK} |
| 322 | readonly_user TestPwd123 ${HTTP_OK} |
| 323 | noaccess_user TestPwd123 ${HTTP_FORBIDDEN} |
| 324 | |
shrsuman123 | b361d41 | 2020-09-30 06:17:23 -0500 | [diff] [blame] | 325 | Enable DHCP On VMI Network Via Different Users Roles And Verify |
| 326 | [Documentation] Enable DHCP On VMI Network Via Different Users Roles And Verify. |
| 327 | [Tags] Enable_DHCP_On_VMI_Network_Via_Different_Users_Roles_And_Verify |
| 328 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 329 | [Template] Update User Role And Set VMI IPv4 Origin |
| 330 | [Teardown] Delete BMC Users Using Redfish |
| 331 | |
| 332 | # username password dhcp_enabled valid_status_code |
| 333 | admin_user TestPwd123 ${True} ${HTTP_ACCEPTED} |
| 334 | operator_user TestPwd123 ${True} ${HTTP_FORBIDDEN} |
| 335 | readonly_user TestPwd123 ${True} ${HTTP_FORBIDDEN} |
| 336 | noaccess_user TestPwd123 ${True} ${HTTP_FORBIDDEN} |
| 337 | |
| 338 | Disable DHCP On VMI Network Via Different Users Roles And Verify |
| 339 | [Documentation] Disable DHCP On VMI Network Via Different Users Roles And Verify. |
| 340 | [Tags] Disable_DHCP_On_VMI_Network_Via_Different_Users_Roles_And_Verify |
| 341 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 342 | [Template] Update User Role And Set VMI IPv4 Origin |
| 343 | [Teardown] Delete BMC Users Using Redfish |
| 344 | |
| 345 | # username password dhcp_enabled valid_status_code |
| 346 | admin_user TestPwd123 ${False} ${HTTP_ACCEPTED} |
| 347 | operator_user TestPwd123 ${False} ${HTTP_FORBIDDEN} |
| 348 | readonly_user TestPwd123 ${False} ${HTTP_FORBIDDEN} |
| 349 | noaccess_user TestPwd123 ${False} ${HTTP_FORBIDDEN} |
| 350 | |
shrsuman123 | e37b0cc | 2020-09-02 00:33:42 -0500 | [diff] [blame] | 351 | |
Anves Kumar rayankula | 55b939e | 2020-08-12 04:19:01 -0500 | [diff] [blame] | 352 | Enable And Disable DHCP And Verify |
| 353 | [Documentation] verify enable DHCP and disable DHCP. |
| 354 | [Tags] Enabled_And_Disabled_DHCP_Verify |
| 355 | |
| 356 | Set VMI IPv4 Origin ${True} |
| 357 | ${default}= Set Variable 0.0.0.0 |
| 358 | Verify VMI Network Interface Details ${default} DHCP ${default} ${default} |
| 359 | Set VMI IPv4 Origin ${False} |
Anves Kumar rayankula | 7936eee | 2021-04-19 05:38:36 -0500 | [diff] [blame] | 360 | ${vmi_ip}= Get VMI Network Interface Details |
| 361 | Should Be Empty ${vmi_ip["IPv4_Address"]} |
Anves Kumar rayankula | 55b939e | 2020-08-12 04:19:01 -0500 | [diff] [blame] | 362 | |
| 363 | |
| 364 | Multiple Times Enable And Disable DHCP And Verify |
| 365 | [Documentation] Enable and Disable DHCP in a loop and verify VMI gets an IP address from DHCP |
| 366 | ... each time when DHCP is enabled |
| 367 | [Tags] Multiple_Times_Enable_And_Disable_DHCP_And_Verify |
| 368 | |
| 369 | ${default}= Set Variable 0.0.0.0 |
| 370 | FOR ${i} IN RANGE ${2} |
| 371 | Set VMI IPv4 Origin ${True} |
| 372 | Verify VMI Network Interface Details ${default} DHCP ${default} ${default} |
| 373 | Set VMI IPv4 Origin ${False} |
Anves Kumar rayankula | 7936eee | 2021-04-19 05:38:36 -0500 | [diff] [blame] | 374 | ${vmi_ip}= Get VMI Network Interface Details |
| 375 | Should Be Empty ${vmi_ip["IPv4_Address"]} |
Anves Kumar rayankula | 55b939e | 2020-08-12 04:19:01 -0500 | [diff] [blame] | 376 | END |
| 377 | |
| 378 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 379 | *** Keywords *** |
| 380 | |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 381 | Suite Setup Execution |
| 382 | [Documentation] Do test setup execution task. |
| 383 | |
| 384 | Redfish.Login |
| 385 | Redfish Power On |
| 386 | ${active_channel_config}= Get Active Channel Config |
| 387 | Set Suite Variable ${active_channel_config} |
| 388 | ${resp}= Redfish.Get |
| 389 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 390 | ${ip_resp}= Evaluate json.loads('''${resp.text}''') json |
| 391 | ${length}= Get Length ${ip_resp["IPv4StaticAddresses"]} |
| 392 | ${vmi_network_conf}= Run Keyword If ${length} != ${0} Get VMI Network Interface Details |
| 393 | Set Suite Variable ${vmi_network_conf} |
| 394 | |
| 395 | |
| 396 | Test Teardown Execution |
| 397 | [Documentation] Do test teardown execution task. |
| 398 | |
| 399 | FFDC On Test Case Fail |
| 400 | ${curr_mode}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled |
| 401 | Run Keyword If ${curr_mode} == ${True} Set VMI IPv4 Origin ${False} |
| 402 | Run Keyword If ${vmi_network_conf} != ${None} |
shrsuman123 | f559cbe | 2021-01-06 05:40:45 -0600 | [diff] [blame] | 403 | ... Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]} |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 404 | ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]} |
| 405 | |
| 406 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 407 | Get VMI Network Interface Details |
| 408 | [Documentation] Get VMI network interface details. |
| 409 | [Arguments] ${valid_status_code}=${HTTP_OK} |
| 410 | |
| 411 | # Description of argument(s): |
| 412 | # valid_status_code Expected valid status code from GET request. |
| 413 | |
Anves Kumar rayankula | aa33b05 | 2020-07-22 04:24:51 -0500 | [diff] [blame] | 414 | # Note: It returns a dictionary of VMI eth0 parameters. |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 415 | |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 416 | ${active_channel_config}= Get Active Channel Config |
| 417 | ${resp}= Redfish.Get |
| 418 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 419 | ... valid_status_codes=[${valid_status_code}] |
| 420 | |
| 421 | ${ip_resp}= Evaluate json.loads('''${resp.text}''') json |
| 422 | |
shrsuman123 | 5c7e4d7 | 2021-04-16 05:42:57 -0500 | [diff] [blame] | 423 | ${ip_exists}= Set Variable If ${ip_resp["IPv4Addresses"]} == @{empty} ${False} ${True} |
| 424 | ${static_exists}= Set Variable If ${ip_resp["IPv4StaticAddresses"]} == @{empty} ${False} ${True} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 425 | |
shrsuman123 | 5c7e4d7 | 2021-04-16 05:42:57 -0500 | [diff] [blame] | 426 | ${vmi_ip}= Run Keyword If ${ip_exists} == ${True} |
| 427 | ... Create Dictionary DHCPv4=${${ip_resp["DHCPv4"]["DHCPEnabled"]}} Id=${ip_resp["Id"]} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 428 | ... Description=${ip_resp["Description"]} IPv4_Address=${ip_resp["IPv4Addresses"][0]["Address"]} |
| 429 | ... IPv4_AddressOrigin=${ip_resp["IPv4Addresses"][0]["AddressOrigin"]} Name=${ip_resp["Name"]} |
Sushil Singh | 810234d | 2020-05-13 12:12:03 -0500 | [diff] [blame] | 430 | ... IPv4_Gateway=${ip_resp["IPv4Addresses"][0]["Gateway"]} |
| 431 | ... InterfaceEnabled=${${ip_resp["InterfaceEnabled"]}} |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 432 | ... IPv4_SubnetMask=${ip_resp["IPv4Addresses"][0]["SubnetMask"]} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 433 | ... IPv4StaticAddresses=${${static_exists}} |
shrsuman123 | 5c7e4d7 | 2021-04-16 05:42:57 -0500 | [diff] [blame] | 434 | ... ELSE |
| 435 | ... Create Dictionary DHCPv4=${${ip_resp["DHCPv4"]["DHCPEnabled"]}} Id=${ip_resp["Id"]} |
| 436 | ... Description=${ip_resp["Description"]} IPv4StaticAddresses=${ip_resp["IPv4StaticAddresses"]} |
| 437 | ... IPv4_Address=${ip_resp["IPv4Addresses"]} Name=${ip_resp["Name"]} |
| 438 | ... InterfaceEnabled=${${ip_resp["InterfaceEnabled"]}} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 439 | |
| 440 | [Return] &{vmi_ip} |
| 441 | |
| 442 | |
| 443 | Get Immediate Child Parameter From VMI Network Interface |
| 444 | [Documentation] Get immediate child parameter from VMI network interface. |
| 445 | [Arguments] ${parameter} ${valid_status_code}=${HTTP_OK} |
| 446 | |
| 447 | # Description of argument(s): |
| 448 | # parameter parameter for which value is required. Ex: DHCPEnabled, MACAddress etc. |
| 449 | # valid_status_code Expected valid status code from GET request. |
| 450 | |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 451 | ${active_channel_config}= Get Active Channel Config |
| 452 | ${resp}= Redfish.Get |
| 453 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 454 | ... valid_status_codes=[${valid_status_code}] |
| 455 | |
| 456 | ${ip_resp}= Evaluate json.loads('''${resp.text}''') json |
| 457 | ${value}= Set Variable If '${parameter}' != 'DHCPEnabled' ${ip_resp["${parameter}"]} |
| 458 | ... ${ip_resp["DHCPv4"]["${parameter}"]} |
| 459 | |
| 460 | [Return] ${value} |
| 461 | |
Anves Kumar rayankula | 1b64d94 | 2020-11-17 02:44:02 -0600 | [diff] [blame] | 462 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 463 | Verify VMI EthernetInterfaces |
| 464 | [Documentation] Verify VMI ethernet interfaces. |
| 465 | [Arguments] ${valid_status_code}=${HTTP_OK} |
| 466 | |
| 467 | # Description of argument(s): |
| 468 | # valid_status_code Expected valid status code from GET request. |
| 469 | |
| 470 | ${resp}= Redfish.Get /redfish/v1/Systems/hypervisor/EthernetInterfaces |
| 471 | ... valid_status_codes=[${valid_status_code}] |
| 472 | |
| 473 | ${resp}= Evaluate json.loads('''${resp.text}''') json |
| 474 | ${interfaces}= Set Variable ${resp["Members"]} |
| 475 | |
shrsuman123 | 5c7e4d7 | 2021-04-16 05:42:57 -0500 | [diff] [blame] | 476 | ${number_of_interfaces}= Get Length ${interfaces} |
| 477 | FOR ${i} IN RANGE ${number_of_interfaces} |
| 478 | Should Be Equal As Strings ${interfaces[${i}]}[@odata.id] |
| 479 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/eth${i} |
| 480 | END |
| 481 | Should Be Equal ${resp["Members@odata.count"]} ${number_of_interfaces} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 482 | |
| 483 | |
| 484 | Verify VMI Network Interface Details |
| 485 | [Documentation] Verify VMI network interface details. |
| 486 | [Arguments] ${ip} ${origin} ${gateway} ${netmask} |
Anves Kumar rayankula | d7deb89 | 2020-08-24 02:58:20 -0500 | [diff] [blame] | 487 | ... ${valid_status_code}=${HTTP_OK} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 488 | |
| 489 | # Description of argument(s): |
| 490 | # ip VMI IPv4 address. |
| 491 | # origin Origin of IPv4 address eg. Static or DHCP. |
| 492 | # gateway Gateway for VMI IP. |
| 493 | # netmask Subnetmask for VMI IP. |
| 494 | # 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] | 495 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 496 | ${vmi_ip}= Get VMI Network Interface Details ${valid_status_code} |
| 497 | Should Be Equal As Strings ${origin} ${vmi_ip["IPv4_AddressOrigin"]} |
| 498 | Should Be Equal As Strings ${gateway} ${vmi_ip["IPv4_Gateway"]} |
| 499 | Should Be Equal As Strings ${netmask} ${vmi_ip["IPv4_SubnetMask"]} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 500 | Should Be Equal As Strings ${ip} ${vmi_ip["IPv4_Address"]} |
| 501 | |
Anves Kumar rayankula | 1b64d94 | 2020-11-17 02:44:02 -0600 | [diff] [blame] | 502 | |
| 503 | Set Static IPv4 Address To VMI And Verify |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 504 | [Documentation] Set static IPv4 address to VMI. |
| 505 | [Arguments] ${ip} ${gateway} ${netmask} ${valid_status_code}=${HTTP_ACCEPTED} |
| 506 | |
| 507 | # Description of argument(s): |
| 508 | # ip VMI IPv4 address. |
| 509 | # gateway Gateway for VMI IP. |
| 510 | # netmask Subnetmask for VMI IP. |
| 511 | # valid_status_code Expected valid status code from GET request. Default is HTTP_ACCEPTED. |
| 512 | |
| 513 | ${data}= Set Variable |
| 514 | ... {"IPv4StaticAddresses": [{"Address": "${ip}","SubnetMask": "${netmask}","Gateway": "${gateway}"}]} |
| 515 | |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 516 | ${active_channel_config}= Get Active Channel Config |
| 517 | ${resp}= Redfish.Patch |
| 518 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 519 | ... body=${data} valid_status_codes=[${valid_status_code}] |
Prashanth Katti | 1ce6821 | 2020-11-13 00:39:03 -0600 | [diff] [blame] | 520 | |
| 521 | # Wait few seconds for new configuration to get populated on runtime. |
| 522 | Sleep ${wait_time} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 523 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 524 | Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED} |
shrsuman123 | 75e7706 | 2020-09-18 01:08:45 -0500 | [diff] [blame] | 525 | ${host_power_state} ${host_state}= Redfish Get Host State |
| 526 | Run Keyword If '${host_power_state}' == 'On' and '${host_state}' == 'Enabled' |
| 527 | ... Verify VMI Network Interface Details ${ip} Static ${gateway} ${netmask} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 528 | |
| 529 | |
| 530 | Delete VMI IPv4 Address |
| 531 | [Documentation] Delete VMI IPv4 address. |
| 532 | [Arguments] ${delete_param}=IPv4StaticAddresses ${valid_status_code}=${HTTP_ACCEPTED} |
| 533 | |
| 534 | # Description of argument(s): |
| 535 | # delete_param Parameter to be deleted eg. IPv4StaticAddresses or IPv4Addresses. |
| 536 | # Default is IPv4StaticAddresses. |
| 537 | # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK. |
| 538 | |
| 539 | ${data}= Set Variable {"${delete_param}": [${Null}]} |
Anves Kumar rayankula | 358c41d | 2020-08-14 04:53:06 -0500 | [diff] [blame] | 540 | ${active_channel_config}= Get Active Channel Config |
| 541 | ${resp}= Redfish.Patch |
| 542 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 543 | ... body=${data} valid_status_codes=[${valid_status_code}] |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 544 | |
Anves Kumar rayankula | 1b64d94 | 2020-11-17 02:44:02 -0600 | [diff] [blame] | 545 | Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED} |
shrsuman123 | 5c7e4d7 | 2021-04-16 05:42:57 -0500 | [diff] [blame] | 546 | ${vmi_ip}= Get VMI Network Interface Details |
| 547 | Should Be Empty ${vmi_ip["IPv4_Address"]} |
Anves Kumar rayankula | 1b64d94 | 2020-11-17 02:44:02 -0600 | [diff] [blame] | 548 | |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 549 | |
| 550 | Set VMI IPv4 Origin |
| 551 | [Documentation] Set VMI IPv4 origin. |
| 552 | [Arguments] ${dhcp_enabled}=${False} ${valid_status_code}=${HTTP_ACCEPTED} |
| 553 | |
| 554 | # Description of argument(s): |
| 555 | # dhcp_enabled True if user wants to enable DHCP. Default is Static, hence value is set to False. |
| 556 | # valid_status_code Expected valid status code from PATCH request. Default is HTTP_OK. |
| 557 | |
| 558 | ${data}= Set Variable If ${dhcp_enabled} == ${False} ${DISABLE_DHCP} ${ENABLE_DHCP} |
Anves Kumar rayankula | aa33b05 | 2020-07-22 04:24:51 -0500 | [diff] [blame] | 559 | ${resp}= Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/eth0 body=${data} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 560 | ... valid_status_codes=[${valid_status_code}] |
shrsuman123 | b361d41 | 2020-09-30 06:17:23 -0500 | [diff] [blame] | 561 | Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED} |
| 562 | ${resp}= Redfish.Get |
| 563 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 564 | Should Be Equal ${resp.dict["DHCPv4"]["DHCPEnabled"]} ${dhcp_enabled} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 565 | |
| 566 | |
| 567 | Switch VMI IPv4 Origin And Verify Details |
| 568 | [Documentation] Switch VMI IPv4 origin and verify details. |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 569 | |
Anves Kumar rayankula | 7936eee | 2021-04-19 05:38:36 -0500 | [diff] [blame] | 570 | ${dhcp_mode_before}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled |
Anves Kumar rayankula | e7dc89a | 2021-04-28 04:29:38 -0500 | [diff] [blame] | 571 | ${dhcp_enabled}= Set Variable If ${dhcp_mode_before} == ${False} ${True} ${False} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 572 | |
| 573 | ${default}= Set Variable 0.0.0.0 |
Anves Kumar rayankula | e7dc89a | 2021-04-28 04:29:38 -0500 | [diff] [blame] | 574 | ${origin}= Set Variable If ${dhcp_mode_before} == ${False} DHCP Static |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 575 | Set VMI IPv4 Origin ${dhcp_enabled} ${HTTP_ACCEPTED} |
Anves Kumar rayankula | 7936eee | 2021-04-19 05:38:36 -0500 | [diff] [blame] | 576 | |
| 577 | ${dhcp_mode_after}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled |
| 578 | Should Not Be Equal ${dhcp_mode_before} ${dhcp_mode_after} |
| 579 | |
| 580 | Run Keyword If ${dhcp_mode_after} == ${True} |
| 581 | ... Verify VMI Network Interface Details ${default} ${origin} ${default} ${default} |
Vijay | 06a169d | 2020-04-23 09:28:24 -0500 | [diff] [blame] | 582 | |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 583 | |
| 584 | Delete VMI Static IP Address Using Different Users |
| 585 | [Documentation] Update user role and delete vmi static IP address. |
| 586 | [Arguments] ${username} ${password} ${valid_status_code} |
| 587 | [Teardown] Run Keywords Redfish.Login AND |
shrsuman123 | f559cbe | 2021-01-06 05:40:45 -0600 | [diff] [blame] | 588 | ... Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 589 | ... ${test_netmask} ${HTTP_ACCEPTED} AND Redfish.Logout |
| 590 | |
| 591 | # Description of argument(s): |
| 592 | # username The host username. |
| 593 | # password The host password. |
| 594 | # valid_status_code The expected valid status code. |
| 595 | |
| 596 | Redfish.Login ${username} ${password} |
| 597 | Delete VMI IPv4 Address delete_param=IPv4StaticAddresses valid_status_code=${valid_status_code} |
| 598 | Redfish.Logout |
| 599 | |
| 600 | |
| 601 | Config VMI Static IP Address Using Different Users |
| 602 | [Documentation] Update user role and update vmi static ip address. |
| 603 | [Arguments] ${username} ${password} ${ip} ${gateway} ${netmask} |
| 604 | ... ${valid_status_code} |
| 605 | |
| 606 | # Description of argument(s): |
| 607 | # username The host username. |
| 608 | # password The host password. |
| 609 | # ip IP address to be added (e.g. "10.7.7.7"). |
| 610 | # subnet_mask Subnet mask for the IP to be added |
| 611 | # (e.g. "255.255.0.0"). |
| 612 | # gateway Gateway for the IP to be added (e.g. "10.7.7.1"). |
| 613 | # valid_status_code The expected valid status code. |
| 614 | |
| 615 | Redfish.Login ${username} ${password} |
Anves Kumar rayankula | 1b64d94 | 2020-11-17 02:44:02 -0600 | [diff] [blame] | 616 | Set Static IPv4 Address To VMI And Verify ${ip} ${gateway} ${netmask} ${valid_status_code} |
Anves Kumar rayankula | d5de207 | 2020-09-30 06:24:11 -0500 | [diff] [blame] | 617 | Redfish.Logout |
| 618 | |
| 619 | |
| 620 | Read VMI Static IP Address Using Different Users |
| 621 | [Documentation] Update user role and read vmi static ip address. |
| 622 | [Arguments] ${username} ${password} ${valid_status_code} |
| 623 | |
| 624 | # Description of argument(s): |
| 625 | # username The host username. |
| 626 | # password The host password. |
| 627 | # valid_status_code The expected valid status code. |
| 628 | |
| 629 | Redfish.Login ${username} ${password} |
| 630 | Redfish.Get |
| 631 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 632 | ... valid_status_codes=[${valid_status_code}] |
| 633 | Redfish.Logout |
| 634 | |
| 635 | |
| 636 | Delete BMC Users Using Redfish |
| 637 | [Documentation] Delete BMC users via redfish. |
| 638 | |
| 639 | Redfish.Login |
| 640 | Delete BMC Users Via Redfish users=${USERS} |
shrsuman123 | b361d41 | 2020-09-30 06:17:23 -0500 | [diff] [blame] | 641 | |
| 642 | Update User Role And Set VMI IPv4 Origin |
| 643 | [Documentation] Update User Role And Set VMI IPv4 Origin. |
| 644 | [Arguments] ${username} ${password} ${dhcp_enabled} ${valid_status_code} |
| 645 | |
| 646 | # Description of argument(s): |
| 647 | # username The host username. |
| 648 | # password The host password. |
| 649 | # dhcp_enabled Indicates whether dhcp should be enabled |
| 650 | # (${True}, ${False}). |
| 651 | # valid_status_code The expected valid status code. |
| 652 | |
| 653 | Redfish.Login ${username} ${password} |
| 654 | Set VMI IPv4 Origin ${dhcp_enabled} ${valid_status_code} |
| 655 | Redfish.Logout |