Updated FOR loop syntax to new robot version
Signed-off-by: Marissa Garza <garzam@us.ibm.com>
Change-Id: Iad394c40eef9508db6840ed9692d102910a5c5df
diff --git a/lib/bmc_cleanup.robot b/lib/bmc_cleanup.robot
index 2058cd1..8040ead 100644
--- a/lib/bmc_cleanup.robot
+++ b/lib/bmc_cleanup.robot
@@ -25,8 +25,9 @@
Should Not Be Empty ${SKIP_LIST}
${skip_list_string}= Set Variable cd ${cleanup_dir_path}
- :FOR ${file} IN @{skip_list}
- \ ${skip_list_string}= Set Variable ${skip_list_string} && rm ${file}
+ FOR ${file} IN @{skip_list}
+ ${skip_list_string}= Set Variable ${skip_list_string} && rm ${file}
+ END
${file_count1} ${stderr} ${rc}= BMC Execute Command
... find ${cleanup_dir_path} | wc -l
diff --git a/lib/bmc_redfish_utils.robot b/lib/bmc_redfish_utils.robot
index 6239d3f..0eeecb2 100644
--- a/lib/bmc_redfish_utils.robot
+++ b/lib/bmc_redfish_utils.robot
@@ -71,9 +71,9 @@
# Remove the current login session from the list.
Remove Values From List ${resp_list} ${saved_session_info["location"]}
- :FOR ${session} IN @{resp_list}
- \ Redfish.Delete ${session}
-
+ FOR ${session} IN @{resp_list}
+ Redfish.Delete ${session}
+ END
Get Valid FRUs
[Documentation] Return a dictionary containing all of the valid FRU records for the given fru_type.
diff --git a/lib/code_update_utils.robot b/lib/code_update_utils.robot
index 02c5cdd..3c9665f 100644
--- a/lib/code_update_utils.robot
+++ b/lib/code_update_utils.robot
@@ -74,9 +74,9 @@
${sw_id_list}= Create List
${sw_list}= Get Software Objects ${version_type}
- :FOR ${index} IN @{sw_list}
- \ Append To List ${sw_id_list} ${index.rsplit('/', 1)[1]}
-
+ FOR ${index} IN @{sw_list}
+ Append To List ${sw_id_list} ${index.rsplit('/', 1)[1]}
+ END
[Return] ${sw_id_list}
@@ -98,11 +98,11 @@
${software}= Create List
${pnor_details}= Get Software Objects ${VERSION_PURPOSE_HOST}
- :FOR ${pnor} IN @{pnor_details}
- \ ${resp}= OpenBMC Get Request ${pnor} quiet=${1}
- \ ${json}= To JSON ${resp.content}
- \ Append To List ${software} ${json["data"]}
-
+ FOR ${pnor} IN @{pnor_details}
+ ${resp}= OpenBMC Get Request ${pnor} quiet=${1}
+ ${json}= To JSON ${resp.content}
+ Append To List ${software} ${json["data"]}
+ END
[Return] ${software}
Set Host Software Property
@@ -420,11 +420,11 @@
${priority_value_list}= Create List
${sw_list}= Get Software Objects version_type=${version_type}
- :FOR ${index} IN @{sw_list}
- \ ${priority_value}=
- ... Read Software Attribute ${index} Priority
- \ Append To List ${priority_value_list} ${priority_value}
-
+ FOR ${index} IN @{sw_list}
+ ${priority_value}=
+ ... Read Software Attribute ${index} Priority
+ Append To List ${priority_value_list} ${priority_value}
+ END
${min_value}= Min List Value ${priority_value_list}
[Return] ${min_value}
diff --git a/lib/common_utils.robot b/lib/common_utils.robot
index 26d0e8d..08878a4 100755
--- a/lib/common_utils.robot
+++ b/lib/common_utils.robot
@@ -518,10 +518,11 @@
@{ip}= Split String ${i_ipaddress} .
${index}= Set Variable ${0}
- :FOR ${item} IN @{ip}
- \ ${hex}= Convert To Hex ${item} prefix=0x lowercase=yes
- \ Set List Value ${ip} ${index} ${hex}
- \ ${index}= Set Variable ${index + 1}
+ FOR ${item} IN @{ip}
+ ${hex}= Convert To Hex ${item} prefix=0x lowercase=yes
+ Set List Value ${ip} ${index} ${hex}
+ ${index}= Set Variable ${index + 1}
+ END
${ip_hex}= Catenate @{ip}
[Return] ${ip_hex}
@@ -586,23 +587,23 @@
Check BMC CPU Performance
[Documentation] Minimal 10% of proc should be free in 3 sample
- :FOR ${var} IN RANGE 1 4
- \ BMC CPU Performance Check
-
+ FOR ${var} IN RANGE 1 4
+ BMC CPU Performance Check
+ END
Check BMC Mem Performance
[Documentation] Minimal 10% of memory should be free
- :FOR ${var} IN RANGE 1 4
- \ BMC Mem Performance Check
-
+ FOR ${var} IN RANGE 1 4
+ BMC Mem Performance Check
+ END
Check BMC File System Performance
[Documentation] Check for file system usage for 4 times
- :FOR ${var} IN RANGE 1 4
- \ BMC File System Usage check
-
+ FOR ${var} IN RANGE 1 4
+ BMC File System Usage check
+ END
Get URL List
[Documentation] Return list of URLs under given URL.
diff --git a/lib/connection_client.robot b/lib/connection_client.robot
index 4cd2088..6efb1b4 100755
--- a/lib/connection_client.robot
+++ b/lib/connection_client.robot
@@ -105,33 +105,33 @@
# Connect to the alias or host that matches. If both are given, only connect
# to a connection that has both.
- :FOR ${connection} IN @{open_connections}
- \ Log ${connection}
- \ ${alias_match}= Evaluate '${alias}' == '${connection.alias}'
- \ ${host_match}= Evaluate '${host}' == '${connection.host}'
- \ ${given_alias}= Evaluate '${alias}' != 'None'
- \ ${no_alias}= Evaluate '${alias}' == 'None'
- \ ${given_host}= Evaluate '${host}' != '${EMPTY}'
- \ ${no_host}= Evaluate '${host}' == '${EMPTY}'
- \ Run Keyword If
- ... ${given_alias} and ${given_host} and ${alias_match} and ${host_match}
- ... Run Keywords
- ... Switch Connection ${alias} AND
- ... Log to Console Found connection. Switched to ${alias} ${host} AND
- ... Return From Keyword If ${alias_match} and ${host_match}
- ... ELSE Run Keyword If
- ... ${given_alias} and ${no_host} and ${alias_match}
- ... Run Keywords
- ... Switch Connection ${alias} AND
- ... Log to Console Found connection. Switched to: ${alias} AND
- ... Return From Keyword If ${alias_match}
- ... ELSE Run Keyword If
- ... ${given_host} and ${no_alias} and ${host_match}
- ... Run Keywords
- ... Switch Connection ${connection.index} AND
- ... Log to Console Found Connection. Switched to: ${host} AND
- ... Return From Keyword If ${host_match}
-
+ FOR ${connection} IN @{open_connections}
+ Log ${connection}
+ ${alias_match}= Evaluate '${alias}' == '${connection.alias}'
+ ${host_match}= Evaluate '${host}' == '${connection.host}'
+ ${given_alias}= Evaluate '${alias}' != 'None'
+ ${no_alias}= Evaluate '${alias}' == 'None'
+ ${given_host}= Evaluate '${host}' != '${EMPTY}'
+ ${no_host}= Evaluate '${host}' == '${EMPTY}'
+ Run Keyword If
+ ... ${given_alias} and ${given_host} and ${alias_match} and ${host_match}
+ ... Run Keywords
+ ... Switch Connection ${alias} AND
+ ... Log to Console Found connection. Switched to ${alias} ${host} AND
+ ... Return From Keyword If ${alias_match} and ${host_match}
+ ... ELSE Run Keyword If
+ ... ${given_alias} and ${no_host} and ${alias_match}
+ ... Run Keywords
+ ... Switch Connection ${alias} AND
+ ... Log to Console Found connection. Switched to: ${alias} AND
+ ... Return From Keyword If ${alias_match}
+ ... ELSE Run Keyword If
+ ... ${given_host} and ${no_alias} and ${host_match}
+ ... Run Keywords
+ ... Switch Connection ${connection.index} AND
+ ... Log to Console Found Connection. Switched to: ${host} AND
+ ... Return From Keyword If ${host_match}
+ END
# If no connections are found, open a connection with the provided args.
Log No connection with provided arguments. Opening a connection.
Open Connection and Log In &{connection_args}
diff --git a/lib/dump_utils.robot b/lib/dump_utils.robot
index cb64fba..2ff2aeb 100644
--- a/lib/dump_utils.robot
+++ b/lib/dump_utils.robot
@@ -134,10 +134,10 @@
# Get the list of dump entries and delete them all.
${dump_entries}= Get URL List ${DUMP_ENTRY_URI}
- :FOR ${entry} IN @{dump_entries}
- \ ${dump_id}= Fetch From Right ${entry} /
- \ Delete BMC Dump ${dump_id}
-
+ FOR ${entry} IN @{dump_entries}
+ ${dump_id}= Fetch From Right ${entry} /
+ Delete BMC Dump ${dump_id}
+ END
Delete All BMC Dump
[Documentation] Delete all BMC dump entries using "DeleteAll" interface.
diff --git a/lib/fan_utils.robot b/lib/fan_utils.robot
index 3fbf99a..b6445b8 100755
--- a/lib/fan_utils.robot
+++ b/lib/fan_utils.robot
@@ -107,12 +107,13 @@
${max_target}= Set Variable 0
${paths}= Get Endpoint Paths ${SENSORS_URI}fan_tach/ 0
- :FOR ${path} IN @{paths}
- \ ${response}= OpenBMC Get Request ${path}
- \ ${json}= To JSON ${response.content}
- \ ${target_speed}= Set Variable ${json["data"]["Target"]}
- \ ${max_target}= Run Keyword If ${target_speed} > ${max_target}
- ... Set Variable ${target_speed} ELSE Set Variable ${max_target}
+ FOR ${path} IN @{paths}
+ ${response}= OpenBMC Get Request ${path}
+ ${json}= To JSON ${response.content}
+ ${target_speed}= Set Variable ${json["data"]["Target"]}
+ ${max_target}= Run Keyword If ${target_speed} > ${max_target}
+ ... Set Variable ${target_speed} ELSE Set Variable ${max_target}
+ END
[Return] ${max_target}
@@ -251,9 +252,9 @@
# fan_names A list containing the names of the fans (e.g. fan0
# fan2 fan3).
- :FOR ${fan_name} IN @{fan_names}
- \ Set Fan State ${fan_name} ${fan_functional}
-
+ FOR ${fan_name} IN @{fan_names}
+ Set Fan State ${fan_name} ${fan_functional}
+ END
Verify Fan Speed
[Documentation] Verify fans are running at or near target speed.
@@ -268,18 +269,18 @@
# fan_names A list containing the names of the fans (e.g. fan0 fan1).
# Compare the fan's speed with its target speed.
- :FOR ${fan_name} IN @{fan_names}
- \ ${target_speed} ${fan_speed}= Get Fan Target And Speed ${fan_name}
- \ Rpvars fan_name target_speed fan_speed
- \ # Calculate tolerance, which is a % of the target speed.
- \ ${tolerance_value}= Evaluate ${tolerance}*${target_speed}
- \ # Calculate upper and lower speed limits.
- \ ${max_limit}= Evaluate ${target_speed}+${tolerance_value}
- \ ${min_limit}= Evaluate ${target_speed}-${tolerance_value}
- \ Run Keyword If
- ... ${fan_speed} < ${min_limit} or ${fan_speed} > ${max_limit}
- ... Fail msg=${fan_name} speed of ${fan_speed} is out of range.
-
+ FOR ${fan_name} IN @{fan_names}
+ ${target_speed} ${fan_speed}= Get Fan Target And Speed ${fan_name}
+ Rpvars fan_name target_speed fan_speed
+ # Calculate tolerance, which is a % of the target speed.
+ ${tolerance_value}= Evaluate ${tolerance}*${target_speed}
+ # Calculate upper and lower speed limits.
+ ${max_limit}= Evaluate ${target_speed}+${tolerance_value}
+ ${min_limit}= Evaluate ${target_speed}-${tolerance_value}
+ Run Keyword If
+ ... ${fan_speed} < ${min_limit} or ${fan_speed} > ${max_limit}
+ ... Fail msg=${fan_name} speed of ${fan_speed} is out of range.
+ END
Verify Direct Fan Control
[Documentation] Verify direct control of fans.
@@ -312,15 +313,16 @@
# For each fan, set a new target speed and wait for the fan to
# accelerate. Then check that the fan is running near that speed.
- :FOR ${fan_name} IN @{fan_names}
- \ Set Fan Target Speed ${fan_name} ${max_speed}
- \ Run Key U Sleep \ 60s
- \ ${target_speed} ${cw_speed} ${ccw_speed}=
- ... Get Target And Blade Speeds ${fan_name}
- \ Rpvars fan_name target_speed cw_speed ccw_speed
- \ Run Keyword If
- ... ${cw_speed} < ${min_speed} or ${ccw_speed} < ${min_speed}
- ... Fail msg=${fan_name} failed manual speed test.
+ FOR ${fan_name} IN @{fan_names}
+ Set Fan Target Speed ${fan_name} ${max_speed}
+ Run Key U Sleep \ 60s
+ ${target_speed} ${cw_speed} ${ccw_speed}=
+ ... Get Target And Blade Speeds ${fan_name}
+ Rpvars fan_name target_speed cw_speed ccw_speed
+ Run Keyword If
+ ... ${cw_speed} < ${min_speed} or ${ccw_speed} < ${min_speed}
+ ... Fail msg=${fan_name} failed manual speed test.
+ END
# Check the fan speeds in the BMC file system.
@@ -344,13 +346,14 @@
Rpvars speeds
# Count the number of speeds > ${min_speed}.
${count}= Set Variable ${0}
- :FOR ${speed} IN @{speeds}
- \ ${count}= Run Keyword If ${speed} > ${min_speed}
- ... Evaluate ${count}+1 ELSE Set Variable ${count}
- # Because each fan has two rotating fan blades, the count should be
- # equual to 2*${number_of_fans}. On water-cooled systems some
- # speeds may be reported by hwmon as 0. That is expected,
- # and the number_of_fans reported in the system will be less.
+ FOR ${speed} IN @{speeds}
+ ${count}= Run Keyword If ${speed} > ${min_speed}
+ ... Evaluate ${count}+1 ELSE Set Variable ${count}
+ # Because each fan has two rotating fan blades, the count should be
+ # equual to 2*${number_of_fans}. On water-cooled systems some
+ # speeds may be reported by hwmon as 0. That is expected,
+ # and the number_of_fans reported in the system will be less.
+ END
${fail_test}= Evaluate (2*${number_of_fans})-${count}
# Re-enable the fan daemon
@@ -425,8 +428,9 @@
${wait_after_poweroff}= Set Variable 15s
# Set fans to be non-functional.
- :FOR ${fan_name} IN @{fan_names}
- \ Set Fan State ${fan_name} ${fan_nonfunctional}
+ FOR ${fan_name} IN @{fan_names}
+ Set Fan State ${fan_name} ${fan_nonfunctional}
+ END
# System should notice the non-functional fans and power-off.
# The Wait For PowerOff keyword will time-out and report
diff --git a/lib/ipmi_client.robot b/lib/ipmi_client.robot
index e20be6c..5c12ac5 100755
--- a/lib/ipmi_client.robot
+++ b/lib/ipmi_client.robot
@@ -246,11 +246,12 @@
Set Global Variable ${arrayByte} array:byte:
@{listargs}= Split String ${args}
${index}= Set Variable ${0}
- :FOR ${word} IN @{listargs}
- \ Run Keyword if ${index} == 0 Set NetFn Byte ${word}
- \ Run Keyword if ${index} == 1 Set Cmd Byte ${word}
- \ Run Keyword if ${index} > 1 Set Array Byte ${word}
- \ ${index}= Set Variable ${index + 1}
+ FOR ${word} IN @{listargs}
+ Run Keyword if ${index} == 0 Set NetFn Byte ${word}
+ Run Keyword if ${index} == 1 Set Cmd Byte ${word}
+ Run Keyword if ${index} > 1 Set Array Byte ${word}
+ ${index}= Set Variable ${index + 1}
+ END
${length}= Get Length ${arrayByte}
${length}= Evaluate ${length} - 1
${arrayByteLocal}= Get Substring ${arrayByte} 0 ${length}
diff --git a/lib/logging_utils.robot b/lib/logging_utils.robot
index daecd5f..7c1fbea 100644
--- a/lib/logging_utils.robot
+++ b/lib/logging_utils.robot
@@ -27,9 +27,10 @@
Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND}
${jsondata}= To JSON ${resp.content}
- :FOR ${entry} IN @{jsondata["data"]}
- \ Continue For Loop If '${entry.rsplit('/', 1)[1]}' == 'callout'
- \ Append To List ${entry_list} ${entry}
+ FOR ${entry} IN @{jsondata["data"]}
+ Continue For Loop If '${entry.rsplit('/', 1)[1]}' == 'callout'
+ Append To List ${entry_list} ${entry}
+ END
# Logging entries list.
# ['/xyz/openbmc_project/logging/entry/14',
@@ -47,11 +48,12 @@
@{elog_entries}= Get Logging Entry List
- :FOR ${entry} IN @{elog_entries}
- \ ${resp}= Read Properties ${entry}
- \ ${status}= Run Keyword And Return Status
- ... Should Be Equal As Strings ${message_id} ${resp["Message"]}
- \ Return From Keyword If ${status} == ${TRUE} ${entry}
+ FOR ${entry} IN @{elog_entries}
+ ${resp}= Read Properties ${entry}
+ ${status}= Run Keyword And Return Status
+ ... Should Be Equal As Strings ${message_id} ${resp["Message"]}
+ Return From Keyword If ${status} == ${TRUE} ${entry}
+ END
Fail No ${message_id} logging entry found.
diff --git a/lib/openbmc_ffdc_utils.robot b/lib/openbmc_ffdc_utils.robot
index 9d459b8..ed2034c 100644
--- a/lib/openbmc_ffdc_utils.robot
+++ b/lib/openbmc_ffdc_utils.robot
@@ -94,9 +94,10 @@
# --- FFDC header notes ---
@{entries}= Get ffdc cmd index
- :FOR ${index} IN @{entries}
- \ Write Data To File * ${index.upper()}
- \ Write Data To File ${\n}
+ FOR ${index} IN @{entries}
+ Write Data To File * ${index.upper()}
+ Write Data To File ${\n}
+ END
Write Data To File ${MSG_DETAIL}
[Return] ${ffdc_file_list}