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