Change to use new 'BMC Execute Command'.
Changes to use new 'BMC Execute Command' and to stop using
'Open Connection and Log In'.
Change-Id: Iab86623f8835845913233cfe2cb858c93b5e39b6
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/openbmc_ffdc_methods.robot b/lib/openbmc_ffdc_methods.robot
index a6173a3..df959af 100755
--- a/lib/openbmc_ffdc_methods.robot
+++ b/lib/openbmc_ffdc_methods.robot
@@ -9,6 +9,7 @@
Library OperatingSystem
Library Collections
Library String
+Library gen_print.py
Library gen_robot_keyword.py
*** Keywords ***
@@ -34,7 +35,6 @@
# obtained via a call to 'Get FFDC Method Desc' (also
# from lib/openbmc_ffdc_list.py).
- Run Key U Open Connection And Log In
@{entries}= Get FFDC Method Index
:FOR ${index} IN @{entries}
\ Method Call Keyword List ${index} ${ffdc_function_list}
@@ -119,12 +119,16 @@
[Arguments] ${key_index}
... ${cmd}
... ${logpath}=${FFDC_FILE_PATH}
+ ... ${target}=BMC
Run Keyword If '${logpath}' == '${FFDC_FILE_PATH}'
... Write Cmd Output to FFDC File ${key_index} ${cmd}
- ${stdout} ${stderr}=
- ... Execute Command ${cmd} return_stderr=True
+ ${cmd_buf}= Catenate ${target} Execute Command \ ${cmd} \ ignore_err=${1}
+ ${status} ${ret_values}= Run Key ${cmd_buf} ignore=${1}
+
+ ${stdout}= Set Variable @{ret_values}[0]
+ ${stderr}= Set Variable @{ret_values}[1]
# Write stdout on success and stderr/stdout to the file on failure.
Run Keyword If $stderr == '${EMPTY}'
@@ -232,7 +236,8 @@
@{cmd_list}= get ffdc os all distros call ${key_index}
:FOR ${cmd} IN @{cmd_list}
\ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt
- \ Execute Command and Write FFDC ${cmd[0]} ${cmd[1]} ${logpath}
+ \ Execute Command and Write FFDC ${cmd[0]} ${cmd[1]} ${logpath}
+ \ ... target=OS
Log OS SPECIFIC DISTRO FFDC
@@ -244,7 +249,8 @@
@{cmd_list}= get ffdc os distro call ${key_index} ${linux_distro}
:FOR ${cmd} IN @{cmd_list}
\ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt
- \ Execute Command and Write FFDC ${cmd[0]} ${cmd[1]} ${logpath}
+ \ Execute Command and Write FFDC ${cmd[0]} ${cmd[1]} ${logpath}
+ \ ... target=OS
@@ -259,29 +265,24 @@
# If can't ping, return
${rc}= Run Keyword and Return Status Ping Host ${OS_HOST}
Return From Keyword If '${rc}' == '${False}'
- ... Could not ping OS
+ ... Could not ping OS.
- Open Connection And Log In host=${OS_HOST} username=${OS_USERNAME}
- ... password=${OS_PASSWORD}
+ ${stdout} ${stderr} ${rc}= OS Execute Command uptime ignore_err=${1}
+ Return From Keyword If '${rc}' != '${0}' Could not connect to OS.
- ${output} ${stderr} ${rc}= Execute Command uptime return_stderr=True
- ... return_rc=True
+ ${stdout} ${stderr} ${rc}= OS Execute Command
+ ... . /etc/os-release; echo $ID ignore_err=${0}
+ Set Global Variable ${linux_distro} ${stdout}
- # If the return code returned by "Execute Command" is non-zero, return
- Return From Keyword If '${rc}' != '${0}'
- ... Could not connect to OS
+ Rpvars linux_distro
@{entries}= Get ffdc os all distros index
:FOR ${index} IN @{entries}
\ Log OS ALL DISTROS FFDC ${index}
- ${linux_distro}= Execute Command
- ... . /etc/os-release; echo $ID
- ... return_stdout=True return_stderr=False return_rc=False
-
Return From Keyword If
... '${linux_distro}' == '${EMPTY}' or '${linux_distro}' == 'None'
- ... Could not determine Linux Distribution
+ ... Could not determine Linux Distribution.
@{entries}= Get ffdc os distro index ${linux_distro}
:FOR ${index} IN @{entries}
@@ -291,16 +292,17 @@
##############################################################################
SCP Coredump Files
[Documentation] Copy core dump file from BMC to local system.
+
# Check if core dump exist in the /tmp
- ${core_files}= Execute Command ls /tmp/core_*
+ ${core_files} ${stderr} ${rc}= BMC Execute Command ls /tmp/core_*
@{core_list} = Split String ${core_files}
# Copy the core files
Run Key U Open Connection for SCP
:FOR ${index} IN @{core_list}
\ scp.Get File ${index} ${LOG_PREFIX}${index.lstrip("/tmp/")}
# Remove the file from remote to avoid re-copying on next FFDC call
- \ Execute Command On BMC rm ${index}
- Run Key U scp.Close Connection
+ \ BMC Execute Command rm ${index}
+ # I can't find a way to do this: scp.Close Connection
##############################################################################