Introduction

Karaf library. General utility keywords for interacting with the karaf environment, such as the karaf console, karaf.log, karaf features, and karaf config files.

This library is useful to deal with controller Karaf console for ssh sessions in cluster. Running Setup_Karaf_Keywords is necessary. If SetupUtils initialization is called, this gets initialized as well. If this gets initialized, ClusterManagement gets initialized as well.

Keywords

Arguments

exception_line exceptions_black_list

Documentation

As soon as the ${exceptions_line} is found in one of the elements of ${exceptions_white_list} this keyword will exit and give a Pass to the caller. If there is no match, this keyword will end up marking a failure. In the case that no exceptions are found, the caller could end up passing a single empty line as that is what is returned when a grep on karaf.log has no match, so we can safely return in that case as well.

Arguments

cmd elements controller
= ${ODL_SYSTEM_IP}
karaf_port
= ${KARAF_SHELL_PORT}
timeout
= 5

Documentation

Will execute the command using Issue Command On Karaf Console then check for the given elements in the command output message

Arguments

message count

Documentation

Verifies that the ${message} exists in the Karaf Log Folder and checks that it appears ${count} number of times

Arguments

message count

Documentation

Verifies that the ${message} exists in the Karaf Console log:display and checks that it appears ${count} number of times

Arguments

filter_string * message_list

Documentation

Will succeed if the @{messages} are found in the output of "log:display"

Arguments

message count use_console
= False

Documentation

Verifies that the ${message} exists specified number of times in karaf console log or Karaf Log Folder based on the arg ${use_console}.

Arguments

timeout member_index_list
= ${EMPTY}

Documentation

Configure a different timeout for each Karaf console.

Arguments

command member_index
= ${1}

Documentation

Send command to karaf without affecting current SSH connection. Read, log and return response.

Arguments

command member_index
= ${1}

Documentation

Attemp to send command to karaf for ${member_index}, if fail then open connection and try again.

Arguments

test_name log_file
= ${KARAF_LOG}
fail
= False

Documentation

Create a failure if an Exception is found in the karaf.log that has not been whitelisted. Will work for single controller jobs as well as 3node cluster jobs

Arguments

test_name exceptions_white_list
= ${EMPTY}

Documentation

Create a failure if an Exception is found in the karaf.log. Will work for single controller jobs as well as 3node cluster jobs

Arguments

test_name user
= ${ODL_SYSTEM_USER}
password
= ${ODL_SYSTEM_PASSWORD}
prompt
= ${ODL_SYSTEM_PROMPT}

Documentation

Wrapper for the wrapper "Get Karaf Log Types From Test Start" so that we can easily loop over any number of controllers to analyze karaf.log for ERROR, WARN and Exception log messages

Arguments

ip test_name cmd user
= ${ODL_SYSTEM_USER}
password
= ${ODL_SYSTEM_PASSWORD}
prompt
= ${ODL_SYSTEM_PROMPT}
log_file
= ${KARAF_LOG}

Documentation

Scrapes all log messages that match regexp ${type} which fall after a point given by a log message that contains ${test_name}. This is useful if your test cases are marking karaf.log with a message indicating when that test case has started; such that you can easily pull out any extra log messsages to parse/log/etc in the test logic itself. For example, you can grab all ERRORS that occur during your test case.

Arguments

ip test_name type user
= ${ODL_SYSTEM_USER}
password
= ${ODL_SYSTEM_PASSWORD}
prompt
= ${ODL_SYSTEM_PROMPT}
log_file
= ${KARAF_LOG}

Documentation

Scrapes all log messages that match regexp ${type} which fall after a point given by a log message that contains ${test_name}. This is useful if your test cases are marking karaf.log with a message indicating when that test case has started; such that you can easily pull out any extra log messsages to parse/log/etc in the test logic itself. For example, you can grab all ERRORS that occur during your test case.

Arguments

ip test_name types user
= ${ODL_SYSTEM_USER}
password
= ${ODL_SYSTEM_PASSWORD}
prompt
= ${ODL_SYSTEM_PROMPT}
log_file
= ${KARAF_LOG}

Documentation

A wrapper keyword for "Get Karaf Log Type From Test Start" so that we can parse for multiple types of log messages. For example, we can grab all messages of type WARN and ERROR

Arguments

feature_name controller
= ${ODL_SYSTEM_IP}
karaf_port
= ${KARAF_SHELL_PORT}
timeout
= 180

Documentation

Will Install the given ${feature_name}

Arguments

feature_name

Documentation

Will Install the given ${feature_name} using active connection

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.

Arguments

exlist listlength

Documentation

Print the list of failed exceptions and fail the test

Arguments

message member_index_list
= ${EMPTY}
tolerate_failure
= True

Documentation

Make sure this resource is initialized. Send a message into the controller's karaf log file on every node listed (or all). By default, failure while processing a node is silently ignored, unless ${tolerate_failure} is False.

Arguments

member_index_list
= ${EMPTY}

Documentation

Log suite name to karaf log, useful in suite setup.

Arguments

member_index_list
= ${EMPTY}

Documentation

Log test case name to karaf log, useful in test case setup.

Arguments

member_index
= ${1}
timeout
= 10
loglevel
= INFO

Documentation

If there is a stored ssh connection index of connection to the controller's karaf console for ${member_index}, close the previous connection. In any case create a new connection to karaf console for ${member_index}, set correct prompt set and login to karaf console. Store connection index for ${member_index} and restore the previous active connection.

Arguments

member_index
= ${1}
timeout
= 3s

Documentation

Open new connection to karaf console for member index with specified timeout.

Arguments

bundle_id

Documentation

Restarts bundle passed as argument. Note this operation is only for testing and not production environments

Documentation

Restarts jetty bundle (to reload certificates or key/truststore information)

Documentation

Restarts Karaf and polls log to detect when Karaf is up and running again

Arguments

cmd controller
= ${ODL_SYSTEM_IP}
karaf_port
= ${KARAF_SHELL_PORT}
timeout
= 10
loglevel
= INFO

Documentation

Run Issue_Command_On_Karaf_Console but restore previous connection afterwards.

Arguments

bgpcep_level
= ${DEFAULT_BGPCEP_LOG_LEVEL}
protocol_level
= ${DEFAULT_PROTOCOL_LOG_LEVEL}
member_index_list
= ${EMPTY}

Documentation

Assuming OCKCOB was used, set logging level on bgpcep and protocol loggers without affecting current SSH session.

Arguments

http_timeout
= ${DEFAULT_TIMEOUT_HTTP}

Documentation

Initialize ClusterManagement. Open ssh karaf connections to each ODL.

Arguments

feature_name controller
= ${ODL_SYSTEM_IP}
karaf_port
= ${KARAF_SHELL_PORT}
timeout
= 180

Documentation

Will UnInstall the given ${feature_name}

Arguments

controller_ip test_name exceptions_white_list

Documentation

Local keyword to make it easier to loop through N controllers to pull Exceptions from the karaf.log file and validate with "Check Against White List"

Arguments

bundle_name controller
= ${ODL_SYSTEM_IP}
karaf_port
= ${KARAF_SHELL_PORT}

Documentation

Will succeed if the given ${bundle name} is present in the output of "bundle:list -s "

Arguments

bundle_name controller
= ${ODL_SYSTEM_IP}
karaf_port
= ${KARAF_SHELL_PORT}

Documentation

Will succeed if the given ${bundle_name} is NOT found in the output of "bundle:list -s"

Arguments

feature_name controller
= ${ODL_SYSTEM_IP}
karaf_port
= ${KARAF_SHELL_PORT}

Documentation

Will Succeed if the given ${feature_name} is found in the output of "feature:list -i"

Arguments

message timeout
= 60
member_index
= ${1}

Documentation

Read karaf logs until message appear

KarafKeywords

image/svg+xml