DMTF Update 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: Ie9c06a79137399190469ff3a071d2d90c93c8e07
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/redfish/dmtf_tools/Redfish_Interop_Validator.robot b/redfish/dmtf_tools/Redfish_Interop_Validator.robot
index 8dc3718..6cf32e8 100644
--- a/redfish/dmtf_tools/Redfish_Interop_Validator.robot
+++ b/redfish/dmtf_tools/Redfish_Interop_Validator.robot
@@ -1,7 +1,9 @@
 *** Settings ***
-Documentation      Test BMC Redfish conformance using  https://github.com/DMTF/Redfish-Interop-Validator.
+Documentation      Test BMC Redfish conformance using
+...                https://github.com/DMTF/Redfish-Interop-Validator.
 ...                DMTF tool.
-...                It validate the Redfish service based on an interoperability profile given to it.
+...                It validate the Redfish service based on an
+...                interoperability profile given to it.
 
 Resource           ../../lib/dmtf_tools_utils.robot
 
@@ -33,4 +35,4 @@
 
     ${rc}  ${output}=  Run DMTF Tool  ${rsv_dir_path}  ${cmd_str_master}  check_error=1
 
-    Run Keyword If  ${rc} != 0  Fail  Redfish-Interop-Validator Failed.
+    IF  ${rc} != 0  Fail  Redfish-Interop-Validator Failed.
diff --git a/redfish/dmtf_tools/Redfish_JsonSchema_ResponseValidator.robot b/redfish/dmtf_tools/Redfish_JsonSchema_ResponseValidator.robot
index 8f72736..ad6ad22 100644
--- a/redfish/dmtf_tools/Redfish_JsonSchema_ResponseValidator.robot
+++ b/redfish/dmtf_tools/Redfish_JsonSchema_ResponseValidator.robot
@@ -35,12 +35,13 @@
     FOR  ${url}  IN  @{url_list}
         ${rc}  ${output}=  Run DMTF Tool  ${rsv_dir_path}  ${command_string} -i ${url}
         ${status}=  Run Keyword And Return Status  Redfish JsonSchema ResponseValidator Result  ${output}
-        Run Keyword If  ${status} == ${False}  Set Test Variable  ${test_run_status}  ${status}
+        IF  ${status} == ${False}  Set Test Variable  ${test_run_status}  ${status}
         Save Logs For Debugging  ${status}  ${url}
     END
 
-    Run Keyword If  ${test_run_status} == ${False}
-    ...  Fail  Redfish-JsonSchema-ResponseValidator detected errors.
+    IF  ${test_run_status} == ${False}
+        Fail  Redfish-JsonSchema-ResponseValidator detected errors.
+    END
 
 
 *** Keywords ***
@@ -58,5 +59,6 @@
 
     # URL /redfish/v1/Managers/${MANAGER_ID} strip the last ending string and save off
     # the logs for debugging "validate_errs_AccountService" and move to logs/.
-    Run Keyword If  ${status} == ${False}
-    ...  Shell Cmd  mv validate_errs logs/validate_errs_${url.rsplit("/")[-1]}
+    IF  ${status} == ${False}
+        Shell Cmd  mv validate_errs logs/validate_errs_${url.rsplit("/")[-1]}
+    END
diff --git a/redfish/dmtf_tools/Redfish_Protocol_Validator.robot b/redfish/dmtf_tools/Redfish_Protocol_Validator.robot
index 4fa730d..0fa27dc 100644
--- a/redfish/dmtf_tools/Redfish_Protocol_Validator.robot
+++ b/redfish/dmtf_tools/Redfish_Protocol_Validator.robot
@@ -40,8 +40,7 @@
 
     ${fail_count}=  Should Match Regexp  ${output}  FAIL: (\\d+)
 
-    Run Keyword If  ${fail_count[1]} != 0
-    ...  Fail  Redfish Protocol Validator Failed
+    IF  ${fail_count[1]} != 0  Fail  Redfish Protocol Validator Failed
 
 
 *** Keywords ***
diff --git a/redfish/dmtf_tools/Redfish_Reference_Checker.robot b/redfish/dmtf_tools/Redfish_Reference_Checker.robot
index 92f2c3b..1fcef8f 100644
--- a/redfish/dmtf_tools/Redfish_Reference_Checker.robot
+++ b/redfish/dmtf_tools/Redfish_Reference_Checker.robot
@@ -30,7 +30,7 @@
 
     # Work complete, total failures:  0
     Should Match Regexp    ${output}  Work complete, total failures:[ ]+0
-    Run Keyword If  ${rc} != 0  Fail  Redfish-Reference-Checker Failed.
+    IF  ${rc} != 0  Fail  Redfish-Reference-Checker Failed.
 
 *** Keywords ***
 
diff --git a/redfish/dmtf_tools/Redfish_Service_Validator.robot b/redfish/dmtf_tools/Redfish_Service_Validator.robot
index acbba0a..a6983e4 100644
--- a/redfish/dmtf_tools/Redfish_Service_Validator.robot
+++ b/redfish/dmtf_tools/Redfish_Service_Validator.robot
@@ -29,7 +29,7 @@
     ${rc}  ${output}=  Run DMTF Tool  ${rsv_dir_path}  ${cmd_str_master}  check_error=1
 
     Redfish Service Validator Result  ${output}
-    Run Keyword If  ${rc} != 0  Fail  Redfish-Service-Validator Failed.
+    IF  ${rc} != 0  Fail  Redfish-Service-Validator Failed.
 
 
 Run Redfish Service Validator With Additional Roles
@@ -72,7 +72,7 @@
     ${rc}  ${output}=  Run DMTF Tool  ${rsv_dir_path}  ${cmd}  check_error=1
 
     Redfish Service Validator Result  ${output}
-    Run Keyword If  ${rc} != 0  Fail
+    IF  ${rc} != 0  Fail
 
 
 Delete User Created
diff --git a/redfish/dmtf_tools/Redfish_Usecase_Checkers.robot b/redfish/dmtf_tools/Redfish_Usecase_Checkers.robot
index 6e96cb2..4908488 100644
--- a/redfish/dmtf_tools/Redfish_Usecase_Checkers.robot
+++ b/redfish/dmtf_tools/Redfish_Usecase_Checkers.robot
@@ -52,8 +52,10 @@
 
     FOR  ${result}  IN  @{result_list}
        ${rc}=  Evaluate  'ErrorMessages'=='${result}'
-       ${num}=  Run Keyword If  ${rc} == False  Set Variable  ${result_list["${result}"]["fail"]}
-       Run Keyword If  ${num} != None and ${num} > 0  Append To List  ${failed_tc_list}   ${result}
+       ${num}=  Set Variable If  ${rc} == False  ${result_list["${result}"]["fail"]}
+       IF  ${num} != None and ${num} > 0
+           Append To List  ${failed_tc_list}   ${result}
+       END
     END
 
     Should Be Empty  ${failed_tc_list}  Failed test cases are ${failed_tc_list}
@@ -100,10 +102,17 @@
 
     FOR  ${result}  IN  @{result_list}
        ${rc}=  Evaluate  'ErrorMessages'=='${result}'
-       ${num}=  Run Keyword If  ${rc} == False  Set Variable  ${result_list["${result}"]["fail"]}
-       Run Keyword If  ${num} != None and ${num} > 0  Append To List  ${failed_tc_list}   ${result}
-       Run Keyword If  ${rc} == True   Set Variable
-       ...  Append To List  ${error_messages}  ${result_list["ErrorMessages"]}
+
+       ${num}=  Set Variable If  ${rc} == False
+       ...  ${result_list["${result}"]["fail"]}
+
+       IF  ${num} != None and ${num} > 0
+           Append To List  ${failed_tc_list}   ${result}
+       END
+
+       IF  ${rc} == True
+           Append To List  ${error_messages}  ${result_list["ErrorMessages"]}
+       END
     END
 
     Log Many            ErrorMessages:   @{error_messages}
diff --git a/redfish/dmtf_tools/test_redfishtool_certificate.robot b/redfish/dmtf_tools/test_redfishtool_certificate.robot
index e7d6e68..c11feb0 100644
--- a/redfish/dmtf_tools/test_redfishtool_certificate.robot
+++ b/redfish/dmtf_tools/test_redfishtool_certificate.robot
@@ -222,8 +222,11 @@
     ...  KeyPairAlgorithm=${key_pair_algorithm}  KeyCurveId=${key_curv_id}
 
     # Remove not applicable field for CSR generation.
-    Run Keyword If  '${key_pair_algorithm}' == 'EC'  Remove From Dictionary  ${csr_dict}  KeyBitLength
-    ...  ELSE IF  '${key_pair_algorithm}' == 'RSA'  Remove From Dictionary  ${csr_dict}  KeyCurveId
+    IF  '${key_pair_algorithm}' == 'EC'
+        Remove From Dictionary  ${csr_dict}  KeyBitLength
+    ELSE IF  '${key_pair_algorithm}' == 'RSA'
+        Remove From Dictionary  ${csr_dict}  KeyCurveId
+    END
 
     ${expected_resp}=  Set Variable If
     ...  '${expected_status}' == 'ok'     ${HTTP_OK}, ${HTTP_NO_CONTENT}
@@ -255,10 +258,11 @@
     #                     request (i.e. "ok" or "error").
     # delete_cert         Certificate will be deleted before installing if this True.
 
-    Run Keyword If  '${cert_type}' == 'CA'
-    ...  Delete All CA Certificate Via Redfishtool  ${delete_cert}
-    ...  ELSE IF  '${cert_type}' == 'Client'
-    ...  Redfishtool Delete Certificate Via BMC CLI  ${cert_type}  ${delete_cert}
+    IF  '${cert_type}' == 'CA'
+        Delete All CA Certificate Via Redfishtool  ${delete_cert}
+    ELSE IF  '${cert_type}' == 'Client'
+        Redfishtool Delete Certificate Via BMC CLI  ${cert_type}  ${delete_cert}
+    END
 
     IF  "${install_type}" != "install" and "${file_status}" != "Not Found"
         RETURN
@@ -282,10 +286,10 @@
 
     ${cert_file_content}=  OperatingSystem.Get File  ${cert_file_path}
 
-    ${bmc_cert_content}=  Run Keyword If  '${expected_status}' == 'ok'
-    ...  Redfishtool GetAttribute  ${certificate_uri}/${cert_id}  CertificateString
-
-    Run Keyword If  '${expected_status}' == 'ok'  Should Contain  ${cert_file_content}  ${bmc_cert_content}
+    IF  '${expected_status}' == 'ok'
+        ${bmc_cert_content}=  Redfishtool GetAttribute  ${certificate_uri}/${cert_id}  CertificateString
+        Should Contain  ${cert_file_content}  ${bmc_cert_content}
+    END
 
 
 Delete All CA Certificate Via Redfishtool
@@ -321,13 +325,18 @@
     # Description of argument(s):
     # cert_type           Certificate type (e.g. "Client" or "CA").
 
-    ${certificate_file_path}  ${certificate_service}  ${certificate_uri}=
-    ...  Run Keyword If  '${cert_type}' == 'Client'
-    ...    Set Variable  /etc/nslcd/certs/cert.pem  phosphor-certificate-manager@nslcd.service
-    ...    ${REDFISH_LDAP_CERTIFICATE_URI}
-    ...  ELSE IF  '${cert_type}' == 'CA'
-    ...    Set Variable  ${ROOT_CA_FILE_PATH}  phosphor-certificate-manager@authority.service
-    ...    ${REDFISH_CA_CERTIFICATE_URI}
+    # Check if cert type is Client else set to CA parameters.
+
+    ${certificate_file_path}=  Set Variable If  '${cert_type}' == 'Client'
+    ...  /etc/nslcd/certs/cert.pem  ${ROOT_CA_FILE_PATH}
+
+    ${certificate_service}=  Set Variable If  '${cert_type}' == 'Client'
+     ...  phosphor-certificate-manager@nslcd.service
+     ...  phosphor-certificate-manager@authority.service
+
+    ${certificate_uri}=  Set Variable If  '${cert_type}' == 'Client'
+    ...  ${REDFISH_LDAP_CERTIFICATE_URI}
+    ...  ${REDFISH_CA_CERTIFICATE_URI}
 
     ${file_status}  ${stderr}  ${rc}=  BMC Execute Command
     ...  [ -f ${certificate_file_path} ] && echo "Found" || echo "Not Found"
@@ -366,10 +375,11 @@
     ...  '${resp.status_code}' == '${HTTP_OK}'  ${resp.json()["Id"]}
     ...  '${resp.status_code}' == '${HTTP_NO_CONTENT}'  ${resp.json()["Id"]}  -1
 
-    Run Keyword If  '${status}' == 'ok'
-    ...  Should Contain Any  "${resp.status_code}"  ${HTTP_OK}  ${HTTP_NO_CONTENT}
-    ...  ELSE IF  '${status}' == 'error'
-    ...  Should Be Equal As Strings  ${resp.status_code}  ${HTTP_INTERNAL_SERVER_ERROR}
+    IF  '${status}' == 'ok'
+        Should Contain Any  "${resp.status_code}"  ${HTTP_OK}  ${HTTP_NO_CONTENT}
+    ELSE IF  '${status}' == 'error'
+        Should Be Equal As Strings  ${resp.status_code}  ${HTTP_INTERNAL_SERVER_ERROR}
+    END
 
     Delete All Sessions
 
@@ -388,12 +398,13 @@
     #                  request (i.e. "ok" or "error").
 
     # Install certificate before replacing client or CA certificate.
-    Run Keyword If  '${cert_type}' == 'Client'
-    ...    Verify Redfishtool Install Certificate  ${cert_type}  ${cert_format}  ${expected_status}
-    ...    ${False}  replace
-    ...  ELSE IF  '${cert_type}' == 'CA'
-    ...    Verify Redfishtool Install Certificate  ${cert_type}  ${cert_format}  ${expected_status}
-    ...    ${False}  replace
+    IF  '${cert_type}' == 'Client'
+        Verify Redfishtool Install Certificate  ${cert_type}  ${cert_format}  ${expected_status}
+        ...  ${False}  replace
+    ELSE IF  '${cert_type}' == 'CA'
+        Verify Redfishtool Install Certificate  ${cert_type}  ${cert_format}  ${expected_status}
+        ...  ${False}  replace
+    END
 
     ${cert_file_path}=  Generate Certificate File Via Openssl  ${cert_format}
     ${bytes}=  OperatingSystem.Get Binary File  ${cert_file_path}
@@ -423,10 +434,11 @@
     Sleep  5s
     ${bmc_cert_content}=  Redfishtool GetAttribute  ${certificate_uri}  CertificateString
 
-    Run Keyword If  '${expected_status}' == 'ok'
-    ...    Should Contain  ${cert_file_content}  ${bmc_cert_content}
-    ...  ELSE
-    ...    Should Not Contain  ${cert_file_content}  ${bmc_cert_content}
+    IF  '${expected_status}' == 'ok'
+        Should Contain  ${cert_file_content}  ${bmc_cert_content}
+    ELSE
+        Should Not Contain  ${cert_file_content}  ${bmc_cert_content}
+    END
 
 
 Redfishtool GetAttribute
@@ -441,7 +453,7 @@
     #                 authentication error, etc. ).
 
     ${rc}  ${cmd_output}=  Run And Return RC And Output  ${cmd_args} GET ${uri}
-    Run Keyword If  ${rc} != 0  Is HTTP Error Expected  ${cmd_output}  ${expected_error}
+    IF  ${rc} != 0  Is HTTP Error Expected  ${cmd_output}  ${expected_error}
 
     ${cmd_output}=  Convert String To JSON  ${cmd_output}
 
diff --git a/redfish/dmtf_tools/test_redfishtool_local_user.robot b/redfish/dmtf_tools/test_redfishtool_local_user.robot
index ed046e3..e77dd40 100644
--- a/redfish/dmtf_tools/test_redfishtool_local_user.robot
+++ b/redfish/dmtf_tools/test_redfishtool_local_user.robot
@@ -182,10 +182,11 @@
     ...  redfishtool raw -r ${OPENBMC_HOST} -u ${login_user} -p ${login_pasword} -S Always
     ${data}=  Set Variable
     ...  '{"UserName":${user_name},"Password":${password},"RoleId":${roleId},"Enabled":${enable}}'
-    Run Keyword If  ${login_user} == ""
-    ...   Redfishtool Post  ${data}  /redfish/v1/AccountService/Accounts  ${root_cmd_args}  ${expected_error}
-    ...   ELSE
-    ...   Redfishtool Post  ${data}  /redfish/v1/AccountService/Accounts  ${user_cmd_args}  ${expected_error}
+    IF  ${login_user} == ""
+        Redfishtool Post  ${data}  /redfish/v1/AccountService/Accounts  ${root_cmd_args}  ${expected_error}
+    ELSE
+        Redfishtool Post  ${data}  /redfish/v1/AccountService/Accounts  ${user_cmd_args}  ${expected_error}
+    END
 
 
 Redfishtool Update User Role
@@ -203,12 +204,13 @@
 
     ${user_cmd_args}=  Set Variable
     ...  redfishtool raw -r ${OPENBMC_HOST} -u ${login_user} -p ${login_pasword} -S Always
-    Run Keyword If  ${login_user} == ""
-    ...   Redfishtool Patch  '{"RoleId":${newRole}}'
-          ...  /redfish/v1/AccountService/Accounts/${user_name}  ${root_cmd_args}  ${expected_error}
-    ...   ELSE
-    ...   Redfishtool Patch  '{"RoleId":${newRole}}'
-          ...  /redfish/v1/AccountService/Accounts/${user_name}  ${user_cmd_args}  ${expected_error}
+    IF  ${login_user} == ""
+        Redfishtool Patch  '{"RoleId":${newRole}}'
+        ...  /redfish/v1/AccountService/Accounts/${user_name}  ${root_cmd_args}  ${expected_error}
+    ELSE
+        Redfishtool Patch  '{"RoleId":${newRole}}'
+        ...  /redfish/v1/AccountService/Accounts/${user_name}  ${user_cmd_args}  ${expected_error}
+    END
 
 
 Redfishtool Delete User