${KarafKeywords__karaf_connection_index} -1
*** Keywords ***
-Check Karaf Log File Does Not Have Messages
- [Arguments] ${ip} ${message} ${user}=${CONTROLLER_USER} ${password}=${CONTROLLER_PASSWORD} ${prompt}=${DEFAULT_LINUX_PROMPT} ${log_file}=${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log
- [Documentation] Fails if the provided ${message} is found in the karaf.log file. Uses grep to search. The
- ... karaf.log file can be overridden with ${log_file} to be any file on the given system @ ${ip}
- ${output}= Run Command On Controller ${ip} grep ${message} ${log_file} user=${user} password=${password} prompt=${prompt}
- Should Not Contain ${output} ${message}
-
Verify Feature Is Installed
[Arguments] ${feature_name} ${controller}=${CONTROLLER} ${karaf_port}=${KARAF_SHELL_PORT}
[Documentation] Will Succeed if the given ${feature_name} is found in the output of "feature:list -i"
\ Should Contain ${output} ${message}
[Return] ${output}
+Check Karaf Log File Does Not Have Messages
+ [Arguments] ${ip} ${message} ${user}=${CONTROLLER_USER} ${password}=${CONTROLLER_PASSWORD} ${prompt}=${DEFAULT_LINUX_PROMPT} ${log_file}=${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log
+ [Documentation] Fails if the provided ${message} is found in the karaf.log file. Uses grep to search. The
+ ... karaf.log file can be overridden with ${log_file} to be any file on the given system @ ${ip}
+ ${output}= Run Command On Controller ${ip} grep -c '${message}' ${log_file} user=${user} password=${password} prompt=${prompt}
+ Should Be Equal As Strings ${output} 0
+
Install a Feature
[Arguments] ${feature_name} ${controller}=${CONTROLLER} ${karaf_port}=${KARAF_SHELL_PORT} ${timeout}=15
[Documentation] Will Install the given ${feature_name}
BuiltIn.Run Keyword If '${status_wait}' != 'PASS' BuiltIn.Fail Failed to see prompt after sending the command: ${command}
[Return] ${message_wait}
+Execute Controller Karaf Command With Retry On Background
+ [Arguments] ${command}
+ [Documentation] Attemp to send command to karaf, if fail then open connection and try again.
+ ${status} ${message}= BuiltIn.Run Keyword And Ignore Error Execute Controller Karaf Command On Background ${command}
+ BuiltIn.Return_From_Keyword_If '${status}' == 'PASS' ${message}
+ # TODO: Verify this does not leak connections indices.
+ Open Controller Karaf Console On Background
+ ${message}= Execute Controller Karaf Command On Background ${command}
+ [Return] ${message}
+
Log Message To Controller Karaf
[Arguments] ${message}
[Documentation] Send a message into the controller's karaf log file. Do not change current SSH connection.
- ${reply}= Execute Controller Karaf Command On Background log:log "ROBOT MESSAGE: ${message}"
+ ${reply}= Execute Controller Karaf Command With Retry On Background log:log "ROBOT MESSAGE: ${message}"
[Return] ${reply}
Log Test Suite Start To Controller Karaf
# FIXME: Move to appropriate Resource
Execute Controller Karaf Command On Background log:set ${bgpcep_level} org.opendaylight.bgpcep
Execute Controller Karaf Command On Background log:set ${protocol_level} org.opendaylight.protocol
+
+Wait For Karaf Log
+ [Arguments] ${message} ${timeout}=60
+ [Documentation] Read karaf logs until message appear
+ Log Waiting for '${message}' in karaf log
+ Open Connection ${CONTROLLER} port=${KARAF_SHELL_PORT} prompt=${KARAF_PROMPT} timeout=${timeout}
+ Flexible SSH Login ${KARAF_USER} ${KARAF_PASSWORD}
+ Write log:tail
+ Read Until ${message}
+ Close Connection