Redfish Network 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: Ibe1bbbd4603c0e8348fa0408132e41a165ae0154
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/redfish/managers/test_bmc_ipv6.robot b/redfish/managers/test_bmc_ipv6.robot
index 2f25d99..53c14f6 100644
--- a/redfish/managers/test_bmc_ipv6.robot
+++ b/redfish/managers/test_bmc_ipv6.robot
@@ -294,9 +294,9 @@
       Append To List  ${patch_list}  ${empty_dict}
     END
 
-    ${valid_status_codes}=  Run Keyword If  '${valid_status_codes}' == '${HTTP_OK}'
-    ...  Set Variable   ${HTTP_OK},${HTTP_NO_CONTENT}
-    ...  ELSE  Set Variable  ${valid_status_codes}
+    ${valid_status_codes}=  Set Variable If  '${valid_status_codes}' == '${HTTP_OK}'
+    ...  ${HTTP_OK},${HTTP_NO_CONTENT}
+    ...  ${valid_status_codes}
 
     # We need not check for existence of IPv6 on BMC while adding.
     Append To List  ${patch_list}  ${ipv6_data}
@@ -458,9 +458,11 @@
     # Find the position of IPv6 address to be modified.
     @{ipv6_network_configurations}=  Get IPv6 Network Configuration
     FOR  ${ipv6_network_configuration}  IN  @{ipv6_network_configurations}
-      Run Keyword If  '${ipv6_network_configuration['Address']}' == '${ipv6}'
-      ...  Append To List  ${patch_list}  ${ipv6_data}
-      ...  ELSE  Append To List  ${patch_list}  ${empty_dict}
+      IF  '${ipv6_network_configuration['Address']}' == '${ipv6}'
+          Append To List  ${patch_list}  ${ipv6_data}
+      ELSE
+          Append To List  ${patch_list}  ${empty_dict}
+      END
     END
 
     # Modify the IPv6 address only if given IPv6 is found
@@ -510,8 +512,9 @@
     ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
     ${slaac_verify}=  Get From Dictionary  ${resp.dict}  StatelessAddressAutoConfig
 
-    Run Keyword If  '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}'
-    ...  Fail  msg=SLAACv6 not set properly.
+    IF  '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}'
+        Fail  msg=SLAACv6 not set properly.
+    END
 
 
 Set And Verify DHCPv6 Property
diff --git a/redfish/managers/test_bmc_network_conf.robot b/redfish/managers/test_bmc_network_conf.robot
index ec4854f..8f1ccce 100644
--- a/redfish/managers/test_bmc_network_conf.robot
+++ b/redfish/managers/test_bmc_network_conf.robot
@@ -721,8 +721,7 @@
     # Description of argument(s):
     # ip  IP address to be deleted.
 
-    Run Keyword If  '${TEST STATUS}' == 'FAIL'
-    ...  Delete IP Address  ${ip}
+    IF  '${TEST STATUS}' == 'FAIL'  Delete IP Address  ${ip}
 
     Test Teardown Execution
 
@@ -753,11 +752,10 @@
     ${DHCPEnabled}=  Get IPv4 DHCP Enabled Status   ${CHANNEL_NUMBER}
     Set Suite Variable  ${DHCPEnabled}
 
-    ${ip_addr}  ${gateway}  ${subnetmask}=  Run Keyword If  ${DHCPEnabled}==True
-    ...   Get DHCP IP Info
-
-    Run Keyword If  ${DHCPEnabled}==True
-    ...  Add IP Address  ${ip_addr}  ${subnetmask}  ${gateway}
+    IF  ${DHCPEnabled}==True
+        ${ip_addr}  ${gateway}  ${subnetmask}=  Get DHCP IP Info
+        Add IP Address  ${ip_addr}  ${subnetmask}  ${gateway}
+    END
 
     ${test_gateway}=  Get BMC Default Gateway
     Set Suite Variable  ${test_gateway}
@@ -770,8 +768,7 @@
     #   - Restore the DHCP IPv4 to enabled state
 
     Redfish.Login
-    Run Keyword If  ${DHCPEnabled}==True
-    ...  Enable IPv4 DHCP Settings
+    IF  ${DHCPEnabled}==True   Enable IPv4 DHCP Settings
 
 
 Configure Multiple Static IPv4 Addresses
@@ -813,10 +810,11 @@
     ${active_channel_config}=  Get Active Channel Config
     ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
 
-    Run Keyword If  '${host_state}' == 'on'
-    ...    Redfish Power On  stack_mode=skip
-    ...  ELSE
-    ...    Redfish Power off  stack_mode=skip
+    IF  '${host_state}' == 'on'
+        Redfish Power On  stack_mode=skip
+    ELSE
+        Redfish Power off  stack_mode=skip
+    END
 
     Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
     Ping Host  ${OPENBMC_HOST}
@@ -836,8 +834,9 @@
         ...  ${False}
         IF  ${ip_found}  BREAK
     END
-    Run Keyword If  '${ip_found}' == '${False}'
-    ...  Fail  msg=Configured IP address not found on EthernetInterface URI.
+    IF  '${ip_found}' == '${False}'
+        Fail  msg=Configured IP address not found on EthernetInterface URI.
+    END
 
 
 Enable IPv4 DHCP Settings
diff --git a/redfish/managers/test_bmc_network_mac.robot b/redfish/managers/test_bmc_network_mac.robot
index 6e9c4e9..0a075ea 100644
--- a/redfish/managers/test_bmc_network_mac.robot
+++ b/redfish/managers/test_bmc_network_mac.robot
@@ -187,12 +187,13 @@
     ${status}=  Run Keyword And Return Status
     ...  Validate MAC On BMC  ${mac_address}
 
-    Run Keyword If  ${valid_status_code} == ${HTTP_BAD_REQUEST}
-    ...      Should Be Equal  ${status}  ${False}
-    ...      msg=Allowing the configuration of an invalid MAC.
-    ...  ELSE
-    ...      Should Be Equal  ${status}  ${True}
-    ...      msg=Not allowing the configuration of a valid MAC.
+    IF  ${valid_status_code} == ${HTTP_BAD_REQUEST}
+        Should Be Equal  ${status}  ${False}
+        ...  msg=Allowing the configuration of an invalid MAC.
+    ELSE
+        Should Be Equal  ${status}  ${True}
+        ...  msg=Not allowing the configuration of a valid MAC.
+    END
 
     Verify MAC Address Via FW_Env  ${mac_address}  ${valid_status_code}
 
@@ -207,9 +208,10 @@
     ${status}=  Run Keyword And Return Status
     ...  Validate MAC On FW_Env  ${mac_address}
 
-    Run Keyword If  ${valid_status_code} == ${HTTP_BAD_REQUEST}
-    ...      Should Be Equal  ${status}  ${False}
-    ...      msg=Allowing the configuration of an invalid MAC.
-    ...  ELSE
-    ...      Should Be Equal  ${status}  ${True}
-    ...      msg=Not allowing the configuration of a valid MAC.
+    IF  ${valid_status_code} == ${HTTP_BAD_REQUEST}
+        Should Be Equal  ${status}  ${False}
+        ...  msg=Allowing the configuration of an invalid MAC.
+    ELSE
+        Should Be Equal  ${status}  ${True}
+        ...  msg=Not allowing the configuration of a valid MAC.
+    END
diff --git a/redfish/managers/test_bmc_network_protocol.robot b/redfish/managers/test_bmc_network_protocol.robot
index 49cedc1..e1e68ec 100644
--- a/redfish/managers/test_bmc_network_protocol.robot
+++ b/redfish/managers/test_bmc_network_protocol.robot
@@ -130,8 +130,8 @@
     Get NTP Initial Status
     ${old_date_time}=  CLI Get BMC DateTime
     ${year_status}=  Run Keyword And Return Status  Should Not Contain  ${old_date_time}  ${year_without_ntp}
-    Run Keyword If  ${year_status} == False
-    ...  Enable NTP And Add NTP Address
+
+    IF  ${year_status} == False  Enable NTP And Add NTP Address
 
 Suite Teardown Execution
     [Documentation]  Do the suite level teardown.
diff --git a/redfish/managers/test_bmc_protocol_settings.robot b/redfish/managers/test_bmc_protocol_settings.robot
index da44021..85003c7 100644
--- a/redfish/managers/test_bmc_protocol_settings.robot
+++ b/redfish/managers/test_bmc_protocol_settings.robot
@@ -260,8 +260,9 @@
     # Wait for timeout for new values to take effect.
     Sleep  ${SETTING_WAIT_TIMEOUT}
 
-    Run Keyword if  ${persistency_check} == ${True}
-    ...  Redfish OBMC Reboot (off)  stack_mode=skip
+    IF  ${persistency_check} == ${True}
+        Redfish OBMC Reboot (off)  stack_mode=skip
+    END
     Verify Protocol State  ${ssh_state}  ${ipmi_state}
 
 
diff --git a/redfish/managers/test_certificate.robot b/redfish/managers/test_certificate.robot
index 20d6782..79f3aa3 100644
--- a/redfish/managers/test_certificate.robot
+++ b/redfish/managers/test_certificate.robot
@@ -289,8 +289,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  ${payload}  KeyBitLength
-    ...  ELSE IF  '${key_pair_algorithm}' == 'RSA'  Remove From Dictionary  ${payload}  KeyCurveId
+    IF  '${key_pair_algorithm}' == 'EC'
+        Remove From Dictionary  ${payload}  KeyBitLength
+    ELSE IF  '${key_pair_algorithm}' == 'RSA'
+        Remove From Dictionary  ${payload}  KeyCurveId
+    END
 
     ${expected_resp}=  Set Variable If  '${expected_status}' == 'ok'  ${HTTP_OK}
     ...  '${expected_status}' == 'error'  ${HTTP_INTERNAL_SERVER_ERROR}, ${HTTP_BAD_REQUEST}
diff --git a/redfish/managers/test_lldp_config.robot b/redfish/managers/test_lldp_config.robot
index 5e8ffb7..adfb42f 100644
--- a/redfish/managers/test_lldp_config.robot
+++ b/redfish/managers/test_lldp_config.robot
@@ -65,5 +65,6 @@
     ${resp}=  Redfish.Get  ${REDFISH_LLDP_ETH_IFACE}${ethernet_interface}
     ${lldp_state_expected}=  Get From Dictionary  ${resp.dict}  Ethernet
 
-    Run Keyword If  '${lldp_state}' != '${lldp_state_expected['LLDPEnabled']}'
-    ...  Fail  msg=LLDP value is not set correctly.
+    IF  '${lldp_state}' != '${lldp_state_expected['LLDPEnabled']}'
+        Fail  msg=LLDP value is not set correctly.
+    END
diff --git a/redfish/managers/test_managers_bmc.robot b/redfish/managers/test_managers_bmc.robot
index d55f284..baa9227 100644
--- a/redfish/managers/test_managers_bmc.robot
+++ b/redfish/managers/test_managers_bmc.robot
@@ -220,6 +220,8 @@
 Restore NTP Status
     [Documentation]  Restore NTP Status.
 
-    Run Keyword If  '${original_ntp["ProtocolEnabled"]}' == 'True'
-    ...    Set NTP state  ${TRUE}
-    ...  ELSE  Set NTP state  ${FALSE}
+    IF  '${original_ntp["ProtocolEnabled"]}' == 'True'
+        Set NTP state  ${TRUE}
+    ELSE
+        Set NTP state  ${FALSE}
+    END
diff --git a/redfish/managers/test_managers_bmc_time.robot b/redfish/managers/test_managers_bmc_time.robot
index d845743..bd28baf 100644
--- a/redfish/managers/test_managers_bmc_time.robot
+++ b/redfish/managers/test_managers_bmc_time.robot
@@ -120,8 +120,7 @@
     Get NTP Initial Status
     ${old_date_time}=  CLI Get BMC DateTime
     ${year_status}=  Run Keyword And Return Status  Should Not Contain  ${old_date_time}  ${year_without_ntp}
-    Run Keyword If  ${year_status} == False
-    ...  Enable NTP And Add NTP Address
+    IF  ${year_status} == False  Enable NTP And Add NTP Address
     Set Time To Manual Mode
 
 
diff --git a/redfish/managers/test_multiple_interfaces.robot b/redfish/managers/test_multiple_interfaces.robot
index 9ac6a17..b0a70b9 100644
--- a/redfish/managers/test_multiple_interfaces.robot
+++ b/redfish/managers/test_multiple_interfaces.robot
@@ -267,8 +267,11 @@
 
     ${status}=  Run Keyword And Return Status  Ping Host  ${interface_ip}
 
-    Run Keyword If  ${enabled} == ${True}  Should Be Equal  ${status}  ${True}
-    ...  ELSE  Should Be Equal  ${status}  ${False}
+    IF  ${enabled} == ${True}
+        Should Be Equal  ${status}  ${True}
+    ELSE
+        Should Be Equal  ${status}  ${False}
+    END
 
 
 Run IPMI
@@ -300,10 +303,11 @@
     Create Directory  certificate_dir
     # AUTH_URI is a global variable defined in lib/resource.robot
     Set Test Variable  ${AUTH_URI}  https://${OPENBMC_HOST_ETH1}
-    Run Keyword If  '${cert_type}' == 'CA' and '${delete_cert}' == '${True}'
-    ...  Delete All CA Certificate Via Redfish
-    ...  ELSE IF  '${cert_type}' == 'Client' and '${delete_cert}' == '${True}'
-    ...  Delete Certificate Via BMC CLI  ${cert_type}
+    IF  '${cert_type}' == 'CA' and '${delete_cert}' == '${True}'
+        Delete All CA Certificate Via Redfish
+    ELSE IF  '${cert_type}' == 'Client' and '${delete_cert}' == '${True}'
+        Delete Certificate Via BMC CLI  ${cert_type}
+    END
 
     ${cert_file_path}=  Generate Certificate File Via Openssl  ${cert_format}
     ${bytes}=  OperatingSystem.Get Binary File  ${cert_file_path}
@@ -317,10 +321,18 @@
     Logging  Installed certificate id: ${cert_id}
 
     Sleep  30s
+
     ${cert_file_content}=  OperatingSystem.Get File  ${cert_file_path}
-    ${bmc_cert_content}=  Run Keyword If  '${expected_status}' == 'ok'  redfish_utils.Get Attribute
+
+    ${content}=   redfish_utils.Get Attribute
     ...  ${certificate_uri}/${cert_id}  CertificateString
-    Run Keyword If  '${expected_status}' == 'ok'  Should Contain  ${cert_file_content}  ${bmc_cert_content}
+
+    ${bmc_cert_content}=  Set Variable If  '${expected_status}' == 'ok'
+    ...  ${content}
+
+    IF  '${expected_status}' == 'ok'
+        Should Contain  ${cert_file_content}  ${bmc_cert_content}
+    END
     RETURN  ${cert_id}
 
 Set SSH Value Via Eth1
diff --git a/redfish/managers/test_multiple_interfaces_dhcp.robot b/redfish/managers/test_multiple_interfaces_dhcp.robot
index 7e3c610..bf65e43 100644
--- a/redfish/managers/test_multiple_interfaces_dhcp.robot
+++ b/redfish/managers/test_multiple_interfaces_dhcp.robot
@@ -207,8 +207,11 @@
 Restore Configuration
     [Documentation]  Restore the configuration to Both Static Network
 
-    Run Keyword If  '${CHANNEL_NUMBER}' == '${1}'  Add IP Address  ${OPENBMC_HOST}  ${eth0_subnet_mask}  ${eth0_gateway}
-    ...  ELSE IF  '${CHANNEL_NUMBER}' == '{2}'  Add IP Address  ${OPENBMC_HOST_ETH1}  ${eth1_subnet_mask}  ${eth1_gateway}
+    IF  '${CHANNEL_NUMBER}' == '${1}'
+        Add IP Address  ${OPENBMC_HOST}  ${eth0_subnet_mask}  ${eth0_gateway}
+    ELSE IF  '${CHANNEL_NUMBER}' == '{2}'
+        Add IP Address  ${OPENBMC_HOST_ETH1}  ${eth1_subnet_mask}  ${eth1_gateway}
+    END
 
 Get Network Configuration Using Channel Number
     [Documentation]  Get ethernet interface.