Cleanup ovsdb suites
[integration/test.git] / csit / libraries / KarafKeywords.robot
index deaa0387d7a614054bd24750b4ae440e9d9ca37b..352ffc8cd187d3b7212edafb362ae1e51654fbcd 100644 (file)
@@ -14,7 +14,7 @@ ${connection_index_dict}    &{EMPTY}
 
 *** Keywords ***
 Setup_Karaf_Keywords
-    [Arguments]    ${http_timeout}=1
+    [Arguments]    ${http_timeout}=${DEFAULT_TIMEOUT_HTTP}
     [Documentation]    Initialize ClusterManagement. Open ssh karaf connections to each ODL.
     ClusterManagement.ClusterManagement_Setup    http_timeout=${http_timeout}
     BuiltIn.Comment    First connections to Karaf console may fail, so WUKS is used. TODO: Track as a Bug.
@@ -32,10 +32,10 @@ Issue_Command_On_Karaf_Console
     [Arguments]    ${cmd}    ${controller}=${ODL_SYSTEM_IP}    ${karaf_port}=${KARAF_SHELL_PORT}    ${timeout}=10    ${loglevel}=INFO
     [Documentation]    Will execute the given ${cmd} by ssh'ing to the karaf console running on ${controller}
     ...    Note that this keyword will open&close new SSH connection, without switching back to previously current session.
-    SSHLibrary.Open_Connection    ${controller}    port=${karaf_port}    prompt=${KARAF_PROMPT}    timeout=${timeout}
+    SSHLibrary.Open_Connection    ${controller}    port=${karaf_port}    prompt=${KARAF_PROMPT_LOGIN}    timeout=${timeout}
     SSHLibrary.Login    ${KARAF_USER}    ${KARAF_PASSWORD}    loglevel=${loglevel}
     SSHLibrary.Write    ${cmd}
-    ${output}    SSHLibrary.Read_Until    ${KARAF_PROMPT}
+    ${output}    SSHLibrary.Read_Until_Regexp    ${KARAF_PROMPT}
     SSHLibrary.Close_Connection
     BuiltIn.Log    ${output}
     [Return]    ${output}
@@ -89,7 +89,7 @@ Install_A_Feature_Using_Active_Connection
     [Documentation]    Will Install the given ${feature_name} using active connection
     ${cmd} =    BuiltIn.Set_Variable    feature:install ${feature_name}
     SSHLibrary.Write    ${cmd}
-    ${output}    SSHLibrary.Read_Until    ${KARAF_PROMPT}
+    ${output}    SSHLibrary.Read_Until_Regexp    ${KARAF_PROMPT}
     BuiltIn.Log    ${output}
     [Return]    ${output}
 
@@ -113,7 +113,7 @@ Open_Controller_Karaf_Console_On_Background
     BuiltIn.Run_Keyword_If    '${status}'=='PASS'    BuiltIn.Run_Keywords    SSHLibrary.Switch_Connection    ${old_connection_index}
     ...    AND    SSHLibrary.Close_Connection
     ${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.Open_Connection    ${odl_ip}    port=${KARAF_SHELL_PORT}    prompt=${KARAF_PROMPT_LOGIN}    timeout=${timeout}
     ${karaf_connection_object} =    SSHLibrary.Get_Connection
     Collections.Set_To_Dictionary    ${connection_index_dict}    ${member_index}    ${karaf_connection_object.index}
     SSHLibrary.Login    ${KARAF_USER}    ${KARAF_PASSWORD}    loglevel=${loglevel}
@@ -124,7 +124,7 @@ Open_Controller_Karaf_Console_With_Timeout
     [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.Open_Connection    ${odl_ip}    port=${KARAF_SHELL_PORT}    prompt=${KARAF_PROMPT_LOGIN}    timeout=${timeout}
     SSHLibrary.Login    ${KARAF_USER}    ${KARAF_PASSWORD}
 
 Configure_Timeout_For_Karaf_Console
@@ -144,7 +144,7 @@ Execute_Controller_Karaf_Command_On_Background
     ${karaf_connection_index} =    Collections.Get_From_Dictionary    ${connection_index_dict}    ${member_index}
     ${current_connection_index} =    SSHLibrary.Switch_Connection    ${karaf_connection_index}
     ${status_write}    ${message_write} =    BuiltIn.Run_Keyword_And_Ignore_Error    SSHLibrary.Write    ${command}
-    ${status_wait}    ${message_wait} =    BuiltIn.Run_Keyword_And_Ignore_Error    SSHLibrary.Read_Until_Prompt
+    ${status_wait}    ${message_wait} =    BuiltIn.Run_Keyword_And_Ignore_Error    SSHLibrary.Read_Until_Regexp    ${KARAF_PROMPT}
     BuiltIn.Run Keyword If    '${status_write}' != 'PASS'    BuiltIn.Fail    Failed to send the command: ${command}
     BuiltIn.Log    ${message_wait}
     BuiltIn.Run_Keyword_If    '${status_wait}' != 'PASS'    BuiltIn.Fail    Failed to see prompt after sending the command: ${command}
@@ -198,7 +198,7 @@ Wait_For_Karaf_Log
     # keyword used before this "Wait For Karaf Log" keyword was closing the karaf console connection, so the
     # "Flexible SSH Login" keyword from the patch above (45596) was failing.
     BuiltIn.Log    Waiting for '${message}' in karaf log
-    SSHLibrary.Open_Connection    ${ODL_SYSTEM_IP}    port=${KARAF_SHELL_PORT}    prompt=${KARAF_PROMPT}    timeout=${timeout}
+    SSHLibrary.Open_Connection    ${ODL_SYSTEM_IP}    port=${KARAF_SHELL_PORT}    prompt=${KARAF_PROMPT_LOGIN}    timeout=${timeout}
     SSHLibrary.Login    ${KARAF_USER}    ${KARAF_PASSWORD}    loglevel=${loglevel}
     SSHLibrary.Write    log:tail
     SSHLibrary.Read_Until    ${message}
@@ -208,18 +208,18 @@ Restart_Bundle
     [Arguments]    ${bundle_id}
     [Documentation]    Restarts bundle passed as argument. Note this operation is only for testing and not production environments
     # TODO: prepare this for cluster environment and multiple controllers
-    Safe_Issue_Command_On_Karaf_Console    bundle:restart -f $(bundle:id '${bundle_id}')
+    Execute_Controller_Karaf_Command_With_Retry_On_Background    bundle:restart -f $(bundle:id '${bundle_id}')
 
 Restart_Karaf
     [Documentation]    Restarts Karaf and polls log to detect when Karaf is up and running again
     # TODO: prepare this for cluster environment and multiple controllers
-    Safe_Issue_Command_On_Karaf_Console    log:clear
-    Issue_Command_On_Karaf_Console    shutdown -r -f
+    Execute_Controller_Karaf_Command_With_Retry_On_Background    log:clear
+    Execute_Controller_Karaf_Command_With_Retry_On_Background    shutdown -r -f
     BuiltIn.Run_Keyword_And_Return_Status    BuiltIn.Wait_Until_Keyword_Succeeds    240s    60s    Wait_For_Karaf_Log    Karaf started in
 
 Restart_Jetty
     [Documentation]    Restarts jetty bundle (to reload certificates or key/truststore information)
-    Safe_Issue_Command_On_Karaf_Console    log:clear
+    Execute_Controller_Karaf_Command_With_Retry_On_Background    log:clear
     Restart_Bundle    OPS4J Pax Web - Jetty
     Wait_For_Karaf_Log    Instantiated the Application class org.opendaylight.restconf.RestconfApplication
     Wait_For_Karaf_Log    Instantiated the Application class org.opendaylight.netconf.sal.rest.impl.RestconfApplication