George Keishing | 6a514ef | 2018-08-27 05:19:19 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Remote logging test for rsyslog. |
| 3 | |
| 4 | # Program arguments: |
| 5 | # REMOTE_LOG_SERVER_HOST The host name or IP address of the remote |
George Keishing | 6713367 | 2018-08-31 10:23:15 -0500 | [diff] [blame] | 6 | # logging server. |
George Keishing | 6a514ef | 2018-08-27 05:19:19 -0500 | [diff] [blame] | 7 | # REMOTE_LOG_SERVER_PORT The port number for the remote logging server. |
George Keishing | 6713367 | 2018-08-31 10:23:15 -0500 | [diff] [blame] | 8 | # REMOTE_USERNAME The username for the remote logging server. |
| 9 | # REMOTE_PASSWORD The password for the remote logging server. |
George Keishing | 6a514ef | 2018-08-27 05:19:19 -0500 | [diff] [blame] | 10 | |
George Keishing | 76a5daf | 2018-09-14 06:00:01 -0500 | [diff] [blame] | 11 | Library String |
George Keishing | 6a514ef | 2018-08-27 05:19:19 -0500 | [diff] [blame] | 12 | Resource ../lib/openbmc_ffdc.robot |
George Keishing | 76a5daf | 2018-09-14 06:00:01 -0500 | [diff] [blame] | 13 | Resource ../lib/boot_utils.robot |
George Keishing | bbfc394 | 2018-09-19 10:15:48 -0500 | [diff] [blame] | 14 | Resource ../lib/remote_logging_utils.robot |
George Keishing | 80bfd31 | 2019-03-19 12:05:24 -0500 | [diff] [blame] | 15 | Resource ../lib/bmc_redfish_resource.robot |
| 16 | Resource ../lib/ipmi_client.robot |
George Keishing | 9a0d480 | 2018-08-31 13:29:40 -0500 | [diff] [blame] | 17 | Library ../lib/gen_misc.py |
George Keishing | 6a514ef | 2018-08-27 05:19:19 -0500 | [diff] [blame] | 18 | |
| 19 | Suite Setup Suite Setup Execution |
George Keishing | 216e584 | 2018-08-31 14:58:15 -0500 | [diff] [blame] | 20 | Test Setup Test Setup Execution |
George Keishing | 6a514ef | 2018-08-27 05:19:19 -0500 | [diff] [blame] | 21 | Test Teardown FFDC On Test Case Fail |
| 22 | |
George Keishing | 2cec186 | 2018-09-03 12:59:25 -0500 | [diff] [blame] | 23 | *** Variables *** |
| 24 | |
George Keishing | c1ca5e9 | 2018-09-03 11:19:23 -0500 | [diff] [blame] | 25 | # Strings to check from journald. |
George Keishing | 13451ed | 2018-09-06 12:46:16 -0500 | [diff] [blame] | 26 | ${BMC_STOP_MSG} Stopping Phosphor IPMI BT DBus Bridge |
| 27 | ${BMC_START_MSG} Starting Flush Journal to Persistent Storage |
| 28 | ${BMC_BOOT_MSG} Startup finished in |
| 29 | ${BMC_SYSLOG_REGEX} dropbear|vrm-control.sh |
George Keishing | eacb188 | 2018-09-20 00:11:00 -0500 | [diff] [blame] | 30 | ${RSYSLOG_REGEX} start|exiting on signal 15|there are no active actions configured |
George Keishing | 686cacb | 2019-01-16 01:05:20 -0600 | [diff] [blame] | 31 | ${RSYSLOG_RETRY_REGEX} suspended |
George Keishing | 80bfd31 | 2019-03-19 12:05:24 -0500 | [diff] [blame] | 32 | ${valid_password} 0penBmc1 |
George Keishing | c1ca5e9 | 2018-09-03 11:19:23 -0500 | [diff] [blame] | 33 | |
George Keishing | 6a514ef | 2018-08-27 05:19:19 -0500 | [diff] [blame] | 34 | *** Test Cases *** |
| 35 | |
George Keishing | eb9fc59 | 2018-09-18 07:58:17 -0500 | [diff] [blame] | 36 | Test BMC Hostname Service And Verify |
| 37 | [Documentation] Write to hostname interface and verify via REST and |
| 38 | ... 'hostname' command. |
| 39 | [Tags] Test_BMC_Hostname_Service_And_Verify |
| 40 | |
| 41 | ${openbmc_host_name} ${openbmc_ip} ${openbmc_short_name}= |
| 42 | ... Get Host Name IP host=${OPENBMC_HOST} short_name=1 |
| 43 | |
| 44 | ${host_name_dict}= Create Dictionary data=${openbmc_short_name} |
| 45 | Write Attribute ${NETWORK_MANAGER}config HostName data=${host_name_dict} |
| 46 | ... verify=${TRUE} expected_value=${openbmc_short_name} |
| 47 | |
| 48 | ${hostname} ${stderr} ${rc}= BMC Execute Command hostname |
| 49 | |
| 50 | Should Be Equal As Strings ${hostname} ${openbmc_short_name} |
| 51 | ... msg=The hostname interface ${openbmc_short_name} and command value ${hostname} do not match. |
| 52 | |
| 53 | # Override the suite hostname variable if this test is executed. |
| 54 | Set Suite Variable ${bmc_hostname} ${openbmc_short_name} |
| 55 | |
| 56 | |
George Keishing | 13a64e6 | 2018-09-10 13:07:36 -0500 | [diff] [blame] | 57 | Verify REST Logging On BMC Journal When Disabled |
| 58 | [Documentation] Enable REST logging and verify from journald. |
George Keishing | b77a357 | 2018-09-13 23:26:28 -0500 | [diff] [blame] | 59 | [Tags] Verify_REST_Logging_On_BMC_Journal_When_Disabled |
George Keishing | 13a64e6 | 2018-09-10 13:07:36 -0500 | [diff] [blame] | 60 | |
| 61 | ${log_dict}= Create Dictionary data=${False} |
| 62 | Write Attribute ${BMC_LOGGING_URI}${/}rest_api_logs Enabled data=${log_dict} |
| 63 | ... verify=${True} expected_value=${False} |
| 64 | |
George Keishing | eacb188 | 2018-09-20 00:11:00 -0500 | [diff] [blame] | 65 | # If it was enabled prior, this REST footprint will show up. |
| 66 | # Takes around 5 seconds for the REST to restart service when policy is changed. |
| 67 | Sleep 10s |
| 68 | |
George Keishing | 6218e76 | 2018-10-06 13:14:36 -0500 | [diff] [blame] | 69 | ${login_footprint}= Catenate login json:None 200 OK |
George Keishing | 4df837f | 2018-09-19 14:06:01 -0500 | [diff] [blame] | 70 | # Example: Just get the message part of the syslog |
George Keishing | 6218e76 | 2018-10-06 13:14:36 -0500 | [diff] [blame] | 71 | # user:root POST http://xx.xx.xx.xx/login json:None 200 OK |
George Keishing | 4df837f | 2018-09-19 14:06:01 -0500 | [diff] [blame] | 72 | ${cmd}= Catenate SEPARATOR= --no-pager | egrep '${login_footprint}' |
| 73 | ... | awk -F': ' '{print $2}' |
| 74 | |
| 75 | Start Journal Log filter=${cmd} |
George Keishing | 13a64e6 | 2018-09-10 13:07:36 -0500 | [diff] [blame] | 76 | Initialize OpenBMC |
George Keishing | 4df837f | 2018-09-19 14:06:01 -0500 | [diff] [blame] | 77 | Sleep 5s |
| 78 | ${bmc_journald}= Stop Journal Log |
George Keishing | 13a64e6 | 2018-09-10 13:07:36 -0500 | [diff] [blame] | 79 | |
George Keishing | 4df837f | 2018-09-19 14:06:01 -0500 | [diff] [blame] | 80 | Should Be Empty ${bmc_journald} |
George Keishing | 13a64e6 | 2018-09-10 13:07:36 -0500 | [diff] [blame] | 81 | ... msg=${bmc_journald} contains unexpected REST entries. |
| 82 | |
| 83 | |
George Keishing | b77a357 | 2018-09-13 23:26:28 -0500 | [diff] [blame] | 84 | Verify REST Logging On BMC Journal When Enabled |
George Keishing | 13a64e6 | 2018-09-10 13:07:36 -0500 | [diff] [blame] | 85 | [Documentation] Enable REST logging and verify from journald. |
George Keishing | b77a357 | 2018-09-13 23:26:28 -0500 | [diff] [blame] | 86 | [Tags] Verify_REST_Logging_On_BMC_Journal_When_Enabled |
George Keishing | 13a64e6 | 2018-09-10 13:07:36 -0500 | [diff] [blame] | 87 | |
| 88 | ${log_dict}= Create Dictionary data=${True} |
| 89 | Write Attribute ${BMC_LOGGING_URI}${/}rest_api_logs Enabled data=${log_dict} |
| 90 | ... verify=${True} expected_value=${True} |
| 91 | |
George Keishing | 686cacb | 2019-01-16 01:05:20 -0600 | [diff] [blame] | 92 | Sleep 5s |
| 93 | |
| 94 | Start Journal Log |
George Keishing | 13a64e6 | 2018-09-10 13:07:36 -0500 | [diff] [blame] | 95 | Initialize OpenBMC |
George Keishing | 6218e76 | 2018-10-06 13:14:36 -0500 | [diff] [blame] | 96 | Log Out OpenBMC |
George Keishing | 686cacb | 2019-01-16 01:05:20 -0600 | [diff] [blame] | 97 | ${bmc_journald}= Stop Journal Log |
George Keishing | 13a64e6 | 2018-09-10 13:07:36 -0500 | [diff] [blame] | 98 | |
George Keishing | 6218e76 | 2018-10-06 13:14:36 -0500 | [diff] [blame] | 99 | Should Contain ${bmc_journald} login json:None 200 OK |
George Keishing | 13a64e6 | 2018-09-10 13:07:36 -0500 | [diff] [blame] | 100 | ... msg=${bmc_journald} doesn't contains REST entries. |
| 101 | |
| 102 | |
George Keishing | 38733f3 | 2018-09-20 05:56:50 -0500 | [diff] [blame] | 103 | Test Remote API Valid Config Combination |
| 104 | [Documentation] Verify valid combination of address and port. |
| 105 | [Tags] Test_Remote_API_Valid_Config_Combination |
| 106 | [Template] Verify Configure Remote Logging Server |
| 107 | # Forego normal test setup: |
| 108 | [Setup] No Operation |
| 109 | |
| 110 | # Address Port Expected result |
| 111 | ${EMPTY} ${REMOTE_LOG_SERVER_PORT} ${True} |
| 112 | ${REMOTE_LOG_SERVER_HOST} ${REMOTE_LOG_SERVER_PORT} ${True} |
George Keishing | 38733f3 | 2018-09-20 05:56:50 -0500 | [diff] [blame] | 113 | ${REMOTE_LOG_SERVER_HOST} ${0} ${True} |
| 114 | |
| 115 | |
| 116 | Test Remote API Invalid Config Combination |
| 117 | [Documentation] Verify invalid combination of address and port. |
| 118 | [Tags] Test_Remote_API_Invalid_Config_Combination |
| 119 | [Template] Verify Configure Remote Logging Server |
| 120 | # Forego normal test setup: |
| 121 | [Setup] No Operation |
| 122 | |
| 123 | # Address Port Expected result |
| 124 | ${0} ${REMOTE_LOG_SERVER_PORT} ${False} |
| 125 | "0" ${REMOTE_LOG_SERVER_PORT} ${False} |
| 126 | ${REMOTE_LOG_SERVER_HOST} ${EMPTY} ${False} |
| 127 | ${REMOTE_LOG_SERVER_HOST} "0" ${False} |
| 128 | |
| 129 | |
George Keishing | 6a514ef | 2018-08-27 05:19:19 -0500 | [diff] [blame] | 130 | Test Remote Logging REST Interface And Verify Config |
| 131 | [Documentation] Test remote logging interface and configuration. |
| 132 | [Tags] Test_Remote_Logging_REST_Interface_And_Verify_Config |
| 133 | |
George Keishing | 6a514ef | 2018-08-27 05:19:19 -0500 | [diff] [blame] | 134 | Verify Rsyslog Config On BMC |
| 135 | |
George Keishing | 6a514ef | 2018-08-27 05:19:19 -0500 | [diff] [blame] | 136 | |
George Keishing | 13451ed | 2018-09-06 12:46:16 -0500 | [diff] [blame] | 137 | Test Remote Logging Invalid Port Config And Verify BMC Journald |
| 138 | [Documentation] Test remote logging interface and configuration. |
| 139 | [Tags] Test_Remote_Logging_Invalid_Port_Config_And_Verify_BMC_Journald |
| 140 | |
| 141 | # Invalid port derived by (REMOTE_LOG_SERVER_PORT + 1) port config setting. |
| 142 | ${INVALID_PORT}= Evaluate ${REMOTE_LOG_SERVER_PORT} + ${1} |
George Keishing | bbfc394 | 2018-09-19 10:15:48 -0500 | [diff] [blame] | 143 | Configure Remote Log Server With Parameters |
George Keishing | 13451ed | 2018-09-06 12:46:16 -0500 | [diff] [blame] | 144 | ... remote_host=${REMOTE_LOG_SERVER_HOST} remote_port=${INVALID_PORT} |
| 145 | |
| 146 | Sleep 3s |
Joy Onyerikwu | dbfe97d | 2019-03-11 19:44:56 -0500 | [diff] [blame] | 147 | # rsyslogd[1870]: action 'action 0' suspended, |
| 148 | # next retry is Fri Sep 14 05:47:39 2018 [v8.29.0 try http://www.rsyslog.com/e/2007 ] |
George Keishing | 13451ed | 2018-09-06 12:46:16 -0500 | [diff] [blame] | 149 | ${bmc_journald} ${stderr} ${rc}= BMC Execute Command |
| 150 | ... journalctl -b --no-pager | egrep 'rsyslog.*${RSYSLOG_RETRY_REGEX}' |
| 151 | |
| 152 | Should Contain ${bmc_journald} ${RSYSLOG_RETRY_REGEX} |
| 153 | ... msg=${bmc_journald} doesn't contain rsyslog retry entries. |
| 154 | |
| 155 | |
George Keishing | 6713367 | 2018-08-31 10:23:15 -0500 | [diff] [blame] | 156 | Verfiy BMC Journald Synced To Remote Logging Server |
| 157 | [Documentation] Check that BMC journald is sync to remote rsyslog. |
| 158 | [Tags] Verfiy_BMC_Journald_Synced_To_Remote_Logging_Server |
| 159 | |
George Keishing | 6713367 | 2018-08-31 10:23:15 -0500 | [diff] [blame] | 160 | # Restart BMC dump service and get the last entry of the journald. |
| 161 | # Example: |
George Keishing | 96904c4 | 2018-09-20 09:25:30 -0500 | [diff] [blame] | 162 | # systemd[1]: Started Phosphor Dump Manager. |
George Keishing | 6713367 | 2018-08-31 10:23:15 -0500 | [diff] [blame] | 163 | BMC Execute Command |
| 164 | ... systemctl restart xyz.openbmc_project.Dump.Manager.service |
| 165 | |
| 166 | ${bmc_journald} ${stderr} ${rc}= BMC Execute Command |
George Keishing | 82ea1d4 | 2018-09-11 13:45:36 -0500 | [diff] [blame] | 167 | ... journalctl --no-pager | grep 'Started Phosphor Dump Manager' |
George Keishing | 6713367 | 2018-08-31 10:23:15 -0500 | [diff] [blame] | 168 | |
George Keishing | 96904c4 | 2018-09-20 09:25:30 -0500 | [diff] [blame] | 169 | # systemd[1]: Started Phosphor Dump Manager. |
George Keishing | 82ea1d4 | 2018-09-11 13:45:36 -0500 | [diff] [blame] | 170 | ${cmd}= Catenate SEPARATOR= egrep '${bmc_hostname}.*Started Phosphor Dump Manager' /var/log/syslog |
George Keishing | 6713367 | 2018-08-31 10:23:15 -0500 | [diff] [blame] | 171 | ${remote_journald}= Remote Logging Server Execute Command command=${cmd} |
| 172 | |
George Keishing | 216e584 | 2018-08-31 14:58:15 -0500 | [diff] [blame] | 173 | # TODO: rsyslog configuration and time date template to match BMC journald. |
| 174 | # Compare the BMC journlad log. Example: |
| 175 | # systemd[1]: Started Phosphor Dump Manager. |
George Keishing | 82ea1d4 | 2018-09-11 13:45:36 -0500 | [diff] [blame] | 176 | Should Contain ${remote_journald} ${bmc_journald.split('${bmc_hostname}')[1][0]} |
George Keishing | 216e584 | 2018-08-31 14:58:15 -0500 | [diff] [blame] | 177 | ... msg= ${bmc_journald} doesn't match remote rsyslog:${remote_journald}. |
George Keishing | 6713367 | 2018-08-31 10:23:15 -0500 | [diff] [blame] | 178 | |
| 179 | |
George Keishing | 2cec186 | 2018-09-03 12:59:25 -0500 | [diff] [blame] | 180 | Verify Journald Post BMC Reset |
| 181 | [Documentation] Check that BMC journald is sync'ed to remote rsyslog after |
| 182 | ... BMC reset. |
| 183 | [Tags] Verify_Journald_Post_BMC_Reset |
| 184 | |
| 185 | ${hostname} ${stderr} ${rc}= BMC Execute Command hostname |
| 186 | OBMC Reboot (off) |
| 187 | |
| 188 | ${cmd}= Catenate grep ${hostname} /var/log/syslog | |
| 189 | ... egrep '${BMC_STOP_MSG}|${BMC_START_MSG}|${BMC_BOOT_MSG}' |
| 190 | ${remote_journald}= Remote Logging Server Execute Command command=${cmd} |
| 191 | |
| 192 | # 1. Last reboot message to verify. |
| 193 | Should Contain ${remote_journald} ${BMC_STOP_MSG} |
| 194 | ... msg=The remote journald doesn't contain the IPMI shutdown message: ${BMC_STOP_MSG}. |
| 195 | |
| 196 | # 2. Earliest booting message on journald. |
| 197 | Should Contain ${remote_journald} ${BMC_START_MSG} |
| 198 | ... msg=The remote journald doesn't contain the start message: ${BMC_START_MSG}. |
| 199 | |
| 200 | # 3. Unique boot to standby message. |
| 201 | # Startup finished in 9.961s (kernel) + 1min 59.039s (userspace) = 2min 9.000s |
| 202 | ${bmc_journald} ${stderr} ${rc}= BMC Execute Command |
George Keishing | 6218e76 | 2018-10-06 13:14:36 -0500 | [diff] [blame] | 203 | ... journalctl -b --no-pager | egrep '${BMC_BOOT_MSG}' |
George Keishing | 2cec186 | 2018-09-03 12:59:25 -0500 | [diff] [blame] | 204 | |
| 205 | Should Contain ${remote_journald} |
| 206 | ... ${bmc_journald.split('${hostname}')[1]} |
| 207 | ... msg=The remote journald doesn't contain the boot message: ${BMC_BOOT_MSG}. |
| 208 | |
| 209 | |
George Keishing | cc18f7c | 2018-09-03 09:40:11 -0500 | [diff] [blame] | 210 | Verify BMC Journald Contains No Credential Data |
George Keishing | cb3b9b6 | 2018-09-14 12:11:19 -0500 | [diff] [blame] | 211 | [Documentation] Check that BMC journald doesn't log any credential data. |
George Keishing | cc18f7c | 2018-09-03 09:40:11 -0500 | [diff] [blame] | 212 | [Tags] Verify_BMC_Journald_Contains_No_Credential_Data |
| 213 | |
George Keishing | c25c55d | 2018-10-30 02:23:44 -0500 | [diff] [blame] | 214 | Initialize OpenBMC |
George Keishing | 80bfd31 | 2019-03-19 12:05:24 -0500 | [diff] [blame] | 215 | |
| 216 | Create Redfish And IPMI Users |
George Keishing | c25c55d | 2018-10-30 02:23:44 -0500 | [diff] [blame] | 217 | |
| 218 | # Time for user manager to sync. |
| 219 | Sleep 5 s |
| 220 | |
George Keishing | cc18f7c | 2018-09-03 09:40:11 -0500 | [diff] [blame] | 221 | Open Connection And Log In |
| 222 | ${bmc_journald} ${stderr} ${rc}= BMC Execute Command |
| 223 | ... journalctl -o json-pretty | cat |
| 224 | |
George Keishing | c25c55d | 2018-10-30 02:23:44 -0500 | [diff] [blame] | 225 | Should Not Contain Any ${bmc_journald} ${OPENBMC_PASSWORD} ${REST_PASSWORD} |
George Keishing | cc18f7c | 2018-09-03 09:40:11 -0500 | [diff] [blame] | 226 | ... msg=Journald logs BMC credentials/password ${OPENBMC_PASSWORD}. |
| 227 | |
| 228 | |
George Keishing | 9a0d480 | 2018-08-31 13:29:40 -0500 | [diff] [blame] | 229 | Audit BMC SSH Login And Remote Logging |
| 230 | [Documentation] Check that the SSH login to BMC is logged and synced to |
| 231 | ... remote logging server. |
| 232 | [Tags] Audit_BMC_SSH_Login_And_Remote_Logging |
| 233 | |
George Keishing | aef483e | 2018-09-19 07:57:22 -0500 | [diff] [blame] | 234 | ${login_footprint}= Catenate Started SSH Per-Connection Server |
| 235 | # Example: Just get the message part of the syslog |
| 236 | # Started SSH Per-Connection Server (xx.xx.xx.xx:51292) |
| 237 | ${cmd}= Catenate SEPARATOR= --no-pager | egrep '${login_footprint}' |
| 238 | ... | awk -F': ' '{print $2}' |
George Keishing | 9a0d480 | 2018-08-31 13:29:40 -0500 | [diff] [blame] | 239 | |
George Keishing | aef483e | 2018-09-19 07:57:22 -0500 | [diff] [blame] | 240 | Start Journal Log filter=${cmd} |
George Keishing | 9a0d480 | 2018-08-31 13:29:40 -0500 | [diff] [blame] | 241 | Open Connection And Log In |
George Keishing | aef483e | 2018-09-19 07:57:22 -0500 | [diff] [blame] | 242 | Sleep 5s |
| 243 | ${bmc_journald}= Stop Journal Log |
| 244 | @{ssh_entry}= Split To Lines ${bmc_journald} |
George Keishing | 9a0d480 | 2018-08-31 13:29:40 -0500 | [diff] [blame] | 245 | |
George Keishing | aef483e | 2018-09-19 07:57:22 -0500 | [diff] [blame] | 246 | ${cmd}= Catenate SEPARATOR= egrep -E '*${bmc_hostname}.*${login_footprint}' /var/log/syslog |
George Keishing | 9a0d480 | 2018-08-31 13:29:40 -0500 | [diff] [blame] | 247 | |
| 248 | ${remote_journald}= Remote Logging Server Execute Command command=${cmd} |
| 249 | |
George Keishing | aef483e | 2018-09-19 07:57:22 -0500 | [diff] [blame] | 250 | Should Contain ${remote_journald} ${ssh_entry[0]} |
George Keishing | 9a0d480 | 2018-08-31 13:29:40 -0500 | [diff] [blame] | 251 | ... msg=${remote_journald} don't contain ${bmc_journald} entry. |
| 252 | |
| 253 | |
George Keishing | 6218e76 | 2018-10-06 13:14:36 -0500 | [diff] [blame] | 254 | Verify Rsyslog Does Not Log On BMC |
| 255 | [Documentation] Check that rsyslog journald doesn't log on BMC. |
| 256 | [Tags] Verify_Rsyslog_Does_Not_Log_On_BMC |
| 257 | |
| 258 | # Expected filter rsyslog entries. |
| 259 | # Example: |
Joy Onyerikwu | dbfe97d | 2019-03-11 19:44:56 -0500 | [diff] [blame] | 260 | # syslogd[3356]: |
| 261 | # [origin software="rsyslogd" swVersion="8.29.0" x-pid="3356" x-info="http://www.rsyslog.com"] |
| 262 | # exiting on signal 15. |
| 263 | # rsyslogd[3364]: |
| 264 | # [origin software="rsyslogd" swVersion="8.29.0" x-pid="3364" x-info="http://www.rsyslog.com"] start |
George Keishing | 6218e76 | 2018-10-06 13:14:36 -0500 | [diff] [blame] | 265 | ${bmc_journald} ${stderr} ${rc}= BMC Execute Command |
| 266 | ... journalctl -b --no-pager | egrep 'rsyslog' | egrep -Ev '${RSYSLOG_REGEX}|${RSYSLOG_RETRY_REGEX}' |
| 267 | ... ignore_err=${1} |
| 268 | |
| 269 | Should Be Empty ${bmc_journald} |
| 270 | ... msg=${bmc_journald} contains unexpected rsyslog entries. |
| 271 | |
| 272 | |
George Keishing | 76a5daf | 2018-09-14 06:00:01 -0500 | [diff] [blame] | 273 | Boot Host And Verify Data Is Synced To Remote Server |
| 274 | [Documentation] Boot host and verify the power on sequence logs are synced |
| 275 | ... to remote logging server. |
| 276 | [Tags] Boot_Host_And_Verify_Data_Is_Synced_To_Remote_Server |
| 277 | |
George Keishing | 307c3fa | 2018-10-25 11:43:23 -0500 | [diff] [blame] | 278 | # Filter kernel dmesg from the journald log. |
| 279 | # Example: xx.xx.xx kernel: |
| 280 | |
| 281 | ${openbmc_host_name} ${openbmc_ip} ${openbmc_short_name}= |
| 282 | ... Get Host Name IP host=${OPENBMC_HOST} short_name=1 |
| 283 | |
| 284 | ${cmd}= Catenate SEPARATOR= --no-pager | egrep -Ev '${BMC_SYSLOG_REGEX} |
| 285 | ... |${openbmc_short_name} kernel' | awk -F': ' '{print $2}' |
George Keishing | 76a5daf | 2018-09-14 06:00:01 -0500 | [diff] [blame] | 286 | |
| 287 | # Example: Just get the message part of the syslog |
| 288 | # Started OpenPOWER OCC Active Disable. |
| 289 | Start Journal Log filter=${cmd} |
| 290 | |
| 291 | # Irrespective of the outcome, the journald should be synced. |
| 292 | Run Keyword And Ignore Error REST Power On |
| 293 | ${bmc_journald}= Stop Journal Log |
| 294 | |
| 295 | ${cmd}= Catenate SEPARATOR= egrep '${bmc_hostname}' /var/log/syslog |
| 296 | ${remote_journald}= Remote Logging Server Execute Command command=${cmd} |
| 297 | |
| 298 | @{lines}= Split To Lines ${bmc_journald} |
George Keishing | 307c3fa | 2018-10-25 11:43:23 -0500 | [diff] [blame] | 299 | |
George Keishing | 76a5daf | 2018-09-14 06:00:01 -0500 | [diff] [blame] | 300 | :FOR ${line} IN @{lines} |
| 301 | \ Log To Console \n ${line} |
| 302 | \ Should Contain ${remote_journald} ${line} |
| 303 | ... mgs=${line} line doesn't contain in ${remote_journald}. |
| 304 | |
| 305 | |
George Keishing | 6a514ef | 2018-08-27 05:19:19 -0500 | [diff] [blame] | 306 | *** Keywords *** |
| 307 | |
| 308 | Suite Setup Execution |
| 309 | [Documentation] Do the suite setup. |
| 310 | |
| 311 | Should Not Be Empty ${REMOTE_LOG_SERVER_HOST} |
| 312 | Should Not Be Empty ${REMOTE_LOG_SERVER_PORT} |
George Keishing | 6713367 | 2018-08-31 10:23:15 -0500 | [diff] [blame] | 313 | Should Not Be Empty ${REMOTE_USERNAME} |
| 314 | Should Not Be Empty ${REMOTE_PASSWORD} |
George Keishing | 6a514ef | 2018-08-27 05:19:19 -0500 | [diff] [blame] | 315 | Ping Host ${REMOTE_LOG_SERVER_HOST} |
George Keishing | 6713367 | 2018-08-31 10:23:15 -0500 | [diff] [blame] | 316 | Remote Logging Server Execute Command true |
George Keishing | 6a514ef | 2018-08-27 05:19:19 -0500 | [diff] [blame] | 317 | Remote Logging Interface Should Exist |
| 318 | |
George Keishing | 216e584 | 2018-08-31 14:58:15 -0500 | [diff] [blame] | 319 | ${hostname} ${stderr} ${rc}= BMC Execute Command /bin/hostname |
| 320 | Set Suite Variable ${bmc_hostname} ${hostname} |
George Keishing | bbfc394 | 2018-09-19 10:15:48 -0500 | [diff] [blame] | 321 | Configure Remote Log Server With Parameters |
George Keishing | 216e584 | 2018-08-31 14:58:15 -0500 | [diff] [blame] | 322 | |
| 323 | |
| 324 | Test Setup Execution |
| 325 | [Documentation] Do the test setup. |
| 326 | |
George Keishing | b77a357 | 2018-09-13 23:26:28 -0500 | [diff] [blame] | 327 | # Retain only the past 1 second log: |
| 328 | BMC Execute Command journalctl --vacuum-time=1s |
George Keishing | 13a64e6 | 2018-09-10 13:07:36 -0500 | [diff] [blame] | 329 | |
| 330 | ${config_status}= Run Keyword And Return Status |
George Keishing | 216e584 | 2018-08-31 14:58:15 -0500 | [diff] [blame] | 331 | ... Get Remote Log Server Configured |
| 332 | |
George Keishing | bbfc394 | 2018-09-19 10:15:48 -0500 | [diff] [blame] | 333 | Run Keyword If ${config_status}==${FALSE} |
| 334 | ... Configure Remote Log Server With Parameters |
George Keishing | 216e584 | 2018-08-31 14:58:15 -0500 | [diff] [blame] | 335 | |
George Keishing | 6a514ef | 2018-08-27 05:19:19 -0500 | [diff] [blame] | 336 | |
| 337 | Remote Logging Interface Should Exist |
| 338 | [Documentation] Check that the remote logging URI exist. |
| 339 | |
| 340 | ${resp}= OpenBMC Get Request ${REMOTE_LOGGING_URI} |
| 341 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
George Keishing | 38733f3 | 2018-09-20 05:56:50 -0500 | [diff] [blame] | 342 | |
| 343 | |
| 344 | Verify Configure Remote Logging Server |
| 345 | [Documentation] Configure the remote logging REST interface on BMC. |
| 346 | [Arguments] ${remote_host} ${remote_port} ${expectation} |
| 347 | |
| 348 | # Description of argument(s): |
| 349 | # remote_host The host name or IP address of the remote logging server |
| 350 | # (e.g. "xx.xx.xx.xx"). |
| 351 | # remote_port Remote ryslog server port number (e.g. "514"). |
| 352 | # expectation Expect boolean True/False. |
| 353 | |
| 354 | |
| 355 | ${status}= Run Keyword And Return Status |
George Keishing | ccd6d09 | 2018-09-21 00:39:43 -0500 | [diff] [blame] | 356 | ... Configure Remote Log Server With Parameters remote_host=${remote_host} remote_port=${remote_port} |
George Keishing | 38733f3 | 2018-09-20 05:56:50 -0500 | [diff] [blame] | 357 | |
| 358 | Should Be Equal ${status} ${expectation} |
| 359 | ... msg=Test result ${status} and expectation ${expectation} do not match. |
George Keishing | 80bfd31 | 2019-03-19 12:05:24 -0500 | [diff] [blame] | 360 | |
| 361 | |
| 362 | Create Redfish And IPMI Users |
| 363 | [Documentation] Create a valid Redfish and IPMI local user accounts and |
| 364 | ... delete them. |
| 365 | |
| 366 | # Create redfish local valid user. |
| 367 | ${redfish_username}= Generate Random String 8 [LETTERS] |
| 368 | |
| 369 | Redfish.Login |
| 370 | |
| 371 | ${payload}= Create Dictionary |
| 372 | ... UserName=${redfish_username} Password=${valid_password} |
| 373 | ... RoleId=Administrator Enabled=${True} |
| 374 | Redfish.Post /redfish/v1/AccountService/Accounts body=&{payload} |
| 375 | ... valid_status_codes=[${HTTP_CREATED}] |
| 376 | |
| 377 | # Delete newly created user. |
| 378 | Redfish.Delete /redfish/v1/AccountService/Accounts/${redfish_username} |
| 379 | |
| 380 | Redfish.Logout |
| 381 | |
| 382 | # Create IPMI local valid user. |
| 383 | ${ipmi_username}= Generate Random String 8 [LETTERS] |
| 384 | Set Test Variable ${ipmi_username} |
| 385 | ${random_userid}= Evaluate random.randint(2, 15) modules=random |
| 386 | ${ipmi_cmd}= Catenate user set name ${random_userid} ${ipmi_username} |
| 387 | Run IPMI Standard Command ${ipmi_cmd} |
| 388 | |
| 389 | # Delete IPMI user. |
| 390 | Run IPMI Standard Command user set name ${random_userid} "" |
| 391 | |