Fix for depreciated Return From Keyword If keyword

Changes:
 - Return From Keyword If  is deprecated since
   Robot Framework version 5.*, use IF and RETURN  instead

Tested:
 - Checked using robot dry-run to make sure the
   syntax is not broken

Change-Id: I458528b33a1abe9fc750a6941e98490db9b36094
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/extended/code_update/bmc_code_update.robot b/extended/code_update/bmc_code_update.robot
index b096fd2..c36706b 100644
--- a/extended/code_update/bmc_code_update.robot
+++ b/extended/code_update/bmc_code_update.robot
@@ -300,8 +300,8 @@
     # 2. Collect FFDC if test PASS but error log exists.
 
     # Don't delete our logs if we want to persist them for tests.
-    Return From Keyword If  ${running_persistence_test}
+    IF  ${running_persistence_test}  RETURN
 
     FFDC On Test Case Fail
-    Run Keyword If  '${TEST_STATUS}' == 'PASS'  Check Error And Collect FFDC
+    IF  '${TEST_STATUS}' == 'PASS'  Check Error And Collect FFDC
     Close All Connections
diff --git a/lib/bios_attr_utils.robot b/lib/bios_attr_utils.robot
index b485da4..f9e68a0 100644
--- a/lib/bios_attr_utils.robot
+++ b/lib/bios_attr_utils.robot
@@ -106,8 +106,9 @@
     Log To Console  Current firmware boot side :: ${cur_boot_side["fw_boot_side"]}
     Log To Console  Given firmware boot side :: ${set_fw_boot_side}
 
-    Return From Keyword If  "${cur_boot_side["fw_boot_side_current"]}" == "${set_fw_boot_side}"
-    ...  ${True}
+    IF  "${cur_boot_side["fw_boot_side_current"]}" == "${set_fw_boot_side}"
+        RETURN  ${True}
+    END
 
     # Set the given firmware boot side value.
     Set BIOS Attribute Value And Verify  fw_boot_side  ${set_fw_boot_side}  False
diff --git a/openpower/ext_interfaces/test_lock_management.robot b/openpower/ext_interfaces/test_lock_management.robot
index 0e29da5..2ff19d9 100644
--- a/openpower/ext_interfaces/test_lock_management.robot
+++ b/openpower/ext_interfaces/test_lock_management.robot
@@ -1431,7 +1431,7 @@
 Restart Bmcweb On Failure
     [Documentation]  Restart bmcweb only if test failed.
 
-    Return From Keyword If  "${TEST_STATUS}" == "PASS"
+    IF  "${TEST_STATUS}" == "PASS"  RETURN
 
     # This procedure is needs to be corrected or removed, when we figure out
     # what is causing the real failure here.
diff --git a/openpower/ext_interfaces/test_vmicert_management.robot b/openpower/ext_interfaces/test_vmicert_management.robot
index 2978480..a586a0b 100644
--- a/openpower/ext_interfaces/test_vmicert_management.robot
+++ b/openpower/ext_interfaces/test_vmicert_management.robot
@@ -649,7 +649,7 @@
     ...  expected_status=any
 
     Should Be Equal As Strings  ${resp.status_code}  ${valid_status_code}
-    Return From Keyword If  ${resp.status_code} != ${HTTP_OK}
+    IF  ${resp.status_code} != ${HTTP_OK}  RETURN
 
     ${cert}=  Evaluate  json.loads('''${resp.text}''', strict=False)  json
     Should Contain  ${cert["Certificate"]}  BEGIN CERTIFICATE
@@ -715,7 +715,7 @@
     ...  ${read_timeout}
 
     Should Be Equal As Strings  ${resp.status_code}  ${valid_status_code}
-    Return From Keyword If  ${resp.status_code} != ${HTTP_OK}
+    IF  ${resp.status_code} != ${HTTP_OK}  RETURN
 
     ${cert}=  Evaluate  json.loads('''${resp.text}''', strict=False)  json
     Should Contain  ${cert["Certificate"]}  BEGIN CERTIFICATE
diff --git a/redfish/account_service/test_ldap_configuration.robot b/redfish/account_service/test_ldap_configuration.robot
index 0338772..2a95bc2 100644
--- a/redfish/account_service/test_ldap_configuration.robot
+++ b/redfish/account_service/test_ldap_configuration.robot
@@ -632,7 +632,7 @@
 Restore AccountLockout Attributes
     [Documentation]  Restore AccountLockout Attributes.
 
-    Return From Keyword If  &{old_account_service} == &{EMPTY}
+    IF  &{old_account_service} == &{EMPTY}  RETURN
     Redfish.Patch  ${REDFISH_BASE_URI}AccountService
     ...  body=[('AccountLockoutDuration', ${old_account_service['AccountLockoutDuration']})]
     ...  valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}]
@@ -740,7 +740,7 @@
 
     ${ldap_config}=  Get LDAP Configuration  ${LDAP_TYPE}
     ${num_list_entries}=  Get Length  ${ldap_config["RemoteRoleMapping"]}
-    Return From Keyword If  ${num_list_entries} == ${0}  @{EMPTY}
+    IF  ${num_list_entries} == ${0}  @{EMPTY}  RETURN
 
     RETURN  ${ldap_config["RemoteRoleMapping"][0]["LocalRole"]}
 
@@ -749,7 +749,7 @@
     [Documentation]  Restore the LDAP privilege to its original value.
 
     Redfish.Login
-    Return From Keyword If  '${old_ldap_privilege}' == '${EMPTY}' or '${old_ldap_privilege}' == '[]'
+    IF  '${old_ldap_privilege}' == '${EMPTY}' or '${old_ldap_privilege}' == '[]'  RETURN
     # Log back in to restore the original privilege.
     Update LDAP Configuration with LDAP User Role And Group  ${LDAP_TYPE}
     ...  ${old_ldap_privilege}  ${GROUP_NAME}
@@ -764,7 +764,7 @@
     # expected_power_status  State of Host e.g. Off or On.
 
     ${power_status}=  Redfish.Get Attribute  /redfish/v1/Chassis/${CHASSIS_ID}  PowerState
-    Return From Keyword If  '${power_status}' == '${expected_power_status}'
+    IF  '${power_status}' == '${expected_power_status}'  RETURN
 
     IF  '${power_status}' == 'Off'
         Redfish Power On
@@ -794,7 +794,7 @@
     Redfish.Post  ${REDFISH_POWER_URI}
     ...  body={'ResetType': 'ForceOff'}   valid_status_codes=[${valid_status_code}]
 
-    Return From Keyword If  ${valid_status_code} == ${HTTP_FORBIDDEN}
+    IF  ${valid_status_code} == ${HTTP_FORBIDDEN}  RETURN
     Wait Until Keyword Succeeds  1 min  10 sec  Verify Host Power State  Off
 
 
@@ -820,7 +820,7 @@
     Redfish.Post  ${REDFISH_POWER_URI}
     ...  body={'ResetType': 'On'}   valid_status_codes=[${valid_status_code}]
 
-    Return From Keyword If  ${valid_status_code} == ${HTTP_FORBIDDEN}
+    IF  ${valid_status_code} == ${HTTP_FORBIDDEN}  RETURN
     Verify Host Is Up
 
 
diff --git a/redfish/dmtf_tools/test_redfishtool_certificate.robot b/redfish/dmtf_tools/test_redfishtool_certificate.robot
index 1febefa..e7d6e68 100644
--- a/redfish/dmtf_tools/test_redfishtool_certificate.robot
+++ b/redfish/dmtf_tools/test_redfishtool_certificate.robot
@@ -260,7 +260,9 @@
     ...  ELSE IF  '${cert_type}' == 'Client'
     ...  Redfishtool Delete Certificate Via BMC CLI  ${cert_type}  ${delete_cert}
 
-    Return From Keyword If  "${install_type}" != "install" and "${file_status}" != "Not Found"
+    IF  "${install_type}" != "install" and "${file_status}" != "Not Found"
+        RETURN
+    END
 
     ${cert_file_path}=  Generate Certificate File Via Openssl  ${cert_format}
     ${bytes}=  OperatingSystem.Get Binary File  ${cert_file_path}
@@ -302,7 +304,11 @@
     ...  "${uri_length}" == "0"  None
     Set Test Variable  ${cert_id}
     Set Test Variable  ${file_status}
-    Return From Keyword If  "${file_status}" != "Found" or "${delete_cert}" != "${True}"
+
+    IF  "${file_status}" != "Found" or "${delete_cert}" != "${True}"
+        RETURN
+    END
+
     FOR  ${cert}  IN  @{cert_list}
       Redfishtool Delete  ${cert["@odata.id"]}  ${root_cmd_args}
     END
@@ -327,7 +333,11 @@
     ...  [ -f ${certificate_file_path} ] && echo "Found" || echo "Not Found"
 
     Set Test Variable  ${file_status}
-    Return From Keyword If  "${file_status}" != "Found" or '${delete_cert}' != "${True}"
+
+    IF  "${file_status}" != "Found" or '${delete_cert}' != "${True}"
+        RETURN
+    END
+
     BMC Execute Command  rm ${certificate_file_path}
     BMC Execute Command  systemctl restart ${certificate_service}
     BMC Execute Command  systemctl daemon-reload
diff --git a/redfish/extended/redfish_bmc_code_update.robot b/redfish/extended/redfish_bmc_code_update.robot
index 3ac19d4..56c6985 100644
--- a/redfish/extended/redfish_bmc_code_update.robot
+++ b/redfish/extended/redfish_bmc_code_update.robot
@@ -71,9 +71,11 @@
     ${nonfunctional_sw_inv}=  Get Non Functional Firmware  ${sw_inv}  False
 
     # Redfish active software image API.
-    Run Keyword If  ${num_records} > 0
-    ...  Run Keyword If  '${nonfunctional_sw_inv['version']}' == '${image_version}'
-    ...  Set Backup Firmware To Functional  ${image_version}  ${state}
+    IF  ${num_records} > 0
+        IF  '${nonfunctional_sw_inv['version']}' == '${image_version}'
+            Set Backup Firmware To Functional  ${image_version}  ${state}
+        END
+    END
 
     Print Timen  Performing firmware update ${image_version}.
 
@@ -197,7 +199,7 @@
 
     # If no software inventory record was found, there is no existing
     # firmware for the given version and therefore no action to be taken.
-    Return From Keyword If  not ${num_keys}
+    IF  not ${num_keys}  RETURN
 
     # Check if the existing firmware is functional.
     Pass Execution If  ${software_inventory_record['functional']}
@@ -241,7 +243,8 @@
     ${cur_priority}=  Get Image Priority  ${image_version}
     Rprint Vars  least_priority  cur_priority
 
-    Return From Keyword If  '${least_priority}' == ${cur_priority}
+    IF  '${least_priority}' == ${cur_priority}  RETURN
+
     Set Host Software Property
     ...  ${SOFTWARE_VERSION_URI}${software_inventory['image_id']}
     ...  Priority  ${least_priority}
diff --git a/redfish/systems/LogServices/test_post_codes.robot b/redfish/systems/LogServices/test_post_codes.robot
index 2f4972a..0e0bcad 100644
--- a/redfish/systems/LogServices/test_post_codes.robot
+++ b/redfish/systems/LogServices/test_post_codes.robot
@@ -203,7 +203,7 @@
     ${last_id}=  Split String  ${last_id}  -
     ${boot_count}=  Set Variable  ${last_id[0][1]}
 
-    Return From Keyword  ${boot_count}
+    RETURN  ${boot_count}
 
 
 Populate PostCode Logs Incase No Prior Entries Available
diff --git a/redfish/systems/test_systems_inventory.robot b/redfish/systems/test_systems_inventory.robot
index c3e24e2..0c2224e 100755
--- a/redfish/systems/test_systems_inventory.robot
+++ b/redfish/systems/test_systems_inventory.robot
@@ -22,7 +22,6 @@
 
 *** Test Cases ***
 
-
 Verify CPU And Core Count
     [Documentation]  Get the total number of CPUs and cores in the system.
     ...              Verify counts are above minimums.
@@ -108,7 +107,7 @@
         ${state}=  Set Variable  ${power_supply['Status']['State']}
         ${good_state}=  Evaluate
         ...  any(x in '${state}' for x in ('Enabled', 'StandbyOffline'))
-        Run Keyword If  not ${good_state}  Continue For Loop
+        IF  not ${good_state}  CONTINUE
         ${total_num_supplies}=  Evaluate  $total_num_supplies + ${1}
     END
 
@@ -174,7 +173,7 @@
     #               "/redfish/v1/Systems/system/Processors/cpu0").
 
     ${total_cores}=  Redfish.Get Attribute  ${processor}  TotalCores
-    Return From Keyword If  ${total_cores} is ${NONE}  ${0}
+    IF  ${total_cores} is ${NONE}  RETURN  ${0}
     RETURN  ${total_cores}
 
 
@@ -191,8 +190,9 @@
         ${good_state}=  Evaluate
         ...  any(x in '${state}' for x in ('Absent', 'Enabled', 'UnavailableOffline'))
         Rprint Vars  gpu  state
-        Run Keyword If  not ${good_state}  Fail
-        ...  msg=GPU State is not Absent, Enabled, or UnavailableOffline.
+        IF  not ${good_state}
+            Fail  msg=GPU State is not Absent, Enabled, or UnavailableOffline.
+        END
     END
 
 
@@ -200,6 +200,7 @@
     [Documentation]  Get and return a tuple of lists of URIs for CPU,
     ...              GPU and PowerSupplies.
 
+
     ${processor_info}=  Redfish_Utils.Enumerate Request
     ...  ${SYSTEM_BASE_URI}Processors  return_json=0
 
diff --git a/redfish/update_service/test_redfish_image_upload.robot b/redfish/update_service/test_redfish_image_upload.robot
index f20af6f..62dccc5 100644
--- a/redfish/update_service/test_redfish_image_upload.robot
+++ b/redfish/update_service/test_redfish_image_upload.robot
@@ -148,7 +148,7 @@
     ...  valid_status_codes=[${HTTP_OK}, ${HTTP_INTERNAL_SERVER_ERROR}]
     ...  data=${image_data}
 
-    Return From Keyword If  ${resp.status_code} == ${HTTP_INTERNAL_SERVER_ERROR}
+    IF  ${resp.status_code} == ${HTTP_INTERNAL_SERVER_ERROR}  RETURN
 
     ${image_id}=  Get Latest Image ID
     Rprint Vars  image_id
@@ -169,7 +169,8 @@
     ...  body={"TransferProtocol" : "TFTP", "ImageURI" : "${TFTP_SERVER}/${image_file_name}"}
     Sleep  60s
     ${image_version}=  Get Image Version From TFTP Server  ${TFTP_SERVER}  ${image_file_name}
-    Return From Keyword If  '${image_version}' == '${EMPTY}'
+    IF  '${image_version}' == '${EMPTY}'  RETURN
+
     # Wait for image tar file to download complete.
     ${image_id}=  Wait Until Keyword Succeeds  60 sec  10 sec  Get Latest Image ID
     Rprint Vars  image_id
@@ -182,6 +183,6 @@
     [Documentation]  Do the post test teardown.
 
     FFDC On Test Case Fail
-    Run Keyword If  '${image_id}'  Delete Software Object
-    ...  /xyz/openbmc_project/software/${image_id}
-
+    IF  '${image_id}'
+        Delete Software Object  /xyz/openbmc_project/software/${image_id}
+    END