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