Update of Check_Karaf_Log_Message_Count API 31/70831/7
authoreafatha <a.fathima.thasneem@ericsson.com>
Thu, 12 Apr 2018 17:22:56 +0000 (22:52 +0530)
committerJamo Luhrsen <jluhrsen@redhat.com>
Fri, 13 Apr 2018 20:58:16 +0000 (20:58 +0000)
Enabling user option to use either console or karaf log

Change-Id: I42e23647c608e91a0c8d7d3d271f571f727c0511
Signed-off-by: eafatha <a.fathima.thasneem@ericsson.com>
csit/libraries/KarafKeywords.robot

index 31a60c7df6172291701f8bb5fce7328e597651ac..21811693309d2004b3cb20828db3f2ca5ea4168f 100644 (file)
@@ -80,14 +80,28 @@ Check_Karaf_Log_Has_Messages
     [Return]    ${output}
 
 Check_Karaf_Log_Message_Count
+    [Arguments]    ${message}    ${count}    ${use_console}=False
+    [Documentation]    Verifies that the ${message} exists specified number of times in
+    ...    karaf console log or Karaf Log Folder based on the arg ${use_console}.
+    Run Keyword If    ${use_console} == False    Check_Karaf_Log_File    ${message}    ${count}
+    ...    ELSE    Check_Karaf_Log_From_Console    ${message}    ${count}
+
+Check_Karaf_Log_From_Console
     [Arguments]    ${message}    ${count}
-    [Documentation]    Verifies that the ${message} exists in the karaf.log, and checks
-    ...    that it appears ${count} number of times.
+    [Documentation]    Verifies that the ${message} exists in the Karaf Console log:display and checks
+    ...    that it appears ${count} number of times
     ${output} =    Issue_Command_On_Karaf_Console    log:display | grep ${message} | wc -l
-    ${line} =    String.Get Line    ${output}    0
-    ${stripped} =    String.Strip String    ${line}
+    ${line} =    Get Line    ${output}    0
+    ${stripped} =    Strip String    ${line}
     Should Be Equal As Strings    ${stripped}    ${count}
 
+Check_Karaf_Log_File
+    [Arguments]    ${message}    ${count}
+    [Documentation]    Verifies that the ${message} exists in the Karaf Log Folder and checks
+    ...    that it appears ${count} number of times
+    ${output}    Run Command On Controller    ${ODL_SYSTEM_IP}    grep -o ${message} ${WORKSPACE}/${BUNDLEFOLDER}/data/log/* | wc -l
+    Should Be Equal As Strings    ${output}    ${count}
+
 Install_A_Feature
     [Arguments]    ${feature_name}    ${controller}=${ODL_SYSTEM_IP}    ${karaf_port}=${KARAF_SHELL_PORT}    ${timeout}=180
     [Documentation]    Will Install the given ${feature_name}