Revert "Do not fail on ODLPARENT-152"
[integration/test.git] / csit / libraries / KarafKeywords.robot
index 2c8df1d6f71fb089020742b3097d9075182058eb..d562a0c5c913b2842ec4f99959554b1eed4770a8 100644 (file)
@@ -20,6 +20,7 @@ Setup_Karaf_Keywords
     [Arguments]    ${http_timeout}=${DEFAULT_TIMEOUT_HTTP}
     [Documentation]    Initialize ClusterManagement. Open ssh karaf connections to each ODL.
     ClusterManagement.ClusterManagement_Setup    http_timeout=${http_timeout}
+    ClusterManagement.Run_Bash_Command_On_List_Or_All    iptables -I INPUT -p tcp --dport ${KARAF_SHELL_PORT} -j ACCEPT; iptables-save
     BuiltIn.Comment    First connections to Karaf console may fail, so WUKS is used. TODO: Track as a Bug.
     : FOR    ${index}    IN    @{ClusterManagement__member_index_list}
     \    BuiltIn.Run_Keyword_And_Ignore_Error    BuiltIn.Wait_Until_Keyword_Succeeds    3s    1s    Open_Controller_Karaf_Console_On_Background    member_index=${index}
@@ -79,6 +80,29 @@ Check_Karaf_Log_Has_Messages
     \    BuiltIn.Should_Contain    ${output}    ${message}
     [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 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} =    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}