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