Address issue for deprecated syntax
Change-Id: I9889daa8f34b133ddc2a90ed81cf79a87c77fad0
Signed-off-by: Sushil Singh <susilsi7@in.ibm.com>
diff --git a/lib/list_utils.robot b/lib/list_utils.robot
index ef1b0e5..63384d3 100644
--- a/lib/list_utils.robot
+++ b/lib/list_utils.robot
@@ -13,12 +13,13 @@
${list_size}= Get Length ${lists}
${index}= Set Variable ${0}
- : FOR ${arg} IN @{lists}
- \ ${type_arg}= Evaluate str(type($lists[${index}])).split("'")[1]
- \ Run Keyword If '${type_arg}' != 'list' Run Keywords
- ... Remove From List ${lists} ${index} AND
- ... Continue For Loop
- \ ${index}= Evaluate ${index}+1
+
+ FOR ${arg} IN @{lists}
+ ${type_arg}= Evaluate str(type($lists[${index}])).split("'")[1]
+ Run Keyword If '${type_arg}' != 'list' Run Keywords Remove From List ${lists} ${index} AND
+ ... Continue For Loop
+ ${index}= Evaluate ${index}+1
+ END
${new_list}= Combine Lists @{lists}
@@ -43,11 +44,10 @@
@{smaller_list}= Set Variable If ${length1} >= ${length2} ${list2}
... ${length1} < ${length2} ${list1}
- :FOR ${element} IN @{larger_list}
- \ ${rc}= Run Keyword and Return Status List Should Contain Value
- ... ${smaller_list} ${element}
- \ Run Keyword If '${rc}' == 'True' Append to List ${intersected_list}
- ... ${element}
+ FOR ${element} IN @{larger_list}
+ ${rc}= Run Keyword and Return Status List Should Contain Value ${smaller_list} ${element}
+ Run Keyword If '${rc}' == 'True' Append to List ${intersected_list} ${element}
+ END
@{intersected_list}= Remove Duplicates ${intersected_list}
diff --git a/lib/openbmc_ffdc_methods.robot b/lib/openbmc_ffdc_methods.robot
index 6abbacd..ad21d73 100755
--- a/lib/openbmc_ffdc_methods.robot
+++ b/lib/openbmc_ffdc_methods.robot
@@ -49,11 +49,10 @@
# entries[0]: BMC LOGS
@{ffdc_file_list}= Create List
- :FOR ${index} IN @{entries}
- \ ${ffdc_file_sub_list}= Method Call Keyword List ${index}
- ... ${ffdc_function_list}
- \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
- ... ${ffdc_file_sub_list}
+ FOR ${index} IN @{entries}
+ ${ffdc_file_sub_list}= Method Call Keyword List ${index} ${ffdc_function_list}
+ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list}
+ END
Run Key U SSHLibrary.Close All Connections
@@ -91,11 +90,10 @@
... Split String ${ffdc_function_list} separator=:
@{ffdc_file_list}= Create List
- :FOR ${method} IN @{method_list}
- \ ${ffdc_file_sub_list}= Execute Keyword Method ${method[0]}
- ... ${method[1]} @{ffdc_function_list}
- \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
- ... ${ffdc_file_sub_list}
+ FOR ${method} IN @{method_list}
+ ${ffdc_file_sub_list}= Execute Keyword Method ${method[0]} ${method[1]} @{ffdc_function_list}
+ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list}
+ END
[Return] ${ffdc_file_list}
@@ -135,8 +133,10 @@
@{ffdc_file_list}= Create List ${FFDC_FILE_PATH}
@{entries}= Get FFDC Cmd Index
- :FOR ${index} IN @{entries}
- \ Iterate BMC Command List Pairs ${index}
+
+ FOR ${index} IN @{entries}
+ Iterate BMC Command List Pairs ${index}
+ END
[Return] ${ffdc_file_list}
@@ -147,9 +147,10 @@
@{cmd_list}= Get ffdc bmc cmd ${key_index}
Set Suite Variable ${ENTRY_INDEX} ${key_index}
- :FOR ${cmd} IN @{cmd_list}
- \ Execute Command and Write FFDC ${cmd[0]} ${cmd[1]}
+ FOR ${cmd} IN @{cmd_list}
+ Execute Command and Write FFDC ${cmd[0]} ${cmd[1]}
+ END
Execute Command and Write FFDC
[Documentation] Run a command on the BMC or OS, write the output to the
@@ -168,8 +169,8 @@
# If the command times out, status will be 'FAIL'.
Return From Keyword If '${status}' == 'FAIL' ${ffdc_file_list}
- ${stdout}= Set Variable @{ret_values}[0]
- ${stderr}= Set Variable @{ret_values}[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}'
@@ -198,10 +199,11 @@
... ${OPENBMC_HOST} username=${OPENBMC_USERNAME} password=${OPENBMC_PASSWORD} port=${SSH_PORT}
@{ffdc_file_list}= Create List
- :FOR ${index} IN @{entries}
- \ ${ffdc_file_sub_list}= Create File and Write Data ${index}
- \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
- ... ${ffdc_file_sub_list}
+
+ FOR ${index} IN @{entries}
+ ${ffdc_file_sub_list}= Create File and Write Data ${index}
+ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list}
+ END
BMC Execute Command rm -rf /tmp/BMC_*
scp.Close Connection
@@ -219,13 +221,13 @@
@{ffdc_file_list}= Create List
@{cmd_list}= Get FFDC BMC File ${key_index}
- :FOR ${cmd} IN @{cmd_list}
- \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}
- \ ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]}
- ... ${cmd[1]} ${logpath}
- \ Run Key U scp.Get File \ /tmp/${cmd[0]} \ ${LOG_PREFIX}${cmd[0]}
- \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
- ... ${ffdc_file_sub_list}
+
+ FOR ${cmd} IN @{cmd_list}
+ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}
+ ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]} ${cmd[1]} ${logpath}
+ Run Key U scp.Get File \ /tmp/${cmd[0]} \ ${LOG_PREFIX}${cmd[0]}
+ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list}
+ END
[Return] ${ffdc_file_list}
@@ -279,15 +281,16 @@
@{ffdc_file_list}= Create List
@{cmd_list}= Get FFDC Get Request ${key_index}
- :FOR ${cmd} IN @{cmd_list}
- \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}
- \ ${resp}= OpenBMC Get Request ${cmd[1]} quiet=${1}
- \ ${status}= Run Keyword and Return Status
- ... Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
- \ Run Keyword If '${status}' == '${False}' Continue For Loop
- \ ${jsondata}= to json ${resp.content} pretty_print=True
- \ Write Data To File ${\n}${jsondata}${\n} ${logpath}
- \ Append To List ${ffdc_file_list} ${logpath}
+
+ FOR ${cmd} IN @{cmd_list}
+ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}
+ ${resp}= OpenBMC Get Request ${cmd[1]} quiet=${1}
+ ${status}= Run Keyword and Return Status Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
+ Run Keyword If '${status}' == '${False}' Continue For Loop
+ ${jsondata}= to json ${resp.content} pretty_print=True
+ Write Data To File ${\n}${jsondata}${\n} ${logpath}
+ Append To List ${ffdc_file_list} ${logpath}
+ END
[Return] ${ffdc_file_list}
@@ -301,10 +304,11 @@
# Example of entries:
# entries:
# entries[0]: GET REQUESTS
- :FOR ${index} IN @{entries}
- \ ${ffdc_file_sub_list}= Log FFDC Get Requests ${index}
- \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
- ... ${ffdc_file_sub_list}
+
+ FOR ${index} IN @{entries}
+ ${ffdc_file_sub_list}= Log FFDC Get Requests ${index}
+ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list}
+ END
[Return] ${ffdc_file_list}
@@ -319,14 +323,14 @@
@{ffdc_file_list}= Create List
@{cmd_list}= Get FFDC OS All Distros Call ${key_index}
- :FOR ${cmd} IN @{cmd_list}
- \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}
- \ ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]}
- ... ${cmd[1]} ${logpath} target=OS
- \ # scp it to the LOG_PREFIX ffdc directory.
- \ Run Key U scp.Get File \ /tmp/${cmd[0]} \ ${LOG_PREFIX}${cmd[0]}
- \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
- ... ${ffdc_file_sub_list}
+
+ FOR ${cmd} IN @{cmd_list}
+ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}
+ ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]} ${cmd[1]} ${logpath} target=OS
+ # scp it to the LOG_PREFIX ffdc directory.
+ Run Key U scp.Get File \ /tmp/${cmd[0]} \ ${LOG_PREFIX}${cmd[0]}
+ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list}
+ END
[Return] ${ffdc_file_list}
@@ -343,13 +347,12 @@
@{ffdc_file_list}= Create List
@{cmd_list}= Get FFDC OS Distro Call ${key_index} ${linux_distro}
- :FOR ${cmd} IN @{cmd_list}
- \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}
- \ ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]}
- ... ${cmd[1]} ${logpath} target=OS
- \ Run Key U scp.Get File \ /tmp/${cmd[0]} \ ${LOG_PREFIX}${cmd[0]}
- \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
- ... ${ffdc_file_sub_list}
+
+ FOR ${cmd} IN @{cmd_list}
+ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}
+ ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]} ${cmd[1]} ${logpath} target=OS
+ Run Key U scp.Get File \ /tmp/${cmd[0]} \ ${LOG_PREFIX}${cmd[0]}
+ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list}
# Get the name of the sosreport file.
${sosreport_file_path} ${stderr} ${rc}= OS Execute Command
@@ -410,21 +413,22 @@
... ${OS_HOST} username=${OS_USERNAME} password=${OS_PASSWORD}
@{entries}= Get FFDC OS All Distros Index
- :FOR ${index} IN @{entries}
- \ ${ffdc_file_sub_list}= Log OS All distros FFDC ${index}
- \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
- ... ${ffdc_file_sub_list}
+
+ FOR ${index} IN @{entries}
+ ${ffdc_file_sub_list}= Log OS All distros FFDC ${index}
+ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list}
+ END
Return From Keyword If
... '${linux_distro}' == '${EMPTY}' or '${linux_distro}' == 'None'
... ${ffdc_file_list}
@{entries}= Get ffdc os distro index ${linux_distro}
- :FOR ${index} IN @{entries}
- \ ${ffdc_file_sub_list}= Log OS SPECIFIC DISTRO FFDC ${index}
- ... ${linux_distro}
- \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
- ... ${ffdc_file_sub_list}
+
+ FOR ${index} IN @{entries}
+ ${ffdc_file_sub_list}= Log OS SPECIFIC DISTRO FFDC ${index} ${linux_distro}
+ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list}
+ END
# Delete ffdc files still on OS and close scp.
OS Execute Command rm -rf /tmp/OS_* /tmp/sosreport*FFDC* ignore_err=${True}
@@ -450,8 +454,9 @@
Copy Files ${globex} ${ffdc_dir_path}
- : FOR ${file_name} IN @{file_list}
- \ Append To List ${ffdc_file_list} ${ffdc_dir_path}${file_name}
+ FOR ${file_name} IN @{file_list}
+ Append To List ${ffdc_file_list} ${ffdc_dir_path}${file_name}
+ END
Run Keyword and Ignore Error Remove Files ${globex}
@@ -472,15 +477,19 @@
@{core_list}= Split String ${core_files}
# Copy the core files
Run Key U Open Connection for SCP
- :FOR ${index} IN @{core_list}
- \ ${ffdc_file_path}= Catenate ${LOG_PREFIX}${index.lstrip("/tmp/")}
- \ ${status}= Run Keyword and Return Status
- ... scp.Get File ${index} ${ffdc_file_path}
- \ Run Keyword If '${status}' == '${False}' Continue For Loop
- \ Append To List ${ffdc_file_list} ${ffdc_file_path}
- # Remove the file from remote to avoid re-copying on next FFDC call
- \ BMC Execute Command rm ${index} ignore_err=${1}
- # I can't find a way to do this: scp.Close Connection
+
+ FOR ${index} IN @{core_list}
+ ${ffdc_file_path}= Catenate ${LOG_PREFIX}${index.lstrip("/tmp/")}
+ ${status}= Run Keyword and Return Status scp.Get File ${index} ${ffdc_file_path}
+ Run Keyword If '${status}' == '${False}' Continue For Loop
+ Append To List ${ffdc_file_list} ${ffdc_file_path}
+
+ # Remove the file from remote to avoid re-copying on next FFDC call
+
+ BMC Execute Command rm ${index} ignore_err=${1}
+ # I can't find a way to do this: scp.Close Connection
+
+ END
[Return] ${ffdc_file_list}
@@ -588,8 +597,9 @@
${logpath}= Catenate SEPARATOR= ${log_prefix_path} esel
Create File ${logpath}
- :FOR ${esel} IN @{esels}
- \ Write Data To File "${esel}"${\n} ${logpath}
+ FOR ${esel} IN @{esels}
+ Write Data To File "${esel}"${\n} ${logpath}
+ END
Append To List ${ffdc_file_list} ${logpath}