Add karaf logging to controller-clustering.txt suites
[integration/test.git] / csit / libraries / KarafKeywords.robot
index 1590f071cd2a0ff65c4ec90398b8cd2101fdd4cc..f83bed1b3389466a439a44162e33309cce37c2ea 100644 (file)
@@ -83,6 +83,15 @@ Install a Feature
     Log    ${output}
     [Return]    ${output}
 
+Install a Feature Using Active Connection
+    [Arguments]    ${feature_name}
+    [Documentation]    Will Install the given ${feature_name} using active connection
+    ${cmd}=    BuiltIn.Set_Variable    feature:install ${feature_name}
+    Write    ${cmd}
+    ${output}    SSHLibrary.Read_Until    ${KARAF_PROMPT}
+    Log    ${output}
+    [Return]    ${output}
+
 Uninstall a Feature
     [Arguments]    ${feature_name}    ${controller}=${ODL_SYSTEM_IP}    ${karaf_port}=${KARAF_SHELL_PORT}    ${timeout}=180
     [Documentation]    Will UnInstall the given ${feature_name}
@@ -109,6 +118,14 @@ Open Controller Karaf Console On Background
     SSHLibrary.Login    ${KARAF_USER}    ${KARAF_PASSWORD}
     [Teardown]    SSHKeywords.Restore Current SSH Connection From Index    ${current_ssh_connection_object.index}
 
+Open Controller Karaf Console With Timeout
+    [Arguments]    ${member_index}=${1}    ${timeout}=3s
+    [Documentation]    Open new connection to karaf console for member index with specified timeout.
+    BuiltIn.Log    ${member_index}
+    ${odl_ip}=    ClusterManagement.Resolve_IP_Address_For_Member    ${member_index}
+    SSHLibrary.Open Connection    ${odl_ip}    port=${KARAF_SHELL_PORT}    prompt=${KARAF_DETAILED_PROMPT}    timeout=${timeout}
+    SSHLibrary.Login    ${KARAF_USER}    ${KARAF_PASSWORD}
+
 Configure Timeout For Karaf Console
     [Arguments]    ${timeout}    ${member_index_list}=${EMPTY}
     [Documentation]    Configure a different timeout for each Karaf console.
@@ -144,11 +161,13 @@ Execute Controller Karaf Command With Retry On Background
     [Return]    ${message}
 
 Log Message To Controller Karaf
-    [Arguments]    ${message}    ${member_index_list}=${EMPTY}
+    [Arguments]    ${message}    ${member_index_list}=${EMPTY}    ${tolerate_failure}=True
     [Documentation]    Make sure this resource is initialized. Send a message into the controller's karaf log file on every node listed (or all).
+    ...    By default, failure while processing a node is silently ignored, unless ${tolerate_failure} is False.
     ${index_list} =    ClusterManagement.ClusterManagement__Given_Or_Internal_Index_List    given_list=${member_index_list}
     : FOR    ${index}    IN    @{index_list}    # usually: 1, 2, 3.
-    \    Execute Controller Karaf Command With Retry On Background    log:log "ROBOT MESSAGE: ${message}"    member_index=${index}
+    \    ${status}    ${output}=    BuiltIn.Run Keyword And Ignore Error    Execute Controller Karaf Command With Retry On Background    log:log "ROBOT MESSAGE: ${message}"    member_index=${index}
+    \    BuiltIn.Run_Keyword_Unless    ${tolerate_failure} or "${status}" == "PASS"    BuiltIn.Fail    ${output}
 
 Log Test Suite Start To Controller Karaf
     [Arguments]    ${member_index_list}=${EMPTY}