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