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