Redfish extend 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: If4b31968d98722d74befef6149d2144d23cfa595
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/redfish/extended/test_service_restart_policy.robot b/redfish/extended/test_service_restart_policy.robot
index 18c47a0..d6f9dfb 100644
--- a/redfish/extended/test_service_restart_policy.robot
+++ b/redfish/extended/test_service_restart_policy.robot
@@ -86,20 +86,22 @@
# Proper restart policy services will be appended to auto_restart_policy_always_services list.
FOR ${service} IN @{service_list}
- ${service_status}= Run Keyword And Return Status Check Service Autorestart ${service}
- Run Keyword If ${service_status} == False
- ... Append To List ${incorrect_auto_restart_policy_services} ${service}
- ... ELSE
- ... Append To List ${auto_restart_policy_always_services} ${service}
+ ${service_status}= Run Keyword And Return Status Check Service Autorestart ${service}
+ IF ${service_status} == False
+ Append To List ${incorrect_auto_restart_policy_services} ${service}
+ ELSE
+ Append To List ${auto_restart_policy_always_services} ${service}
+ END
END
${length_incorrect_autorestart_policy}= Get Length ${incorrect_auto_restart_policy_services}
- Run Keyword If ${length_incorrect_autorestart_policy} != 0 and ${length_incorrect_autorestart_policy} == ${length_services}
- ... Run Keywords Log ${incorrect_auto_restart_policy_services} AND
- ... Fail msg=All the given services have incorrect auto-restart policy.
- ... ELSE IF ${length_incorrect_autorestart_policy} != 0 and ${length_incorrect_autorestart_policy} != ${length_services}
- ... Run Keywords Log ${incorrect_auto_restart_policy_services} AND
- ... Run Keyword And Continue On Failure Fail msg=Listed services are having incorrect auto-restart policy.
+ IF ${length_incorrect_autorestart_policy} != 0 and ${length_incorrect_autorestart_policy} == ${length_services}
+ Log ${incorrect_auto_restart_policy_services}
+ Fail msg=All the given services have incorrect auto-restart policy.
+ ELSE IF ${length_incorrect_autorestart_policy} != 0 and ${length_incorrect_autorestart_policy} != ${length_services}
+ Log ${incorrect_auto_restart_policy_services}
+ Run Keyword And Continue On Failure Fail msg=Listed services are having incorrect auto-restart policy.
+ END
# This will get process id and check the service active state before killing the services.
# If service process id was 0 or service was not in active state then those services will get
@@ -112,8 +114,10 @@
${ActiveState}= Get Service Attribute ActiveState ${service}
${main_pid_status}= Run Keyword And Return Status Should Not Be Equal ${0} ${Old_MainPID}
${active_state_status}= Run Keyword And Return Status Should Be Equal active ${ActiveState}
- Run Keyword If ${main_pid_status} == False or ${active_state_status} == False
- ... Run Keywords Append To List ${service_not_started} ${service} AND Continue For Loop
+ IF ${main_pid_status} == False or ${active_state_status} == False
+ Append To List ${service_not_started} ${service}
+ CONTINUE
+ END
BMC Execute Command kill -9 ${Old_MainPID}
Sleep 10s reason=Wait for service to restart.
@@ -132,10 +136,13 @@
${length_service_not_started}= Get Length ${service_not_started}
${incorrect_services}= Evaluate ${length_incorrect_autorestart_policy} + ${length_service_not_started}
- Run Keyword If ${incorrect_services} == ${length_services} and ${length_service_not_started} != 0
- ... Run Keywords Log ${service_not_started} AND Fail msg=All the services were either not started or not in active state by default.
- ... ELSE IF ${incorrect_services} != ${length_services} and ${length_service_not_started} != 0
- ... Run Keywords Log ${service_not_started} AND Fail msg=Few listed services were either not started or not in active state by default.
+ IF ${incorrect_services} == ${length_services} and ${length_service_not_started} != 0
+ Log ${service_not_started}
+ Fail msg=All the services were either not started or not in active state by default.
+ ELSE IF ${incorrect_services} != ${length_services} and ${length_service_not_started} != 0
+ Log ${service_not_started}
+ Fail msg=Few listed services were either not started or not in active state by default.
+ END
*** Keywords ***