Changes to lib/utils.robot.
- I added support for targ_file_path parm for "Stop SOL Console Logging".
- Corrected 80+ char lines in lib/utils.robot.
Change-Id: I9dc5c3f0b7287dcf43b7b03815c3378e948442e9
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index 8cb4d71..63c7cae 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -304,9 +304,12 @@
... writing to file_path.
[Arguments] ${file_path}=/tmp/obmc-console.log
+ ${cmd_buf}= Catenate SEPARATOR=${SPACE}
+ ... ps ax | grep obmc-console-client | grep ${file_path} | grep -v grep
+ ... | awk '{print $1}'
+
${pid}=
- ... Execute Command
- ... ps ax | grep obmc-console-client | grep ${file_path} | grep -v grep | awk '{print $1}'
+ ... Execute Command ${cmd_buf}
Run Keyword If '${pid}' != '${EMPTY}'
... Execute Command kill -s KILL ${pid}
@@ -327,22 +330,32 @@
Stop SOL Console Logging
- [Documentation] Stop obmc_console_client process, if any, and
- ... return the console output as a string.
- [Arguments] ${file_path}=/tmp/obmc-console.log
+ [Documentation] Stop obmc_console_client process, if any, and
+ ... return the console output as a string.
+ [Arguments] ${file_path}=/tmp/obmc-console.log ${targ_file_path}=${EMPTY}
+
+ # Description of arguments:
+ # file_path The path on the obmc system where SOL output may be
+ # found.
+ # targ_file_path If specified, the file path to which SOL data should be
+ # written.
Open Connection And Log In
Stop OBMC Console Client ${file_path}
+ ${cmd_buf}= Set Variable cat ${file_path}
+
${console} ${stderr}=
... Execute Command
- ... cat ${file_path}
+ ... if [ -f ${file_path} ] ; then cat ${file_path} ; fi
... return_stderr=True
Should Be Empty ${stderr}
- [Return] ${console}
+ Run Keyword If '${targ_file_path}' != '${EMPTY}'
+ ... Append To File ${targ_file_path} ${console}
+ [Return] ${console}
Get Time Stamp
[Documentation] Get the current time stamp data
@@ -412,7 +425,8 @@
... Given the following MAC: 00:01:6C:80:02:78
... This keyword will return: 0x00 0x01 0x6C 0x80 0x02 0x78
... Description of arguments:
- ... i_macaddress MAC address in the following format 00:01:6C:80:02:78
+ ... i_macaddress MAC address in the following format
+ ... 00:01:6C:80:02:78
[Arguments] ${i_macaddress}
${mac_hex}= Catenate 0x${i_macaddress.replace(':', ' 0x')}
@@ -424,7 +438,8 @@
... Given the following IP: 10.3.164.100
... This keyword will return: 0xa 0x3 0xa4 0xa0
... Description of arguments:
- ... i_ipaddress IP address in the following format 10.10.10.10
+ ... i_ipaddress IP address in the following format
+ ... 10.10.10.10
[Arguments] ${i_ipaddress}
@{ip}= Split String ${i_ipaddress} .
@@ -477,7 +492,8 @@
[Documentation] Returns all url paths ending with given endpoint
... Example:
... Given the following endpoint: cpu
- ... This keyword will return: list of all urls ending with cpu -
+ ... This keyword will return: list of all urls ending with
+ ... cpu -
... /org/openbmc/inventory/system/chassis/motherboard/cpu0,
... /org/openbmc/inventory/system/chassis/motherboard/cpu1
... Description of arguments:
@@ -494,7 +510,7 @@
Check Zombie Process
[Documentation] Check if any defunct process exist or not on BMC
- ${count} ${stderr} ${rc}= Execute Command ps -o stat | grep Z | wc -l
+ ${count} ${stderr} ${rc}= Execute Command ps -o stat | grep Z | wc -l
... return_stderr=True return_rc=True
Should Be True ${count}==0
Should Be Empty ${stderr}