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.
9 Library OperatingSystem
10 Library ${CURDIR}/netvirt/excepts.py
11 Resource ${CURDIR}/ClusterManagement.robot
12 Resource ${CURDIR}/SSHKeywords.robot
13 Variables ${CURDIR}/../variables/Variables.py
17 ${connection_index_dict} &{EMPTY}
21 [Arguments] ${http_timeout}=${DEFAULT_TIMEOUT_HTTP}
22 [Documentation] Initialize ClusterManagement. Open ssh karaf connections to each ODL.
23 ClusterManagement.ClusterManagement_Setup http_timeout=${http_timeout}
24 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
25 ClusterManagement.Run_Bash_Command_On_List_Or_All iptables -I INPUT -p tcp --dport ${KARAF_SHELL_PORT} -j ACCEPT; iptables-save
26 BuiltIn.Comment First connections to Karaf console may fail, so WUKS is used. TODO: Track as a Bug.
27 FOR ${index} IN @{ClusterManagement__member_index_list}
28 BuiltIn.Run_Keyword_And_Ignore_Error BuiltIn.Wait_Until_Keyword_Succeeds 3s 1s Open_Controller_Karaf_Console_On_Background member_index=${index}
31 Verify_Feature_Is_Installed
32 [Arguments] ${feature_name} ${controller}=${ODL_SYSTEM_IP} ${karaf_port}=${KARAF_SHELL_PORT}
33 [Documentation] Will Succeed if the given ${feature_name} is found in the output of "feature:list -i"
34 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
35 ${output} = Issue_Command_On_Karaf_Console feature:list -i | grep ${feature_name} ${controller} ${karaf_port}
36 BuiltIn.Should_Contain ${output} ${feature_name}
39 Issue_Command_On_Karaf_Console
40 [Arguments] ${cmd} ${controller}=${ODL_SYSTEM_IP} ${karaf_port}=${KARAF_SHELL_PORT} ${timeout}=10 ${loglevel}=INFO
41 [Documentation] Will execute the given ${cmd} by ssh'ing to the karaf console running on ${controller}
42 ... Note that this keyword will open&close new SSH connection, without switching back to previously current session.
43 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
44 SSHLibrary.Open_Connection ${controller} port=${karaf_port} prompt=${KARAF_PROMPT_LOGIN} timeout=${timeout}
45 SSHLibrary.Login ${KARAF_USER} ${KARAF_PASSWORD} loglevel=${loglevel}
46 SSHLibrary.Write ${cmd}
47 ${output} SSHLibrary.Read_Until_Regexp ${KARAF_PROMPT}
48 SSHLibrary.Write logout
49 SSHLibrary.Close_Connection
53 Safe_Issue_Command_On_Karaf_Console
54 [Arguments] ${cmd} ${controller}=${ODL_SYSTEM_IP} ${karaf_port}=${KARAF_SHELL_PORT} ${timeout}=10 ${loglevel}=INFO
55 [Documentation] Run Issue_Command_On_Karaf_Console but restore previous connection afterwards.
56 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
57 BuiltIn.Run_Keyword_And_Return SSHKeywords.Run_Keyword_Preserve_Connection Issue_Command_On_Karaf_Console ${cmd} ${controller} ${karaf_port} ${timeout}
60 Check For Elements On Karaf Command Output Message
61 [Arguments] ${cmd} ${elements} ${controller}=${ODL_SYSTEM_IP} ${karaf_port}=${KARAF_SHELL_PORT} ${timeout}=5
62 [Documentation] Will execute the command using Issue Command On Karaf Console then check for the given elements
63 ... in the command output message
64 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
65 ${output} Issue_Command_On_Karaf_Console ${cmd} ${controller} ${karaf_port} ${timeout}
66 FOR ${i} IN @{elements}
67 BuiltIn.Should_Contain ${output} ${i}
70 Verify_Bundle_Is_Installed
71 [Arguments] ${bundle_name} ${controller}=${ODL_SYSTEM_IP} ${karaf_port}=${KARAF_SHELL_PORT}
72 [Documentation] Will succeed if the given ${bundle name} is present in the output of "bundle:list -s "
73 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
74 ${output} = Issue_Command_On_Karaf_Console bundle:list -s | grep ${bundle_name} ${controller} ${karaf_port}
75 BuiltIn.Should_Contain ${output} ${bundle_name}
78 Verify_Bundle_Is_Not_Installed
79 [Arguments] ${bundle_name} ${controller}=${ODL_SYSTEM_IP} ${karaf_port}=${KARAF_SHELL_PORT}
80 [Documentation] Will succeed if the given ${bundle_name} is NOT found in the output of "bundle:list -s"
81 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
82 ${output} = Issue_Command_On_Karaf_Console bundle:list -i | grep ${bundle_name} ${controller} ${karaf_port}
83 BuiltIn.Should_Not_Contain ${output} ${bundle_name}
86 Check_Karaf_Log_Has_Messages
87 [Arguments] ${filter_string} @{message_list}
88 [Documentation] Will succeed if the @{messages} are found in \ the output of "log:display"
89 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
90 ${output} = Issue_Command_On_Karaf_Console log:display | grep ${filter_string}
91 FOR ${message} IN @{message_list}
92 BuiltIn.Should_Contain ${output} ${message}
96 Check_Karaf_Log_Message_Count
97 [Arguments] ${message} ${count} ${use_console}=False
98 [Documentation] Verifies that the ${message} exists specified number of times in
99 ... karaf console log or Karaf Log Folder based on the arg ${use_console}.
100 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
101 Run Keyword If ${use_console} == False Check_Karaf_Log_File ${message} ${count}
102 ... ELSE Check_Karaf_Log_From_Console ${message} ${count}
104 Check_Karaf_Log_From_Console
105 [Arguments] ${message} ${count}
106 [Documentation] Verifies that the ${message} exists in the Karaf Console log:display and checks
107 ... that it appears ${count} number of times
108 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
109 ${output} = Issue_Command_On_Karaf_Console log:display | grep ${message} | wc -l
110 ${line} = Get Line ${output} 0
111 ${stripped} = Strip String ${line}
112 Should Be Equal As Strings ${stripped} ${count}
115 [Arguments] ${message} ${count}
116 [Documentation] Verifies that the ${message} exists in the Karaf Log Folder and checks
117 ... that it appears ${count} number of times
118 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
119 ${output} Run Command On Controller ${ODL_SYSTEM_IP} grep -o ${message} ${WORKSPACE}/${BUNDLEFOLDER}/data/log/* | wc -l
120 Should Be Equal As Strings ${output} ${count}
123 [Arguments] ${feature_name} ${controller}=${ODL_SYSTEM_IP} ${karaf_port}=${KARAF_SHELL_PORT} ${timeout}=180
124 [Documentation] Will Install the given ${feature_name}
125 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
126 BuiltIn.Log ${timeout}
127 ${output} = Issue_Command_On_Karaf_Console feature:install ${feature_name} ${controller} ${karaf_port} ${timeout}
128 BuiltIn.Log ${output}
131 Install_A_Feature_Using_Active_Connection
132 [Arguments] ${feature_name}
133 [Documentation] Will Install the given ${feature_name} using active connection
134 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
135 ${cmd} = BuiltIn.Set_Variable feature:install ${feature_name}
136 SSHLibrary.Write ${cmd}
137 ${output} SSHLibrary.Read_Until_Regexp ${KARAF_PROMPT}
138 BuiltIn.Log ${output}
142 [Arguments] ${feature_name} ${controller}=${ODL_SYSTEM_IP} ${karaf_port}=${KARAF_SHELL_PORT} ${timeout}=180
143 [Documentation] Will UnInstall the given ${feature_name}
144 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
145 ${output} = Issue_Command_On_Karaf_Console feature:uninstall ${feature_name} ${controller} ${karaf_port} ${timeout}
146 BuiltIn.Log ${output}
149 Open_Controller_Karaf_Console_On_Background
150 [Arguments] ${member_index}=${1} ${timeout}=10 ${loglevel}=INFO
151 [Documentation] If there is a stored ssh connection index of connection to the controller's karaf console for ${member_index},
152 ... close the previous connection. In any case create a new connection
153 ... to karaf console for ${member_index}, set correct prompt set and login to karaf console.
154 ... Store connection index for ${member_index} and restore the previous active connection.
155 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
156 ${current_ssh_connection_object}= SSHLibrary.Get_Connection
157 BuiltIn.Log ${connection_index_dict}
158 BuiltIn.Log ${member_index}
159 ${status} ${old_connection_index} = BuiltIn.Run_Keyword_And_Ignore_Error Get From Dictionary ${connection_index_dict} ${member_index}
160 BuiltIn.Run_Keyword_If '${status}'=='PASS' BuiltIn.Run_Keywords SSHLibrary.Switch_Connection ${old_connection_index}
161 ... AND BuiltIn.Run_Keyword_And_Ignore_Error SSHLibrary.Write logout
162 ... AND BuiltIn.Run_Keyword_And_Ignore_Error SSHLibrary.Close_Connection
163 ${odl_ip} = ClusterManagement.Resolve_IP_Address_For_Member ${member_index}
164 SSHLibrary.Open_Connection ${odl_ip} port=${KARAF_SHELL_PORT} prompt=${KARAF_PROMPT_LOGIN} timeout=${timeout}
165 ${karaf_connection_object} = SSHLibrary.Get_Connection
166 Collections.Set_To_Dictionary ${connection_index_dict} ${member_index} ${karaf_connection_object.index}
167 SSHLibrary.Login ${KARAF_USER} ${KARAF_PASSWORD} loglevel=${loglevel}
168 [Teardown] Run Keyword If '${IS_KARAF_APPL}' == 'True' SSHKeywords.Restore_Current_Ssh_Connection_From_Index ${current_ssh_connection_object.index}
170 Open_Controller_Karaf_Console_With_Timeout
171 [Arguments] ${member_index}=${1} ${timeout}=3s
172 [Documentation] Open new connection to karaf console for member index with specified timeout.
173 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
174 BuiltIn.Log ${member_index}
175 ${odl_ip} = ClusterManagement.Resolve_IP_Address_For_Member ${member_index}
176 SSHLibrary.Open_Connection ${odl_ip} port=${KARAF_SHELL_PORT} prompt=${KARAF_PROMPT_LOGIN} timeout=${timeout}
177 SSHLibrary.Login ${KARAF_USER} ${KARAF_PASSWORD}
179 Configure_Timeout_For_Karaf_Console
180 [Arguments] ${timeout} ${member_index_list}=${EMPTY}
181 [Documentation] Configure a different timeout for each Karaf console.
182 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
183 ${index_list} = ClusterManagement.List_Indices_Or_All given_list=${member_index_list}
184 ${current_connection_object} = SSHLibrary.Get_Connection
185 FOR ${member_index} IN @{index_list} # usually: 1, 2, 3
186 ${karaf_connection_index} = Collections.Get_From_Dictionary ${connection_index_dict} ${member_index}
187 SSHLibrary.Switch_Connection ${karaf_connection_index}
188 SSHLibrary.Set_Client_Configuration timeout=${timeout}
190 [Teardown] Run Keyword If '${IS_KARAF_APPL}' == 'True' SSHKeywords.Restore_Current_Ssh_Connection_From_Index ${current_connection_object.index}
192 Execute_Controller_Karaf_Command_On_Background
193 [Arguments] ${command} ${member_index}=${1}
194 [Documentation] Send command to karaf without affecting current SSH connection. Read, log and return response.
195 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
196 ${karaf_connection_index} = Collections.Get_From_Dictionary ${connection_index_dict} ${member_index}
197 ${current_connection_index} = SSHLibrary.Switch_Connection ${karaf_connection_index}
198 ${status_write} ${message_write} = BuiltIn.Run_Keyword_And_Ignore_Error SSHLibrary.Write ${command}
199 ${status_wait} ${message_wait} = BuiltIn.Run_Keyword_And_Ignore_Error SSHLibrary.Read_Until_Regexp ${KARAF_PROMPT}
200 BuiltIn.Run Keyword If '${status_write}' != 'PASS' BuiltIn.Fail Failed to send the command: ${command}
201 BuiltIn.Log ${message_wait}
202 BuiltIn.Run_Keyword_If '${status_wait}' != 'PASS' BuiltIn.Fail Failed to see prompt after sending the command: ${command}
203 [Teardown] Run Keyword If '${IS_KARAF_APPL}' == 'True' SSHKeywords.Restore_Current_Ssh_Connection_From_Index ${current_connection_index}
204 [Return] ${message_wait}
206 Execute_Controller_Karaf_Command_With_Retry_On_Background
207 [Arguments] ${command} ${member_index}=${1}
208 [Documentation] Attemp to send command to karaf for ${member_index}, if fail then open connection and try again.
209 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
210 ${status} ${message} = BuiltIn.Run_Keyword_And_Ignore_Error Execute_Controller_Karaf_Command_On_Background ${command} ${member_index}
211 BuiltIn.Return_From_Keyword_If '${status}' == 'PASS' ${message}
212 # TODO: Verify this does not leak connections indices.
213 Open_Controller_Karaf_Console_On_Background ${member_index}
214 ${message} = Execute_Controller_Karaf_Command_On_Background ${command} ${member_index}
217 Log_Message_To_Controller_Karaf
218 [Arguments] ${message} ${member_index_list}=${EMPTY} ${tolerate_failure}=True
219 [Documentation] Make sure this resource is initialized. Send a message into the controller's karaf log file on every node listed (or all).
220 ... By default, failure while processing a node is silently ignored, unless ${tolerate_failure} is False.
221 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
222 ${index_list} = ClusterManagement.List_Indices_Or_All given_list=${member_index_list}
223 FOR ${index} IN @{index_list} # usually: 1, 2, 3.
224 ${status} ${output} = BuiltIn.Run_Keyword_And_Ignore_Error Execute_Controller_Karaf_Command_With_Retry_On_Background log:log "ROBOT MESSAGE: ${message}" member_index=${index}
225 BuiltIn.Run_Keyword_Unless ${tolerate_failure} or "${status}" == "PASS" BuiltIn.Fail ${output}
228 Log_Test_Suite_Start_To_Controller_Karaf
229 [Arguments] ${member_index_list}=${EMPTY}
230 [Documentation] Log suite name to karaf log, useful in suite setup.
231 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
232 Log_Message_To_Controller_Karaf Starting suite ${SUITE_SOURCE} ${member_index_list}
234 Log_Testcase_Start_To_Controller_Karaf
235 [Arguments] ${member_index_list}=${EMPTY}
236 [Documentation] Log test case name to karaf log, useful in test case setup.
237 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
238 Log_Message_To_Controller_Karaf Starting test ${SUITE_NAME}.${TEST_NAME} ${member_index_list}
240 Set_Bgpcep_Log_Levels
241 [Arguments] ${bgpcep_level}=${DEFAULT_BGPCEP_LOG_LEVEL} ${protocol_level}=${DEFAULT_PROTOCOL_LOG_LEVEL} ${member_index_list}=${EMPTY}
242 [Documentation] Assuming OCKCOB was used, set logging level on bgpcep and protocol loggers without affecting current SSH session.
243 # FIXME: Move to appropriate Resource
244 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
245 ${index_list} = ClusterManagement.List_Indices_Or_All given_list=${member_index_list}
246 FOR ${index} IN @{index_list} # usually: 1, 2, 3.
247 Execute_Controller_Karaf_Command_On_Background log:set ${bgpcep_level} org.opendaylight.bgpcep member_index=${index}
248 Execute_Controller_Karaf_Command_On_Background log:set ${protocol_level} org.opendaylight.protocol member_index=${index}
251 Get Karaf Log Lines From Test Start
252 [Arguments] ${ip} ${test_name} ${cmd} ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT}
253 ... ${log_file}=${KARAF_LOG}
254 [Documentation] Scrapes all log messages that match regexp ${type} which fall after a point given by a log message that
255 ... contains ${test_name}. This is useful if your test cases are marking karaf.log with a message indicating when
256 ... that test case has started; such that you can easily pull out any extra log messsages to parse/log/etc in the
257 ... test logic itself. For example, you can grab all ERRORS that occur during your test case.
258 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
259 ${output} = Run Command On Controller ${ip} ${cmd} ${user} ${password} ${prompt}
260 @{log_lines} = Split String ${output} ${\n}
261 [Return] ${log_lines}
263 Fail If Exceptions Found During Test
264 [Arguments] ${test_name} ${log_file}=${KARAF_LOG} ${fail}=False
265 [Documentation] Create a failure if an Exception is found in the karaf.log that has not been whitelisted.
266 ... Will work for single controller jobs as well as 3node cluster jobs
267 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
268 FOR ${i} IN RANGE 1 ${NUM_ODL_SYSTEM} + 1
269 ${cmd} = Set Variable sed '1,/ROBOT MESSAGE: Starting test ${test_name}/d' ${log_file}
270 ${output} = Get Karaf Log Lines From Test Start ${ODL_SYSTEM_${i}_IP} ${test_name} ${cmd}
271 ${exlist} ${matchlist} = Verify Exceptions ${output}
272 Write Exceptions Map To File ${SUITE_NAME}.${TEST_NAME} /tmp/odl${i}_exceptions.txt
273 ${listlength} = BuiltIn.Get Length ${exlist}
274 BuiltIn.Run Keyword If "${fail}"=="True" and ${listlength} != 0 Log And Fail Exceptions ${exlist} ${listlength}
275 ... ELSE Collections.Log List ${matchlist}
278 Log And Fail Exceptions
279 [Arguments] ${exlist} ${listlength}
280 [Documentation] Print the list of failed exceptions and fail the test
281 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
282 Collections.Log List ${exlist}
283 ${exstr} = BuiltIn.Catenate ${exlist}
284 BuiltIn.Fail New exceptions found: ${listlength}\n${exstr}
286 Get Karaf Log Type From Test Start
287 [Arguments] ${ip} ${test_name} ${type} ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT}
288 ... ${log_file}=${KARAF_LOG}
289 [Documentation] Scrapes all log messages that match regexp ${type} which fall after a point given by a log message that
290 ... contains ${test_name}. This is useful if your test cases are marking karaf.log with a message indicating when
291 ... that test case has started; such that you can easily pull out any extra log messsages to parse/log/etc in the
292 ... test logic itself. For example, you can grab all ERRORS that occur during your test case.
293 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
294 ${cmd} Set Variable sed '1,/ROBOT MESSAGE: Starting test ${test_name}/d' ${log_file} | grep '${type}'
295 ${output} Run Command On Controller ${ip} ${cmd} ${user} ${password} ${prompt}
298 Get Karaf Log Types From Test Start
299 [Arguments] ${ip} ${test_name} ${types} ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT}
300 ... ${log_file}=${KARAF_LOG}
301 [Documentation] A wrapper keyword for "Get Karaf Log Type From Test Start" so that we can parse for multiple types
302 ... of log messages. For example, we can grab all messages of type WARN and ERROR
303 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
304 FOR ${type} IN @{types}
305 Get Karaf Log Type From Test Start ${ip} ${test_name} ${type} ${user} ${password}
306 ... ${prompt} ${log_file}
309 Get Karaf Log Events From Test Start
310 [Arguments] ${test_name} ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT}
311 [Documentation] Wrapper for the wrapper "Get Karaf Log Types From Test Start" so that we can easily loop over
312 ... any number of controllers to analyze karaf.log for ERROR, WARN and Exception log messages
313 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
314 ${log_types} = Create List ERROR WARN Exception
315 FOR ${i} IN RANGE 1 ${NUM_ODL_SYSTEM} + 1
316 Get Karaf Log Types From Test Start ${ODL_SYSTEM_${i}_IP} ${test_name} ${log_types}
319 Fail If Exceptions Found During Test Deprecated
320 [Arguments] ${test_name} ${exceptions_white_list}=${EMPTY}
321 [Documentation] Create a failure if an Exception is found in the karaf.log. Will work for single controller jobs
322 ... as well as 3node cluster jobs
323 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
324 FOR ${i} IN RANGE 1 ${NUM_ODL_SYSTEM} + 1
325 Verify Exception Logging In Controller ${ODL_SYSTEM_${i}_IP} ${test_name} ${exceptions_white_list}
328 Verify Exception Logging In Controller
329 [Arguments] ${controller_ip} ${test_name} ${exceptions_white_list}
330 [Documentation] Local keyword to make it easier to loop through N controllers to pull Exceptions from the
331 ... karaf.log file and validate with "Check Against White List"
332 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
333 ${exceptions}= Get Karaf Log Type From Test Start ${controller_ip} ${test_name} Exception
334 @{log_lines}= Split String ${exceptions} ${\n}
335 ${num_log_entries} Get Length ${log_lines}
336 Return From Keyword If ${num_log_entries} == ${0} No Exceptions found.
337 FOR ${log_message} IN @{log_lines}
338 Check Against White List ${log_message} ${exceptions_white_list}
341 Check Against White List
342 [Arguments] ${exception_line} ${exceptions_white_list}
343 [Documentation] As soon as the ${exceptions_line} is found in one of the elements of ${exceptions_white_list}
344 ... this keyword will exit and give a Pass to the caller. If there is no match, this keyword will end up
345 ... marking a failure. In the case that no exceptions are found, the caller could end up passing a single
346 ... empty line as that is what is returned when a grep on karaf.log has no match, so we can safely return
347 ... in that case as well.
348 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
349 Return From Keyword If "${exception_line}" == ""
350 FOR ${exception} IN @{exceptions_white_list}
351 Return From Keyword If "${exception}" in "${exception_line}" Exceptions found, but whitelisted: ${\n}${exception_line}${\n}
353 Fail Exceptions Found: ${\n}${exception_line}${\n}
356 [Arguments] ${message} ${timeout}=60 ${member_index}=${1}
357 [Documentation] Read karaf logs until message appear
358 # TODO: refactor this keyword to use the new workflow to account for multiple controllers. Initial work was done
359 # in this patch https://git.opendaylight.org/gerrit/#/c/45596/
360 # however, the consumers of this keyword were breaking after that change. Initial theory is that a previous
361 # keyword used before this "Wait For Karaf Log" keyword was closing the karaf console connection, so the
362 # "Flexible SSH Login" keyword from the patch above (45596) was failing.
363 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
364 BuiltIn.Log Waiting for '${message}' in karaf log
365 SSHLibrary.Open_Connection ${ODL_SYSTEM_IP} port=${KARAF_SHELL_PORT} prompt=${KARAF_PROMPT_LOGIN} timeout=${timeout}
366 SSHLibrary.Login ${KARAF_USER} ${KARAF_PASSWORD} loglevel=${loglevel}
367 SSHLibrary.Write log:tail
368 SSHLibrary.Read_Until ${message}
369 SSHLibrary.Write logout
370 SSHLibrary.Close_Connection
373 [Arguments] ${bundle_id}
374 [Documentation] Restarts bundle passed as argument. Note this operation is only for testing and not production environments
375 # TODO: prepare this for cluster environment and multiple controllers
376 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
377 Execute_Controller_Karaf_Command_With_Retry_On_Background bundle:restart $(bundle:id '${bundle_id}')
380 [Documentation] Restarts Karaf and polls log to detect when Karaf is up and running again
381 # TODO: prepare this for cluster environment and multiple controllers
382 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
383 Execute_Controller_Karaf_Command_With_Retry_On_Background log:clear
384 Execute_Controller_Karaf_Command_With_Retry_On_Background shutdown -r -f
385 BuiltIn.Run_Keyword_And_Return_Status BuiltIn.Wait_Until_Keyword_Succeeds 240s 60s Wait_For_Karaf_Log Shiro environment initialized in
388 [Documentation] Restarts jetty bundle (to reload certificates or key/truststore information)
389 Return From Keyword If '${IS_KARAF_APPL}' == 'False' Not A Karaf App
390 Execute_Controller_Karaf_Command_With_Retry_On_Background log:clear
391 Restart_Bundle OPS4J Pax Web - Jetty
392 Wait_For_Karaf_Log Started jetty-default