Fix 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: Ia7075ebf97e7300a82b032628e550d0caa4e86a8
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/gui/gui_test/settings_menu/test_network_sub_menu.robot b/gui/gui_test/settings_menu/test_network_sub_menu.robot
index 4fc7504..bedfcff 100644
--- a/gui/gui_test/settings_menu/test_network_sub_menu.robot
+++ b/gui/gui_test/settings_menu/test_network_sub_menu.robot
@@ -811,7 +811,7 @@
Sleep ${NETWORK_TIMEOUT}s
# Verify IP on BMC.
- ${edit_status}= Run Keyword If '${ip_version}' == 'ipv4'
+ ${edit_status}= Set Variable If '${ip_version}' == 'ipv4'
... Run Keyword And Return Status Verify IP On BMC ${new_ip}
... ELSE
... Run Keyword And Return Status Verify IPv6 On BMC ${new_ip}
diff --git a/lib/bmc_network_utils.robot b/lib/bmc_network_utils.robot
index 3188c4f..2a59ff6 100644
--- a/lib/bmc_network_utils.robot
+++ b/lib/bmc_network_utils.robot
@@ -551,9 +551,11 @@
@{network_configurations}= Get Network Configuration
FOR ${network_configuration} IN @{network_configurations}
- Run Keyword If '${network_configuration['Address']}' == '${ip}'
- ... Append To List ${patch_list} ${null}
- ... ELSE Append To List ${patch_list} ${empty_dict}
+ IF '${network_configuration['Address']}' == '${ip}'
+ Append To List ${patch_list} ${null}
+ ELSE
+ Append To List ${patch_list} ${empty_dict}
+ END
END
${ip_found}= Run Keyword And Return Status List Should Contain Value
diff --git a/lib/external_intf/vmi_utils.robot b/lib/external_intf/vmi_utils.robot
index 836e9c8..6d53a6e 100644
--- a/lib/external_intf/vmi_utils.robot
+++ b/lib/external_intf/vmi_utils.robot
@@ -57,8 +57,10 @@
Return From Keyword If ${valid_status_code} != ${HTTP_ACCEPTED}
${host_power_state} ${host_state}= Redfish Get Host State
- Run Keyword If '${host_power_state}' == 'On' and '${host_state}' == 'Enabled'
- ... Verify VMI Network Interface Details ${ip} Static ${gateway} ${netmask} ${interface}
+ IF '${host_power_state}' == 'On' and '${host_state}' == 'Enabled'
+ Verify VMI Network Interface Details ${ip} Static ${gateway} ${netmask} ${interface}
+ END
+
Verify VMI Network Interface Details
[Documentation] Verify VMI network interface details.
@@ -144,7 +146,7 @@
${ip_exists}= Set Variable If ${ip_resp["IPv4Addresses"]} == @{empty} ${False} ${True}
${static_exists}= Set Variable If ${ip_resp["IPv4StaticAddresses"]} == @{empty} ${False} ${True}
- ${vmi_ip}= Run Keyword If ${ip_exists} == ${True}
+ ${vmi_ip}= Set Variable If ${ip_exists} == ${True}
... Create Dictionary DHCPv4=${${ip_resp["DHCPv4"]["DHCPEnabled"]}} Id=${ip_resp["Id"]}
... Description=${ip_resp["Description"]} IPv4_Address=${ip_resp["IPv4Addresses"][0]["Address"]}
... IPv4_AddressOrigin=${ip_resp["IPv4Addresses"][0]["AddressOrigin"]} Name=${ip_resp["Name"]}
diff --git a/lib/logging_utils.robot b/lib/logging_utils.robot
index 20e6901..c8d244d 100644
--- a/lib/logging_utils.robot
+++ b/lib/logging_utils.robot
@@ -185,15 +185,15 @@
# }
# }
- Run Keyword If '${pel_type}' == 'Internal Failure'
- ... BMC Execute Command ${CMD_INTERNAL_FAILURE}
- ... ELSE IF '${pel_type}' == 'FRU Callout'
- ... BMC Execute Command ${CMD_FRU_CALLOUT}
- ... ELSE IF '${pel_type}' == 'Procedure And Symbolic FRU Callout'
- ... BMC Execute Command ${CMD_PROCEDURAL_SYMBOLIC_FRU_CALLOUT}
- ... ELSE IF '${pel_type}' == 'Unrecoverable Error'
- ... BMC Execute Command ${CMD_UNRECOVERABLE_ERROR}
-
+ IF '${pel_type}' == 'Internal Failure'
+ BMC Execute Command ${CMD_INTERNAL_FAILURE}
+ ELSE IF '${pel_type}' == 'FRU Callout'
+ BMC Execute Command ${CMD_FRU_CALLOUT}
+ ELSE IF '${pel_type}' == 'Procedure And Symbolic FRU Callout'
+ BMC Execute Command ${CMD_PROCEDURAL_SYMBOLIC_FRU_CALLOUT}
+ ELSE IF '${pel_type}' == 'Unrecoverable Error'
+ BMC Execute Command ${CMD_UNRECOVERABLE_ERROR}
+ END
Create Test Error Log
[Documentation] Generate test error log.
diff --git a/security/test_bmc_network_security.robot b/security/test_bmc_network_security.robot
index fc92791..ef7362f 100644
--- a/security/test_bmc_network_security.robot
+++ b/security/test_bmc_network_security.robot
@@ -213,16 +213,18 @@
# Description of argument(s):
# port Network port.
- Run Keyword If ${port} == ${REDFISH_INTERFACE}
- ... Redfish.Login
- ... ELSE IF ${port} == ${SSH_PORT}
- ... Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
- ... ELSE IF ${port} == ${IPMI_PORT}
- ... Run External IPMI Standard Command lan print
- ... ELSE IF ${port} == ${HOST_SOL_PORT}
- ... Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} port=${HOST_SOL_PORT}
- ... ELSE
- ... Redfish.Login
+ IF ${port} == ${REDFISH_INTERFACE}
+ Redfish.Login
+ ELSE IF ${port} == ${SSH_PORT}
+ Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
+ ELSE IF ${port} == ${IPMI_PORT}
+ Run External IPMI Standard Command lan print
+ ELSE IF ${port} == ${HOST_SOL_PORT}
+ Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} port=${HOST_SOL_PORT}
+ ELSE
+ Redfish.Login
+ END
+
Establish TCP Connections And Get Connection Failures
[Documentation] Establish TCP connections and return nping connection responses.