Fix testcase for verifying trimming of older error logs

Change-Id: If4f18869c744be69ca9ee971aa80ac47bd29cd23
Signed-off-by: manashsarma <manashsarma@in.ibm.com>
diff --git a/openpower/pel/test_bmc_pel.robot b/openpower/pel/test_bmc_pel.robot
index 8e46817..2c6b483 100644
--- a/openpower/pel/test_bmc_pel.robot
+++ b/openpower/pel/test_bmc_pel.robot
@@ -547,7 +547,6 @@
     [Tags]  Verify_Old_Logs_Are_Deleted_When_Count_Crosses_Max
 
     Redfish Purge Event Log
-
     # Create 3000 error logs.
     FOR  ${count}  IN RANGE  ${3000}
         BMC Execute Command  ${CMD_PREDICTIVE_ERROR}
@@ -555,18 +554,22 @@
 
     # Retrieve the IDs of the logs.
     ${pel_ids}=  Get PEL Log Via BMC CLI
+    ${1st_id}=  Get From List  ${pel_ids}  0
+    ${3000th_id}=  Get From List  ${pel_ids}  2999
 
     # Now create 3001st log to cross threshold limit and trigger error logs rotation.
     BMC Execute Command  ${CMD_PREDICTIVE_ERROR}
+
     # Wait few seconds for error logs rotation to complete.
     Sleep  10s
 
     # Now verify that first log is no more available but the 3000th is available.
-    ${1st_id}=  Get From List  ${pel_ids}  0
-    ${3000th_id}=  Get From List  ${pel_ids}  3000
-    ${output}=  peltool -i ${1st_id}
+    ${status}  ${output}=  Run Keyword And Ignore Error  Peltool  -i ${1st_id}
+    Should Be True  '${status}' == 'FAIL'
     Should Contain  ${output}  PEL not found
-    ${output}=  peltool -i ${3000th_id}
+
+    ${status}  ${output}=  Run Keyword And Ignore Error  Peltool  -i ${3000th_id}
+    Should Be True  '${status}' == 'PASS'
     Should Not Contain  ${output}  PEL not found