blob: f566a227e6140ec7baaa8c262831654707da934d [file] [log] [blame]
George Keishing0fff68a2017-04-27 22:25:49 -05001*** Settings ***
2Documentation Keywords for system related test. This is a subset of the
3... utils.robot. This resource file keywords is specifically
4... define for system test use cases.
5
George Keishing91c852f2017-05-03 02:48:21 -05006Library ../lib/gen_robot_keyword.py
7Resource ../extended/obmc_boot_test_resource.robot
George Keishing0fff68a2017-04-27 22:25:49 -05008Resource ../lib/utils.robot
George Keishing91c852f2017-05-03 02:48:21 -05009Resource ../lib/state_manager.robot
George Keishing0fff68a2017-04-27 22:25:49 -050010
George Keishing4ef29082017-05-13 05:01:23 -050011Library OperatingSystem
12Library DateTime
13
George Keishing0fff68a2017-04-27 22:25:49 -050014*** Variables ***
15
George Keishing4ef29082017-05-13 05:01:23 -050016${htx_log_dir_path} ${EXECDIR}${/}logs${/}
17
18
George Keishing0fff68a2017-04-27 22:25:49 -050019*** Keywords ***
20
21Execute Command On OS
22 [Documentation] Execute given command on OS and return output.
23 [Arguments] ${command}
George Keishing91c852f2017-05-03 02:48:21 -050024 # Description of argument(s):
25 # command Shell command to be executed on OS.
George Keishing0fff68a2017-04-27 22:25:49 -050026 ${stdout} ${stderr}= Execute Command ${command} return_stderr=True
27 Should Be Empty ${stderr}
28 [Return] ${stdout}
29
30
31Login To OS
32 [Documentation] Login to OS Host.
33 [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME}
34 ... ${os_password}=${OS_PASSWORD}
George Keishing91c852f2017-05-03 02:48:21 -050035 # Description of argument(s):
36 # os_host IP address of the OS Host.
37 # os_username OS Host Login user name.
38 # os_password OS Host Login passwrd.
George Keishing0fff68a2017-04-27 22:25:49 -050039
George Keishing91c852f2017-05-03 02:48:21 -050040 Ping Host ${os_host}
George Keishing0fff68a2017-04-27 22:25:49 -050041 Open Connection ${os_host}
George Keishing91c852f2017-05-03 02:48:21 -050042 Login ${os_username} ${os_password}
43
44
George Keishing88366b32017-05-12 13:50:48 -050045Tool Exist
46 [Documentation] Check whether given tool is installed on OS.
47 [Arguments] ${tool_name}
48 # Description of argument(s):
49 # tool_name Tool name whose existence is to be checked.
George Keishing91c852f2017-05-03 02:48:21 -050050 Login To OS
George Keishing88366b32017-05-12 13:50:48 -050051 ${output}= Execute Command On OS which ${tool_name}
52 Should Contain ${output} ${tool_name}
53 ... msg=Please install ${tool_name} tool.
George Keishing91c852f2017-05-03 02:48:21 -050054
55
56Boot To OS
57 [Documentation] Boot host OS.
58 Run Key OBMC Boot Test \ REST Power On
59
60
61Power Off Host
62 [Documentation] Power off host.
63 Run Key OBMC Boot Test \ REST Power Off
George Keishing0fff68a2017-04-27 22:25:49 -050064
George Keishing6fec3ab2017-05-05 10:45:08 -050065
66File Exist On OS
67 [Documentation] Check if the given file path exist on OS.
68 [Arguments] ${file_path}
69 # Description of argument(s):
70 # file_path Absolute file path.
71
72 Login To OS
73 ${out}= Execute Command On OS ls ${file_path}
74 Log To Console \n File Exist: ${out}
75
George Keishing8740a0c2017-05-13 07:19:16 -050076
77Is HTX Running
78 [Documentation] Check if the HTX exerciser is currently running.
79
80 ${status}= Execute Command On OS htxcmdline -status
81 Should Not Contain ${status} Daemon state is <IDLE>
George Keishing4ef29082017-05-13 05:01:23 -050082
83
84Write Log Data To File
85 [Documentation] Write log data to the logs directory.
86 [Arguments] ${data}= ${log_file_path}=
87 # Description of argument(s):
88 # data String buffer.
89 # log_file_path The log file path.
90
91 Create File ${log_file_path} ${data}
92
93
94Collect HTX Log Files
95 [Documentation] Collect status and error log files.
96 # Collects the following files:
97 # HTX error log file /tmp/htxerr
98 # HTX status log file /tmp/htxstats
99
100 # Create logs directory and get current datetime.
101 Create Directory ${htx_log_dir_path}
102 ${cur_datetime}= Get Current Date result_format=%Y%m%d%H%M%S%f
103
104 File Exist On OS /tmp/htxerr
105 ${htx_err}= Execute Command On BMC cat /tmp/htxerr
106 Write Log Data To File
107 ... ${htx_err} ${htx_log_dir_path}/${OS_HOST}${cur_datetime}.htxerr
108
109 File Exist On OS /tmp/htxstats
110 ${htx_stats}= Execute Command On BMC cat /tmp/htxstats
111 Write Log Data To File
112 ... ${htx_stats} ${htx_log_dir_path}/${OS_HOST}_${cur_datetime}.htxstats
113