Added host console testcase and verify the logs
This testcase will connect the obmc-console-client from BMC
and verify the console logs
Signed-off-by: Jayashree-D <jayashree-d@hcl.com>
Change-Id: I6646a1d6e1dd33d657cb7127a17b60d38e388f2b
diff --git a/tests/test_host_console.robot b/tests/test_host_console.robot
new file mode 100644
index 0000000..1bbecf5
--- /dev/null
+++ b/tests/test_host_console.robot
@@ -0,0 +1,53 @@
+*** Settings ***
+Documentation This suite will test the host console
+
+Resource ../lib/resource.robot
+Resource ../lib/utils.robot
+
+Library SSHLibrary
+
+Suite Setup Open Connection And Log In
+Test Setup Test Setup Execution
+Suite Teardown Close All Connections
+
+*** Variables ***
+
+${HOST_LOG_PATH} /var/lib/obmc/hostlogs
+
+
+*** Test Cases ***
+
+Verify Host Console Connection
+ [Documentation] Connect the obmc-console from BMC and verify the logs.
+ [Tags] Verify_Host_Console_Connection
+
+ Write obmc-console-client
+ Write \n
+ ${write}= Read Until login:
+ Write ${OS_USERNAME}
+ ${pass}= Read Until Password:
+ Write ${OS_PASSWORD}
+ Write hostname
+ Write exit
+
+ BMC Execute Command rm -rf ${HOST_LOG_PATH}
+ ${id} ${stderr} ${rc}= BMC Execute Command ps | grep hostlogger | grep -v grep | cut -c2-5
+
+ # Flush the messages generated in buffer and store as a log file.
+ BMC Execute Command kill -s USR1 ${id}
+ Sleep 5s
+ ${gz_file} ${stderr} ${rc}= BMC Execute Command ls ${HOST_LOG_PATH}
+ BMC Execute Command gunzip ${HOST_LOG_PATH}/${gz_file}
+ Sleep 5s
+ ${log_file} ${stderr} ${rc}= BMC Execute Command ls ${HOST_LOG_PATH}
+ ${string_compare} = BMC Execute Command grep hostname ${HOST_LOG_PATH}/${log_file}
+ Should Be True ${string_compare} hostname
+
+
+*** Keywords ***
+
+Test Setup Execution
+ [Documentation] Do test case setup tasks.
+
+ Should Not Be Empty ${OS_USERNAME}
+ Should Not Be Empty ${OS_PASSWORD}