Fix for deprecated robot builtin keywords

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: I281e5b9a7ccdc7ad72f75ad324d1c6a09b4f01dd
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/openpower/ext_interfaces/test_savearea_management.robot b/openpower/ext_interfaces/test_savearea_management.robot
index 0b669d1..c294336 100644
--- a/openpower/ext_interfaces/test_savearea_management.robot
+++ b/openpower/ext_interfaces/test_savearea_management.robot
@@ -318,7 +318,7 @@
 
     FOR  ${conf_file}  IN  @{file_name}
       ${file_exist}=  Run Keyword And Return Status  OperatingSystem.File Should Exist  ${conf_file}
-      Run Keyword If  'True' == '${file_exist}'  Remove File  ${conf_file}
+      IF  'True' == '${file_exist}'  Remove File  ${conf_file}
     END
 
 
@@ -335,7 +335,7 @@
 
     FOR  ${conf_file}  IN  @{match_conf_file_list}
       ${file_exist}=  Run Keyword And Return Status  OperatingSystem.File Should Exist  ${conf_file}
-      Run Keyword If  'True' == '${file_exist}'  Remove File  ${conf_file}
+      IF  'True' == '${file_exist}'  Remove File  ${conf_file}
     END
 
 
@@ -425,7 +425,7 @@
     # flag                If True run part of program, else skip.
     # path                Partition file path.
 
-    Run Keyword If  '${flag}' == '${True}'  Initialize OpenBMC
+    IF  '${flag}' == '${True}'  Initialize OpenBMC
     FOR  ${conf_file}  IN  @{file_name}
       # Get the content of the file and upload to BMC.
       ${image_data}=  OperatingSystem.Get Binary File  ${path}${conf_file}
@@ -474,10 +474,11 @@
 
     Upload Partition File To BMC  ${Partition_file_list}  ${HTTP_OK}  ${FILE_UPLOAD_MESSAGE}
     Verify Partition File On BMC  ${Partition_file_list}  Partition_status=1
-    Run Keyword If  ${num_records} == ${1}
-    ...    Delete BMC Partition File  ${Partition_file_list}  ${HTTP_OK}  ${FILE_DELETED_MESSAGE}
-    ...  ELSE
-    ...    Delete All BMC Partition File  ${HTTP_OK}
+    IF  ${num_records} == ${1}
+        Delete BMC Partition File  ${Partition_file_list}  ${HTTP_OK}  ${FILE_DELETED_MESSAGE}
+    ELSE
+        Delete All BMC Partition File  ${HTTP_OK}
+    END
     Delete Local Partition File  ${Partition_file_list}
 
 
@@ -499,12 +500,12 @@
     Upload Partition File To BMC  ${Partition_file_list}  ${status_code}  ${response_message}
     Verify Partition File On BMC  ${Partition_file_list}  Partition_status=${partition_status}
 
-    Run Keyword If  ${partition_status} == 0
-    ...  Run Keywords
-    ...  Delete BMC Partition File
-    ...  ${Partition_file_list}  ${HTTP_NOT_FOUND}  ${RESOURCE_NOT_FOUND_MESSAGE}  AND
-    ...  Delete All BMC Partition File  ${HTTP_OK}  AND
-    ...  Delete Local Server Partition File
+    IF  ${partition_status} == 0
+        Delete BMC Partition File
+        ...  ${Partition_file_list}  ${HTTP_NOT_FOUND}  ${RESOURCE_NOT_FOUND_MESSAGE}
+        Delete All BMC Partition File  ${HTTP_OK}
+        Delete Local Server Partition File
+    END
 
     Delete Local Partition File  ${Partition_file_list}
 
@@ -583,10 +584,12 @@
 
     Verify Partition File On BMC  ${Partition_file_list}  Partition_status=1
     Initialize OpenBMC
-    Run Keyword If  ${num_records} == ${1}
-    ...    Delete BMC Partition File  ${Partition_file_list}  ${HTTP_OK}  ${FILE_DELETED_MESSAGE}
-    ...  ELSE
-    ...    Delete All BMC Partition File  ${HTTP_OK}
+    IF  ${num_records} == ${1}
+        Delete BMC Partition File  ${Partition_file_list}  ${HTTP_OK}  ${FILE_DELETED_MESSAGE}
+    ELSE
+        Delete All BMC Partition File  ${HTTP_OK}
+    END
+
     Delete Local Partition File  ${Partition_file_list}
 
 
@@ -653,18 +656,20 @@
 
     ${before_reboot_xauth_token}=  Set Variable  ${XAUTH_TOKEN}
 
-    Run Keyword If  ${True} == ${reboot_flag}
-    ...  Run Keywords  Redfish BMC Reset Operation  AND
-    ...  Set Global Variable  ${XAUTH_TOKEN}  ${before_reboot_xauth_token}  AND
-    ...  Wait Until Keyword Succeeds  3 min  10 sec  Redfish BMC Match States  match_state=Enabled  AND
-    ...  Is BMC Standby  AND
-    ...  Initialize OpenBMC  AND
-    ...  Verify Redfish Partition File Content  ${Partition_file_list}  ${content_dict}  ${HTTP_OK}
+    IF  ${True} == ${reboot_flag}
+        Redfish BMC Reset Operation
+        Set Global Variable  ${XAUTH_TOKEN}  ${before_reboot_xauth_token}
+        Wait Until Keyword Succeeds  3 min  10 sec  Redfish BMC Match States  match_state=Enabled
+        Is BMC Standby
+        Initialize OpenBMC
+        Verify Redfish Partition File Content  ${Partition_file_list}  ${content_dict}  ${HTTP_OK}
+    END
 
-    Run Keyword If  ${num_records} == ${1}
-    ...    Delete BMC Partition File  ${Partition_file_list}  ${HTTP_OK}  ${FILE_DELETED_MESSAGE}
-    ...  ELSE
-    ...    Delete All BMC Partition File  ${HTTP_OK}
+    IF  ${num_records} == ${1}
+        Delete BMC Partition File  ${Partition_file_list}  ${HTTP_OK}  ${FILE_DELETED_MESSAGE}
+    ELSE
+        Delete All BMC Partition File  ${HTTP_OK}
+    END
 
     Delete Local Partition File  ${Partition_file_list}
 
@@ -686,12 +691,13 @@
 
     ${before_reboot_xauth_token}=  Set Variable  ${XAUTH_TOKEN}
 
-    Run Keyword If  ${True} == ${reboot_flag}
-    ...  Run Keywords  Redfish BMC Reset Operation  AND
-    ...  Set Global Variable  ${XAUTH_TOKEN}  ${before_reboot_xauth_token}  AND
-    ...  Wait Until Keyword Succeeds  3 min  10 sec  Redfish BMC Match States  match_state=Enabled  AND
-    ...  Is BMC Standby  AND
-    ...  Initialize OpenBMC
+    IF  ${True} == ${reboot_flag}
+        Redfish BMC Reset Operation
+        Set Global Variable  ${XAUTH_TOKEN}  ${before_reboot_xauth_token}
+        Wait Until Keyword Succeeds  3 min  10 sec  Redfish BMC Match States  match_state=Enabled
+        Is BMC Standby
+        Initialize OpenBMC
+    END
 
     ${content_dict}=  Add Content To Files  ${Partition_file_list}  ${0}
     Upload Partition File To BMC  ${Partition_file_list}  ${HTTP_OK}  ${FILE_UPDATED_MESSAGE}
@@ -719,12 +725,13 @@
 
     ${before_reboot_xauth_token}=  Set Variable  ${XAUTH_TOKEN}
 
-    Run Keyword If  ${True} == ${reboot_flag}
-    ...  Run Keywords  Redfish BMC Reset Operation  AND
-    ...  Set Global Variable  ${XAUTH_TOKEN}  ${before_reboot_xauth_token}  AND
-    ...  Wait Until Keyword Succeeds  3 min  10 sec  Redfish BMC Match States  match_state=Enabled  AND
-    ...  Is BMC Standby  AND
-    ...  Initialize OpenBMC
+    IF  ${True} == ${reboot_flag}
+        Redfish BMC Reset Operation
+        Set Global Variable  ${XAUTH_TOKEN}  ${before_reboot_xauth_token}
+        Wait Until Keyword Succeeds  3 min  10 sec  Redfish BMC Match States  match_state=Enabled
+        Is BMC Standby
+        Initialize OpenBMC
+    END
 
     ${content_dict}=  Add Content To Files  ${Partition_file_list}  ${1}
     Upload Partition File To BMC  ${Partition_file_list}  ${HTTP_OK}  ${FILE_UPDATED_MESSAGE}
@@ -844,13 +851,13 @@
 
     ${file_name_length}=  Get Length  ${Partition_file_list}[0]
 
-    Run Keyword If  ${file_name_length} == 20
-    ...  Run Keywords
-    ...    Upload Partition File To BMC  ${Partition_file_list}  ${status_code}  ${message}  AND
-    ...    Verify Partition File On BMC  ${Partition_file_list}  Partition_status=1  AND
-    ...    Delete BMC Partition File  ${Partition_file_list}  ${HTTP_OK}  ${FILE_DELETED_MESSAGE}
-    ...  ELSE
-    ...    Upload Partition File To BMC  ${Partition_file_list}  ${status_code}  ${message}
+    IF  ${file_name_length} == 20
+        Upload Partition File To BMC  ${Partition_file_list}  ${status_code}  ${message}
+        Verify Partition File On BMC  ${Partition_file_list}  Partition_status=1
+        Delete BMC Partition File  ${Partition_file_list}  ${HTTP_OK}  ${FILE_DELETED_MESSAGE}
+    ELSE
+        Upload Partition File To BMC  ${Partition_file_list}  ${status_code}  ${message}
+    END
 
     Delete Local Partition File  ${Partition_file_list}
 
diff --git a/redfish/systems/LogServices/test_post_codes.robot b/redfish/systems/LogServices/test_post_codes.robot
index 0e0bcad..dc35356 100644
--- a/redfish/systems/LogServices/test_post_codes.robot
+++ b/redfish/systems/LogServices/test_post_codes.robot
@@ -212,6 +212,6 @@
 
     ${post_codes}=  Redfish.Get Properties
     ...  /redfish/v1/Systems/${SYSTEM_ID}/LogServices/PostCodes/Entries
-    Run Keyword If  ${post_codes['Members@odata.count']} == 0
-    ...  RF SYS GracefulRestart
-
+    IF  ${post_codes['Members@odata.count']} == 0
+        RF SYS GracefulRestart
+    END
diff --git a/redfish/systems/test_boot_devices.robot b/redfish/systems/test_boot_devices.robot
index de636b6..1ff3030 100644
--- a/redfish/systems/test_boot_devices.robot
+++ b/redfish/systems/test_boot_devices.robot
@@ -249,9 +249,9 @@
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
     Should Contain  ${output}  ${redfish_ipmi_enabled_map['${override_enabled}']}
     Should Contain  ${output}  ${redfish_ipmi_target_map['${override_target}']}
-    Run Keyword If  '${PLATFORM_ARCH_TYPE}' == 'x86'
-    ...  Should Contain  ${output}  ${redfish_ipmi_mode_map['${override_mode}']}
-
+    IF  '${PLATFORM_ARCH_TYPE}' == 'x86'
+        Should Contain  ${output}  ${redfish_ipmi_mode_map['${override_mode}']}
+    END
 
 Verify Boot Source Override After BMC Reboot
     [Documentation]  Verify Boot Source Override After BMC Reboot.
@@ -304,8 +304,9 @@
     ${output}=  Run IPMI Standard Command  chassis bootparam get 5
     Should Contain  ${output}  ${redfish_ipmi_enabled_map['${override_enabled}']}
     Should Contain  ${output}  ${redfish_ipmi_target_map['${override_target}']}
-    Run Keyword If  '${PLATFORM_ARCH_TYPE}' == 'x86'
-    ...  Should Contain  ${output}  ${redfish_ipmi_mode_map['${override_mode}']}
+    IF  '${PLATFORM_ARCH_TYPE}' == 'x86'
+        Should Contain  ${output}  ${redfish_ipmi_mode_map['${override_mode}']}
+    END
 
 
 Verify Boot Source Override with Enabled Mode As Once After Host Reboot
@@ -369,9 +370,9 @@
     ${resp}=  Redfish.Get Attribute  /redfish/v1/Systems/system  Boot
     Should Be Equal As Strings  ${resp["BootSourceOverrideEnabled"]}  Disabled
     Should Be Equal As Strings  ${resp["BootSourceOverrideTarget"]}  None
-    Run Keyword If  '${PLATFORM_ARCH_TYPE}' == 'x86'
-    ...  Should Be Equal As Strings  ${resp["BootSourceOverrideMode"]}  Legacy
-
+    IF  '${PLATFORM_ARCH_TYPE}' == 'x86'
+        Should Be Equal As Strings  ${resp["BootSourceOverrideMode"]}  Legacy
+    END
 
 Verify Boot Source Override with Enabled Mode As Continuous After Host Reboot
     [Documentation]  Verify Boot Source Override with Enabled Mode As Continuous After Host Reboot.
@@ -434,9 +435,10 @@
     ${resp}=  Redfish.Get Attribute  /redfish/v1/Systems/system  Boot
     Should Be Equal As Strings  ${resp["BootSourceOverrideEnabled"]}  Continuous
     Should Be Equal As Strings  ${resp["BootSourceOverrideTarget"]}  ${override_target}
-    Run Keyword If  '${PLATFORM_ARCH_TYPE}' == 'x86'
-    ...  Should Be Equal As Strings  ${resp["BootSourceOverrideMode"]}  ${override_mode}
 
+    IF  '${PLATFORM_ARCH_TYPE}' == 'x86'
+        Should Be Equal As Strings  ${resp["BootSourceOverrideMode"]}  ${override_mode}
+    END
 
 Host Reboot For Bios Setup
     [Documentation]  Rebooting Host without checking Host state.
diff --git a/systest/gpu_stress_test.robot b/systest/gpu_stress_test.robot
index 697afcd..2b03864 100755
--- a/systest/gpu_stress_test.robot
+++ b/systest/gpu_stress_test.robot
@@ -47,8 +47,7 @@
     # The BMC and OS should report the same number of GPUs.
     ${failmsg01}=  Catenate  OS reports ${num_os_gpus} GPUs, but BMC
     ...  reports ${num_bmc_gpus} present and functional GPUs.
-    Run Keyword If  '${num_os_gpus}' != '${num_bmc_gpus}'
-    ...  Fail  msg=${failmsg01}
+    IF  '${num_os_gpus}' != '${num_bmc_gpus}'  Fail  msg=${failmsg01}
 
     # Show parameters for HTX stress test.
     Printn
@@ -60,8 +59,7 @@
 
     # Shutdown HTX if it is already running.
     ${status}=  Is HTX Running
-    Run Keyword If  '${status}' == 'True'
-    ...  Shutdown HTX Exerciser
+    IF  '${status}' == 'True'  Shutdown HTX Exerciser
 
     Repeat Keyword  ${HTX_LOOP} times  Execute GPU Test
 
@@ -113,23 +111,24 @@
     Rpvars  power  power_max  temperature  temperature_via_rest
     ...  temperature_max  clock  clock_max
 
-    Run Keyword If  ${power} > ${power_max}  Fail
-    ...  msg=GPU Power ${power} exceeds limit of ${power_max}.
+    IF  ${power} > ${power_max}
+        Fail  msg=GPU Power ${power} exceeds limit of ${power_max}.
+    END
 
     ${err_msg}=  Catenate  GPU temperature of ${temperature} exceeds limit
     ...  of ${temperature_max}.
-    Run Keyword If  ${temperature} > ${temperature_max}  Fail  msg=${err_msg}
+    IF  ${temperature} > ${temperature_max}  Fail  msg=${err_msg}
 
-    Run Keyword If  ${clock} > ${clock_max}  Fail
-    ...  msg=GPU clock of ${clock} exceeds limit of ${clock_max}.
+    IF  ${clock} > ${clock_max}  Fail  msg=GPU clock of ${clock} exceeds limit of ${clock_max}.
 
     ${err_msg}=  Catenate  The GPU temperature reported by REST is not within
     ...  5 degrees of the nvidia_smi reported temperature.
     ${upper_limit}=  Evaluate  ${temperature_via_rest}+5
     ${lower_limit}=  Evaluate  ${temperature_via_rest}-5
-    Run Keyword If
-    ...  ${temperature} > ${upper_limit} or ${temperature} < ${lower_limit}
-    ...  Fail  msg=${err_msg}
+
+    IF  ${temperature} > ${upper_limit} or ${temperature} < ${lower_limit}
+        Fail  msg=${err_msg}
+    END
 
     Shutdown HTX Exerciser
 
@@ -171,8 +170,7 @@
     Rpvars  num_os_gpus
 
     # If no GPUs detected, we cannot continue.
-    Run Keyword If  '${num_os_gpus}' == '${0}'  Fail
-    ...  msg=No GPUs detected so cannot run test.
+    IF  '${num_os_gpus}' == '${0}'  Fail  msg=No GPUs detected so cannot run test.
 
     Set Suite Variable  ${num_os_gpus}  children=true
 
@@ -182,8 +180,7 @@
     [Documentation]  Do the post test teardown.
 
     # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
-    Run Keyword If  '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
-    ...  Shutdown HTX Exerciser
+    IF  '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}  Shutdown HTX Exerciser
 
     ${keyword_buf}=  Catenate  Stop SOL Console Logging
     ...  \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
diff --git a/systest/htx_hardbootme_test.robot b/systest/htx_hardbootme_test.robot
index 9e7ce18..bc3b4a6 100755
--- a/systest/htx_hardbootme_test.robot
+++ b/systest/htx_hardbootme_test.robot
@@ -81,8 +81,9 @@
     Rprint Vars  HTX_DURATION  HTX_LOOP  HTX_INTERVAL  CHECK_INVENTORY
     ...  INV_IGNORE_LIST  PREV_INV_FILE_PATH
 
-    Run Keyword If  '${PREV_INV_FILE_PATH}' != 'NONE'
-    ...  OperatingSystem.File Should Exist  ${PREV_INV_FILE_PATH}
+    IF  '${PREV_INV_FILE_PATH}' != 'NONE'
+        OperatingSystem.File Should Exist  ${PREV_INV_FILE_PATH}
+    END
 
     Set Suite Variable  ${PREV_INV_FILE_PATH}  children=true
     Set Suite Variable  ${INV_IGNORE_LIST}  children=true
@@ -136,12 +137,11 @@
     # Post Power off and on, the OS SSH session needs to be established.
     Login To OS
 
-    Run Keyword If  '${CHECK_INVENTORY}' == 'True'
-    ...  Do Inventory And Compare  ${json_initial_file_path}
-    ...  ${PREV_INV_FILE_PATH}
+    IF  '${CHECK_INVENTORY}' == 'True'
+        Do Inventory And Compare  ${json_initial_file_path}  ${PREV_INV_FILE_PATH}
+    END
 
-    Run Keyword If  '${HTX_MDT_PROFILE}' == 'mdt.bu'
-    ...  Create Default MDT Profile
+    IF  '${HTX_MDT_PROFILE}' == 'mdt.bu'  Create Default MDT Profile
 
     Run MDT Profile
 
@@ -149,9 +149,9 @@
 
     Shutdown HTX Exerciser
 
-    Run Keyword If  '${CHECK_INVENTORY}' == 'True'
-    ...  Do Inventory And Compare  ${json_final_file_path}
-    ...  ${PREV_INV_FILE_PATH}
+    IF  '${CHECK_INVENTORY}' == 'True'
+        Do Inventory And Compare  ${json_final_file_path}  ${PREV_INV_FILE_PATH}
+    END
 
     Run Keyword  ${rest_keyword} Power Off
 
@@ -179,9 +179,9 @@
     # PREV_INV_FILE_PATH   The previous inventory to compare with.
 
     Create JSON Inventory File  ${inventory_file_path}
-    Run Keyword If  '${PREV_INV_FILE_PATH}' != 'NONE'
-    ...  Compare Json Inventory Files  ${inventory_file_path}
-    ...  ${PREV_INV_FILE_PATH}
+    IF  '${PREV_INV_FILE_PATH}' != 'NONE'
+        Compare Json Inventory Files  ${inventory_file_path}  ${PREV_INV_FILE_PATH}
+    END
     ${PREV_INV_FILE_PATH}=   Set Variable  ${inventory_file_path}
     Set Suite Variable  ${PREV_INV_FILE_PATH}  children=true
 
@@ -194,11 +194,12 @@
     # file2   A file that has an inventory snapshot, to compare with file1.
 
     ${diff_rc}=  File_Diff  ${file1}
-     ...  ${file2}  ${json_diff_file_path}  ${INV_IGNORE_LIST}
-    Run Keyword If  '${diff_rc}' != '${0}'
-    ...  Report Inventory Mismatch  ${diff_rc}  ${json_diff_file_path}
-    ...  ELSE  Print Timen  Inventoy check: No differences found.
-
+    ...  ${file2}  ${json_diff_file_path}  ${INV_IGNORE_LIST}
+    IF  '${diff_rc}' != '${0}'
+        Report Inventory Mismatch  ${diff_rc}  ${json_diff_file_path}
+    ELSE
+        Print Timen  Inventoy check: No differences found.
+    END
 
 Report Inventory Mismatch
     [Documentation]  Report inventory mismatch.
@@ -253,17 +254,16 @@
 
     # Shutdown if HTX is running.
     ${status}=  Is HTX Running
-    Run Keyword If  '${status}' == 'True'
-    ...  Shutdown HTX Exerciser
+    IF  '${status}' == 'True'  Shutdown HTX Exerciser
 
 
 Test Teardown Execution
     [Documentation]  Do the post-test teardown.
 
     # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
-    Run Keyword If
-    ...  '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
-    ...  Shutdown HTX Exerciser
+    IF  '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
+        Shutdown HTX Exerciser
+    END
 
     ${keyword_buf}=  Catenate  Stop SOL Console Logging
     ...  \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
diff --git a/systest/network_stability_test.robot b/systest/network_stability_test.robot
index af2daca..a1caf26 100755
--- a/systest/network_stability_test.robot
+++ b/systest/network_stability_test.robot
@@ -42,8 +42,7 @@
     # Post Power off and on, the OS SSH session needs to be established.
     Login To OS
 
-    Run Keyword If  '${HTX_MDT_PROFILE}' == 'mdt.bu'
-    ...  Create Default MDT Profile
+    IF  '${HTX_MDT_PROFILE}' == 'mdt.bu'  Create Default MDT Profile
 
     Run MDT Profile
 
@@ -51,8 +50,9 @@
     ${status}=  Run Until Keyword Fails  ${HTX_DURATION}  ${HTX_INTERVAL}
     ...  Start Network Test
 
-    Run Keyword If  '${status}' == 'False'
-    ...  Fail  Network is unstable. Please check for errors.
+    IF  '${status}' == 'False'
+        Fail  Network is unstable. Please check for errors.
+    END
 
     Shutdown HTX Exerciser
 
@@ -85,8 +85,7 @@
 
     # Shutdown if HTX is running.
     ${status}=  Is HTX Running
-    Run Keyword If  '${status}' == 'True'
-    ...  Shutdown HTX Exerciser
+    IF  '${status}' == 'True'  Shutdown HTX Exerciser
 
 
 Test Teardown Execution
@@ -96,8 +95,9 @@
     # 3. Close all open SSH connections.
 
     # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
-    Run Keyword If  '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
-    ...  Shutdown HTX Exerciser
+    IF  '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
+        Shutdown HTX Exerciser
+    END
 
     FFDC On Test Case Fail
     Close All Connections