Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test BMC multiple network interface functionalities. |
| 3 | |
| 4 | # User input BMC IP for the eth1. |
| 5 | # Use can input as -v OPENBMC_HOST_1:xx.xxx.xx from command line. |
| 6 | Library ../../lib/bmc_redfish.py https://${OPENBMC_HOST_1}:${HTTPS_PORT} |
| 7 | ... ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} WITH NAME Redfish1 |
| 8 | |
| 9 | Resource ../../lib/resource.robot |
| 10 | Resource ../../lib/common_utils.robot |
| 11 | Resource ../../lib/connection_client.robot |
| 12 | Resource ../../lib/bmc_network_utils.robot |
| 13 | Resource ../../lib/openbmc_ffdc.robot |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 14 | Resource ../../lib/bmc_ldap_utils.robot |
Anves Kumar rayankula | 2f9632f | 2021-07-05 04:37:45 -0500 | [diff] [blame] | 15 | Resource ../../lib/snmp/resource.robot |
| 16 | Resource ../../lib/snmp/redfish_snmp_utils.robot |
Anves Kumar rayankula | 75ac429 | 2021-07-14 01:30:43 -0500 | [diff] [blame] | 17 | Resource ../../lib/certificate_utils.robot |
Anves Kumar rayankula | a38ec2e | 2021-07-10 01:09:23 -0500 | [diff] [blame] | 18 | Library ../../lib/jobs_processing.py |
Anves Kumar rayankula | 75ac429 | 2021-07-14 01:30:43 -0500 | [diff] [blame] | 19 | Library OperatingSystem |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 20 | |
| 21 | Suite Setup Suite Setup Execution |
| 22 | Test Teardown FFDC On Test Case Fail |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 23 | Suite Teardown Run Keywords Redfish1.Logout AND Redfish.Logout |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 24 | |
Anves Kumar rayankula | d0a2f33 | 2021-07-14 07:53:12 -0500 | [diff] [blame] | 25 | *** Variables *** |
| 26 | |
| 27 | ${cmd_prefix} ipmitool -I lanplus -C 17 -p 623 -U ${OPENBMC_USERNAME} -P ${OPENBMC_PASSWORD} |
Sweta Potthuri | 2667f2c | 2022-10-11 07:55:21 -0500 | [diff] [blame] | 28 | ${test_ipv4_addr} 10.7.7.7 |
| 29 | ${test_ipv4_addr2} 10.7.7.8 |
| 30 | ${test_subnet_mask} 255.255.255.0 |
Anves Kumar rayankula | d0a2f33 | 2021-07-14 07:53:12 -0500 | [diff] [blame] | 31 | |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 32 | *** Test Cases *** |
| 33 | |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 34 | Verify Both Interfaces BMC IP Addresses Accessible Via SSH |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 35 | [Documentation] Verify both interfaces (eth0, eth1) BMC IP addresses accessible via SSH. |
| 36 | [Tags] Verify_Both_Interfaces_BMC_IP_Addresses_Accessible_Via_SSH |
| 37 | |
| 38 | Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} host=${OPENBMC_HOST} |
| 39 | Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} host=${OPENBMC_HOST_1} |
| 40 | Close All Connections |
| 41 | |
| 42 | |
Anves Kumar rayankula | 55d5192 | 2021-07-01 06:37:00 -0500 | [diff] [blame] | 43 | Verify Redfish Works On Both Interfaces |
| 44 | [Documentation] Verify access BMC with both interfaces (eth0, eth1) IP addresses via Redfish. |
| 45 | [Tags] Verify_Redfish_Works_On_Both_Interfaces |
| 46 | [Teardown] Run Keywords |
| 47 | ... Configure Hostname ${hostname} AND Validate Hostname On BMC ${hostname} |
| 48 | |
| 49 | Redfish1.Login |
| 50 | Redfish.Login |
| 51 | |
| 52 | ${hostname}= Redfish.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName |
| 53 | ${data}= Create Dictionary HostName=openbmc |
| 54 | Redfish1.patch ${REDFISH_NW_ETH_IFACE}eth1 body=&{data} |
| 55 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 56 | |
| 57 | Validate Hostname On BMC openbmc |
| 58 | |
| 59 | ${resp1}= Redfish.Get ${REDFISH_NW_ETH_IFACE}eth0 |
| 60 | ${resp2}= Redfish1.Get ${REDFISH_NW_ETH_IFACE}eth1 |
| 61 | Should Be Equal ${resp1.dict['HostName']} ${resp2.dict['HostName']} |
| 62 | |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 63 | |
| 64 | Verify LDAP Login Works When Eth1 IP Is Not Configured |
| 65 | [Documentation] Verify LDAP login works when eth1 IP is erased. |
| 66 | [Tags] Verify_LDAP_Login_Works_When_Eth1_IP_Is_Not_Configured |
kothais | 01f95fc | 2023-11-01 14:12:51 +0000 | [diff] [blame] | 67 | [Setup] Run Keywords Set Test Variable ${CHANNEL_NUMBER} ${SECONDARY_CHANNEL_NUMBER} |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 68 | ... AND Delete IP Address ${OPENBMC_HOST_1} |
Sweta Potthuri | b9513c6 | 2023-03-01 01:11:43 -0600 | [diff] [blame] | 69 | ... AND Redfish.Login |
| 70 | [Teardown] Run Keywords Redfish.Logout AND |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 71 | ... Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway} |
| 72 | |
| 73 | Create LDAP Configuration |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 74 | Redfish.Logout |
Sweta Potthuri | b9513c6 | 2023-03-01 01:11:43 -0600 | [diff] [blame] | 75 | Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD} |
| 76 | |
| 77 | |
| 78 | Verify LDAP Login Works When Both Interfaces Are Configured |
| 79 | [Documentation] Verify LDAP login works when both interfaces are configured. |
| 80 | [Tags] Verify_LDAP_Login_Works_When_Both_Interfaces_Are_Configured |
| 81 | [Setup] Redfish.Login |
| 82 | [Teardown] Redfish.Logout |
| 83 | |
| 84 | Create LDAP Configuration |
| 85 | Redfish.Logout |
| 86 | Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD} |
| 87 | |
| 88 | |
| 89 | Verify Secure LDAP Login Works When Both Interfaces Are Configured |
| 90 | [Documentation] Verify Secure LDAP login works when both the interfaces are configured. |
| 91 | [Tags] Verify_Secure_LDAP_Login_Works_When_Both_Interfaces_Are_Configured |
| 92 | [Setup] Redfish.Login |
| 93 | [Teardown] Redfish.Logout |
| 94 | |
| 95 | Create LDAP Configuration ${LDAP_TYPE} ${LDAP_SERVER_URI_1} ${LDAP_BIND_DN} |
| 96 | ... ${LDAP_BIND_DN_PASSWORD} ${LDAP_BASE_DN} |
| 97 | Redfish.Logout |
| 98 | Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD} |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 99 | |
| 100 | |
Anves Kumar rayankula | 2f9632f | 2021-07-05 04:37:45 -0500 | [diff] [blame] | 101 | Verify SNMP Works When Eth1 IP Is Not Configured |
| 102 | [Documentation] Verify SNMP works when eth1 IP is not configured. |
| 103 | [Tags] Verify_SNMP_Works_When_Eth1_IP_Is_Not_Configured |
kothais | 01f95fc | 2023-11-01 14:12:51 +0000 | [diff] [blame] | 104 | [Setup] Run Keywords Set Test Variable ${CHANNEL_NUMBER} ${SECONDARY_CHANNEL_NUMBER} |
Anves Kumar rayankula | 2f9632f | 2021-07-05 04:37:45 -0500 | [diff] [blame] | 105 | ... AND Delete IP Address ${OPENBMC_HOST_1} |
| 106 | [Teardown] Run Keywords Redfish.Login AND |
| 107 | ... Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway} |
| 108 | |
| 109 | Create Error On BMC And Verify Trap |
| 110 | |
| 111 | |
Anves Kumar rayankula | 04bc48c | 2021-07-08 23:33:37 -0500 | [diff] [blame] | 112 | Disable And Enable Eth0 Interface |
| 113 | [Documentation] Disable and Enable eth0 ethernet interface via redfish. |
| 114 | [Tags] Disable_And_Enable_Eth0_Interface |
| 115 | [Template] Set BMC Ethernet Interfaces State |
| 116 | |
| 117 | # interface_ip interface enabled |
| 118 | ${OPENBMC_HOST} eth0 ${False} |
| 119 | ${OPENBMC_HOST} eth0 ${True} |
| 120 | |
| 121 | |
Anves Kumar rayankula | a38ec2e | 2021-07-10 01:09:23 -0500 | [diff] [blame] | 122 | Verify Both Interfaces Access Concurrently Via Redfish |
| 123 | [Documentation] Verify both interfaces access conurrently via redfish. |
| 124 | [Tags] Verify_Both_Interfaces_Access_Concurrently_Via_Redfish |
| 125 | |
| 126 | Redfish.Login |
| 127 | Redfish1.Login |
| 128 | |
| 129 | ${dict}= Execute Process Multi Keyword ${2} |
| 130 | ... Redfish.Patch ${REDFISH_NW_ETH_IFACE}eth0 body={'DHCPv4':{'UseDNSServers':${True}}} |
| 131 | ... Redfish1.Patch ${REDFISH_NW_ETH_IFACE}eth1 body={'DHCPv4':{'UseDNSServers':${True}}} |
| 132 | |
| 133 | Dictionary Should Not Contain Value ${dict} False |
| 134 | ... msg=One or more operations has failed. |
| 135 | |
| 136 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}eth0 |
| 137 | ${resp1}= Redfish1.Get ${REDFISH_NW_ETH_IFACE}eth1 |
| 138 | |
| 139 | Should Be Equal ${resp.dict["DHCPv4"]['UseDNSServers']} ${True} |
| 140 | Should Be Equal ${resp1.dict["DHCPv4"]['UseDNSServers']} ${True} |
| 141 | |
Anves Kumar rayankula | 54482cd | 2021-07-09 07:13:25 -0500 | [diff] [blame] | 142 | Able To Access Serial Console Via Both Network Interfaces |
| 143 | [Documentation] Able to access serial console via both network interfaces. |
George Keishing | c4914b7 | 2021-07-27 08:03:19 -0500 | [diff] [blame] | 144 | [Tags] Able_To_Access_Serial_Console_Via_Both_Network_Interfaces |
Anves Kumar rayankula | 54482cd | 2021-07-09 07:13:25 -0500 | [diff] [blame] | 145 | |
| 146 | Open Connection And Log In host=${OPENBMC_HOST} port=2200 |
| 147 | Open Connection And Log In host=${OPENBMC_HOST_1} port=2200 |
| 148 | Close All Connections |
| 149 | |
Anves Kumar rayankula | d0a2f33 | 2021-07-14 07:53:12 -0500 | [diff] [blame] | 150 | Verify IPMI Works On Both Network Interfaces |
| 151 | [Documentation] Verify IPMI works on both network interfaces. |
| 152 | [Tags] Verify_IPMI_Works_On_Both_Network_Interfaces |
| 153 | |
| 154 | Run IPMI ${OPENBMC_HOST_1} power on |
| 155 | ${status1}= Run IPMI ${OPENBMC_HOST} power status |
| 156 | ${status2}= Run IPMI ${OPENBMC_HOST_1} power status |
| 157 | Should Be Equal ${status1} ${status2} |
| 158 | |
Sweta Potthuri | 2667f2c | 2022-10-11 07:55:21 -0500 | [diff] [blame] | 159 | Verify Modifying IP Address Multiple Times On Interface |
| 160 | [Documentation] Verify modifying IP address multiple times on interface. |
| 161 | [Tags] Verify_Modifying_IP_Address_Multiple_Times_On_Interface |
| 162 | [Teardown] Run Keywords |
| 163 | ... Delete IP Address ${test_ipv4_addr} AND Test Teardown |
| 164 | |
| 165 | ${test_gateway}= Get BMC Default Gateway |
| 166 | Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} |
| 167 | Update IP Address ${test_ipv4_addr} ${test_ipv4_addr2} ${test_subnet_mask} ${test_gateway} |
| 168 | Update IP Address ${test_ipv4_addr2} ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} |
| 169 | Run Keyword Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} |
| 170 | Run Keyword Wait For Host To Ping ${OPENBMC_HOST_1} ${NETWORK_TIMEOUT} |
Anves Kumar rayankula | 75ac429 | 2021-07-14 01:30:43 -0500 | [diff] [blame] | 171 | |
| 172 | Verify Able To Load Certificates Via Eth1 IP Address |
George Keishing | b13682a | 2021-07-20 08:52:39 -0500 | [diff] [blame] | 173 | [Documentation] Verify able to load certificates via eth1 IP address. |
Anves Kumar rayankula | 75ac429 | 2021-07-14 01:30:43 -0500 | [diff] [blame] | 174 | [Setup] Create Directory certificate_dir |
| 175 | [Tags] Verify_Able_To_Load_Certificates_Via_Eth1_IP_Address |
| 176 | [Teardown] Run Keywords Remove Directory certificate_dir recursive=True |
| 177 | ... AND FFDC On Test Case Fail |
| 178 | [Template] Install Certificate Via Redfish And Verify |
| 179 | |
| 180 | # cert_type cert_format expected_status |
| 181 | CA Valid Certificate ok |
| 182 | Client Valid Certificate Valid Privatekey ok |
| 183 | |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 184 | *** Keywords *** |
| 185 | |
| 186 | Get Network Configuration Using Channel Number |
| 187 | [Documentation] Get ethernet interface. |
| 188 | [Arguments] ${channel_number} |
| 189 | |
| 190 | # Description of argument(s): |
| 191 | # channel_number Ethernet channel number, 1 is for eth0 and 2 is for eth1 (e.g. "1"). |
| 192 | |
| 193 | ${active_channel_config}= Get Active Channel Config |
| 194 | ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']} |
| 195 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
| 196 | |
| 197 | @{network_configurations}= Get From Dictionary ${resp.dict} IPv4StaticAddresses |
| 198 | [Return] @{network_configurations} |
| 199 | |
| 200 | |
| 201 | Suite Setup Execution |
| 202 | [Documentation] Do suite setup task. |
| 203 | |
| 204 | Valid Value OPENBMC_HOST_1 |
| 205 | |
| 206 | # Check both interfaces are configured and reachable. |
| 207 | Ping Host ${OPENBMC_HOST} |
| 208 | Ping Host ${OPENBMC_HOST_1} |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 209 | |
kothais | 01f95fc | 2023-11-01 14:12:51 +0000 | [diff] [blame] | 210 | ${network_configurations}= Get Network Configuration Using Channel Number ${SECONDARY_CHANNEL_NUMBER} |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 211 | FOR ${network_configuration} IN @{network_configurations} |
| 212 | |
| 213 | Run Keyword If '${network_configuration['Address']}' == '${OPENBMC_HOST_1}' |
| 214 | ... Run Keywords Set Suite Variable ${eth1_subnet_mask} ${network_configuration['SubnetMask']} |
| 215 | ... AND Set Suite Variable ${eth1_gateway} ${network_configuration['Gateway']} |
| 216 | ... AND Exit For Loop |
| 217 | |
| 218 | END |
Anves Kumar rayankula | 04bc48c | 2021-07-08 23:33:37 -0500 | [diff] [blame] | 219 | |
| 220 | |
| 221 | Set BMC Ethernet Interfaces State |
| 222 | [Documentation] Set BMC ethernet interface state. |
| 223 | [Arguments] ${interface_ip} ${interface} ${enabled} |
| 224 | [Teardown] Redfish1.Logout |
| 225 | |
| 226 | # Description of argument(s): |
| 227 | # interface_ip IP address of ethernet interface. |
| 228 | # interface The ethernet interface name (eg. eth0 or eth1). |
| 229 | # enabled Indicates interface should be enabled (eg. True or False). |
| 230 | |
| 231 | Redfish1.Login |
| 232 | |
| 233 | ${data}= Create Dictionary InterfaceEnabled=${enabled} |
| 234 | |
| 235 | Redfish1.patch ${REDFISH_NW_ETH_IFACE}${interface} body=&{data} |
| 236 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 237 | |
| 238 | Sleep ${NETWORK_TIMEOUT}s |
| 239 | ${interface_status}= Redfish1.Get Attribute ${REDFISH_NW_ETH_IFACE}${interface} InterfaceEnabled |
| 240 | Should Be Equal ${interface_status} ${enabled} |
| 241 | |
| 242 | ${status}= Run Keyword And Return Status Ping Host ${interface_ip} |
| 243 | |
| 244 | Run Keyword If ${enabled} == ${True} Should Be Equal ${status} ${True} |
| 245 | ... ELSE Should Be Equal ${status} ${False} |
Anves Kumar rayankula | d0a2f33 | 2021-07-14 07:53:12 -0500 | [diff] [blame] | 246 | |
| 247 | |
| 248 | Run IPMI |
| 249 | [Documentation] Run IPMI command. |
| 250 | [Arguments] ${host} ${sub_cmd} |
| 251 | |
| 252 | # Description of argument(s): |
| 253 | # host BMC host name or IP address. |
| 254 | # sub_cmd The IPMI command string to be executed. |
| 255 | |
| 256 | ${rc} ${output}= Run And Return Rc And Output ${cmd_prefix} -H ${host} ${sub_cmd} |
| 257 | Should Be Equal As Strings ${rc} 0 |
| 258 | [Return] ${output} |
| 259 | |
Anves Kumar rayankula | 75ac429 | 2021-07-14 01:30:43 -0500 | [diff] [blame] | 260 | |
| 261 | Install Certificate Via Redfish And Verify |
| 262 | [Documentation] Install and verify certificate using Redfish. |
| 263 | [Arguments] ${cert_type} ${cert_format} ${expected_status} ${delete_cert}=${True} |
| 264 | |
| 265 | # Description of argument(s): |
| 266 | # cert_type Certificate type (e.g. "Client" or "CA"). |
| 267 | # cert_format Certificate file format |
| 268 | # (e.g. "Valid_Certificate_Valid_Privatekey"). |
| 269 | # expected_status Expected status of certificate replace Redfish |
| 270 | # request (i.e. "ok" or "error"). |
| 271 | # delete_cert Certificate will be deleted before installing if this True. |
| 272 | |
| 273 | # AUTH_URI is a global variable defined in lib/resource.robot |
| 274 | Set Test Variable ${AUTH_URI} https://${OPENBMC_HOST_1} |
| 275 | Run Keyword If '${cert_type}' == 'CA' and '${delete_cert}' == '${True}' |
| 276 | ... Delete All CA Certificate Via Redfish |
| 277 | ... ELSE IF '${cert_type}' == 'Client' and '${delete_cert}' == '${True}' |
| 278 | ... Delete Certificate Via BMC CLI ${cert_type} |
| 279 | |
| 280 | ${cert_file_path}= Generate Certificate File Via Openssl ${cert_format} |
| 281 | ${bytes}= OperatingSystem.Get Binary File ${cert_file_path} |
| 282 | ${file_data}= Decode Bytes To String ${bytes} UTF-8 |
| 283 | |
| 284 | ${certificate_uri}= Set Variable If |
| 285 | ... '${cert_type}' == 'Client' ${REDFISH_LDAP_CERTIFICATE_URI} |
| 286 | ... '${cert_type}' == 'CA' ${REDFISH_CA_CERTIFICATE_URI} |
| 287 | |
| 288 | ${cert_id}= Install Certificate File On BMC ${certificate_uri} ${expected_status} data=${file_data} |
| 289 | Logging Installed certificate id: ${cert_id} |
| 290 | |
| 291 | Sleep 30s |
| 292 | ${cert_file_content}= OperatingSystem.Get File ${cert_file_path} |
| 293 | ${bmc_cert_content}= Run Keyword If '${expected_status}' == 'ok' redfish_utils.Get Attribute |
| 294 | ... ${certificate_uri}/${cert_id} CertificateString |
| 295 | Run Keyword If '${expected_status}' == 'ok' Should Contain ${cert_file_content} ${bmc_cert_content} |
| 296 | [Return] ${cert_id} |