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