Fix deprecrated Run Keyword If for systems
Changes:
- Run Keyword If is deprecated since
Robot Framework version 5.*, use IF and END or Inline IF
Tested:
- Checked using robot dry-run to make sure the
syntax is not broken
Change-Id: I9bd9ba2706772fb288c62fa43016eaa343fc7324
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/redfish/systems/eventlog/test_event_logging.robot b/redfish/systems/eventlog/test_event_logging.robot
index b082ae3..87f82c2 100644
--- a/redfish/systems/eventlog/test_event_logging.robot
+++ b/redfish/systems/eventlog/test_event_logging.robot
@@ -301,9 +301,9 @@
${elogs}= Get Event Logs
${count}= Get Length ${elogs}
- Run Keyword If ${count} > 200
- ... Fail Error logs created exceeded max capacity 200.
-
+ IF ${count} > 200
+ Fail Error logs created exceeded max capacity 200.
+ END
Test Event Log Wrapping
[Documentation] Verify event log entries wraps when 200 max cap is reached.
@@ -373,7 +373,7 @@
Redfish Purge Event Log
${status}= Run Keyword And Return Status Logging Test Binary Exist
- Run Keyword If ${status} == ${False} Install Tarball
+ IF ${status} == ${False} Install Tarball
Suite Teardown Execution
@@ -388,7 +388,7 @@
Redfish Purge Event Log
${status}= Run Keyword And Return Status Logging Test Binary Exist
- Run Keyword If ${status} == ${False} Install Tarball
+ IF ${status} == ${False} Install Tarball
Test Teardown Execution
@@ -451,7 +451,7 @@
IF '${found_match}' == 'True' BREAK
END
- Run Keyword If '${found_match}' == 'False' Fail msg=No watchdog error logged.
+ IF '${found_match}' == 'False' Fail msg=No watchdog error logged.
Is Watchdog Error Found
diff --git a/redfish/systems/test_power_operations.robot b/redfish/systems/test_power_operations.robot
index 7b064d8..91a9eca 100644
--- a/redfish/systems/test_power_operations.robot
+++ b/redfish/systems/test_power_operations.robot
@@ -42,10 +42,11 @@
Redfish Power On
- Run Keyword If ${additional_occ_check} == ${1}
- ... Wait Until Keyword Succeeds 3 mins 30 secs Match OCC And CPU State Count
+ IF ${additional_occ_check} == ${1}
+ Wait Until Keyword Succeeds 3 mins 30 secs Match OCC And CPU State Count
+ END
- Run Keyword If ${additional_power_check} == ${1} Power Check
+ IF ${additional_power_check} == ${1} Power Check
Verify Redfish Host GracefulRestart
@@ -67,7 +68,7 @@
[Documentation] Do test case setup tasks.
Printn
- Run Keyword If ${capture_sol} == ${1} Start SOL Console Logging
+ IF ${capture_sol} == ${1} Start SOL Console Logging
Redfish.Login
@@ -75,12 +76,14 @@
[Documentation] Collect FFDC and SOL log.
FFDC On Test Case Fail
- Run Keyword If ${capture_sol} == ${1} Stop SOL Capture
+ IF ${capture_sol} == ${1} Stop SOL Capture
- Run Keyword If ${REDFISH_SUPPORTED}
- ... Redfish Set Auto Reboot RetryAttempts
- ... ELSE
- ... Set Auto Reboot ${1}
+ IF ${REDFISH_SUPPORTED}
+ Redfish Set Auto Reboot RetryAttempts
+ ELSE
+ Set Auto Reboot ${1}
+ END
+
Redfish.Logout
@@ -108,8 +111,9 @@
# Ensure the path does have the attribute else set to EMPTY as default to skip.
${value}= Get Variable Value ${power_control[0]['PowerConsumedWatts']} ${EMPTY}
- Run Keyword If "${value}" == "${EMPTY}"
- ... Remove Values From List ${power_uri_list} ${idx}
+ IF "${value}" == "${EMPTY}"
+ Remove Values From List ${power_uri_list} ${idx}
+ END
# Check the next available element in the list.
IF "${value}" == "${EMPTY}" CONTINUE
diff --git a/redfish/systems/test_power_voltage_readings.robot b/redfish/systems/test_power_voltage_readings.robot
index d8539fe..157955f 100755
--- a/redfish/systems/test_power_voltage_readings.robot
+++ b/redfish/systems/test_power_voltage_readings.robot
@@ -44,8 +44,9 @@
... [('Health', '^OK$'), ('State', '^Enabled$'), ('${reading_type}', '')] regex=1 invert=1
${num_invalid_records}= Get Length ${invalid_records}
- Run Keyword If ${num_invalid_records} > ${0}
- ... Rprint Vars num_invalid_records invalid_records fmt=terse
+ IF ${num_invalid_records} > ${0}
+ Rprint Vars num_invalid_records invalid_records fmt=terse
+ END
Valid Value num_invalid_records valid_values=[0]
${cmd} Catenate [x for x in ${records}
@@ -53,8 +54,10 @@
${invalid_records}= Evaluate ${cmd}
${num_invalid_records}= Get Length ${invalid_records}
- Run Keyword If ${num_invalid_records} > ${0}
- ... Rprint Vars num_invalid_records invalid_records fmt=terse
+ IF ${num_invalid_records} > ${0}
+ Rprint Vars num_invalid_records invalid_records fmt=terse
+ END
+
Valid Value num_invalid_records valid_values=[0]
diff --git a/redfish/systems/test_sensor_monitoring.robot b/redfish/systems/test_sensor_monitoring.robot
index f3a1bfe..4115804 100644
--- a/redfish/systems/test_sensor_monitoring.robot
+++ b/redfish/systems/test_sensor_monitoring.robot
@@ -93,10 +93,13 @@
Should Not Be Empty ${OS_HOST}
Should Not Be Empty ${OS_USERNAME}
Should Not Be Empty ${OS_PASSWORD}
- Run Keyword If '${OPENBMC_CONN_METHOD}' == 'ssh'
- ... Should Not Be Empty ${OPENBMC_HOST}
- ... ELSE IF '${OPENBMC_CONN_METHOD}' == 'telnet'
- ... Should Not Be Empty ${OPENBMC_SERIAL_HOST}
+
+ IF '${OPENBMC_CONN_METHOD}' == 'ssh'
+ Should Not Be Empty ${OPENBMC_HOST}
+ ELSE IF '${OPENBMC_CONN_METHOD}' == 'telnet'
+ Should Not Be Empty ${OPENBMC_SERIAL_HOST}
+ END
+
Should Not Be Empty ${OPENBMC_MODEL}
@@ -158,8 +161,9 @@
... or '${resp.dict['Status']['State']}' != 'Enabled'
... or ${resp.dict['Reading']} == ${null}
- Run Keyword If ${condition_str}
- ... Append To List ${INVALID_SENSORS} ${sensor_name}
+ IF ${condition_str}
+ Append To List ${INVALID_SENSORS} ${sensor_name}
+ END
Check Sensor Status And Reading Via Sensor Info
@@ -179,8 +183,9 @@
... or '${sensor_info['Status']['State']}' != 'Enabled'
... or ${sensor_info['${reading_unit}']} == ${null}
- Run Keyword If ${condition_str}
- ... Append To List ${INVALID_SENSORS} ${sensor_info['MemberId']}
+ IF ${condition_str}
+ Append To List ${INVALID_SENSORS} ${sensor_info['MemberId']}
+ END
END
@@ -218,6 +223,7 @@
FOR ${sensor_name} IN @{expected_sensor_name_list}
${exist}= Evaluate '${sensor_name}' in ${curr_sensor_name_list}
- Run Keyword If '${exist}' == '${False}'
- ... Append To List ${INVALID_SENSORS} ${sensor_name}
+ IF '${exist}' == '${False}'
+ Append To List ${INVALID_SENSORS} ${sensor_name}
+ END
END
diff --git a/redfish/systems/test_thermal_ambient_temperatures.robot b/redfish/systems/test_thermal_ambient_temperatures.robot
index 8a79051..1f29aad 100755
--- a/redfish/systems/test_thermal_ambient_temperatures.robot
+++ b/redfish/systems/test_thermal_ambient_temperatures.robot
@@ -60,8 +60,10 @@
${invalid_records}= Evaluate ${cmd}
${num_invalid_records}= Get Length ${invalid_records}
- Run Keyword If ${num_invalid_records} > ${0}
- ... Rprint Vars num_invalid_records invalid_records
+ IF ${num_invalid_records} > ${0}
+ Rprint Vars num_invalid_records invalid_records
+ END
+
Valid Value num_invalid_records valid_values=[0]
Event Log Should Not Exist