Merge "Reworked FlowConfigBlaster to be able to batch multiple flows in a single...
[integration/test.git] / test / csit / libraries / KarafKeywords.txt
1 *** Settings ***
2 Library           SSHLibrary
3 Library           OperatingSystem
4
5 *** Variables ***
6 ${WORKSPACE}      /tmp
7 ${BUNDLEFOLDER}    distribution-karaf-0.3.0-SNAPSHOT
8 ${karaf_shell_port}    8101
9 ${karaf_prompt}    opendaylight-user
10 ${karaf_user}     karaf
11 ${karaf_password}    karaf
12
13 *** Keywords ***
14 Check Karaf Log File Does Not Have Messages
15     [Arguments]    ${ip}    ${message}    ${log_file}=${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log
16     ${output}=    Run Command On Remote System    ${ip}    grep ${message} ${log_file}
17     Should Not Contain    ${output}    ${message}
18
19 Verify Feature Is Installed
20     [Arguments]    ${feature_name}    ${controller}=${CONTROLLER}    ${karaf_port}=${karaf_shell_port}
21     [Documentation]    Will Succeed if the given ${feature_name} is found in the output of "feature:list -i"
22     ${output}=    Issue Command On Karaf Console    feature:list -i | grep ${feature_name}    ${controller}    ${karaf_port}
23     Should Contain    ${output}    ${feature_name}
24     [Return]    ${output}
25
26 Verify Feature Is Not Installed
27     [Arguments]    ${feature_name}    ${controller}=${CONTROLLER}    ${karaf_port}=${karaf_shell_port}
28     [Documentation]    Will Succeed if the given ${feature_name} is NOT found in the output of "feature:list -i"
29     ${output}=    Issue Command On Karaf Console    feature:list -i | grep ${feature_name}    ${controller}    ${karaf_port}
30     Should Not Contain    ${output}    ${feature_name}
31     [Return]    ${output}
32
33 Issue Command On Karaf Console
34     [Arguments]    ${cmd}    ${controller}=${CONTROLLER}    ${karaf_port}=${karaf_shell_port}    ${timeout}=5
35     [Documentation]    Will execute the given ${cmd} by ssh'ing to the karaf console running on ${CONTROLLER}
36     Open Connection    ${controller}    port=${karaf_port}    prompt=${karaf_prompt}    timeout=${timeout}
37     Login    ${karaf_user}    ${karaf_password}
38     Write    ${cmd}
39     ${output}    Read Until    ${karaf_prompt}
40     Close Connection
41     Log    ${output}
42     [Return]    ${output}
43
44 Verify Bundle Is Installed
45     [Arguments]    ${bundle_name}    ${controller}=${CONTROLLER}    ${karaf_port}=${karaf_shell_port}
46     [Documentation]    Will succeed if the given ${bundle name} is present in the output of "bundle:list -s "
47     ${output}=    Issue Command On Karaf Console    bundle:list -s | grep ${bundle_name}    ${controller}    ${karaf_port}
48     Should Contain    ${output}    ${bundle_name}
49     [Return]    ${output}
50
51 Verify Bundle Is Not Installed
52     [Arguments]    ${bundle_name}    ${controller}=${CONTROLLER}    ${karaf_port}=${karaf_shell_port}
53     [Documentation]    Will succeed if the given ${bundle_name} is NOT found in the output of "bundle:list -s"
54     ${output}=    Issue Command On Karaf Console    bundle:list -i | grep ${bundle_name}    ${controller}    ${karaf_port}
55     Should Not Contain    ${output}    ${bundle_name}
56     [Return]    ${output}
57
58 Check Karaf Log Has Messages
59     [Arguments]    ${filter_string}    @{message_list}
60     [Documentation]    Will succeed if the @{messages} are found in \ the output of "log:display"
61     ${output}=    Issue Command On Karaf Console    log:display | grep ${filter_string}
62     : FOR    ${message}    IN    @{message_list}
63     \    Should Contain    ${output}    ${message}
64     [Return]    ${output}