2 Documentation Karaf library. General utility keywords for interacting with the karaf environment, such as the
3 ... karaf console, karaf.log, karaf features, and karaf config files.
5 ... This library is useful to deal with controller Karaf console for ssh sessions in cluster.
6 ... Running Setup_Karaf_Keywords is necessary. If SetupUtils initialization is called, this gets initialized as well.
7 ... If this gets initialized, ClusterManagement gets initialized as well.
10 Library OperatingSystem
11 Library ${CURDIR}/excepts.py
12 Resource ${CURDIR}/ClusterManagement.robot
13 Resource ${CURDIR}/SSHKeywords.robot
14 Variables ${CURDIR}/../variables/Variables.py
19 ${connection_index_dict} &{EMPTY}
24 [Documentation] Initialize ClusterManagement. Open ssh karaf connections to each ODL.
25 [Arguments] ${http_timeout}=${DEFAULT_TIMEOUT_HTTP}
26 ClusterManagement.ClusterManagement_Setup http_timeout=${http_timeout}
27 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
28 ClusterManagement.Run_Bash_Command_On_List_Or_All
29 ... iptables -I INPUT -p tcp --dport ${KARAF_SHELL_PORT} -j ACCEPT; iptables-save
30 BuiltIn.Comment First connections to Karaf console may fail, so WUKS is used. TODO: Track as a Bug.
31 FOR ${index} IN @{ClusterManagement__member_index_list}
32 BuiltIn.Run_Keyword_And_Ignore_Error
33 ... BuiltIn.Wait_Until_Keyword_Succeeds
36 ... Open_Controller_Karaf_Console_On_Background
37 ... member_index=${index}
40 Verify_Feature_Is_Installed
41 [Documentation] Will Succeed if the given ${feature_name} is found in the output of "feature:list -i"
42 [Arguments] ${feature_name} ${controller}=${ODL_SYSTEM_IP} ${karaf_port}=${KARAF_SHELL_PORT}
43 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
44 ${output} = Issue_Command_On_Karaf_Console
45 ... feature:list -i | grep ${feature_name}
48 BuiltIn.Should_Contain ${output} ${feature_name}
51 Issue_Command_On_Karaf_Console
52 [Documentation] Will execute the given ${cmd} by ssh'ing to the karaf console running on ${controller}
53 ... Note that this keyword will open&close new SSH connection, without switching back to previously current session.
54 [Arguments] ${cmd} ${controller}=${ODL_SYSTEM_IP} ${karaf_port}=${KARAF_SHELL_PORT} ${timeout}=10 ${loglevel}=INFO
55 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
56 SSHLibrary.Open_Connection
58 ... port=${karaf_port}
59 ... prompt=${KARAF_PROMPT_LOGIN}
60 ... timeout=${timeout}
61 SSHLibrary.Login ${KARAF_USER} ${KARAF_PASSWORD} loglevel=${loglevel}
62 SSHLibrary.Write ${cmd}
63 ${output} = SSHLibrary.Read_Until_Regexp ${KARAF_PROMPT}
64 SSHLibrary.Write_Bare logout\n
65 SSHLibrary.Close_Connection
69 Safe_Issue_Command_On_Karaf_Console
70 [Documentation] Run Issue_Command_On_Karaf_Console but restore previous connection afterwards.
71 [Arguments] ${cmd} ${controller}=${ODL_SYSTEM_IP} ${karaf_port}=${KARAF_SHELL_PORT} ${timeout}=10 ${loglevel}=INFO
72 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
73 BuiltIn.Run_Keyword_And_Return
74 ... SSHKeywords.Run_Keyword_Preserve_Connection
75 ... Issue_Command_On_Karaf_Console
82 Check For Elements On Karaf Command Output Message
83 [Documentation] Will execute the command using Issue Command On Karaf Console then check for the given elements
84 ... in the command output message
85 [Arguments] ${cmd} ${elements} ${controller}=${ODL_SYSTEM_IP} ${karaf_port}=${KARAF_SHELL_PORT} ${timeout}=5
86 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
87 ${output} = Issue_Command_On_Karaf_Console ${cmd} ${controller} ${karaf_port} ${timeout}
88 FOR ${i} IN @{elements}
89 BuiltIn.Should_Contain ${output} ${i}
92 Verify_Bundle_Is_Installed
93 [Documentation] Will succeed if the given ${bundle name} is present in the output of "bundle:list -s "
94 [Arguments] ${bundle_name} ${controller}=${ODL_SYSTEM_IP} ${karaf_port}=${KARAF_SHELL_PORT}
95 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
96 ${output} = Issue_Command_On_Karaf_Console
97 ... bundle:list -s | grep ${bundle_name}
100 BuiltIn.Should_Contain ${output} ${bundle_name}
103 Verify_Bundle_Is_Not_Installed
104 [Documentation] Will succeed if the given ${bundle_name} is NOT found in the output of "bundle:list -s"
105 [Arguments] ${bundle_name} ${controller}=${ODL_SYSTEM_IP} ${karaf_port}=${KARAF_SHELL_PORT}
106 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
107 ${output} = Issue_Command_On_Karaf_Console
108 ... bundle:list -i | grep ${bundle_name}
111 BuiltIn.Should_Not_Contain ${output} ${bundle_name}
114 Check_Karaf_Log_Has_Messages
115 [Documentation] Will succeed if the @{messages} are found in \ the output of "log:display"
116 [Arguments] ${filter_string} @{message_list}
117 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
118 ${output} = Issue_Command_On_Karaf_Console log:display | grep ${filter_string}
119 FOR ${message} IN @{message_list}
120 BuiltIn.Should_Contain ${output} ${message}
124 Check_Karaf_Log_Message_Count
125 [Documentation] Verifies that the ${message} exists specified number of times in
126 ... karaf console log or Karaf Log Folder based on the arg ${use_console}.
127 [Arguments] ${message} ${count} ${use_console}=False
128 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
129 IF ${use_console} == False
130 Check_Karaf_Log_File ${message} ${count}
132 Check_Karaf_Log_From_Console ${message} ${count}
135 Check_Karaf_Log_From_Console
136 [Documentation] Verifies that the ${message} exists in the Karaf Console log:display and checks
137 ... that it appears ${count} number of times
138 [Arguments] ${message} ${count}
139 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
140 ${output} = Issue_Command_On_Karaf_Console log:display | grep ${message} | wc -l
141 ${line} = Get Line ${output} 0
142 ${stripped} = Strip String ${line}
143 Should Be Equal As Strings ${stripped} ${count}
146 [Documentation] Verifies that the ${message} exists in the Karaf Log Folder and checks
147 ... that it appears ${count} number of times
148 [Arguments] ${message} ${count}
149 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
150 ${output} = Run Command On Controller
152 ... grep -o ${message} ${WORKSPACE}/${BUNDLEFOLDER}/data/log/* | wc -l
153 Should Be Equal As Strings ${output} ${count}
156 [Documentation] Will Install the given ${feature_name}
157 [Arguments] ${feature_name} ${controller}=${ODL_SYSTEM_IP} ${karaf_port}=${KARAF_SHELL_PORT} ${timeout}=180
158 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
159 BuiltIn.Log ${timeout}
160 ${output} = Issue_Command_On_Karaf_Console
161 ... feature:install ${feature_name}
165 BuiltIn.Log ${output}
168 Install_A_Feature_Using_Active_Connection
169 [Documentation] Will Install the given ${feature_name} using active connection
170 [Arguments] ${feature_name}
171 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
172 ${cmd} = BuiltIn.Set_Variable feature:install ${feature_name}
173 SSHLibrary.Write ${cmd}
174 ${output} = SSHLibrary.Read_Until_Regexp ${KARAF_PROMPT}
175 BuiltIn.Log ${output}
179 [Documentation] Will UnInstall the given ${feature_name}
180 [Arguments] ${feature_name} ${controller}=${ODL_SYSTEM_IP} ${karaf_port}=${KARAF_SHELL_PORT} ${timeout}=180
181 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
182 ${output} = Issue_Command_On_Karaf_Console
183 ... feature:uninstall ${feature_name}
187 BuiltIn.Log ${output}
190 Open_Controller_Karaf_Console_On_Background
191 [Documentation] If there is a stored ssh connection index of connection to the controller's karaf console for ${member_index},
192 ... close the previous connection. In any case create a new connection
193 ... to karaf console for ${member_index}, set correct prompt set and login to karaf console.
194 ... Store connection index for ${member_index} and restore the previous active connection.
195 [Arguments] ${member_index}=${1} ${timeout}=10 ${loglevel}=INFO
196 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
197 ${current_ssh_connection_object} = SSHLibrary.Get_Connection
198 BuiltIn.Log ${connection_index_dict}
199 BuiltIn.Log ${member_index}
200 ${status} ${old_connection_index} = BuiltIn.Run_Keyword_And_Ignore_Error
201 ... Get From Dictionary
202 ... ${connection_index_dict}
204 IF '${status}'=='PASS'
206 ... SSHLibrary.Switch_Connection
207 ... ${old_connection_index}
209 ... BuiltIn.Run_Keyword_And_Ignore_Error
213 ... BuiltIn.Run_Keyword_And_Ignore_Error
214 ... SSHLibrary.Close_Connection
216 ${odl_ip} = ClusterManagement.Resolve_IP_Address_For_Member ${member_index}
217 SSHLibrary.Open_Connection
219 ... port=${KARAF_SHELL_PORT}
220 ... prompt=${KARAF_PROMPT_LOGIN}
221 ... timeout=${timeout}
222 ${karaf_connection_object} = SSHLibrary.Get_Connection
223 Collections.Set_To_Dictionary ${connection_index_dict} ${member_index} ${karaf_connection_object.index}
224 SSHLibrary.Login ${KARAF_USER} ${KARAF_PASSWORD} loglevel=${loglevel}
225 [Teardown] Run Keyword If '${IS_KARAF_APPL}' == 'True' SSHKeywords.Restore_Current_Ssh_Connection_From_Index ${current_ssh_connection_object.index}
227 Open_Controller_Karaf_Console_With_Timeout
228 [Documentation] Open new connection to karaf console for member index with specified timeout.
229 [Arguments] ${member_index}=${1} ${timeout}=3s
230 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
231 BuiltIn.Log ${member_index}
232 ${odl_ip} = ClusterManagement.Resolve_IP_Address_For_Member ${member_index}
233 SSHLibrary.Open_Connection
235 ... port=${KARAF_SHELL_PORT}
236 ... prompt=${KARAF_PROMPT_LOGIN}
237 ... timeout=${timeout}
238 SSHLibrary.Login ${KARAF_USER} ${KARAF_PASSWORD}
240 Configure_Timeout_For_Karaf_Console
241 [Documentation] Configure a different timeout for each Karaf console.
242 [Arguments] ${timeout} ${member_index_list}=${EMPTY}
243 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
244 ${index_list} = ClusterManagement.List_Indices_Or_All given_list=${member_index_list}
245 ${current_connection_object} = SSHLibrary.Get_Connection
246 FOR ${member_index} IN @{index_list} # usually: 1, 2, 3
247 ${karaf_connection_index} = Collections.Get_From_Dictionary ${connection_index_dict} ${member_index}
248 SSHLibrary.Switch_Connection ${karaf_connection_index}
249 SSHLibrary.Set_Client_Configuration timeout=${timeout}
251 [Teardown] Run Keyword If '${IS_KARAF_APPL}' == 'True' SSHKeywords.Restore_Current_Ssh_Connection_From_Index ${current_connection_object.index}
253 Execute_Controller_Karaf_Command_On_Background
254 [Documentation] Send command to karaf without affecting current SSH connection. Read, log and return response.
255 [Arguments] ${command} ${member_index}=${1}
256 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
257 ${karaf_connection_index} = Collections.Get_From_Dictionary ${connection_index_dict} ${member_index}
258 ${current_connection_index} = SSHLibrary.Switch_Connection ${karaf_connection_index}
259 ${status_write} ${message_write} = BuiltIn.Run_Keyword_And_Ignore_Error SSHLibrary.Write ${command}
260 ${status_wait} ${message_wait} = BuiltIn.Run_Keyword_And_Ignore_Error
261 ... SSHLibrary.Read_Until_Regexp
263 IF '${status_write}' != 'PASS'
264 BuiltIn.Fail Failed to send the command: ${command}
266 BuiltIn.Log ${message_wait}
267 IF '${status_wait}' != 'PASS'
268 BuiltIn.Fail Failed to see prompt after sending the command: ${command}
270 RETURN ${message_wait}
271 [Teardown] Run Keyword If '${IS_KARAF_APPL}' == 'True' SSHKeywords.Restore_Current_Ssh_Connection_From_Index ${current_connection_index}
273 Execute_Controller_Karaf_Command_With_Retry_On_Background
274 [Documentation] Attemp to send command to karaf for ${member_index}, if fail then open connection and try again.
275 [Arguments] ${command} ${member_index}=${1}
276 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
277 ${status} ${message} = BuiltIn.Run_Keyword_And_Ignore_Error
278 ... Execute_Controller_Karaf_Command_On_Background
281 IF '${status}' == 'PASS' RETURN ${message}
282 # TODO: Verify this does not leak connections indices.
283 Open_Controller_Karaf_Console_On_Background ${member_index}
284 ${message} = Execute_Controller_Karaf_Command_On_Background ${command} ${member_index}
287 Log_Message_To_Controller_Karaf
288 [Documentation] Make sure this resource is initialized. Send a message into the controller's karaf log file on every node listed (or all).
289 ... By default, failure while processing a node is silently ignored, unless ${tolerate_failure} is False.
290 [Arguments] ${message} ${member_index_list}=${EMPTY} ${tolerate_failure}=True
291 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
292 ${index_list} = ClusterManagement.List_Indices_Or_All given_list=${member_index_list}
293 FOR ${index} IN @{index_list} # usually: 1, 2, 3.
294 ${status} ${output} = BuiltIn.Run_Keyword_And_Ignore_Error
295 ... Execute_Controller_Karaf_Command_With_Retry_On_Background
296 ... log:log "ROBOT MESSAGE: ${message}"
297 ... member_index=${index}
298 IF not ${tolerate_failure} and "${status}" != "PASS"
299 BuiltIn.Fail ${output}
303 Log_Test_Suite_Start_To_Controller_Karaf
304 [Documentation] Log suite name to karaf log, useful in suite setup.
305 [Arguments] ${member_index_list}=${EMPTY}
306 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
307 Log_Message_To_Controller_Karaf Starting suite ${SUITE_SOURCE} ${member_index_list}
309 Log_Testcase_Start_To_Controller_Karaf
310 [Documentation] Log test case name to karaf log, useful in test case setup.
311 [Arguments] ${member_index_list}=${EMPTY}
312 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
313 Log_Message_To_Controller_Karaf Starting test ${SUITE_NAME}.${TEST_NAME} ${member_index_list}
315 Set_Bgpcep_Log_Levels
316 [Documentation] Assuming OCKCOB was used, set logging level on bgpcep and protocol loggers without affecting current SSH session.
317 [Arguments] ${bgpcep_level}=${DEFAULT_BGPCEP_LOG_LEVEL} ${protocol_level}=${DEFAULT_PROTOCOL_LOG_LEVEL} ${member_index_list}=${EMPTY}
318 # FIXME: Move to appropriate Resource
319 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
320 ${index_list} = ClusterManagement.List_Indices_Or_All given_list=${member_index_list}
321 FOR ${index} IN @{index_list} # usually: 1, 2, 3.
322 Execute_Controller_Karaf_Command_On_Background
323 ... log:set ${bgpcep_level} org.opendaylight.bgpcep
324 ... member_index=${index}
325 Execute_Controller_Karaf_Command_On_Background
326 ... log:set ${protocol_level} org.opendaylight.protocol
327 ... member_index=${index}
330 Get Karaf Log Lines From Test Start
331 [Documentation] Scrapes all log messages that match regexp ${type} which fall after a point given by a log message that
332 ... contains ${test_name}. This is useful if your test cases are marking karaf.log with a message indicating when
333 ... that test case has started; such that you can easily pull out any extra log messsages to parse/log/etc in the
334 ... test logic itself. For example, you can grab all ERRORS that occur during your test case.
335 [Arguments] ${ip} ${test_name} ${cmd} ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT}
336 ... ${log_file}=${KARAF_LOG}
337 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
338 ${output} = Run Command On Controller ${ip} ${cmd} ${user} ${password} ${prompt}
339 @{log_lines} = Split String ${output} ${\n}
342 Fail If Exceptions Found During Test
343 [Documentation] Create a failure if an Exception is found in the karaf.log that has not been whitelisted.
344 ... Will work for single controller jobs as well as 3node cluster jobs
345 [Arguments] ${test_name} ${log_file}=${KARAF_LOG} ${fail}=False
346 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
347 FOR ${i} IN RANGE 1 ${NUM_ODL_SYSTEM} + 1
348 ${cmd} = Set Variable sed '1,/ROBOT MESSAGE: Starting test ${test_name}/d' ${log_file}
349 ${output} = Get Karaf Log Lines From Test Start ${ODL_SYSTEM_${i}_IP} ${test_name} ${cmd}
350 ${exlist} ${matchlist} = Verify Exceptions ${output}
351 Write Exceptions Map To File ${SUITE_NAME}.${TEST_NAME} /tmp/odl${i}_exceptions.txt
352 ${listlength} = BuiltIn.Get Length ${exlist}
353 IF "${fail}"=="True" and ${listlength} != 0
354 Log And Fail Exceptions ${exlist} ${listlength}
356 Collections.Log List ${matchlist}
360 Log And Fail Exceptions
361 [Documentation] Print the list of failed exceptions and fail the test
362 [Arguments] ${exlist} ${listlength}
363 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
364 Collections.Log List ${exlist}
365 ${exstr} = BuiltIn.Catenate ${exlist}
366 BuiltIn.Fail New exceptions found: ${listlength}\n${exstr}
368 Get Karaf Log Type From Test Start
369 [Documentation] Scrapes all log messages that match regexp ${type} which fall after a point given by a log message that
370 ... contains ${test_name}. This is useful if your test cases are marking karaf.log with a message indicating when
371 ... that test case has started; such that you can easily pull out any extra log messsages to parse/log/etc in the
372 ... test logic itself. For example, you can grab all ERRORS that occur during your test case.
373 [Arguments] ${ip} ${test_name} ${type} ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT}
374 ... ${log_file}=${KARAF_LOG}
375 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
376 ${cmd} = Set Variable sed '1,/ROBOT MESSAGE: Starting test ${test_name}/d' ${log_file} | grep '${type}'
377 ${output} = Run Command On Controller ${ip} ${cmd} ${user} ${password} ${prompt}
380 Get Karaf Log Types From Test Start
381 [Documentation] A wrapper keyword for "Get Karaf Log Type From Test Start" so that we can parse for multiple types
382 ... of log messages. For example, we can grab all messages of type WARN and ERROR
383 [Arguments] ${ip} ${test_name} ${types} ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT}
384 ... ${log_file}=${KARAF_LOG}
385 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
386 FOR ${type} IN @{types}
387 Get Karaf Log Type From Test Start ${ip} ${test_name} ${type} ${user} ${password}
388 ... ${prompt} ${log_file}
391 Get Karaf Log Events From Test Start
392 [Documentation] Wrapper for the wrapper "Get Karaf Log Types From Test Start" so that we can easily loop over
393 ... any number of controllers to analyze karaf.log for ERROR, WARN and Exception log messages
394 [Arguments] ${test_name} ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT}
395 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
396 ${log_types} = Create List ERROR WARN Exception
397 FOR ${i} IN RANGE 1 ${NUM_ODL_SYSTEM} + 1
398 Get Karaf Log Types From Test Start ${ODL_SYSTEM_${i}_IP} ${test_name} ${log_types}
401 Fail If Exceptions Found During Test Deprecated
402 [Documentation] Create a failure if an Exception is found in the karaf.log. Will work for single controller jobs
403 ... as well as 3node cluster jobs
404 [Arguments] ${test_name} ${exceptions_white_list}=${EMPTY}
405 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
406 FOR ${i} IN RANGE 1 ${NUM_ODL_SYSTEM} + 1
407 Verify Exception Logging In Controller ${ODL_SYSTEM_${i}_IP} ${test_name} ${exceptions_white_list}
410 Verify Exception Logging In Controller
411 [Documentation] Local keyword to make it easier to loop through N controllers to pull Exceptions from the
412 ... karaf.log file and validate with "Check Against White List"
413 [Arguments] ${controller_ip} ${test_name} ${exceptions_white_list}
414 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
415 ${exceptions} = Get Karaf Log Type From Test Start ${controller_ip} ${test_name} Exception
416 @{log_lines} = Split String ${exceptions} ${\n}
417 ${num_log_entries} = Get Length ${log_lines}
418 IF ${num_log_entries} == ${0} RETURN No Exceptions found.
419 FOR ${log_message} IN @{log_lines}
420 Check Against White List ${log_message} ${exceptions_white_list}
423 Check Against White List
424 [Documentation] As soon as the ${exceptions_line} is found in one of the elements of ${exceptions_white_list}
425 ... this keyword will exit and give a Pass to the caller. If there is no match, this keyword will end up
426 ... marking a failure. In the case that no exceptions are found, the caller could end up passing a single
427 ... empty line as that is what is returned when a grep on karaf.log has no match, so we can safely return
428 ... in that case as well.
429 [Arguments] ${exception_line} ${exceptions_white_list}
430 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
431 IF "${exception_line}" == "" RETURN
432 FOR ${exception} IN @{exceptions_white_list}
433 IF "${exception}" in "${exception_line}"
434 RETURN Exceptions found, but whitelisted: ${\n}${exception_line}${\n}
437 Fail Exceptions Found: ${\n}${exception_line}${\n}
440 [Documentation] Read karaf logs until message appear
441 [Arguments] ${message} ${timeout}=60 ${member_index}=${1}
442 # TODO: refactor this keyword to use the new workflow to account for multiple controllers. Initial work was done
443 # in this patch https://git.opendaylight.org/gerrit/#/c/45596/
444 # however, the consumers of this keyword were breaking after that change. Initial theory is that a previous
445 # keyword used before this "Wait For Karaf Log" keyword was closing the karaf console connection, so the
446 # "Flexible SSH Login" keyword from the patch above (45596) was failing.
447 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
448 BuiltIn.Log Waiting for '${message}' in karaf log
449 SSHLibrary.Open_Connection
451 ... port=${KARAF_SHELL_PORT}
452 ... prompt=${KARAF_PROMPT_LOGIN}
453 ... timeout=${timeout}
454 SSHLibrary.Login ${KARAF_USER} ${KARAF_PASSWORD} loglevel=${loglevel}
455 SSHLibrary.Write log:tail
456 SSHLibrary.Read_Until ${message}
457 SSHLibrary.Write logout
458 SSHLibrary.Close_Connection
461 [Documentation] Restarts bundle passed as argument. Note this operation is only for testing and not production environments
462 [Arguments] ${bundle_id}
463 # TODO: prepare this for cluster environment and multiple controllers
464 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
465 Execute_Controller_Karaf_Command_With_Retry_On_Background bundle:restart $(bundle:id '${bundle_id}')
468 [Documentation] Restarts Karaf and polls log to detect when Karaf is up and running again
469 # TODO: prepare this for cluster environment and multiple controllers
470 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
471 Execute_Controller_Karaf_Command_With_Retry_On_Background log:clear
472 Execute_Controller_Karaf_Command_With_Retry_On_Background shutdown -r -f
473 BuiltIn.Run_Keyword_And_Return_Status
474 ... BuiltIn.Wait_Until_Keyword_Succeeds
477 ... Wait_For_Karaf_Log
478 ... Shiro environment initialized in
481 [Documentation] Restarts jetty bundle (to reload certificates or key/truststore information)
482 IF '${IS_KARAF_APPL}' == 'False' RETURN Not A Karaf App
483 Execute_Controller_Karaf_Command_With_Retry_On_Background log:clear
484 Restart_Bundle OPS4J Pax Web - Jetty
485 Wait_For_Karaf_Log Started jetty-default