Fix deprecrated Run Keyword If for VMI
Changes:
- Run Keyword If is deprecated since
Robot Framework version 5.*, use IF and END or Inline IF
Tested:
- Checked using robot dry-run to make sure the
syntax is not broken
Change-Id: Ic217689a0f5283f4ba636d8ec021f8fc474a9b25
Signed-off-by: Megha G N <Megha.G.N@ibm.com>
diff --git a/openpower/ext_interfaces/test_vmi.robot b/openpower/ext_interfaces/test_vmi.robot
index 40cbd74..706188a 100644
--- a/openpower/ext_interfaces/test_vmi.robot
+++ b/openpower/ext_interfaces/test_vmi.robot
@@ -58,9 +58,10 @@
Should Be Equal As Strings ${vmi_ip["Description"]}
... Hypervisor's Virtual Management Ethernet Interface
Should Be Equal As Strings ${vmi_ip["Name"]} Hypervisor Ethernet Interface
- Run Keyword If ${vmi_ip["IPv4StaticAddresses"]} != @{empty}
- ... Verify VMI Network Interface Details ${vmi_ip["IPv4_Address"]}
- ... ${origin} ${vmi_ip["IPv4_Gateway"]} ${vmi_ip["IPv4_SubnetMask"]}
+ IF ${vmi_ip["IPv4StaticAddresses"]} != @{empty}
+ Verify VMI Network Interface Details ${vmi_ip["IPv4_Address"]}
+ ... ${origin} ${vmi_ip["IPv4_Gateway"]} ${vmi_ip["IPv4_SubnetMask"]}
+ END
Delete Existing Static VMI IP Address
@@ -68,7 +69,9 @@
[Tags] Delete_Existing_Static_VMI_IP_Address
${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
- Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED}
+ IF ${curr_origin} == ${True}
+ Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED}
+ END
Delete VMI IPv4 Address
@@ -78,7 +81,9 @@
[Tags] Verify_User_Cannot_Delete_ReadOnly_Property_IPv4Addresses
${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
- Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED}
+ IF ${curr_origin} == ${True}
+ Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED}
+ END
Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask}
Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_FORBIDDEN}
@@ -243,7 +248,9 @@
[Teardown] Test Teardown Execution
${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
- Run Keyword If ${curr_origin} == ${False} Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
+ IF ${curr_origin} == ${False}
+ Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED}
+ END
${vmi_ip_config}= Get VMI Network Interface Details
Verify VMI Network Interface Details ${vmi_ip_config["IPv4_Address"]}
... DHCP ${vmi_ip_config["IPv4_Gateway"]} ${vmi_ip_config["IPv4_SubnetMask"]}
@@ -774,7 +781,7 @@
... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface}
${ip_resp}= Evaluate json.loads(r'''${resp.text}''') json
${length}= Get Length ${ip_resp["IPv4StaticAddresses"]}
- ${vmi_network_conf}= Run Keyword If ${length} != ${0} Get VMI Network Interface Details
+ ${vmi_network_conf}= IF ${length} != ${0} Get VMI Network Interface Details
Set Suite Variable ${vmi_network_conf}
@@ -783,10 +790,12 @@
FFDC On Test Case Fail
${curr_mode}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
- Run Keyword If ${curr_mode} == ${True} Set VMI IPv4 Origin ${False}
- Run Keyword If '${vmi_network_conf["IPv4_Address"]}' != '${default}'
- ... Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]}
- ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]}
+ IF ${curr_mode} == ${True}
+ Set VMI IPv4 Origin ${False}
+ ELSE '${vmi_network_conf["IPv4_Address"]}' != '${default}'
+ Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]}
+ ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]}
+ END
Get Immediate Child Parameter From VMI Network Interface
@@ -820,8 +829,9 @@
${dhcp_mode_after}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled
Should Not Be Equal ${dhcp_mode_before} ${dhcp_mode_after}
- Run Keyword If ${dhcp_mode_after} == ${True}
- ... Verify VMI Network Interface Details ${default} ${origin} ${default} ${default}
+ IF ${dhcp_mode_after} == ${True}
+ Verify VMI Network Interface Details ${default} ${origin} ${default} ${default}
+ END
Delete VMI Static IP Address Using Different Users
@@ -906,9 +916,11 @@
Suite Teardown Execution
[Documentation] Do suite teardown execution task.
- Run Keyword If ${vmi_network_conf} != ${None}
- ... Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]}
+ IF ${vmi_network_conf} != ${None}
+ Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]}
... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]}
+ END
+
Delete All Redfish Sessions
Redfish.Logout
diff --git a/openpower/ext_interfaces/test_vmi_multiple_interfaces.robot b/openpower/ext_interfaces/test_vmi_multiple_interfaces.robot
index 973f26f..4e1d23e 100644
--- a/openpower/ext_interfaces/test_vmi_multiple_interfaces.robot
+++ b/openpower/ext_interfaces/test_vmi_multiple_interfaces.robot
@@ -119,8 +119,8 @@
${ip_resp}= Evaluate json.loads(r'''${resp.text}''') json
${length}= Get Length ${ip_resp["IPv4StaticAddresses"]}
${vmi_network_conf}= Catenate SEPARATOR=_ vmi_network_conf ${interface}
- ${vmi_network_conf_value}= Run Keyword If ${length} != ${0}
- ... Get VMI Network Interface Details ${interface}
+ ${conf_value}= Get VMI Network Interface Details ${interface}
+ ${vmi_network_conf_value}= Set Variable If ${length} != ${0} ${conf_value}
Set Suite Variable ${${vmi_network_conf}} ${vmi_network_conf_value}
END
@@ -130,12 +130,13 @@
... Set original vmi details and verify.
FOR ${interface} IN @{interface_list}
- Run Keyword If ${vmi_network_conf_${interface}} != ${None}
- ... Set Static IPv4 Address To VMI And Verify
- ... ${vmi_network_conf_${interface}}[IPv4_Address]
- ... ${vmi_network_conf_${interface}}[IPv4_Gateway]
- ... ${vmi_network_conf_${interface}}[IPv4_SubnetMask]
- ... ${HTTP_ACCEPTED} ${interface}
+ IF ${vmi_network_conf_${interface}} != ${None}
+ Set Static IPv4 Address To VMI And Verify
+ ... ${vmi_network_conf_${interface}}[IPv4_Address]
+ ... ${vmi_network_conf_${interface}}[IPv4_Gateway]
+ ... ${vmi_network_conf_${interface}}[IPv4_SubnetMask]
+ ... ${HTTP_ACCEPTED} ${interface}
+ END
END
Redfish.Logout
diff --git a/openpower/ext_interfaces/test_vmicert_management.robot b/openpower/ext_interfaces/test_vmicert_management.robot
index a586a0b..a7ff413 100644
--- a/openpower/ext_interfaces/test_vmicert_management.robot
+++ b/openpower/ext_interfaces/test_vmicert_management.robot
@@ -603,8 +603,9 @@
# username Username to create a REST session.
# password Password to create a REST session.
- Run Keyword If "${XAUTH_TOKEN}" != "${EMPTY}" or ${force_create} == ${True}
- ... Initialize OpenBMC rest_username=${username} rest_password=${password}
+ IF "${XAUTH_TOKEN}" != "${EMPTY}" or ${force_create} == ${True}
+ Initialize OpenBMC rest_username=${username} rest_password=${password}
+ END
${data}= Create Dictionary
${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
@@ -636,8 +637,9 @@
# This is not applicable for root certificate.
# valid_status_code Expected status code from REST request.
- Run Keyword If "${XAUTH_TOKEN}" != "${EMPTY}" or ${force_create} == ${True}
- ... Initialize OpenBMC rest_username=${username} rest_password=${password}
+ IF "${XAUTH_TOKEN}" != "${EMPTY}" or ${force_create} == ${True}
+ Initialize OpenBMC rest_username=${username} rest_password=${password}
+ END
${data}= Create Dictionary
${headers}= Create Dictionary X-Auth-Token=${XAUTH_TOKEN}
@@ -664,10 +666,10 @@
# file_name Name of CSR or signed CERT file.
# is_csr_file A True value means a CSR while a False is for signed CERT file.
- ${subject}= Run Keyword If ${is_csr_file}
- ... Run openssl req -in ${file_name} -text -noout | grep Subject:
- ... ELSE
- ... Run openssl x509 -in ${file_name} -text -noout | grep Subject:
+ ${openssl_cmd}= Set Variable If ${is_csr_file}
+ ... openssl req -in ${file_name} -text -noout | grep Subject:
+ ... openssl x509 -in ${file_name} -text -noout | grep Subject:
+ ${subject}= Run ${openssl_cmd}
RETURN ${subject}
@@ -680,8 +682,10 @@
# file_name Name of CSR or CERT file.
# is_csr_file A True value means a CSR while a False is for signed CERT file.
- ${PublicKey}= Run Keyword If ${is_csr_file} Run openssl req -in ${file_name} -noout -pubkey
- ... ELSE Run openssl x509 -in ${file_name} -noout -pubkey
+ ${openssl_cmd}= Set Variable If ${is_csr_file}
+ ... openssl req -in ${file_name} -noout -pubkey
+ ... openssl x509 -in ${file_name} -noout -pubkey
+ ${PublicKey}= Run ${openssl_cmd}
RETURN ${PublicKey}