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 |
| 67 | [Setup] Run Keywords Set Test Variable ${CHANNEL_NUMBER} ${2} |
| 68 | ... AND Delete IP Address ${OPENBMC_HOST_1} |
| 69 | [Teardown] Run Keywords Redfish.Login AND |
| 70 | ... Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway} |
| 71 | |
| 72 | Create LDAP Configuration |
| 73 | Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD} |
| 74 | Redfish.Logout |
| 75 | |
| 76 | |
Anves Kumar rayankula | 2f9632f | 2021-07-05 04:37:45 -0500 | [diff] [blame] | 77 | Verify SNMP Works When Eth1 IP Is Not Configured |
| 78 | [Documentation] Verify SNMP works when eth1 IP is not configured. |
| 79 | [Tags] Verify_SNMP_Works_When_Eth1_IP_Is_Not_Configured |
| 80 | [Setup] Run Keywords Set Test Variable ${CHANNEL_NUMBER} ${2} |
| 81 | ... AND Delete IP Address ${OPENBMC_HOST_1} |
| 82 | [Teardown] Run Keywords Redfish.Login AND |
| 83 | ... Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway} |
| 84 | |
| 85 | Create Error On BMC And Verify Trap |
| 86 | |
| 87 | |
Anves Kumar rayankula | 04bc48c | 2021-07-08 23:33:37 -0500 | [diff] [blame] | 88 | Disable And Enable Eth0 Interface |
| 89 | [Documentation] Disable and Enable eth0 ethernet interface via redfish. |
| 90 | [Tags] Disable_And_Enable_Eth0_Interface |
| 91 | [Template] Set BMC Ethernet Interfaces State |
| 92 | |
| 93 | # interface_ip interface enabled |
| 94 | ${OPENBMC_HOST} eth0 ${False} |
| 95 | ${OPENBMC_HOST} eth0 ${True} |
| 96 | |
| 97 | |
Anves Kumar rayankula | a38ec2e | 2021-07-10 01:09:23 -0500 | [diff] [blame] | 98 | Verify Both Interfaces Access Concurrently Via Redfish |
| 99 | [Documentation] Verify both interfaces access conurrently via redfish. |
| 100 | [Tags] Verify_Both_Interfaces_Access_Concurrently_Via_Redfish |
| 101 | |
| 102 | Redfish.Login |
| 103 | Redfish1.Login |
| 104 | |
| 105 | ${dict}= Execute Process Multi Keyword ${2} |
| 106 | ... Redfish.Patch ${REDFISH_NW_ETH_IFACE}eth0 body={'DHCPv4':{'UseDNSServers':${True}}} |
| 107 | ... Redfish1.Patch ${REDFISH_NW_ETH_IFACE}eth1 body={'DHCPv4':{'UseDNSServers':${True}}} |
| 108 | |
| 109 | Dictionary Should Not Contain Value ${dict} False |
| 110 | ... msg=One or more operations has failed. |
| 111 | |
| 112 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}eth0 |
| 113 | ${resp1}= Redfish1.Get ${REDFISH_NW_ETH_IFACE}eth1 |
| 114 | |
| 115 | Should Be Equal ${resp.dict["DHCPv4"]['UseDNSServers']} ${True} |
| 116 | Should Be Equal ${resp1.dict["DHCPv4"]['UseDNSServers']} ${True} |
| 117 | |
Anves Kumar rayankula | 54482cd | 2021-07-09 07:13:25 -0500 | [diff] [blame] | 118 | Able To Access Serial Console Via Both Network Interfaces |
| 119 | [Documentation] Able to access serial console via both network interfaces. |
George Keishing | c4914b7 | 2021-07-27 08:03:19 -0500 | [diff] [blame] | 120 | [Tags] Able_To_Access_Serial_Console_Via_Both_Network_Interfaces |
Anves Kumar rayankula | 54482cd | 2021-07-09 07:13:25 -0500 | [diff] [blame] | 121 | |
| 122 | Open Connection And Log In host=${OPENBMC_HOST} port=2200 |
| 123 | Open Connection And Log In host=${OPENBMC_HOST_1} port=2200 |
| 124 | Close All Connections |
| 125 | |
Anves Kumar rayankula | d0a2f33 | 2021-07-14 07:53:12 -0500 | [diff] [blame] | 126 | Verify IPMI Works On Both Network Interfaces |
| 127 | [Documentation] Verify IPMI works on both network interfaces. |
| 128 | [Tags] Verify_IPMI_Works_On_Both_Network_Interfaces |
| 129 | |
| 130 | Run IPMI ${OPENBMC_HOST_1} power on |
| 131 | ${status1}= Run IPMI ${OPENBMC_HOST} power status |
| 132 | ${status2}= Run IPMI ${OPENBMC_HOST_1} power status |
| 133 | Should Be Equal ${status1} ${status2} |
| 134 | |
Sweta Potthuri | 2667f2c | 2022-10-11 07:55:21 -0500 | [diff] [blame] | 135 | Verify Modifying IP Address Multiple Times On Interface |
| 136 | [Documentation] Verify modifying IP address multiple times on interface. |
| 137 | [Tags] Verify_Modifying_IP_Address_Multiple_Times_On_Interface |
| 138 | [Teardown] Run Keywords |
| 139 | ... Delete IP Address ${test_ipv4_addr} AND Test Teardown |
| 140 | |
| 141 | ${test_gateway}= Get BMC Default Gateway |
| 142 | Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} |
| 143 | Update IP Address ${test_ipv4_addr} ${test_ipv4_addr2} ${test_subnet_mask} ${test_gateway} |
| 144 | Update IP Address ${test_ipv4_addr2} ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} |
| 145 | Run Keyword Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} |
| 146 | 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] | 147 | |
| 148 | Verify Able To Load Certificates Via Eth1 IP Address |
George Keishing | b13682a | 2021-07-20 08:52:39 -0500 | [diff] [blame] | 149 | [Documentation] Verify able to load certificates via eth1 IP address. |
Anves Kumar rayankula | 75ac429 | 2021-07-14 01:30:43 -0500 | [diff] [blame] | 150 | [Setup] Create Directory certificate_dir |
| 151 | [Tags] Verify_Able_To_Load_Certificates_Via_Eth1_IP_Address |
| 152 | [Teardown] Run Keywords Remove Directory certificate_dir recursive=True |
| 153 | ... AND FFDC On Test Case Fail |
| 154 | [Template] Install Certificate Via Redfish And Verify |
| 155 | |
| 156 | # cert_type cert_format expected_status |
| 157 | CA Valid Certificate ok |
| 158 | Client Valid Certificate Valid Privatekey ok |
| 159 | |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 160 | *** Keywords *** |
| 161 | |
| 162 | Get Network Configuration Using Channel Number |
| 163 | [Documentation] Get ethernet interface. |
| 164 | [Arguments] ${channel_number} |
| 165 | |
| 166 | # Description of argument(s): |
| 167 | # channel_number Ethernet channel number, 1 is for eth0 and 2 is for eth1 (e.g. "1"). |
| 168 | |
| 169 | ${active_channel_config}= Get Active Channel Config |
| 170 | ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']} |
| 171 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
| 172 | |
| 173 | @{network_configurations}= Get From Dictionary ${resp.dict} IPv4StaticAddresses |
| 174 | [Return] @{network_configurations} |
| 175 | |
| 176 | |
| 177 | Suite Setup Execution |
| 178 | [Documentation] Do suite setup task. |
| 179 | |
| 180 | Valid Value OPENBMC_HOST_1 |
| 181 | |
| 182 | # Check both interfaces are configured and reachable. |
| 183 | Ping Host ${OPENBMC_HOST} |
| 184 | Ping Host ${OPENBMC_HOST_1} |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 185 | |
| 186 | ${network_configurations}= Get Network Configuration Using Channel Number ${2} |
| 187 | FOR ${network_configuration} IN @{network_configurations} |
| 188 | |
| 189 | Run Keyword If '${network_configuration['Address']}' == '${OPENBMC_HOST_1}' |
| 190 | ... Run Keywords Set Suite Variable ${eth1_subnet_mask} ${network_configuration['SubnetMask']} |
| 191 | ... AND Set Suite Variable ${eth1_gateway} ${network_configuration['Gateway']} |
| 192 | ... AND Exit For Loop |
| 193 | |
| 194 | END |
Anves Kumar rayankula | 04bc48c | 2021-07-08 23:33:37 -0500 | [diff] [blame] | 195 | |
| 196 | |
| 197 | Set BMC Ethernet Interfaces State |
| 198 | [Documentation] Set BMC ethernet interface state. |
| 199 | [Arguments] ${interface_ip} ${interface} ${enabled} |
| 200 | [Teardown] Redfish1.Logout |
| 201 | |
| 202 | # Description of argument(s): |
| 203 | # interface_ip IP address of ethernet interface. |
| 204 | # interface The ethernet interface name (eg. eth0 or eth1). |
| 205 | # enabled Indicates interface should be enabled (eg. True or False). |
| 206 | |
| 207 | Redfish1.Login |
| 208 | |
| 209 | ${data}= Create Dictionary InterfaceEnabled=${enabled} |
| 210 | |
| 211 | Redfish1.patch ${REDFISH_NW_ETH_IFACE}${interface} body=&{data} |
| 212 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 213 | |
| 214 | Sleep ${NETWORK_TIMEOUT}s |
| 215 | ${interface_status}= Redfish1.Get Attribute ${REDFISH_NW_ETH_IFACE}${interface} InterfaceEnabled |
| 216 | Should Be Equal ${interface_status} ${enabled} |
| 217 | |
| 218 | ${status}= Run Keyword And Return Status Ping Host ${interface_ip} |
| 219 | |
| 220 | Run Keyword If ${enabled} == ${True} Should Be Equal ${status} ${True} |
| 221 | ... ELSE Should Be Equal ${status} ${False} |
Anves Kumar rayankula | d0a2f33 | 2021-07-14 07:53:12 -0500 | [diff] [blame] | 222 | |
| 223 | |
| 224 | Run IPMI |
| 225 | [Documentation] Run IPMI command. |
| 226 | [Arguments] ${host} ${sub_cmd} |
| 227 | |
| 228 | # Description of argument(s): |
| 229 | # host BMC host name or IP address. |
| 230 | # sub_cmd The IPMI command string to be executed. |
| 231 | |
| 232 | ${rc} ${output}= Run And Return Rc And Output ${cmd_prefix} -H ${host} ${sub_cmd} |
| 233 | Should Be Equal As Strings ${rc} 0 |
| 234 | [Return] ${output} |
| 235 | |
Anves Kumar rayankula | 75ac429 | 2021-07-14 01:30:43 -0500 | [diff] [blame] | 236 | |
| 237 | Install Certificate Via Redfish And Verify |
| 238 | [Documentation] Install and verify certificate using Redfish. |
| 239 | [Arguments] ${cert_type} ${cert_format} ${expected_status} ${delete_cert}=${True} |
| 240 | |
| 241 | # Description of argument(s): |
| 242 | # cert_type Certificate type (e.g. "Client" or "CA"). |
| 243 | # cert_format Certificate file format |
| 244 | # (e.g. "Valid_Certificate_Valid_Privatekey"). |
| 245 | # expected_status Expected status of certificate replace Redfish |
| 246 | # request (i.e. "ok" or "error"). |
| 247 | # delete_cert Certificate will be deleted before installing if this True. |
| 248 | |
| 249 | # AUTH_URI is a global variable defined in lib/resource.robot |
| 250 | Set Test Variable ${AUTH_URI} https://${OPENBMC_HOST_1} |
| 251 | Run Keyword If '${cert_type}' == 'CA' and '${delete_cert}' == '${True}' |
| 252 | ... Delete All CA Certificate Via Redfish |
| 253 | ... ELSE IF '${cert_type}' == 'Client' and '${delete_cert}' == '${True}' |
| 254 | ... Delete Certificate Via BMC CLI ${cert_type} |
| 255 | |
| 256 | ${cert_file_path}= Generate Certificate File Via Openssl ${cert_format} |
| 257 | ${bytes}= OperatingSystem.Get Binary File ${cert_file_path} |
| 258 | ${file_data}= Decode Bytes To String ${bytes} UTF-8 |
| 259 | |
| 260 | ${certificate_uri}= Set Variable If |
| 261 | ... '${cert_type}' == 'Client' ${REDFISH_LDAP_CERTIFICATE_URI} |
| 262 | ... '${cert_type}' == 'CA' ${REDFISH_CA_CERTIFICATE_URI} |
| 263 | |
| 264 | ${cert_id}= Install Certificate File On BMC ${certificate_uri} ${expected_status} data=${file_data} |
| 265 | Logging Installed certificate id: ${cert_id} |
| 266 | |
| 267 | Sleep 30s |
| 268 | ${cert_file_content}= OperatingSystem.Get File ${cert_file_path} |
| 269 | ${bmc_cert_content}= Run Keyword If '${expected_status}' == 'ok' redfish_utils.Get Attribute |
| 270 | ... ${certificate_uri}/${cert_id} CertificateString |
| 271 | Run Keyword If '${expected_status}' == 'ok' Should Contain ${cert_file_content} ${bmc_cert_content} |
| 272 | [Return] ${cert_id} |