IPMI test suite 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: Id248062c860ff209875d8f57315f572d9321f783
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/ipmi/test_ipmi_cipher.robot b/ipmi/test_ipmi_cipher.robot
index 4e9497a..c0e71be 100644
--- a/ipmi/test_ipmi_cipher.robot
+++ b/ipmi/test_ipmi_cipher.robot
@@ -196,7 +196,7 @@
     ${resp}=  Strip String  ${resp}
 
     # channel 14 represents current channel in which we send request.
-    ${channel_num}=  Run Keyword If  '${channel_num}' == '14'
+    ${channel_num}=  Set Variable If  '${channel_num}' == '14'
     ...  Convert To Hex  ${CHANNEL_NUMBER}  length=2
     ...  ELSE
     ...  Convert To Hex  ${channel_num}  length=2
@@ -225,7 +225,7 @@
    # Description of argument(s):
    # byte_length   extra or less.
 
-   ${req_cmd}=  Run Keyword If  '${byte_length}' == 'less'
+   ${req_cmd}=  Set Variable If  '${byte_length}' == 'less'
    ...  Catenate  ${IPMI_RAW_CMD['Cipher Suite']['get'][0]} ${CHANNEL_NUMBER} 00
    ...  ELSE
    ...  Catenate  ${IPMI_RAW_CMD['Cipher Suite']['get'][0]} ${CHANNEL_NUMBER} 00 00 01
diff --git a/ipmi/test_ipmi_general.robot b/ipmi/test_ipmi_general.robot
index ba05a2b..7b3603f 100644
--- a/ipmi/test_ipmi_general.robot
+++ b/ipmi/test_ipmi_general.robot
@@ -422,7 +422,7 @@
    #               e.g. high - add extra byte to request data like "0x06 0x38 0x01 0x04 0x01".
    #               low - reduce bytes in actual request data like "0x06 0x38".
 
-   ${req_cmd}=  Run Keyword If  '${byte_length}' == 'low'
+   ${req_cmd}=  Set Variable If  '${byte_length}' == 'low'
    ...  Catenate  ${IPMI_RAW_CMD['Get Channel Auth Cap']['get'][0]}  ${CHANNEL_NUMBER}
    ...  ELSE
    ...  Catenate  ${IPMI_RAW_CMD['Get Channel Auth Cap']['get'][0]}  ${CHANNEL_NUMBER} 0x04 0x01
diff --git a/ipmi/test_ipmi_sdr.robot b/ipmi/test_ipmi_sdr.robot
index 96d550a..74b31c7 100755
--- a/ipmi/test_ipmi_sdr.robot
+++ b/ipmi/test_ipmi_sdr.robot
@@ -241,7 +241,7 @@
     ${reservation_id}=  Run IPMI Command
     ...  ${IPMI_RAW_CMD['SDR']['Reserve SDR Repository'][0]}
 
-    ${reservation_id}=  Run Keyword If  ${add_prefix}
+    ${reservation_id}=  Set Variable If  ${add_prefix}
     ...  Add Prefix To String  ${reservation_id}  0x
     ...  ELSE IF  ${convert_lsb_to_msb}
     ...  Convert LSB To MSB  ${reservation_id}
diff --git a/ipmi/test_ipmi_sel_time.robot b/ipmi/test_ipmi_sel_time.robot
index 05e0ac6..c358371 100644
--- a/ipmi/test_ipmi_sel_time.robot
+++ b/ipmi/test_ipmi_sel_time.robot
@@ -564,11 +564,11 @@
 
     ${modifying_date_status}=  Run Keyword And Return Status  Should Contain  ${time}  +
 
-    ${date_time}=  Set Variable IF
+    ${date_time}=  Set Variable If
     ...  ${modifying_date_status} == True  ${time.split("+")[-1]}
     ...  ${modifying_date_status} == False  ${time.split("-")[-1]}
 
-    ${datetime} =  Run Keyword IF  ${modifying_date_status} == True
+    ${datetime} =  Set Variable If  ${modifying_date_status} == True
     ...    Add Time To Date
     ...    ${current_date}  ${date_time}  result_format=%m/%d/%Y %H:%M:%S  date_format=%m/%d/%Y %H:%M:%S
     ...  ELSE IF  ${modifying_date_status} == False
diff --git a/ipmi/test_ipmi_sensor.robot b/ipmi/test_ipmi_sensor.robot
index 566d7a9..b6e09df 100644
--- a/ipmi/test_ipmi_sensor.robot
+++ b/ipmi/test_ipmi_sensor.robot
@@ -211,7 +211,7 @@
     # sensor_id     Sensor id used to get reading in IPMI or DCMI.
     # member_id     Member id of sensor data in Redfish.
 
-    ${ipmi_value}=  Run Keyword If  '${command_type}' == 'IPMI'  Get IPMI Sensor Reading  ${sensor_id}
+    ${ipmi_value}=  Set Variable If  '${command_type}' == 'IPMI'  Get IPMI Sensor Reading  ${sensor_id}
     ...  ELSE  Get DCMI Sensor Reading  ${sensor_id}
 
     ${redfish_value}=  Get Temperature Reading From Redfish  ${member_id}
diff --git a/ipmi/test_ipmi_sol.robot b/ipmi/test_ipmi_sol.robot
index 3f3a7d9..ce49fd7 100644
--- a/ipmi/test_ipmi_sol.robot
+++ b/ipmi/test_ipmi_sol.robot
@@ -328,7 +328,7 @@
     # Retry interval setting is set in multiples of 10.
     # Reference IPMI specification v2.0
 
-    ${expected_value}=  Run Keyword If
+    ${expected_value}=  Set Variable If
     ...  '${setting_name}' == 'character-accumulate-level'  Evaluate  ${value}*5
     ...  ELSE IF  '${setting_name}' == 'retry-interval'  Evaluate  ${value}*10
     ...  ELSE  Set Variable  ${value}
diff --git a/lib/list_utils.robot b/lib/list_utils.robot
index ae477ef..ebdef6f 100644
--- a/lib/list_utils.robot
+++ b/lib/list_utils.robot
@@ -1,8 +1,10 @@
 *** Settings ***
 Documentation  This module contains keywords for list manipulation.
+
 Library  Collections
 
 *** Keywords ***
+
 Smart Combine Lists
     [Documentation]  Combine all valid list arguments and return the result.
     [Arguments]  @{lists}
@@ -16,8 +18,10 @@
 
     FOR  ${arg}  IN  @{lists}
       ${type_arg}=  Evaluate  str(type($lists[${index}])).split("'")[1]
-      Run Keyword If  '${type_arg}' != 'list'  Run Keywords  Remove From List  ${lists}  ${index}  AND
-      ...  Continue For Loop
+      IF  '${type_arg}' != 'list'
+           Remove From List  ${lists}  ${index}
+           Continue For Loop
+      END
       ${index}=  Evaluate  ${index}+1
     END
 
@@ -31,6 +35,7 @@
     ...  values common to both lists with no duplicates.
     [Arguments]  ${list1}  ${list2}
 
+    # Description of argument(s):
     # list1      The first list to intersect.
     # list2      The second list to intersect.
 
@@ -46,7 +51,7 @@
 
     FOR  ${element}  IN  @{larger_list}
       ${rc}=  Run Keyword and Return Status  List Should Contain Value  ${smaller_list}  ${element}
-      Run Keyword If  '${rc}' == 'True'  Append to List  ${intersected_list}  ${element}
+      IF  '${rc}' == 'True'  Append to List  ${intersected_list}  ${element}
     END
 
     @{intersected_list}=  Remove Duplicates  ${intersected_list}
@@ -67,8 +72,7 @@
     FOR  ${item}  IN  @{list1}
         ${status}=  Run Keyword And Return Status
         ...  Should Contain  ${list2}  ${item}
-        Run Keyword If  '${status}' == '${False}'
-        ...  Append To List  ${diff_list}  ${item}
+        IF  '${status}' == '${False}'  Append To List  ${diff_list}  ${item}
     END
 
     RETURN  ${diff_list}