Fix security test suite with latest directives
Changes:
- Run KeyWord If is deprecated since Robot
Framework version 5.*, use 'IF' instead
Tested:
- Executed test_bmc_connections.robot and made sure
fix is not broken
Change-Id: I448a2a68ad0c15b1a3f5b3df8d3acc09c5013fe8
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/security/test_bmc_connections.robot b/security/test_bmc_connections.robot
index 53265d2..50ff40f 100644
--- a/security/test_bmc_connections.robot
+++ b/security/test_bmc_connections.robot
@@ -63,9 +63,11 @@
... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}]
# Every 100th iteration, check BMC allows patch with auth token.
- ${status}= Run Keyword If ${iter} % 100 == 0 Run Keyword And Return Status
- ... Login And Configure Hostname ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
- Run Keyword If ${status} == False Append To List ${fail_list} ${iter}
+ IF ${iter} % 100 == 0
+ ${status}= Run Keyword And Return Status
+ ... Login And Configure Hostname ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
+ IF ${status} == False Append To List ${fail_list} ${iter}
+ END
END
${verify_count}= Evaluate ${iterations}/100
${fail_count}= Get Length ${fail_list}
@@ -119,9 +121,10 @@
... valid_status_codes=[${HTTP_UNAUTHORIZED}, ${HTTP_FORBIDDEN}]
# Every 100th iteration, check BMC allows post with auth token.
- ${status}= Run Keyword If ${iter} % 100 == 0 Run Keyword And Return Status
- ... Login And Create User
- Run Keyword If ${status} == False Append To List ${fail_list} ${iter}
+ IF ${iter} % 100 == 0
+ ${status}= Run Keyword And Return Status Login And Create User
+ IF ${status} == False Append To List ${fail_list} ${iter}
+ END
END
${verify_count}= Evaluate ${iterations}/100
${fail_count}= Get Length ${fail_list}
@@ -145,9 +148,11 @@
... Open Connection And Log In ${OPENBMC_USERNAME} ${invalid_password}
# Every 100th iteration Login with correct credentials
- ${status}= Run keyword If ${iter} % ${100} == ${0} Run Keyword And Return Status
- ... Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
- Run Keyword If ${status} == ${False} Append To List ${ssh_status_list} ${status}
+ IF ${iter} % ${100} == ${0}
+ ${status}= Run Keyword And Return Status
+ ... Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
+ IF ${status} == ${False} Append To List ${ssh_status_list} ${status}
+ END
SSHLibrary.Close Connection
END
@@ -175,15 +180,17 @@
Run Keyword And Ignore Error Login to GUI With Incorrect Credentials
# Every 100th iteration, check BMC GUI is responsive.
- ${status}= Run Keyword If ${iter} % 100 == 0 Run Keyword And Return Status
- ... Open Browser ${bmc_url}
+ IF ${iter} % 100 == 0
+ ${status}= Run Keyword And Return Status Open Browser ${bmc_url}
+ END
Append To List ${status_list} ${status}
- Run Keyword If '${status}' == 'True'
- ... Run Keywords Close Browser AND Switch Browser browser1
+ IF '${status}' == 'True'
+ Run Keywords Close Browser AND Switch Browser browser1
+ END
END
${fail_count}= Count Values In List ${status_list} False
- Run Keyword If ${fail_count} > ${0} FAIL Could not open BMC GUI ${fail_count} times
+ IF ${fail_count} > ${0} FAIL Could not open BMC GUI ${fail_count} times
Test BMC GUI Stability On Continuous Refresh Of GUI Home Page
@@ -209,13 +216,15 @@
# Every 100th iteration, check BMC GUI is responsive.
${status}= Run Keyword And Return Status
... Run Keywords Launch Browser And Login GUI AND Logout GUI
- Run Keyword If '${status}' == 'False' Append To List ${failed_list} ${iter}
- ... ELSE IF '${status}' == 'True'
- ... Run Keywords Close Browser AND Switch Browser browser1
+ IF '${status}' == 'False'
+ Append To List ${failed_list} ${iter}
+ ELSE
+ Run Keywords Close Browser AND Switch Browser browser1
+ END
END
Log ${failed_list}
${fail_count}= Get Length ${failed_list}
- Run Keyword If ${fail_count} > ${0} FAIL Could not open BMC GUI ${fail_count} times
+ IF ${fail_count} > ${0} FAIL Could not open BMC GUI ${fail_count} times
Test BMCweb Stability On Continuous Redfish Login Attempts With Invalid Credentials
@@ -253,11 +262,11 @@
# Every 100th iteration, check delete operation with valid session token.
${status}= Run Keyword And Return Status
... Login And Delete User
- Run Keyword If '${status}' == 'False' Append To List ${failed_iter_list} ${iter}
+ IF '${status}' == 'False' Append To List ${failed_iter_list} ${iter}
END
Log ${failed_iter_list}
${fail_count}= Get Length ${failed_iter_list}
- Run Keyword If ${fail_count} > ${0} FAIL Could not do Redfish delete operation ${fail_count} times
+ IF ${fail_count} > ${0} FAIL Could not do Redfish delete operation ${fail_count} times
Verify Flood Put Method Without Auth Token
@@ -268,15 +277,17 @@
@{status_list}= Create List
FOR ${iter} IN RANGE ${1} ${iterations}
+
Log To Console ${iter}th iteration
Run Keyword And Ignore Error
... Redfish.Put ${LED_LAMP_TEST_ASSERTED_URI}attr/Asserted body={"data":1}
+
# Every 100th iteration, check BMC allows put with auth token.
- ${status}= Run Keyword If ${iter} % 100 == 0
- ... Run Keyword And Return Status
- ... Login And Upload Partition File To BMC
- Run Keyword If ${status} == ${False}
- ... Append To List ${status_list} ${status}
+ IF ${iter} % 100 == 0
+ ${status}= Run Keyword And Return Status Login And Upload Partition File To BMC
+ IF ${status} == ${False} Append To List ${status_list} ${status}
+ END
+
END
# Note the count for every 100 iterations.
@@ -364,12 +375,12 @@
# Every 100th iteration, check Redfish is responsive.
${status}= Run Keyword And Return Status
... Redfish.Login ${login_username} ${login_password}
- Run Keyword If '${status}' == 'False' Append To List ${failed_iter_list} ${iter}
+ IF '${status}' == 'False' Append To List ${failed_iter_list} ${iter}
Redfish.Logout
END
Log ${failed_iter_list}
${fail_count}= Get Length ${failed_iter_list}
- Run Keyword If ${fail_count} > ${0} FAIL Could not Login to Redfish ${fail_count} times
+ IF ${fail_count} > ${0} FAIL Could not Login to Redfish ${fail_count} times
Confirm Ability to Connect Then Close All Connections
@@ -405,7 +416,7 @@
[Documentation] Delete local partition file.
${file_exist}= Run Keyword And Return Status OperatingSystem.File Should Exist 100-file
- Run Keyword If 'True' == '${file_exist}' Remove File 100-file
+ IF 'True' == '${file_exist}' Remove File 100-file
Create Partition File