Redfish extend robot codes with latest directives
Changes:
- Run KeyWord If is deprecated since Robot
Framework version 5.*, use 'IF' instead
Tested:
- Checked using robot dry-run to make sure the
syntax is not broken
Change-Id: If4b31968d98722d74befef6149d2144d23cfa595
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/redfish/extended/redfish_bmc_code_update.robot b/redfish/extended/redfish_bmc_code_update.robot
index 56c6985..7081948 100644
--- a/redfish/extended/redfish_bmc_code_update.robot
+++ b/redfish/extended/redfish_bmc_code_update.robot
@@ -125,11 +125,13 @@
Redfish.Login
# Delete BMC dump and Error logs.
Run Keyword And Ignore Error Redfish Delete All BMC Dumps
- Run Keyword If ${DELETE_ERRLOGS} == ${1}
- ... Run Keyword And Ignore Error Redfish Purge Event Log
+ IF ${DELETE_ERRLOGS} == ${1}
+ Run Keyword And Ignore Error Redfish Purge Event Log
+ END
# To invalidate all the guard records.
- Run Keyword If '${DELETE_OLD_GUARD_FILE}' == '${1}'
- ... BMC Execute Command guard -I
+ IF '${DELETE_OLD_GUARD_FILE}' == '${1}'
+ BMC Execute Command guard -I
+ END
# Checking for file existence.
Valid File Path IMAGE_FILE_PATH
@@ -141,8 +143,9 @@
... valid_status_codes=[${HTTP_OK},${HTTP_NOT_FOUND},${HTTP_METHOD_NOT_ALLOWED}]
# If the method is not found, set update URI to old method.
- Run Keyword If ${resp.status} == ${HTTP_NOT_FOUND}
- ... Set Suite Variable ${REDFISH_UPDATE_URI} /redfish/v1/UpdateService
+ IF ${resp.status} == ${HTTP_NOT_FOUND}
+ Set Suite Variable ${REDFISH_UPDATE_URI} /redfish/v1/UpdateService
+ END
Log To Console Update URI: ${REDFISH_UPDATE_URI}
diff --git a/redfish/extended/redfish_host_code_update.robot b/redfish/extended/redfish_host_code_update.robot
index 006e711..c492f00 100644
--- a/redfish/extended/redfish_host_code_update.robot
+++ b/redfish/extended/redfish_host_code_update.robot
@@ -43,9 +43,10 @@
${num_records}= Get Length ${functional_sw_inv}
- Run Keyword If ${num_records} != 0
- ... Pass Execution If '${functional_sw_inv['version']}' == '${image_version}'
- ... The existing ${image_version} firmware is already functional.
+ IF ${num_records} != 0
+ Pass Execution If '${functional_sw_inv['version']}' == '${image_version}'
+ ... The existing ${image_version} firmware is already functional.
+ END
${post_code_update_actions}= Get Post Boot Action
${state}= Get Pre Reboot State
diff --git a/redfish/extended/test_bmc_dump.robot b/redfish/extended/test_bmc_dump.robot
index 7044303..694eeb8 100644
--- a/redfish/extended/test_bmc_dump.robot
+++ b/redfish/extended/test_bmc_dump.robot
@@ -83,9 +83,10 @@
[Documentation] Do initial suite setup tasks.
${resp}= OpenBMC Get Request ${DUMP_URI}
- Run Keyword If '${resp.status_code}' == '${HTTP_NOT_FOUND}'
- ... Run Keywords Set Suite Variable ${DUMP_URI} /xyz/openbmc_project/dump/ AND
- ... Set Suite Variable ${DUMP_ENTRY_URI} /xyz/openbmc_project/dump/entry/
+ IF '${resp.status_code}' == '${HTTP_NOT_FOUND}'
+ Set Suite Variable ${DUMP_URI} /xyz/openbmc_project/dump/
+ Set Suite Variable ${DUMP_ENTRY_URI} /xyz/openbmc_project/dump/entry/
+ END
Test Teardown Execution
diff --git a/redfish/extended/test_escale_base.robot b/redfish/extended/test_escale_base.robot
index 040581d..e97ab7f 100755
--- a/redfish/extended/test_escale_base.robot
+++ b/redfish/extended/test_escale_base.robot
@@ -156,12 +156,16 @@
FFDC On Test Case Fail
# Restore the system's initial power limit setting.
- Run Keyword If '${initial_power_setting}' != '${0}'
- ... Set DCMI Power Limit And Verify ${initial_power_setting}
+ IF '${initial_power_setting}' != '${0}'
+ Set DCMI Power Limit And Verify ${initial_power_setting}
+ END
# Restore the system's initial deactivation/activation setting.
- Run Keyword If '${initial_deactivation}' == '${1}'
- ... Deactivate DCMI Power And Verify ELSE Activate DCMI Power And Verify
+ IF '${initial_deactivation}' == '${1}'
+ Deactivate DCMI Power And Verify
+ ELSE
+ Activate DCMI Power And Verify
+ END
# Clean up any error logs before exiting.
Delete All Error Logs
diff --git a/redfish/extended/test_power_capping.robot b/redfish/extended/test_power_capping.robot
index e5861a0..99b1583 100644
--- a/redfish/extended/test_power_capping.robot
+++ b/redfish/extended/test_power_capping.robot
@@ -244,8 +244,12 @@
Smart Power Off
- Run Keyword If '${initial_power_setting}' != '${0}'
- ... Set DCMI Power Limit And Verify ${initial_power_setting}
+ IF '${initial_power_setting}' != '${0}'
+ Set DCMI Power Limit And Verify ${initial_power_setting}
+ END
- Run Keyword If '${initial_deactivation}' == '${1}'
- ... Deactivate DCMI Power And Verify ELSE Activate DCMI Power And Verify
+ IF '${initial_deactivation}' == '${1}'
+ Deactivate DCMI Power And Verify
+ ELSE
+ Activate DCMI Power And Verify
+ END
diff --git a/redfish/extended/test_power_restore.robot b/redfish/extended/test_power_restore.robot
index 523a05f..aac2614 100644
--- a/redfish/extended/test_power_restore.robot
+++ b/redfish/extended/test_power_restore.robot
@@ -151,11 +151,13 @@
Redfish.Login
- Run Keyword If '${expectedState}' == 'Running'
- ... Redfish Power On stack_mode=skip
+ IF '${expectedState}' == 'Running'
+ Redfish Power On stack_mode=skip
+ END
- Run Keyword If '${expectedState}' == 'Off'
- ... Redfish Power Off stack_mode=skip
+ IF '${expectedState}' == 'Off'
+ Redfish Power Off stack_mode=skip
+ END
Test Teardown Execution
diff --git a/redfish/extended/test_service_restart_policy.robot b/redfish/extended/test_service_restart_policy.robot
index 18c47a0..d6f9dfb 100644
--- a/redfish/extended/test_service_restart_policy.robot
+++ b/redfish/extended/test_service_restart_policy.robot
@@ -86,20 +86,22 @@
# Proper restart policy services will be appended to auto_restart_policy_always_services list.
FOR ${service} IN @{service_list}
- ${service_status}= Run Keyword And Return Status Check Service Autorestart ${service}
- Run Keyword If ${service_status} == False
- ... Append To List ${incorrect_auto_restart_policy_services} ${service}
- ... ELSE
- ... Append To List ${auto_restart_policy_always_services} ${service}
+ ${service_status}= Run Keyword And Return Status Check Service Autorestart ${service}
+ IF ${service_status} == False
+ Append To List ${incorrect_auto_restart_policy_services} ${service}
+ ELSE
+ Append To List ${auto_restart_policy_always_services} ${service}
+ END
END
${length_incorrect_autorestart_policy}= Get Length ${incorrect_auto_restart_policy_services}
- Run Keyword If ${length_incorrect_autorestart_policy} != 0 and ${length_incorrect_autorestart_policy} == ${length_services}
- ... Run Keywords Log ${incorrect_auto_restart_policy_services} AND
- ... Fail msg=All the given services have incorrect auto-restart policy.
- ... ELSE IF ${length_incorrect_autorestart_policy} != 0 and ${length_incorrect_autorestart_policy} != ${length_services}
- ... Run Keywords Log ${incorrect_auto_restart_policy_services} AND
- ... Run Keyword And Continue On Failure Fail msg=Listed services are having incorrect auto-restart policy.
+ IF ${length_incorrect_autorestart_policy} != 0 and ${length_incorrect_autorestart_policy} == ${length_services}
+ Log ${incorrect_auto_restart_policy_services}
+ Fail msg=All the given services have incorrect auto-restart policy.
+ ELSE IF ${length_incorrect_autorestart_policy} != 0 and ${length_incorrect_autorestart_policy} != ${length_services}
+ Log ${incorrect_auto_restart_policy_services}
+ Run Keyword And Continue On Failure Fail msg=Listed services are having incorrect auto-restart policy.
+ END
# This will get process id and check the service active state before killing the services.
# If service process id was 0 or service was not in active state then those services will get
@@ -112,8 +114,10 @@
${ActiveState}= Get Service Attribute ActiveState ${service}
${main_pid_status}= Run Keyword And Return Status Should Not Be Equal ${0} ${Old_MainPID}
${active_state_status}= Run Keyword And Return Status Should Be Equal active ${ActiveState}
- Run Keyword If ${main_pid_status} == False or ${active_state_status} == False
- ... Run Keywords Append To List ${service_not_started} ${service} AND Continue For Loop
+ IF ${main_pid_status} == False or ${active_state_status} == False
+ Append To List ${service_not_started} ${service}
+ CONTINUE
+ END
BMC Execute Command kill -9 ${Old_MainPID}
Sleep 10s reason=Wait for service to restart.
@@ -132,10 +136,13 @@
${length_service_not_started}= Get Length ${service_not_started}
${incorrect_services}= Evaluate ${length_incorrect_autorestart_policy} + ${length_service_not_started}
- Run Keyword If ${incorrect_services} == ${length_services} and ${length_service_not_started} != 0
- ... Run Keywords Log ${service_not_started} AND Fail msg=All the services were either not started or not in active state by default.
- ... ELSE IF ${incorrect_services} != ${length_services} and ${length_service_not_started} != 0
- ... Run Keywords Log ${service_not_started} AND Fail msg=Few listed services were either not started or not in active state by default.
+ IF ${incorrect_services} == ${length_services} and ${length_service_not_started} != 0
+ Log ${service_not_started}
+ Fail msg=All the services were either not started or not in active state by default.
+ ELSE IF ${incorrect_services} != ${length_services} and ${length_service_not_started} != 0
+ Log ${service_not_started}
+ Fail msg=Few listed services were either not started or not in active state by default.
+ END
*** Keywords ***
diff --git a/redfish/extended/test_websocket.robot b/redfish/extended/test_websocket.robot
index 906b02c..d74494e 100755
--- a/redfish/extended/test_websocket.robot
+++ b/redfish/extended/test_websocket.robot
@@ -57,8 +57,9 @@
${current_esel_count}= Get Number Of Event Logs
- Run Keyword If ${initial_esel_count} == ${current_esel_count}
- ... Fail msg=System failed to generate eSEL upon request.
+ IF ${initial_esel_count} == ${current_esel_count}
+ Fail msg=System failed to generate eSEL upon request.
+ END
${line}= Grep File ${monitor_file} ${esel_received}
# Typical monitor_file contents:
@@ -68,8 +69,9 @@
# eSEL received over websocket interface.
${num_chars}= Get Length ${line}
- Run Keyword If ${num_chars} < ${min_number_chars} Fail
- ... msg=No eSEL notification from websocket_monitor.py.
+ IF ${num_chars} < ${min_number_chars}
+ Fail msg=No eSEL notification from websocket_monitor.py.
+ END
Test BMC Websocket Dump Interface
@@ -90,8 +92,9 @@
# Dump notification received over websocket interface.
${num_chars}= Get Length ${line}
- Run Keyword If ${num_chars} < ${min_number_chars} Fail
- ... msg=No dump notification from websocket_monitor.py.
+ IF ${num_chars} < ${min_number_chars}
+ Fail msg=No dump notification from websocket_monitor.py.
+ END
*** Keywords ***
@@ -165,7 +168,7 @@
[Documentation] Do teardown tasks after a test.
FFDC On Test Case Fail
- Run Keyword If '${TEST_STATUS}' == 'FAIL' Print Websocket Monitor Log
+ IF '${TEST_STATUS}' == 'FAIL' Print Websocket Monitor Log
Kill Websocket Monitor
Redfish Delete All BMC Dumps