Jayashree-D | 39c6662 | 2020-08-14 12:22:24 +0530 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This suite will test the host console |
| 3 | |
| 4 | Resource ../lib/resource.robot |
| 5 | Resource ../lib/utils.robot |
| 6 | |
| 7 | Library SSHLibrary |
| 8 | |
| 9 | Suite Setup Open Connection And Log In |
| 10 | Test Setup Test Setup Execution |
| 11 | Suite Teardown Close All Connections |
| 12 | |
| 13 | *** Variables *** |
| 14 | |
| 15 | ${HOST_LOG_PATH} /var/lib/obmc/hostlogs |
| 16 | |
| 17 | |
| 18 | *** Test Cases *** |
| 19 | |
| 20 | Verify Host Console Connection |
| 21 | [Documentation] Connect the obmc-console from BMC and verify the logs. |
| 22 | [Tags] Verify_Host_Console_Connection |
| 23 | |
| 24 | Write obmc-console-client |
| 25 | Write \n |
| 26 | ${write}= Read Until login: |
| 27 | Write ${OS_USERNAME} |
| 28 | ${pass}= Read Until Password: |
| 29 | Write ${OS_PASSWORD} |
| 30 | Write hostname |
| 31 | Write exit |
| 32 | |
| 33 | BMC Execute Command rm -rf ${HOST_LOG_PATH} |
| 34 | ${id} ${stderr} ${rc}= BMC Execute Command ps | grep hostlogger | grep -v grep | cut -c2-5 |
| 35 | |
| 36 | # Flush the messages generated in buffer and store as a log file. |
| 37 | BMC Execute Command kill -s USR1 ${id} |
| 38 | Sleep 5s |
| 39 | ${gz_file} ${stderr} ${rc}= BMC Execute Command ls ${HOST_LOG_PATH} |
| 40 | BMC Execute Command gunzip ${HOST_LOG_PATH}/${gz_file} |
| 41 | Sleep 5s |
| 42 | ${log_file} ${stderr} ${rc}= BMC Execute Command ls ${HOST_LOG_PATH} |
| 43 | ${string_compare} = BMC Execute Command grep hostname ${HOST_LOG_PATH}/${log_file} |
| 44 | Should Be True ${string_compare} hostname |
| 45 | |
| 46 | |
| 47 | *** Keywords *** |
| 48 | |
| 49 | Test Setup Execution |
| 50 | [Documentation] Do test case setup tasks. |
| 51 | |
| 52 | Should Not Be Empty ${OS_USERNAME} |
| 53 | Should Not Be Empty ${OS_PASSWORD} |